00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "Prefs.h"
00010
00011 #include <stdlib.h>
00012
00013 #include <qcheckbox.h>
00014 #include <qlabel.h>
00015 #include <qpushbutton.h>
00016 #include <qspinbox.h>
00017 #include <qlayout.h>
00018 #include <qvariant.h>
00019 #include <qtooltip.h>
00020 #include <qwhatsthis.h>
00021 #include <qbuttongroup.h>
00022 #include <qlineedit.h>
00023 #include <qdir.h>
00024 #ifdef USECOMBO
00025 #include <qcombobox.h>
00026 #else
00027 #include <qpe/menubutton.h>
00028 #endif
00029 #include <qfontdatabase.h>
00030
00031 #ifdef USECOMBO
00032 void populate_colours(QComboBox *mb)
00033 #else
00034 void populate_colours(MenuButton *mb)
00035 #endif
00036 {
00037 mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00038 mb->insertItem("White");
00039 mb->insertItem("Black");
00040 mb->insertItem("Dark Gray");
00041 mb->insertItem("Gray");
00042 mb->insertItem("Light Gray");
00043 mb->insertItem("Red");
00044 mb->insertItem("Green");
00045 mb->insertItem("Blue");
00046 mb->insertItem("Cyan");
00047 mb->insertItem("Magenta");
00048 mb->insertItem("Yellow");
00049 mb->insertItem("Dark Red");
00050 mb->insertItem("Dark Green");
00051 mb->insertItem("Dark Blue");
00052 mb->insertItem("Dark Cyan");
00053 mb->insertItem("Dark Magenta");
00054 mb->insertItem("Dark Yellow");
00055 }
00056
00057 CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl )
00058 : QWidget( parent, name, fl )
00059 {
00060 QHBoxLayout* hb = new QHBoxLayout(this);
00061 QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this);
00062 hb->addWidget(bg);
00063
00064 StripCR = new QCheckBox( bg );
00065 StripCR->setText( tr( "Strip CR" ) );
00066
00067 Dehyphen = new QCheckBox( bg );
00068 Dehyphen->setText( tr( "Dehyphen" ) );
00069
00070 SingleSpace = new QCheckBox( bg );
00071 SingleSpace->setText( tr( "Single Space" ) );
00072
00073 Unindent = new QCheckBox( bg );
00074 Unindent->setText( tr( "Unindent" ) );
00075
00076 Reparagraph = new QCheckBox( bg );
00077 Reparagraph->setText( tr( "Reparagraph" ) );
00078
00079 DoubleSpace = new QCheckBox( bg );
00080 DoubleSpace->setText( tr( "Double Space" ) );
00081
00082 Remap = new QCheckBox( bg );
00083 Remap->setText( tr( "Remap" ) );
00084
00085 Embolden = new QCheckBox( bg );
00086 Embolden->setText( tr( "Embolden" ) );
00087
00088 FullJustify = new QCheckBox( bg );
00089 FullJustify->setText( tr( "Full Justify" ) );
00090
00091 FixGraphics = new QCheckBox( bg );
00092 FixGraphics->setText( tr( "Fix Graphic Size" ) );
00093
00094 hyphenate = new QCheckBox( bg );
00095 hyphenate->setText( tr( "Hyphenate" ) );
00096
00097
00098
00099
00100
00101
00102 prepalm = new QCheckBox( bg );
00103 prepalm->setText( tr( "Repalm(Baen)" ) );
00104
00105 pkern = new QCheckBox( bg );
00106 pkern->setText( tr( "Kern" ) );
00107
00108 InlineTables = new QCheckBox( bg );
00109 InlineTables->setText( tr( "Inline Tables" ) );
00110
00111 Underlinelinks = new QCheckBox( bg );
00112 Underlinelinks->setText( tr( "Underline Links" ) );
00113
00114
00115
00116
00117
00118
00119
00120 }
00121
00122
00123
00124
00125 CLayoutPrefs::~CLayoutPrefs()
00126 {
00127
00128 }
00129
00130
00131
00132 CLayoutPrefs2::CLayoutPrefs2( int w, QWidget* parent, const char* name, WFlags fl )
00133 : QWidget( parent, name, fl )
00134 {
00135
00136 QVBoxLayout* vb = new QVBoxLayout(this);
00137 QGridLayout* gl = new QGridLayout(vb, 4, 5);
00138
00139 QLabel *TextLabel;
00140
00141 TextLabel = new QLabel( this );
00142 TextLabel->setText( tr( "Page\nOverlap" ) );
00143 gl->addWidget(TextLabel, 0, 0);
00144 pageoverlap = new QSpinBox( this );
00145 pageoverlap->setRange(0,20);
00146 gl->addWidget(pageoverlap, 0, 1);
00147
00148 TextLabel = new QLabel( this, "TextLabel1" );
00149 TextLabel->setText( tr( "Indent" ) );
00150 gl->addWidget(TextLabel, 1, 0);
00151 Indent = new QSpinBox( this, "Indent" );
00152 Indent->setRange(0,20);
00153 gl->addWidget(Indent, 1, 1);
00154
00155
00156
00157 TextLabel = new QLabel( this );
00158 TextLabel->setText( tr( "Graphics\nZoom" ) );
00159 gl->addWidget(TextLabel, 1, 2);
00160 gfxzoom = new QSpinBox( this );
00161 gfxzoom->setRange(0,2000);
00162 gfxzoom->setLineStep(10);
00163 gfxzoom->setSuffix("%");
00164 gl->addWidget(gfxzoom, 1, 3);
00165
00166 TextLabel = new QLabel( this, "TextLabel4" );
00167 TextLabel->setText( tr( "Top\nMargin" ) );
00168 gl->addWidget(TextLabel, 2, 0);
00169 TopMargin = new QSpinBox( this, "TMargin" );
00170 TopMargin->setRange(0, 1000);
00171 gl->addWidget(TopMargin, 2, 1);
00172
00173 TextLabel = new QLabel( this );
00174 TextLabel->setText( tr( "Bottom\nMargin" ) );
00175 gl->addWidget(TextLabel, 2, 2);
00176 BottomMargin = new QSpinBox( this, "BMargin" );
00177 BottomMargin->setRange(0, 1000);
00178 gl->addWidget(BottomMargin, 2, 3);
00179
00180 TextLabel = new QLabel( this, "TextLabel4" );
00181 TextLabel->setText( tr( "Left\nMargin" ) );
00182 gl->addWidget(TextLabel, 3, 0);
00183 LeftMargin = new QSpinBox( this, "LMargin" );
00184 LeftMargin->setRange(0, 1000);
00185 gl->addWidget(LeftMargin, 3, 1);
00186
00187 TextLabel = new QLabel( this );
00188 TextLabel->setText( tr( "Right\nMargin" ) );
00189 gl->addWidget(TextLabel, 3, 2);
00190 RightMargin = new QSpinBox( this, "RMargin" );
00191 RightMargin->setRange(0, 1000);
00192 gl->addWidget(RightMargin, 3, 3);
00193
00194 TextLabel = new QLabel( this );
00195 TextLabel->setText( tr( "Paragraph\nLeading" ) );
00196 gl->addWidget(TextLabel, 4, 0);
00197 ParaLead = new QSpinBox( this );
00198 ParaLead->setRange(-5, 50);
00199 gl->addWidget(ParaLead, 4, 1);
00200
00201 TextLabel = new QLabel( this );
00202 TextLabel->setText( tr( "Line\nLeading" ) );
00203 gl->addWidget(TextLabel, 4, 2);
00204 LineLead = new QSpinBox( this );
00205 LineLead->setRange(-5, 50);
00206 gl->addWidget(LineLead, 4, 3);
00207
00208 gl = new QGridLayout(vb, 2, 2);
00209
00210 TextLabel = new QLabel( this);
00211 TextLabel->setText( tr( "Markup" ) );
00212 gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
00213 TextLabel = new QLabel( this);
00214 TextLabel->setText( tr( "Font" ) );
00215 gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
00216
00217
00218 #ifdef USECOMBO
00219 Markup = new QComboBox( this);
00220 #else
00221 Markup = new MenuButton( this);
00222 #endif
00223 Markup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00224 Markup->insertItem("Auto");
00225 Markup->insertItem("None");
00226 Markup->insertItem("Text");
00227 Markup->insertItem("HTML");
00228 Markup->insertItem("PML");
00229 gl->addWidget(Markup, 1, 0, Qt::AlignTop);
00230
00231 #ifdef USECOMBO
00232 fontselector = new QComboBox( this);
00233 #else
00234 fontselector = new MenuButton( this);
00235 #endif
00236 fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00237 {
00238 QFontDatabase f;
00239 QStringList flist = f.families();
00240 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
00241 {
00242 fontselector->insertItem(*nm);
00243 }
00244 }
00245 gl->addWidget(fontselector, 1, 1, Qt::AlignTop);
00246
00247 #ifdef USECOMBO
00248 bgsel = new QComboBox( this );
00249 #else
00250 bgsel = new MenuButton( this );
00251 #endif
00252 populate_colours(bgsel);
00253
00254 #ifdef USECOMBO
00255 fgsel = new QComboBox( this );
00256 #else
00257 fgsel = new MenuButton( this );
00258 #endif
00259 populate_colours(fgsel);
00260 gl = new QGridLayout(vb, 2, 2);
00261
00262 TextLabel = new QLabel( this);
00263 TextLabel->setText( tr( "Background" ) );
00264 gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom);
00265 TextLabel = new QLabel( this);
00266 TextLabel->setText( tr( "Foreground" ) );
00267 gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom);
00268
00269 gl->addWidget(bgsel, 1, 0, Qt::AlignTop);
00270 gl->addWidget(fgsel, 1, 1, Qt::AlignTop);
00271
00272 }
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 CLayoutPrefs2::~CLayoutPrefs2()
00495 {
00496
00497 }
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584 CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl )
00585 : QWidget( parent, name, fl )
00586 {
00587
00588 QVBoxLayout* vl = new QVBoxLayout(this);
00589 QHBoxLayout* hl = new QHBoxLayout;
00590 vl->addLayout(hl);
00591
00592 vl->setMargin( 0 );
00593 hl->setMargin( 0 );
00594
00595 QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this);
00596 hl->addWidget( gb );
00597
00598 annotation = new QCheckBox( gb );
00599 annotation->setText( tr( "Annotation" ) );
00600
00601 dictionary = new QCheckBox( gb );
00602 dictionary->setText( tr( "Dictionary" ) );
00603
00604 clipboard = new QCheckBox( gb );
00605 clipboard->setText( tr( "Clipboard" ) );
00606
00607 boutput = new QCheckBox( gb );
00608 boutput->setText( tr( "Output" ) );
00609
00610 QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this);
00611 hl->addWidget( bg );
00612
00613 Depluck = new QCheckBox( bg );
00614 Depluck->setText( tr( "Depluck" ) );
00615
00616 Dejpluck = new QCheckBox( bg );
00617 Dejpluck->setText( tr( "Dejpluck" ) );
00618
00619 Continuous = new QCheckBox( bg );
00620 Continuous->setText( tr( "Continuous" ) );
00621 bg = new QButtonGroup(2, Qt::Horizontal, "Background", this);
00622 vl->addWidget( bg );
00623
00624
00625
00626
00627 #ifdef USECOMBO
00628 bgtype = new QComboBox( bg );
00629 #else
00630 bgtype = new MenuButton( this);
00631 #endif
00632 bgtype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00633
00634 bgtype->insertItem( tr("Centred") );
00635 bgtype->insertItem( tr("Tiled") );
00636 bgtype->insertItem( tr("Fitted") );
00637
00638 DoubleBuffer = new QCheckBox( bg );
00639 DoubleBuffer->setText( tr( "Double Buffer" ) );
00640
00641 QLabel* TextLabel = new QLabel( bg );
00642 TextLabel->setText( tr( "Minibar Colour" ) );
00643 #ifdef USECOMBO
00644 minibarcol = new QComboBox( bg );
00645 #else
00646 minibarcol = new MenuButton( this);
00647 #endif
00648 populate_colours(minibarcol);
00649 minibarcol->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00650 }
00651
00652 CMiscPrefs::~CMiscPrefs()
00653 {
00654
00655 }
00656
00657 CScrollPrefs::CScrollPrefs( QWidget* parent, const char* name, WFlags fl )
00658 : QWidget( parent, name, fl )
00659 {
00660
00661 QHBoxLayout* hl = new QHBoxLayout(this);
00662
00663 hl->setMargin( 0 );
00664
00665 QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Scroll", this);
00666 hl->addWidget( bg );
00667
00668
00669
00670 QLabel* TextLabel = new QLabel( bg );
00671 TextLabel->setText( tr( "Scroll step" ) );
00672
00673 scrollstep = new QSpinBox( bg );
00674 scrollstep->setRange(1, 10);
00675 scrollstep->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00676
00677 TextLabel = new QLabel( bg );
00678 TextLabel->setText( tr( "Scroll type" ) );
00679 #ifdef USECOMBO
00680 scrolltype = new QComboBox( bg );
00681 #else
00682 scrolltype = new MenuButton( this);
00683 #endif
00684 scrolltype->insertItem("In Place");
00685 scrolltype->insertItem("Rolling (moving bg)");
00686 scrolltype->insertItem("Rolling (window)");
00687 scrolltype->insertItem("Rolling (static bg)");
00688 scrolltype->insertItem("Send to output");
00689 scrolltype->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00690
00691 TextLabel = new QLabel( bg );
00692 TextLabel->setText( tr( "Colour of scroll\nprogress indicator" ) );
00693
00694 #ifdef USECOMBO
00695 scrollcolor = new QComboBox( bg );
00696 #else
00697 scrollcolor = new MenuButton( this);
00698 #endif
00699 populate_colours(scrollcolor);
00700 scrollcolor->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00701
00702 TextLabel = new QLabel( bg );
00703 TextLabel->setText( tr( "Output" ) );
00704
00705 #ifdef USECOMBO
00706 outcodec = new QComboBox( bg );
00707 #else
00708 outcodec = new MenuButton( this);
00709 #endif
00710 #ifdef USEQPE
00711 #ifdef OPIE
00712 QString codecpath(getenv("OPIEDIR"));
00713 #else
00714 QString codecpath(getenv("QTDIR"));
00715 #endif
00716 codecpath += "/plugins/reader/outcodecs";
00717 #else
00718 QString codecpath(getenv("READERDIR"));
00719 codecpath += "/outcodecs";
00720 #endif
00721 QDir ocd(codecpath, "lib*.so");
00722 for (int i = 0; i < ocd.count(); ++i)
00723 {
00724 QString tmp(ocd[i]);
00725 outcodec->insertItem(tmp.mid(3,tmp.length()-6));
00726 }
00727 outcodec->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00728 }
00729
00730 CScrollPrefs::~CScrollPrefs()
00731 {
00732
00733 }
00734
00735
00736 CPrefs::CPrefs( int w, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
00737 {
00738 setCaption(tr( "OpieReader Settings" ) );
00739 QTabWidget* td = new QTabWidget(this);
00740 layout = new CLayoutPrefs(this);
00741 layout2 = new CLayoutPrefs2(w, this);
00742 scroll = new CScrollPrefs(this);
00743 misc = new CMiscPrefs(this);
00744
00745 inter = new CInterPrefs(this);
00746 td->addTab(layout, tr("Layout"));
00747 td->addTab(layout2, tr("Layout(2)"));
00748 td->addTab(inter, tr("Locale"));
00749 td->addTab(scroll, tr("Scroll"));
00750 td->addTab(misc, tr("Misc"));
00751
00752 QVBoxLayout* v = new QVBoxLayout(this);
00753 v->addWidget(td);
00754
00755 if (fs) showMaximized();
00756 }
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768 #include "CEncoding_tables.h"
00769
00770 CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl )
00771 : QWidget( parent, name, fl )
00772 {
00773 QHBoxLayout* hb = new QHBoxLayout(this);
00774
00775 QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("International"), this);
00776
00777 hb->addWidget(gb);
00778
00779 QLabel *TextLabel;
00780
00781 ideogram = new QCheckBox( gb );
00782 ideogram->setText( tr( "Ideograms" ) );
00783
00784 TextLabel = new QLabel( gb );
00785 TextLabel->setText( tr( "Ideogram Width" ) );
00786 ideogramwidth = new QSpinBox( gb );
00787 ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00788 ideogramwidth->setRange(1,200);
00789
00790 propfontchange = new QCheckBox( gb );
00791 propfontchange->setText( tr( "Apply font\nto dialogs" ) );
00792
00793 TextLabel = new QLabel( gb );
00794 TextLabel->setText( tr( "Encoding" ) );
00795 #ifdef USECOMBO
00796 encoding = new QComboBox(gb);
00797 #else
00798 encoding = new MenuButton(gb);
00799 #endif
00800 encoding->insertItem("Ascii");
00801 encoding->insertItem("UTF-8");
00802 encoding->insertItem("UCS-2(BE)");
00803 encoding->insertItem("USC-2(LE)");
00804 encoding->insertItem("Palm");
00805 for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++)
00806 {
00807 encoding->insertItem(iter->mime);
00808 }
00809
00810 QVBoxLayout* vb = new QVBoxLayout;
00811
00812 gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this);
00813
00814 TextLabel = new QLabel( gb );
00815 TextLabel->setText( tr( "Application" ) );
00816 application = new QLineEdit(gb);
00817 application->setFixedWidth(80);
00818
00819 TextLabel = new QLabel( gb );
00820 TextLabel->setText( tr( "Message" ) );
00821 message = new QLineEdit(gb);
00822 message->setFixedWidth(80);
00823
00824 twotouch = new QCheckBox( gb );
00825 twotouch->setText( tr( "Two/One\nTouch" ) );
00826
00827 SwapMouse = new QCheckBox( gb );
00828 SwapMouse->setText("Swap Tap\nActions");
00829
00830
00831 vb->addWidget(gb);
00832
00833
00834 hb->addLayout(vb);
00835 }
00836
00837 CInterPrefs::~CInterPrefs()
00838 {
00839
00840 }