Subversion Repositories Scribus

Rev

Rev 1194 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
#include "prefs.h"
2
#include "prefs.moc"
3
#include "keymanager.h"
263 Franz 4
#include "scribusdoc.h"
3 paul 5
#include <qfont.h>
6
#include <qcolordialog.h>
663 cbradney 7
#include <qcombobox.h>
3 paul 8
#include <qcolor.h>
9
#include <qstringlist.h>
10
#include <qstylefactory.h>
11
#include <qpointarray.h>
12
#include <qpainter.h>
13
#include <qrect.h>
14
#include <qwmatrix.h>
15
#include <cmath>
663 cbradney 16
#include "langmgr.h"
788 fschmid 17
#include "tabtypography.h"
879 fschmid 18
#include "tabguides.h"
795 fschmid 19
#include "hysettings.h"
20
#include "cmsprefs.h"
21
#include "keymanager.h"
1194 fschmid 22
#include "tabtools.h"
3 paul 23
 
504 cbradney 24
using namespace std;
25
 
3 paul 26
extern QPixmap loadIcon(QString nam);
795 fschmid 27
extern bool CMSavail;
28
extern ProfilesL InputProfiles;
3 paul 29
 
1065 cbradney 30
extern "C" void* Run(QWidget *d, ApplicationPrefs *prefsData);
3 paul 31
 
199 Franz 32
/*!
1065 cbradney 33
 \fn void* Run(QWidget *d, ApplicationPrefs *prefsData)
145 Franz 34
 \author Franz Schmid
1030 subik 35
 \date
145 Franz 36
 \brief Creates Preferences dialog and returns pointer to it
202 Franz 37
 \param d QWidget * to Preferences dialog widget
1065 cbradney 38
 \param prefsData ApplicationPrefs * struct
202 Franz 39
 \retval dia * widget pointer
145 Franz 40
 */
1065 cbradney 41
void* Run(QWidget *d, ApplicationPrefs *prefsData)
3 paul 42
{
776 fschmid 43
        Preferences *dia = new Preferences(d, prefsData);
3 paul 44
        return dia;
45
}
46
 
199 Franz 47
/*!
1065 cbradney 48
 \fn Preferences::Preferences( QWidget* parent, ApplicationPrefs *prefsData)
1030 subik 49
 \author Franz Schmid
50
 \date
145 Franz 51
 \brief Constructor for Preferences dialog box
52
 \param parent QWidget pointer to parent window
1065 cbradney 53
 \param prefsData ApplicationPrefs * struct
145 Franz 54
 \retval Preferences dialog
55
 */
1065 cbradney 56
Preferences::Preferences( QWidget* parent, ApplicationPrefs *prefsData) : PrefsDialogBase( parent )
3 paul 57
{
173 Franz 58
        int decimals;
188 Franz 59
        ap = (ScribusApp*)parent;
199 Franz 60
        Umrech = 1.0;
1065 cbradney 61
        docUnitIndex = prefsData->docUnitIndex;
333 Franz 62
        int f[] = {2, 3, 4};
1065 cbradney 63
        if (docUnitIndex == 3)
188 Franz 64
                decimals = f[0];
65
        else
1065 cbradney 66
                decimals = f[docUnitIndex];
776 fschmid 67
        DisScale = prefsData->DisScale;
199 Franz 68
        setCaption( tr( "Preferences" ) );
45 Franz 69
 
776 fschmid 70
        tab = new QWidget( prefsWidgets, "tab" );
199 Franz 71
        tabLayout = new QGridLayout( tab );
72
        tabLayout->setSpacing( 6 );
73
        tabLayout->setMargin( 10 );
776 fschmid 74
        tabLayout->setAlignment( Qt::AlignTop );
663 cbradney 75
 
76
        // GUI Group
341 Franz 77
        ButtonGroup1 = new QButtonGroup( tr( "GUI" ), tab, "ButtonGroup1" );
199 Franz 78
        ButtonGroup1->setColumnLayout(0, Qt::Vertical );
79
        ButtonGroup1->layout()->setSpacing( 0 );
80
        ButtonGroup1->layout()->setMargin( 0 );
81
        ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
82
        ButtonGroup1Layout->setAlignment( Qt::AlignTop );
83
        ButtonGroup1Layout->setSpacing( 6 );
84
        ButtonGroup1Layout->setMargin( 10 );
663 cbradney 85
 
86
        langMgr.init();
87
        QStringList languageList;
88
        langMgr.fillInstalledStringList(&languageList, true);
675 cbradney 89
        languageList.sort();
663 cbradney 90
        guiLangCombo = new QComboBox( false, ButtonGroup1, "guiLangCombo");
91
        guiLangCombo->insertStringList( languageList );
776 fschmid 92
        guiLangCombo->setCurrentText(langMgr.getLangFromAbbrev(prefsData->guiLanguage));
93
        selectedGUILang=prefsData->guiLanguage;
663 cbradney 94
        guiLangLabel = new QLabel(guiLangCombo, tr("&Language:"), ButtonGroup1, "guiLangLabel");
95
        ButtonGroup1Layout->addWidget( guiLangLabel, 0, 0 );
782 fschmid 96
        ButtonGroup1Layout->addWidget( guiLangCombo, 0, 1, Qt::AlignLeft );
97
 
199 Franz 98
        GUICombo = new QComboBox( true, ButtonGroup1, "GUICombo" );
188 Franz 99
        QStringList STtest;
100
        STtest = QStyleFactory::keys();
101
        for (uint stt = 0; stt < STtest.count(); ++stt)
102
                GUICombo->insertItem(STtest[stt]);
199 Franz 103
        GUICombo->setEditable(false);
776 fschmid 104
        GUICombo->setCurrentText(prefsData->GUI);
341 Franz 105
        TextGstil = new QLabel(GUICombo, tr("&Theme:"), ButtonGroup1, "dd");
663 cbradney 106
        ButtonGroup1Layout->addWidget( TextGstil, 1, 0 );
782 fschmid 107
        ButtonGroup1Layout->addWidget( GUICombo, 1, 1, Qt::AlignLeft );
108
 
199 Franz 109
        GFsize = new QSpinBox(ButtonGroup1, "gfs" );
351 Franz 110
        GFsize->setSuffix( tr( " pt" ) );
199 Franz 111
        GFsize->setMaxValue( 22 );
112
        GFsize->setMinValue( 8 );
776 fschmid 113
        GFsize->setValue( prefsData->AppFontSize );
341 Franz 114
        TextGstil2 = new QLabel(GFsize, tr("&Font Size:"), ButtonGroup1, "dd");
663 cbradney 115
        ButtonGroup1Layout->addWidget( TextGstil2, 2, 0 );
782 fschmid 116
        ButtonGroup1Layout->addWidget( GFsize, 2, 1, Qt::AlignLeft );
117
        SpinBox3 = new QSpinBox( ButtonGroup1, "SpinBox3" );
199 Franz 118
        SpinBox3->setMaxValue( 1000 );
119
        SpinBox3->setMinValue( 0 );
120
        SpinBox3->setLineStep( 10 );
776 fschmid 121
        SpinBox3->setValue( prefsData->Wheelval );
782 fschmid 122
        TextLabel1_2 = new QLabel( SpinBox3, tr( "&Wheel Jump:" ), ButtonGroup1, "TextLabel1_2" );
123
        ButtonGroup1Layout->addWidget( TextLabel1_2, 3, 0 );
124
        ButtonGroup1Layout->addWidget( SpinBox3, 3, 1, Qt::AlignLeft );
125
        Recen = new QSpinBox( ButtonGroup1, "Recen" );
199 Franz 126
        Recen->setMaxValue( 30 );
127
        Recen->setMinValue( 1 );
776 fschmid 128
        Recen->setValue( prefsData->RecentDCount );
782 fschmid 129
        TextLabel4c = new QLabel( Recen, tr( "&Recent Documents:" ), ButtonGroup1, "TextLabel4c" );
130
        ButtonGroup1Layout->addWidget( TextLabel4c, 4, 0);
131
        ButtonGroup1Layout->addWidget( Recen, 4, 1, Qt::AlignLeft );
132
        tabLayout->addWidget( ButtonGroup1, 0, 0 );
3 paul 133
 
341 Franz 134
        GroupBox200 = new QGroupBox( tr( "Paths" ), tab, "GroupBox200" );
199 Franz 135
        GroupBox200->setColumnLayout(0, Qt::Horizontal );
136
        GroupBox200->layout()->setSpacing( 0 );
137
        GroupBox200->layout()->setMargin( 0 );
138
        GroupBox200Layout = new QGridLayout( GroupBox200->layout() );
139
        GroupBox200Layout->setAlignment( Qt::AlignTop );
140
        GroupBox200Layout->setSpacing( 0 );
141
        GroupBox200Layout->setMargin( 5 );
782 fschmid 142
 
199 Franz 143
        Docs = new QLineEdit( GroupBox200, "Datei" );
144
        Docs->setMinimumSize( QSize( 268, 22 ) );
776 fschmid 145
        Docs->setText(prefsData->DocDir);
341 Franz 146
        PfadText = new QLabel( Docs, tr("&Documents:"), GroupBox200, "Pfadtext" );
199 Franz 147
        FileC = new QToolButton( GroupBox200, "FileC" );
148
        FileC->setMinimumSize( QSize( 88, 24 ) );
341 Franz 149
        FileC->setText( tr( "&Change..." ) );
150
        GroupBox200Layout->addWidget( PfadText, 0, 0 );
151
        GroupBox200Layout->addWidget( Docs, 0, 1 );
199 Franz 152
        GroupBox200Layout->addWidget( FileC, 0, 2 );
776 fschmid 153
 
199 Franz 154
        ProPfad = new QLineEdit( GroupBox200, "Datei1" );
155
        ProPfad->setMinimumSize( QSize( 268, 22 ) );
776 fschmid 156
        ProPfad->setText(prefsData->ProfileDir);
341 Franz 157
        PfadText2 = new QLabel( ProPfad, tr("&ICC Profiles:"), GroupBox200, "Pfadtext1" );
199 Franz 158
        FileC2 = new QToolButton( GroupBox200, "FileC1" );
159
        FileC2->setMinimumSize( QSize( 88, 24 ) );
341 Franz 160
        FileC2->setText( tr( "C&hange..." ) );
161
        GroupBox200Layout->addWidget( PfadText2, 1, 0 );
162
        GroupBox200Layout->addWidget( ProPfad, 1, 1 );
199 Franz 163
        GroupBox200Layout->addWidget( FileC2, 1, 2 );
91 Franz 164
 
199 Franz 165
        ScriptPfad = new QLineEdit( GroupBox200, "Datei1" );
166
        ScriptPfad->setMinimumSize( QSize( 268, 22 ) );
776 fschmid 167
        ScriptPfad->setText(prefsData->ScriptDir);
341 Franz 168
        PfadText3 = new QLabel( ScriptPfad, tr("&Scripts:"), GroupBox200, "Pfadtext1" );
199 Franz 169
        FileC3 = new QToolButton( GroupBox200, "FileC3" );
170
        FileC3->setMinimumSize( QSize( 88, 24 ) );
341 Franz 171
        FileC3->setText( tr( "Ch&ange..." ) );
172
        GroupBox200Layout->addWidget( PfadText3, 2, 0 );
173
        GroupBox200Layout->addWidget( ScriptPfad, 2, 1 );
199 Franz 174
        GroupBox200Layout->addWidget( FileC3, 2, 2 );
91 Franz 175
 
410 Franz 176
        TemplateDir = new QLineEdit( GroupBox200, "Datei1" );
177
        TemplateDir->setMinimumSize( QSize( 268, 22 ) );
776 fschmid 178
        TemplateDir->setText(prefsData->TemplateDir);
410 Franz 179
        PfadText4 = new QLabel( TemplateDir, tr("T&emplates:"), GroupBox200, "Pfadtext1" );
180
        FileC4 = new QToolButton( GroupBox200, "FileC4" );
181
        FileC4->setMinimumSize( QSize( 88, 24 ) );
182
        FileC4->setText( tr( "Cha&nge..." ) );
183
        GroupBox200Layout->addWidget( PfadText4, 3, 0 );
184
        GroupBox200Layout->addWidget( TemplateDir, 3, 1 );
185
        GroupBox200Layout->addWidget( FileC4, 3, 2 );
782 fschmid 186
        tabLayout->addWidget( GroupBox200, 1, 0 );
776 fschmid 187
        addItem( tr("General"), loadIcon("AppIcon.png"), tab);
410 Franz 188
 
776 fschmid 189
        tab_7 = new QWidget( prefsWidgets, "tab_7" );
199 Franz 190
        tabLayout_7 = new QHBoxLayout( tab_7, 11, 6, "tabLayout_7");
191
        Layout21 = new QVBoxLayout( 0, 0, 6, "Layout21");
341 Franz 192
        GroupSize = new QButtonGroup( tr( "Page Size" ), tab_7, "GroupSize" );
199 Franz 193
        GroupSize->setColumnLayout(0, Qt::Vertical );
194
        GroupSize->layout()->setSpacing( 6 );
195
        GroupSize->layout()->setMargin( 10 );
196
        GroupSizeLayout = new QVBoxLayout( GroupSize->layout() );
197
        GroupSizeLayout->setAlignment( Qt::AlignTop );
198
        Layout6 = new QGridLayout( 0, 1, 1, 0, 6, "Layout6");
782 fschmid 199
 
199 Franz 200
        GZComboF = new QComboBox( true, GroupSize, "GZComboF" );
782 fschmid 201
        const QString ar_size[] =
202
            {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B0", "B1", "B2", "B3",
850 cbradney 203
             "B4", "B5", "B6", "B7", "B8", "B9", "B10", "C5E", "Comm10E", "DLE", tr("Executive"),
204
             tr("Folio"), tr("Ledger"), tr("Legal"), tr("Letter"), tr("Tabloid")
782 fschmid 205
            };
188 Franz 206
        size_t ar_s = sizeof(ar_size) / sizeof(*ar_size);
207
        for (uint s = 0; s < ar_s; ++s)
199 Franz 208
                GZComboF->insertItem(ar_size[s]);
209
        GZComboF->insertItem( tr( "Custom" ) );
188 Franz 210
        GZComboF->setEditable(false);
776 fschmid 211
        GZComboF->setCurrentItem(prefsData->PageFormat);
341 Franz 212
        GZText1 = new QLabel( GZComboF, tr( "&Size:" ), GroupSize, "GZText1" );
213
        Layout6->addWidget( GZText1, 0, 0 );
199 Franz 214
        Layout6->addWidget( GZComboF, 0, 1 );
3 paul 215
 
199 Franz 216
        GZComboO = new QComboBox( true, GroupSize, "GZComboO" );
217
        GZComboO->insertItem( tr( "Portrait" ) );
218
        GZComboO->insertItem( tr( "Landscape" ) );
188 Franz 219
        GZComboO->setEditable(false);
776 fschmid 220
        GZComboO->setCurrentItem(prefsData->Ausrichtung);
341 Franz 221
        GZText2 = new QLabel( GZComboO, tr( "Orie&ntation:" ), GroupSize, "GZText2" );
222
        Layout6->addWidget( GZText2, 1, 0 );
199 Franz 223
        Layout6->addWidget( GZComboO, 1, 1 );
782 fschmid 224
        UnitCombo = new QComboBox( true, GroupSize, "UnitCombo" );
225
        UnitCombo->insertItem( tr( "Points (pt)" ) );
226
        UnitCombo->insertItem( tr( "Millimetres (mm)" ) );
227
        UnitCombo->insertItem( tr( "Inches (in)" ) );
228
        UnitCombo->insertItem( tr( "Picas (p)" ) );
229
        UnitCombo->setEditable(false);
1065 cbradney 230
        UnitCombo->setCurrentItem(prefsData->docUnitIndex);
782 fschmid 231
        unitComboText = new QLabel( UnitCombo, tr( "Units:" ), GroupSize, "unitComboText" );
232
        Layout6->addWidget( unitComboText, 2, 0 );
233
        Layout6->addWidget( UnitCombo, 2, 1 );
3 paul 234
 
199 Franz 235
        GroupSizeLayout->addLayout( Layout6 );
3 paul 236
 
199 Franz 237
        Layout5_2 = new QHBoxLayout( 0, 0, 6, "Layout5_2");
3 paul 238
 
782 fschmid 239
        pageWidth = new MSpinBox( 1, 10000, GroupSize, decimals );
240
        pageWidth->setEnabled( false );
241
        pageWidth->setMinimumSize( QSize( 70, 20 ) );
242
        pageWidth->setValue(prefsData->PageBreite * Umrech);
243
        GZText3 = new QLabel( pageWidth, tr( "&Width:" ), GroupSize, "GZText3" );
244
        Layout5_2->addWidget( GZText3 );
245
        Layout5_2->addWidget( pageWidth );
3 paul 246
 
782 fschmid 247
        pageHeight = new MSpinBox( 1, 10000, GroupSize, decimals );
248
        pageHeight->setEnabled( false );
249
        pageHeight->setMinimumSize( QSize( 70, 20 ) );
250
        pageHeight->setValue(prefsData->PageHoehe * Umrech);
251
        GZText4 = new QLabel( pageHeight, tr( "&Height:" ), GroupSize, "GZText4" );
252
        Layout5_2->addWidget( GZText4 );
253
        Layout5_2->addWidget( pageHeight );
254
 
199 Franz 255
        GroupSizeLayout->addLayout( Layout5_2 );
782 fschmid 256
 
199 Franz 257
        Layout8 = new QHBoxLayout( 0, 0, 6, "Layout8");
3 paul 258
 
782 fschmid 259
        facingPages = new QCheckBox( tr( "&Facing Pages" ), GroupSize, "facingPages" );
260
        facingPages->setChecked(prefsData->DoppelSeiten);
261
        Layout8->addWidget( facingPages );
3 paul 262
 
341 Franz 263
        Linkszuerst = new QCheckBox( tr( "Left &Page First" ), GroupSize, "Linkszuerst" );
776 fschmid 264
        Linkszuerst->setChecked(prefsData->ErsteLinks);
782 fschmid 265
        if (!facingPages->isChecked())
188 Franz 266
                Linkszuerst->setEnabled(false);
199 Franz 267
        Layout8->addWidget( Linkszuerst );
268
        GroupSizeLayout->addLayout( Layout8 );
269
        Layout21->addWidget( GroupSize );
3 paul 270
 
341 Franz 271
        GroupRand = new QGroupBox( tr( "Margin Guides" ), tab_7, "GroupRand" );
199 Franz 272
        GroupRand->setColumnLayout(0, Qt::Vertical );
273
        GroupRand->layout()->setSpacing( 5 );
274
        GroupRand->layout()->setMargin( 10 );
275
        GroupRandLayout = new QGridLayout( GroupRand->layout() );
276
        GroupRandLayout->setAlignment( Qt::AlignTop );
3 paul 277
 
333 Franz 278
        TopR = new MSpinBox( 0, 1000, GroupRand, decimals );
199 Franz 279
        TopR->setMinimumSize( QSize( 70, 20 ) );
776 fschmid 280
        TopR->setValue(prefsData->RandOben * Umrech);
281
        RandT = prefsData->RandOben;
199 Franz 282
        GroupRandLayout->addWidget( TopR, 0, 1 );
333 Franz 283
        BottomR = new MSpinBox( 0, 1000, GroupRand, decimals );
199 Franz 284
        BottomR->setMinimumSize( QSize( 70, 20 ) );
776 fschmid 285
        BottomR->setValue(prefsData->RandUnten * Umrech);
286
        RandB = prefsData->RandUnten;
199 Franz 287
        GroupRandLayout->addWidget( BottomR, 1, 1 );
333 Franz 288
        RightR = new MSpinBox( 0, 1000, GroupRand, decimals );
199 Franz 289
        RightR->setMinimumSize( QSize( 70, 20 ) );
776 fschmid 290
        RightR->setValue(prefsData->RandRechts * Umrech);
291
        RandR = prefsData->RandRechts;
199 Franz 292
        GroupRandLayout->addWidget( RightR, 1, 3 );
333 Franz 293
        LeftR = new MSpinBox( 0, 1000, GroupRand, decimals );
199 Franz 294
        LeftR->setMinimumSize( QSize( 70, 20 ) );
776 fschmid 295
        LeftR->setValue(prefsData->RandLinks * Umrech);
296
        RandL = prefsData->RandLinks;
199 Franz 297
        GroupRandLayout->addWidget( LeftR, 0, 3 );
3 paul 298
 
341 Franz 299
        GRText2 = new QLabel( BottomR, tr( "&Bottom:" ), GroupRand, "GRText2" );
199 Franz 300
        GroupRandLayout->addWidget( GRText2, 1, 0 );
341 Franz 301
        GRText1 = new QLabel( TopR, tr( "&Top:" ), GroupRand, "GRText1" );
199 Franz 302
        GroupRandLayout->addWidget( GRText1, 0, 0 );
341 Franz 303
        GRText4 = new QLabel( RightR, tr( "&Right:" ), GroupRand, "GRText4" );
199 Franz 304
        GroupRandLayout->addWidget( GRText4, 1, 2 );
341 Franz 305
        GRText3 = new QLabel( LeftR, tr( "&Left:" ), GroupRand, "GRText3" );
199 Franz 306
        GroupRandLayout->addWidget( GRText3, 0, 2 );
3 paul 307
 
199 Franz 308
        Layout21->addWidget( GroupRand );
3 paul 309
 
341 Franz 310
        GroupAS = new QGroupBox( tr( "Autosave" ), tab_7, "GroupAS" );
199 Franz 311
        GroupAS->setColumnLayout(0, Qt::Vertical );
312
        GroupAS->layout()->setSpacing( 5 );
313
        GroupAS->layout()->setMargin( 10 );
314
        GroupASLayout = new QGridLayout( GroupAS->layout() );
315
        GroupASLayout->setAlignment( Qt::AlignTop );
341 Franz 316
        ASon = new QCheckBox( tr( "&Enabled" ), GroupAS, "Enable Autosave" );
776 fschmid 317
        ASon->setChecked(prefsData->AutoSave);
199 Franz 318
        GroupASLayout->addMultiCellWidget( ASon, 0, 0, 0, 1 );
319
        ASTime = new QSpinBox( GroupAS, "Time" );
320
        ASTime->setMaxValue( 60 );
321
        ASTime->setMinValue( 1 );
322
        ASTime->setSuffix( " " + tr("min") );
776 fschmid 323
        ASTime->setValue(prefsData->AutoSaveTime / 1000 / 60);
341 Franz 324
        ASText = new QLabel( ASTime, tr( "&Interval:" ), GroupAS, "ASText" );
325
        GroupASLayout->addWidget( ASText, 1, 0 );
199 Franz 326
        GroupASLayout->addWidget( ASTime, 1, 1 );
782 fschmid 327
        Layout21->addWidget( GroupAS );
328
        tabLayout_7->addLayout( Layout21 );
776 fschmid 329
        addItem( tr("Document"), loadIcon("page.png"), tab_7);
3 paul 330
 
1195 fschmid 331
        tabGuides = new TabGuides(prefsWidgets, &prefsData->guidesSettings, &prefsData->typographicSetttings, Umrech, "");
776 fschmid 332
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
1195 fschmid 333
        tabTypo = new TabTypograpy(  prefsWidgets, &prefsData->typographicSetttings);
776 fschmid 334
        addItem( tr("Typography"), loadIcon("font.png"), tabTypo);
1194 fschmid 335
        tabTools = new TabTools(  prefsWidgets, &prefsData->toolSettings, Umrech, "", 0);
782 fschmid 336
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
337
 
795 fschmid 338
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
339
        tabHyphenator->verbose->setChecked(!prefsData->Automatic);
340
        tabHyphenator->input->setChecked(prefsData->AutoCheck);
341
        tabHyphenator->language->setCurrentText(ap->LangTransl[prefsData->Language]);
342
        tabHyphenator->wordLen->setValue(prefsData->MinWordLen);
343
        tabHyphenator->maxCount->setValue(prefsData->HyCount);
344
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
345
 
346
        if (CMSavail)
347
        {
348
                tabColorManagement = new CMSPrefs(prefsWidgets, &prefsData->DCMSset, &InputProfiles, &ap->PrinterProfiles, &ap->MonitorProfiles);
349
                addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
350
        }
351
 
352
        tabKeys = new KeyManager(this, prefsData->KeyActions);
353
        addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeys);
354
 
776 fschmid 355
        tab_5 = new QWidget( prefsWidgets, "tab_5" );
188 Franz 356
        tabLayout_5 = new QGridLayout( tab_5 );
357
        tabLayout_5->setSpacing( 6 );
358
        tabLayout_5->setMargin( 11 );
788 fschmid 359
        saving = new QGroupBox( tr( "Other Options" ), tab_5, "Saving" );
360
        saving->setColumnLayout(0, Qt::Vertical );
361
        saving->layout()->setSpacing( 0 );
362
        saving->layout()->setMargin( 0 );
363
        savingLayout = new QHBoxLayout( saving->layout() );
364
        savingLayout->setAlignment( Qt::AlignTop );
365
        savingLayout->setSpacing( 6 );
366
        savingLayout->setMargin( 25 );
367
        SaveAtQuit = new QCheckBox( tr( "Sa&ve Contents on Changes" ), saving, "SaveAtQuit" );
776 fschmid 368
        SaveAtQuit->setChecked(prefsData->SaveAtQ);
788 fschmid 369
        savingLayout->addWidget( SaveAtQuit );
370
        tabLayout_5->addWidget( saving, 1, 0 );
371
        preview = new QGroupBox( tr( "Preview" ), tab_5, "Preview" );
372
        preview->setColumnLayout(0, Qt::Vertical );
373
        preview->layout()->setSpacing( 0 );
374
        preview->layout()->setMargin( 0 );
375
        previewLayout = new QHBoxLayout( preview->layout() );
376
        previewLayout->setAlignment( Qt::AlignTop );
377
        previewLayout->setSpacing( 10 );
378
        previewLayout->setMargin( 24 );
379
        PreviewSize = new QComboBox( true, preview, "PreviewSize" );
188 Franz 380
        PreviewSize->insertItem( tr( "Small" ) );
381
        PreviewSize->insertItem( tr( "Medium" ) );
341 Franz 382
        PreviewSize->insertItem( tr( "Large" ) );
188 Franz 383
        PreviewSize->setEditable(false);
776 fschmid 384
        int sci = prefsData->PSize == 40 ? 0 : prefsData->PSize == 60 ? 1 : 2;
188 Franz 385
        PreviewSize->setCurrentItem(sci);
788 fschmid 386
        textLabelP = new QLabel( PreviewSize, tr( "&Size:" ), preview, "TextLabel1_3" );
387
        previewLayout->addWidget( textLabelP );
388
        previewLayout->addWidget( PreviewSize );
389
        tabLayout_5->addWidget( preview, 0, 0 );
776 fschmid 390
        addItem(  tr("Scrapbook"), loadIcon("scrap.png"), tab_5);
199 Franz 391
 
776 fschmid 392
        tabView = new QWidget( prefsWidgets, "tabView" );
393
        tabViewLayout = new QVBoxLayout( tabView, 10, 5, "tabViewLayout");
394
        tabViewLayout->setAlignment( Qt::AlignTop );
395
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
1195 fschmid 396
        pageBackground->setTitle( tr( "Page Display" ) );
776 fschmid 397
        pageBackground->setColumnLayout(0, Qt::Vertical );
398
        pageBackground->layout()->setSpacing( 5 );
399
        pageBackground->layout()->setMargin( 10 );
1195 fschmid 400
        pageBackgroundLayout = new QVBoxLayout( pageBackground->layout() );
776 fschmid 401
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
1195 fschmid 402
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
776 fschmid 403
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
404
        textLabel9->setText( tr( "Color:" ) );
1195 fschmid 405
        layout10->addWidget( textLabel9 );
776 fschmid 406
        backColor = new QPushButton( pageBackground, "backColor" );
407
        backColor->setMinimumSize( QSize( 60, 20 ) );
408
        backColor->setMaximumSize( QSize( 60, 20 ) );
409
        backColor->setFlat( false );
410
        backColor->setAutoDefault( false );
411
        QPixmap pm5 = QPixmap(54, 14);
412
        pm5.fill(prefsData->DpapColor);
413
        colorPaper = prefsData->DpapColor;
414
        backColor->setPixmap(pm5);
415
        backColor->setText( QString::null );
1195 fschmid 416
        layout10->addWidget( backColor );
417
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
418
        layout10->addItem( spacer3 );
419
        pageBackgroundLayout->addLayout( layout10 );
776 fschmid 420
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
421
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
422
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
1065 cbradney 423
        checkUnprintable->setChecked( prefsData->marginColored );
776 fschmid 424
        pageBackgroundLayout->addWidget( checkUnprintable );
1195 fschmid 425
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
426
        checkPictures->setText( tr( "Show Pictures" ) );
427
        checkPictures->setChecked(prefsData->guidesSettings.showPic);
428
        pageBackgroundLayout->addWidget( checkPictures );
429
        checkLink = new QCheckBox( pageBackground, "checkLink" );
430
        checkLink->setText( tr( "Show Text Chains" ) );
431
        checkLink->setChecked(prefsData->guidesSettings.linkShown);
432
        pageBackgroundLayout->addWidget( checkLink );
433
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
434
        checkFrame->setText( tr( "Show Frames" ) );
435
        checkFrame->setChecked(prefsData->guidesSettings.framesShown);
436
        pageBackgroundLayout->addWidget( checkFrame );
776 fschmid 437
        tabViewLayout->addWidget( pageBackground );
3 paul 438
 
776 fschmid 439
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
440
        groupScratch->setTitle( tr( "Scratch Space" ) );
441
        groupScratch->setColumnLayout(0, Qt::Vertical );
442
        groupScratch->layout()->setSpacing( 0 );
443
        groupScratch->layout()->setMargin( 0 );
444
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
445
        groupScratchLayout->setAlignment( Qt::AlignTop );
446
        groupScratchLayout->setSpacing( 0 );
447
        groupScratchLayout->setMargin( 10 );
448
        Layout4s = new QGridLayout;
449
        Layout4s->setSpacing( 6 );
450
        Layout4s->setMargin( 0 );
451
        topScratch = new MSpinBox( groupScratch, 4 );
452
        topScratch->setDecimals( decimals );
453
        topScratch->setMaxValue(1000);
454
        topScratch->setValue(prefsData->ScratchTop * Umrech);
455
        Layout4s->addWidget( topScratch, 0, 1 );
456
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
457
        Layout4s->addWidget( TextLabel5s, 0, 0 );
458
        leftScratch = new MSpinBox( groupScratch, 4 );
459
        leftScratch->setDecimals( decimals );
460
        leftScratch->setMaxValue(1000);
461
        leftScratch->setValue(prefsData->ScratchLeft * Umrech);
462
        Layout4s->addWidget( leftScratch, 0, 3 );
463
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
464
        Layout4s->addWidget( Linkss, 0, 2 );
465
        bottomScratch = new MSpinBox( groupScratch, 4 );
466
        bottomScratch->setDecimals( decimals );
467
        bottomScratch->setMaxValue(1000);
468
        bottomScratch->setValue(prefsData->ScratchBottom * Umrech);
469
        Layout4s->addWidget( bottomScratch, 1, 1 );
470
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
471
        Layout4s->addWidget( TextLabel7s, 1, 0 );
472
        rightScratch = new MSpinBox( groupScratch, 4 );
473
        rightScratch->setDecimals( decimals );
474
        rightScratch->setMaxValue(1000);
475
        rightScratch->setValue(prefsData->ScratchRight * Umrech);
476
        Layout4s->addWidget( rightScratch, 1, 3 );
477
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
478
        Layout4s->addWidget( Rechtss, 1, 2 );
479
        groupScratchLayout->addLayout( Layout4s );
480
        tabViewLayout->addWidget( groupScratch );
3 paul 481
 
776 fschmid 482
        CaliGroup = new QGroupBox( tr( "&Adjust Display Size" ), tabView, "CaliGroup" );
188 Franz 483
        CaliGroup->setColumnLayout(0, Qt::Vertical );
484
        CaliGroup->layout()->setSpacing( 6 );
485
        CaliGroup->layout()->setMargin( 11 );
486
        CaliGroupLayout = new QVBoxLayout( CaliGroup->layout() );
487
        CaliGroupLayout->setAlignment( Qt::AlignTop );
341 Franz 488
        CaliText = new QLabel( tr( "To adjust the display drag the ruler below with the Slider." ), CaliGroup, "CaliText" );
188 Franz 489
        CaliGroupLayout->addWidget( CaliText );
490
        CaliRuler = new QLabel( CaliGroup, "CaliRuler" );
491
        CaliRuler->setMinimumSize( QSize( 20, 20 ) );
788 fschmid 492
        drawRuler();
188 Franz 493
        CaliRuler->setFrameShape( QLabel::Box );
494
        CaliRuler->setFrameShadow( QLabel::Sunken );
776 fschmid 495
        CaliRuler->setScaledContents( false );
188 Franz 496
        CaliGroupLayout->addWidget( CaliRuler );
497
        layout15ca = new QHBoxLayout( 0, 0, 6, "layout15");
498
        CaliSlider = new QSlider( CaliGroup, "CaliSlider" );
499
        CaliSlider->setMinValue( -100 );
500
        CaliSlider->setMaxValue( 100 );
501
        CaliSlider->setValue(static_cast<int>(100 * DisScale)-100);
502
        CaliSlider->setOrientation( QSlider::Horizontal );
503
        CaliSlider->setTickmarks( QSlider::Right );
504
        CaliSlider->setTickInterval( 10 );
341 Franz 505
        CaliText->setBuddy(CaliGroup);
188 Franz 506
        layout15ca->addWidget( CaliSlider );
507
        CaliAnz = new QLabel( CaliGroup, "CaliAnz" );
508
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
509
        layout15ca->addWidget( CaliAnz );
510
        CaliGroupLayout->addLayout( layout15ca );
776 fschmid 511
        tabViewLayout->addWidget( CaliGroup );
512
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
782 fschmid 513
 
776 fschmid 514
        ExtTool = new QWidget( prefsWidgets, "ExtTool" );
782 fschmid 515
        ExtToolLayout = new QVBoxLayout( ExtTool, 11, 6, "ExtToolLayout");
776 fschmid 516
        ExtToolLayout->setAlignment( Qt::AlignTop );
341 Franz 517
        groupGS = new QGroupBox( tr( "Postscript Interpreter" ), ExtTool, "groupGS" );
220 Franz 518
        groupGS->setColumnLayout(0, Qt::Vertical );
519
        groupGS->layout()->setSpacing( 6 );
520
        groupGS->layout()->setMargin( 10 );
521
        groupGSLayout = new QVBoxLayout( groupGS->layout() );
522
        groupGSLayout->setAlignment( Qt::AlignTop );
782 fschmid 523
        GSlayout = new QHBoxLayout( 0, 0, 6, "GSlayout");
220 Franz 524
        GSName = new QLineEdit( groupGS, "GSName" );
776 fschmid 525
        GSName->setText(prefsData->gs_exe);
341 Franz 526
        GSText = new QLabel( GSName, tr( "&Name of Executable:" ), groupGS, "GSText" );
527
        GSlayout->addWidget( GSText );
220 Franz 528
        GSlayout->addWidget( GSName );
529
        groupGSLayout->addLayout( GSlayout );
341 Franz 530
        GSantiText = new QCheckBox( tr( "Antialias &Text" ), groupGS, "GSantiText" );
776 fschmid 531
        GSantiText->setChecked(prefsData->gs_antiText);
220 Franz 532
        groupGSLayout->addWidget( GSantiText );
341 Franz 533
        GSantiGraph = new QCheckBox( tr( "Antialias &Graphics" ), groupGS, "GSantiGraph" );
776 fschmid 534
        GSantiGraph->setChecked(prefsData->gs_antiGraph);
220 Franz 535
        groupGSLayout->addWidget( GSantiGraph );
536
        ExtToolLayout->addWidget( groupGS );
341 Franz 537
        groupGimp = new QGroupBox( tr( "Image Processing Tool" ), ExtTool, "groupGimp" );
220 Franz 538
        groupGimp->setColumnLayout(0, Qt::Vertical );
539
        groupGimp->layout()->setSpacing( 6 );
540
        groupGimp->layout()->setMargin( 10 );
541
        groupGimpLayout = new QHBoxLayout( groupGimp->layout() );
542
        groupGimpLayout->setAlignment( Qt::AlignTop );
543
        GimpName = new QLineEdit( groupGimp, "GimpName" );
776 fschmid 544
        GimpName->setText(prefsData->gimp_exe);
341 Franz 545
        GimpText = new QLabel( GimpName, tr( "Name of &Executable:" ), groupGimp, "GimpText" );
546
        groupGimpLayout->addWidget( GimpText );
220 Franz 547
        groupGimpLayout->addWidget( GimpName );
548
        ExtToolLayout->addWidget( groupGimp );
549
        QSpacerItem* spacer_gs = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
550
        ExtToolLayout->addItem( spacer_gs );
776 fschmid 551
        addItem(  tr("External Tools."), loadIcon("misc.png"), ExtTool);
222 Franz 552
 
776 fschmid 553
        Misc = new QWidget( prefsWidgets, "Misc" );
782 fschmid 554
        MiscLayout = new QVBoxLayout( Misc, 11, 6, "MiscLayout");
776 fschmid 555
        MiscLayout->setAlignment( Qt::AlignTop );
341 Franz 556
        groupPrint = new QGroupBox( tr( "Printing" ), Misc, "groupPrint" );
222 Franz 557
        groupPrint->setColumnLayout(0, Qt::Vertical );
558
        groupPrint->layout()->setSpacing( 10 );
559
        groupPrint->layout()->setMargin( 10 );
560
        groupPrintLayout = new QVBoxLayout( groupPrint->layout() );
561
        groupPrintLayout->setAlignment( Qt::AlignTop );
341 Franz 562
        ClipMarg = new QCheckBox( tr( "Clip to Page &Margins" ), groupPrint, "ClipMarg" );
776 fschmid 563
        ClipMarg->setChecked(prefsData->ClipMargin);
222 Franz 564
        groupPrintLayout->addWidget( ClipMarg );
344 Franz 565
        DoGCR = new QCheckBox( tr( "Apply &Under Color Removal" ), groupPrint, "ClipMarg" );
776 fschmid 566
        DoGCR->setChecked(prefsData->GCRMode);
344 Franz 567
        groupPrintLayout->addWidget( DoGCR );
222 Franz 568
        MiscLayout->addWidget( groupPrint );
569
        QSpacerItem* spacer_3m = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
570
        MiscLayout->addItem( spacer_3m );
776 fschmid 571
        addItem(  tr("Misc."), loadIcon("misc.png"), Misc);
222 Franz 572
 
188 Franz 573
        setDS();
245 Franz 574
        //tab order
575
        QWidget::setTabOrder( GFsize, SpinBox3 );
776 fschmid 576
        QWidget::setTabOrder( SpinBox3, UnitCombo );
245 Franz 577
        QWidget::setTabOrder( UnitCombo, Recen );
284 Franz 578
        QWidget::setTabOrder( Recen, Docs );
245 Franz 579
        QWidget::setTabOrder( Docs, FileC );
580
        QWidget::setTabOrder( FileC, ProPfad );
581
        QWidget::setTabOrder( ProPfad, FileC2  );
582
        QWidget::setTabOrder( FileC2, ScriptPfad );
583
        QWidget::setTabOrder( ScriptPfad, FileC3 );
410 Franz 584
        QWidget::setTabOrder( FileC3, TemplateDir );
585
        QWidget::setTabOrder( TemplateDir, FileC4 );
228 Franz 586
 
245 Franz 587
 
588
        QWidget::setTabOrder( TopR, BottomR );
589
        QWidget::setTabOrder( BottomR, LeftR );
590
        QWidget::setTabOrder( LeftR, RightR );
591
 
592
        QWidget::setTabOrder( PreviewSize, SaveAtQuit );
593
 
1195 fschmid 594
        QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
595
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
596
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
675 cbradney 597
        QToolTip::add( guiLangCombo, tr( "Select your default language for Scribus to run with.\nLeave this blank to choose based on environment variables.\nYou can still override this by passing a command line option when starting Scribus" ) );
228 Franz 598
        QToolTip::add( GUICombo, tr( "Choose the default window decoration and looks.\nScribus inherits any available KDE or Qt themes" ) );
599
        QToolTip::add( GFsize, tr( "Default font size for the menus and windows" ) );
600
        QToolTip::add( UnitCombo, tr( "Default unit of measurement for document editing" ) );
601
        QToolTip::add( SpinBox3, tr( "Number of lines Scribus will scroll for each move of the mouse wheel" ) );
602
        QToolTip::add( Recen, tr( "Number of recently edited documents to show in the File menu" ) );
603
        QToolTip::add( Docs, tr( "Default documents directory" ) );
604
        QToolTip::add( ProPfad, tr( "Default ICC profiles directory" ) );
605
        QToolTip::add( ScriptPfad, tr( "Default Scripter scripts directory" ) );
410 Franz 606
        QToolTip::add( TemplateDir, tr( "Additional Directory for Document Templates" ) );
228 Franz 607
 
608
        QToolTip::add( GZComboF, tr( "Default page size, either a standard size or a custom size" ) );
609
        QToolTip::add( GZComboO, tr( "Default orientation of document pages" ) );
782 fschmid 610
        QToolTip::add( pageWidth, tr( "Width of document pages, editable if you have chosen a custom page size" ) );
611
        QToolTip::add( pageHeight, tr( "Height of document pages, editable if you have chosen a custom page size" ) );
612
        QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
228 Franz 613
        QToolTip::add( Linkszuerst, tr( "Make the first page the left page of a document" ) );
614
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
615
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
616
        QToolTip::add( LeftR, tr( "Distance between the left margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
236 Franz 617
        QToolTip::add( RightR, tr( "Distance between the right margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
228 Franz 618
        QToolTip::add( ASon, tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension\neach time the time period elapses" ) );
619
        QToolTip::add( ASTime, tr( "Time period between saving automatically" ) );
620
 
621
        QToolTip::add( PreviewSize, tr( "Choose the size of the preview in the scrapbook palette" ) );
243 Franz 622
        QToolTip::add( SaveAtQuit, tr( "Save the scrapbook contents everytime after a change" ) );
228 Franz 623
 
776 fschmid 624
        QToolTip::add( backColor, tr( "Color for paper" ) );
625
        QToolTip::add( checkUnprintable, tr( "Mask the area outside the margins in the margin color" ) );
228 Franz 626
        QToolTip::add( CaliSlider, tr( "Set the default zoom level" ) );
627
 
628
        QToolTip::add( GSName, tr( "Filesystem location for the Ghostscript interpreter" ) );
629
        QToolTip::add( GSantiText, tr( "Antialias text for EPS and PDF onscreen rendering" ) );
630
        QToolTip::add( GSantiGraph, tr( "Antialias graphics for EPS and PDF onscreen rendering" ) );
249 Franz 631
        QToolTip::add( GimpName, tr( "Filesystem location for graphics editor" ) );
228 Franz 632
 
633
        QToolTip::add( ClipMarg, tr( "Do not show objects outside the margins on the printed page or exported file" ) );
415 Franz 634
        QToolTip::add( DoGCR, tr( "A way of switching off some of the gray shades which are composed\n"
782 fschmid 635
                                          "of cyan, yellow and magenta and using black instead.\n"
636
                                          "UCR most affects parts of images which are neutral and/or dark tones\n"
637
                                          "which are close to the gray. Use of this may improve printing some images\n"
638
                                          "and some experimentation and testing is need on a case by case basis.\n"
639
                                          "UCR reduces the possibility of over saturation with CMY inks." ) );
228 Franz 640
 
188 Franz 641
        // signals and slots connections
663 cbradney 642
        connect( guiLangCombo, SIGNAL( activated( const QString & ) ), this, SLOT( setSelectedGUILang( const QString & ) ) );
776 fschmid 643
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
788 fschmid 644
        connect(UnitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
782 fschmid 645
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
646
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
188 Franz 647
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
648
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
649
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
650
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
651
        connect(GZComboO, SIGNAL(activated(int)), this, SLOT(setOrien(int)));
652
        connect(GZComboF, SIGNAL(activated(int)), this, SLOT(setSize(int)));
782 fschmid 653
        connect(facingPages, SIGNAL(clicked()), this, SLOT(setDS()));
788 fschmid 654
        connect(FileC, SIGNAL(clicked()), this, SLOT(changeDocs()));
655
        connect(FileC2, SIGNAL(clicked()), this, SLOT(changeProfs()));
656
        connect(FileC3, SIGNAL(clicked()), this, SLOT(changeScripts()));
657
        connect(FileC4, SIGNAL(clicked()), this, SLOT(changeTemplates()));
658
        connect(CaliSlider, SIGNAL(valueChanged(int)), this, SLOT(setDisScale()));
776 fschmid 659
        setSize(prefsData->PageFormat);
660
        setOrien(prefsData->Ausrichtung);
782 fschmid 661
        pageWidth->setValue(prefsData->PageBreite * Umrech);
662
        pageHeight->setValue(prefsData->PageHoehe * Umrech);
788 fschmid 663
        unitChange();
776 fschmid 664
        prefsWidgets->raiseWidget(0);
665
        resize( minimumSizeHint() );
666
        arrangeIcons();
667
        clearWState( WState_Polished );
3 paul 668
}
669
 
199 Franz 670
/*!
145 Franz 671
 \fn Preferences::~Preferences
1030 subik 672
 \author Franz Schmid
673
 \date
145 Franz 674
 \brief Destructor for Preferences dialog box
675
 \param None
676
 \retval None
3 paul 677
 */
678
Preferences::~Preferences()
679
{
199 Franz 680
        // no need to delete child widgets, Qt does it all for us
3 paul 681
}
682
 
263 Franz 683
 
199 Franz 684
/*!
145 Franz 685
 \fn void Preferences::ChangeDocs()
1030 subik 686
 \author Franz Schmid
687
 \date
145 Franz 688
 \brief Runs QFileDialog to get Preferences (General) Path to Documents directory
689
 \param None
690
 \retval None
691
 */
788 fschmid 692
void Preferences::changeDocs()
3 paul 693
{
694
        QString s = QFileDialog::getExistingDirectory(Docs->text(), this, "d", tr("Choose a Directory"), true);
695
        if (s != "")
696
                Docs->setText(s);
697
}
698
 
199 Franz 699
/*!
145 Franz 700
 \fn void Preferences::ChangeProfs()
1030 subik 701
 \author Franz Schmid
702
 \date
145 Franz 703
 \brief Runs QFileDialog to get Preferences (General) Path to Colour Profiles directory
704
 \param None
705
 \retval None
706
 */
788 fschmid 707
void Preferences::changeProfs()
68 Franz 708
{
788 fschmid 709
        QString s = QFileDialog::getExistingDirectory(ProPfad->text(), this, "d", tr("Choose a Directory"), true);
68 Franz 710
        if (s != "")
711
                ProPfad->setText(s);
712
}
713
 
199 Franz 714
/*!
145 Franz 715
 \fn void Preferences::ChangeScripts()
1030 subik 716
 \author Franz Schmid
717
 \date
145 Franz 718
 \brief Runs QFileDialog to get Preferences (General) Path to Scripts directory
719
 \param None
1030 subik 720
 \retval None
145 Franz 721
 */
788 fschmid 722
void Preferences::changeScripts()
91 Franz 723
{
788 fschmid 724
        QString s = QFileDialog::getExistingDirectory(ScriptPfad->text(), this, "d", tr("Choose a Directory"), true);
91 Franz 725
        if (s != "")
726
                ScriptPfad->setText(s);
727
}
728
 
199 Franz 729
/*!
410 Franz 730
 \fn void Preferences::ChangeTemplates()
1030 subik 731
 \author Riku Leino
732
 \date
410 Franz 733
 \brief Runs QFileDialog to get Preferences (General) Path to Templates directory
734
 \param None
1030 subik 735
 \retval None
410 Franz 736
 */
788 fschmid 737
void Preferences::changeTemplates()
410 Franz 738
{
788 fschmid 739
        QString s = QFileDialog::getExistingDirectory(TemplateDir->text(), this, "d", tr("Choose a Directory"), true);
410 Franz 740
        if (s != "")
741
                TemplateDir->setText(s);
742
}
743
 
744
/*!
145 Franz 745
 \fn void Preferences::setDS()
1030 subik 746
 \author Franz Schmid
747
 \date
145 Franz 748
 \brief Preferences (Document / Page Size), switches default between Facing Pages and swaps text labels for margin guides
749
 \param None
1030 subik 750
 \retval None
145 Franz 751
 */
3 paul 752
void Preferences::setDS()
753
{
782 fschmid 754
        bool m = facingPages->isChecked() ? true : false;
341 Franz 755
        GRText3->setText(m == true ? tr( "&Inside:" ) : tr( "&Left:" ));
756
        GRText4->setText(m == true ? tr( "O&utside:" ) : tr( "&Right:" ));
188 Franz 757
        Linkszuerst->setEnabled(m);
758
        if (m == false)
759
                Linkszuerst->setChecked(false);
3 paul 760
}
761
 
199 Franz 762
/*!
782 fschmid 763
 \fn void Preferences::setPageWidth(int v)
1030 subik 764
 \author Franz Schmid
765
 \date
145 Franz 766
 \brief Preferences (Document / Page Size), sets Page width values
767
 \param v Width value
1030 subik 768
 \retval None
145 Franz 769
 */
782 fschmid 770
void Preferences::setPageWidth(int)
3 paul 771
{
782 fschmid 772
        Pagebr = pageWidth->value() / Umrech;
773
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
774
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
775
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
776
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
3 paul 777
}
778
 
199 Franz 779
/*!
782 fschmid 780
 \fn void Preferences::setPageHeight(int v)
1030 subik 781
 \author Franz Schmid
782
 \date
145 Franz 783
 \brief Preferences (Document / Page Size), sets Page height values
784
 \param v Height value
1030 subik 785
 \retval None
145 Franz 786
 */
782 fschmid 787
void Preferences::setPageHeight(int)
3 paul 788
{
782 fschmid 789
        Pageho = pageHeight->value() / Umrech;
790
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
791
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
792
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
793
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
3 paul 794
}
795
 
199 Franz 796
/*!
145 Franz 797
 \fn void Preferences::setTop(int v)
1030 subik 798
 \author Franz Schmid
799
 \date
145 Franz 800
 \brief Preferences (Document / Page Size), sets Page top values
801
 \param v Top value
1030 subik 802
 \retval None
145 Franz 803
 */
146 Franz 804
void Preferences::setTop(int)
36 Franz 805
{
146 Franz 806
        RandT = TopR->value() / Umrech;
782 fschmid 807
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
36 Franz 808
}
809
 
199 Franz 810
/*!
145 Franz 811
 \fn void Preferences::setBottom(int v)
1030 subik 812
 \author Franz Schmid
813
 \date
145 Franz 814
 \brief Preferences (Document / Page Size), sets Page bottom values
815
 \param v Bottom value
1030 subik 816
 \retval None
145 Franz 817
 */
146 Franz 818
void Preferences::setBottom(int)
36 Franz 819
{
146 Franz 820
        RandB = BottomR->value() / Umrech;
782 fschmid 821
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
36 Franz 822
}
823
 
199 Franz 824
/*!
145 Franz 825
 \fn void Preferences::setLeft(int v)
1030 subik 826
 \author Franz Schmid
827
 \date
145 Franz 828
 \brief Preferences (Document / Page Size), sets Page left values
829
 \param v Top value
1030 subik 830
 \retval None
145 Franz 831
 */
146 Franz 832
void Preferences::setLeft(int)
36 Franz 833
{
146 Franz 834
        RandL = LeftR->value() / Umrech;
782 fschmid 835
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
36 Franz 836
}
837
 
199 Franz 838
/*!
145 Franz 839
 \fn void Preferences::setRight(int v)
1030 subik 840
 \author Franz Schmid
841
 \date
145 Franz 842
 \brief Preferences (Document / Page Size), sets Page right values
843
 \param v Right value
1030 subik 844
 \retval None
145 Franz 845
 */
146 Franz 846
void Preferences::setRight(int)
36 Franz 847
{
146 Franz 848
        RandR = RightR->value() / Umrech;
782 fschmid 849
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
36 Franz 850
}
851
 
199 Franz 852
/*!
145 Franz 853
 \fn void Preferences::setSize(int gr)
1030 subik 854
 \author Franz Schmid
855
 \date
145 Franz 856
 \brief Preferences (Document / Page Size), sets Page size values. Connects signals for setting page dimensions.
857
 \param gr Standard page size value (eg A4)
1030 subik 858
 \retval None
145 Franz 859
 */
3 paul 860
void Preferences::setSize(int gr)
861
{
782 fschmid 862
        Pagebr = pageWidth->value() / Umrech;
863
        Pageho = pageHeight->value() / Umrech;
864
        pageWidth->setEnabled(false);
865
        pageHeight->setEnabled(false);
188 Franz 866
        int br[] = {2380, 1684, 1190, 842, 595, 421, 297, 210, 148, 105, 2836, 2004, 1418, 1002, 709, 501, 355,
199 Franz 867
                    250, 178, 125, 89, 462, 298, 312, 542, 595, 1224, 612, 612, 792};
188 Franz 868
        int ho[] = {3368, 2380, 1684, 1190, 842, 595, 421, 297, 210, 148, 4008, 2836, 2004, 1418, 1002, 709, 501,
199 Franz 869
                    355, 250, 178, 125, 649, 683, 624, 720, 935, 792, 1008, 792, 1224};
188 Franz 870
        if (gr == 30)
871
        {
782 fschmid 872
                pageWidth->setEnabled(true);
873
                pageHeight->setEnabled(true);
188 Franz 874
        }
875
        else
876
        {
877
                Pagebr = br[gr];
878
                Pageho = ho[gr];
879
        }
782 fschmid 880
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
881
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
882
        pageWidth->setValue(Pagebr * Umrech);
883
        pageHeight->setValue(Pageho * Umrech);
884
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
885
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
886
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
887
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
888
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
889
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
3 paul 890
}
891
 
199 Franz 892
/*!
145 Franz 893
 \fn void Preferences::setOrien(int ori)
1030 subik 894
 \author Franz Schmid
895
 \date
145 Franz 896
 \brief Preferences (Document / Page Size), sets Page orientation value and page dimensions
897
 \param ori Orientation value
1030 subik 898
 \retval None
145 Franz 899
 */
3 paul 900
void Preferences::setOrien(int ori)
901
{
146 Franz 902
        double br;
3 paul 903
        setSize(GZComboF->currentItem());
782 fschmid 904
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
905
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
3 paul 906
        if (ori == 0)
188 Franz 907
        {
908
                if (GZComboF->currentItem() == 30)
3 paul 909
                {
782 fschmid 910
                        br = pageWidth->value();
911
                        pageWidth->setValue(pageHeight->value());
912
                        pageHeight->setValue(br);
3 paul 913
                }
188 Franz 914
        }
3 paul 915
        else
188 Franz 916
        {
782 fschmid 917
                br = pageWidth->value();
918
                pageWidth->setValue(pageHeight->value());
919
                pageHeight->setValue(br);
188 Franz 920
        }
782 fschmid 921
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
922
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
3 paul 923
}
924
 
199 Franz 925
/*!
145 Franz 926
 \fn void Preferences::changePapColor()
1030 subik 927
 \author Franz Schmid
928
 \date
145 Franz 929
 \brief Preferences ([dox?], [dox?]), Sets Paper colour [dox?]
930
 \param None
1030 subik 931
 \retval None
145 Franz 932
 */
776 fschmid 933
void Preferences::changePaperColor()
3 paul 934
{
935
        QColor neu = QColor();
776 fschmid 936
        neu = QColorDialog::getColor(colorPaper, this);
3 paul 937
        if (neu.isValid())
188 Franz 938
        {
776 fschmid 939
                QPixmap pm = QPixmap(54, 14);
199 Franz 940
                pm.fill(neu);
776 fschmid 941
                colorPaper = neu;
942
                backColor->setPixmap(pm);
188 Franz 943
        }
3 paul 944
}
945
 
199 Franz 946
/*!
145 Franz 947
 \fn void Preferences::UnitChange()
1030 subik 948
 \author Franz Schmid
949
 \date
145 Franz 950
 \brief Preferences (General, Units). Sets scaling factors and units descriptions when default units are changed. Updates preference values
951
 \param None
1030 subik 952
 \retval None
145 Franz 953
 */
788 fschmid 954
void Preferences::unitChange()
3 paul 955
{
782 fschmid 956
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
957
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
199 Franz 958
        disconnect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
959
        disconnect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
960
        disconnect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
961
        disconnect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
333 Franz 962
        int decimals;
80 Franz 963
        double AltUmrech = Umrech;
782 fschmid 964
        double oldMin, oldMax, oldB, oldBM, oldH, oldHM, val;
965
        pageWidth->getValues(&oldB, &oldBM, &decimals, &val);
333 Franz 966
        oldB /= AltUmrech;
967
        oldBM /= AltUmrech;
782 fschmid 968
        pageHeight->getValues(&oldH, &oldHM, &decimals, &val);
333 Franz 969
        oldH /= AltUmrech;
970
        oldHM /= AltUmrech;
139 Franz 971
        QString einh;
1065 cbradney 972
        docUnitIndex = UnitCombo->currentItem();
3 paul 973
        switch (UnitCombo->currentItem())
188 Franz 974
        {
199 Franz 975
        case 0:
976
                Umrech = 1.0;
977
                decimals = 100;
978
                einh = tr( " pt" );
979
                break;
980
        case 1:
981
                Umrech = 0.3527777;
982
                decimals = 1000;
983
                einh = tr( " mm" );
984
                break;
985
        case 2:
986
                Umrech = 1.0 / 72.0;
987
                decimals = 10000;
988
                einh = tr( " in" );
989
                break;
990
        case 3:
991
                Umrech = 1.0 / 12.0;
992
                decimals = 100;
993
                einh = tr( " p" );
994
                break;
188 Franz 995
        }
782 fschmid 996
        pageWidth->setSuffix(einh);
997
        pageHeight->setSuffix(einh);
188 Franz 998
        TopR->setSuffix(einh);
999
        BottomR->setSuffix(einh);
1000
        LeftR->setSuffix(einh);
1001
        RightR->setSuffix(einh);
879 fschmid 1002
        tabGuides->minorSpace->setSuffix(einh);
1003
        tabGuides->majorSpace->setSuffix(einh);
1004
        tabGuides->snapDistance->setSuffix(einh);
1195 fschmid 1005
        tabGuides->baseGrid->setSuffix(einh);
1006
        tabGuides->baseOffset->setSuffix(einh);
1194 fschmid 1007
        tabTools->gapText->setSuffix(einh);
776 fschmid 1008
        topScratch->setSuffix(einh);
1009
        bottomScratch->setSuffix(einh);
1010
        leftScratch->setSuffix(einh);
1011
        rightScratch->setSuffix(einh);
782 fschmid 1012
        pageWidth->setValues(oldB * Umrech, oldBM * Umrech, decimals, Pagebr * Umrech);
1013
        pageHeight->setValues(oldH * Umrech, oldHM * Umrech, decimals, Pageho * Umrech);
1014
        TopR->setValues(0, pageHeight->value() - RandB * Umrech, decimals, RandT * Umrech);
1015
        BottomR->setValues(0, pageHeight->value() - RandT * Umrech, decimals, RandB * Umrech);
1016
        LeftR->setValues(0, pageWidth->value() - RandR * Umrech, decimals, RandL * Umrech);
1017
        RightR->setValues(0, pageWidth->value() - RandL * Umrech, decimals, RandR * Umrech);
1018
        int decimalsOld;
1019
        double invUnitConversion = 1.0 / AltUmrech * Umrech;
879 fschmid 1020
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1021
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1022
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1023
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1024
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1025
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1195 fschmid 1026
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1027
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1028
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1029
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1194 fschmid 1030
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1031
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
782 fschmid 1032
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1033
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1034
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1035
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1036
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1037
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1038
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1039
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
788 fschmid 1040
        drawRuler();
782 fschmid 1041
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1042
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
43 Franz 1043
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
1044
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
1045
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
1046
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
3 paul 1047
}
1048
 
199 Franz 1049
/*!
145 Franz 1050
 \fn void Preferences::SetDisScale()
1030 subik 1051
 \author Franz Schmid
1052
 \date
145 Franz 1053
 \brief Preferences (Display, Display Size). Sets Scale for ruler scale
1054
 \param None
1055
 \retval None
1056
 */
788 fschmid 1057
void Preferences::setDisScale()
11 Franz 1058
{
1059
        DisScale = QMAX((100.0 + CaliSlider->value()) / 100.0, 0.01);
788 fschmid 1060
        drawRuler();
11 Franz 1061
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
1062
}
1063
 
199 Franz 1064
/*!
145 Franz 1065
 \fn void Preferences::DrawRuler()
1030 subik 1066
 \author Franz Schmid
1067
 \date
145 Franz 1068
 \brief Preferences (Display, Display Size). Draws ruler depending on scaling factor
1069
 \param None
1070
 \retval None
1071
 */
788 fschmid 1072
void Preferences::drawRuler()
11 Franz 1073
{
80 Franz 1074
        double xl, iter, iter2, maxi;
1065 cbradney 1075
        switch (docUnitIndex)
188 Franz 1076
        {
199 Franz 1077
        case 0:
1078
                iter = 10.0;
1079
                iter2 = iter * 10.0;
1080
                maxi = 200.0;
1081
                break;
1082
        case 1:
1083
                iter = (10.0 / 25.4) * 72.0;
1084
                iter2 = iter * 10.0;
1085
                maxi = iter2;
1086
                break;
1087
        case 2:
1088
                iter = 18.0;
1089
                iter2 = 72.0;
1090
                maxi = 2 * iter2;
1091
                break;
1092
        case 3:
1093
                iter = 12.0;
1094
                iter2 = 120.0;
1095
                maxi = 240.0;
1096
                break;
734 fschmid 1097
        default:
1098
                iter = 10.0;
1099
                iter2 = iter * 10.0;
1100
                maxi = 200.0;
1101
                break;
188 Franz 1102
        }
11 Franz 1103
        QPixmap pm(static_cast<int>(maxi*DisScale+30), 21);
1104
        pm.fill();
1105
        QPainter p;
1106
        p.begin(&pm);
1107
        p.drawLine(0, 19, width(), 19);
1108
        p.setBrush(black);
1109
        p.setPen(black);
1110
        p.scale(DisScale, 1.0);
1111
        for (xl = 0; xl < maxi; xl += iter)
1112
                p.drawLine(static_cast<int>(xl), 13, static_cast<int>(xl), 19);
1113
        for (xl = 0; xl < maxi+10; xl += iter2)
188 Franz 1114
        {
11 Franz 1115
                p.drawLine(static_cast<int>(xl), 6, static_cast<int>(xl), 19);
1116
                p.save();
1117
                p.scale(1.0 / DisScale, 1.0);
1065 cbradney 1118
                switch (docUnitIndex)
188 Franz 1119
                {
199 Franz 1120
                case 2:
1121
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1122
                                   QString::number(xl / iter2));
1123
                        break;
1124
                case 3:
1125
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1126
                                   QString::number(xl / iter));
1127
                        break;
1128
                default:
1129
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1130
                                   QString::number(xl / iter * 10));
1131
                        break;
188 Franz 1132
                }
11 Franz 1133
                p.restore();
188 Franz 1134
        }
11 Franz 1135
        p.end();
1136
        CaliRuler->setPixmap(pm);
1137
}
663 cbradney 1138
/*
1139
QString Preferences::getSelectedGUILang( )
1140
{
1141
        return langMgr.getAbbrevFromLang(guiLangCombo->currentText());
1142
}
1143
*/
1144
void Preferences::setSelectedGUILang( const QString &newLang )
1145
{
1146
        selectedGUILang=langMgr.getAbbrevFromLang(newLang);
1147
}
11 Franz 1148