void tst_QAbstractScrollArea::setScrollBars() { QScrollArea scrollArea; scrollArea.resize(300, 300); scrollArea.show(); QPointer<QScrollBar> vbar = scrollArea.verticalScrollBar(); QPointer<QScrollBar> hbar = scrollArea.horizontalScrollBar(); // Now set properties on the scroll bars scrollArea.verticalScrollBar()->setInvertedAppearance(true); scrollArea.verticalScrollBar()->setInvertedControls(true); scrollArea.verticalScrollBar()->setTracking(true); scrollArea.verticalScrollBar()->setRange(-100, 100); scrollArea.verticalScrollBar()->setPageStep(42); scrollArea.verticalScrollBar()->setSingleStep(3); scrollArea.verticalScrollBar()->setValue(43); scrollArea.horizontalScrollBar()->setInvertedAppearance(true); scrollArea.horizontalScrollBar()->setInvertedControls(true); scrollArea.horizontalScrollBar()->setTracking(true); scrollArea.horizontalScrollBar()->setRange(-100, 100); scrollArea.horizontalScrollBar()->setPageStep(42); scrollArea.horizontalScrollBar()->setSingleStep(3); scrollArea.horizontalScrollBar()->setValue(43); qApp->processEvents(); // Then replace the scroll bars scrollArea.setVerticalScrollBar(new QScrollBar); scrollArea.setHorizontalScrollBar(new QScrollBar); // Check that the old ones were deleted QVERIFY(!vbar); QVERIFY(!hbar); qApp->processEvents(); // Check that all properties have been populated QVERIFY(scrollArea.verticalScrollBar()->invertedAppearance()); QVERIFY(scrollArea.verticalScrollBar()->invertedControls()); QVERIFY(scrollArea.verticalScrollBar()->hasTracking()); QVERIFY(scrollArea.verticalScrollBar()->isVisible()); QCOMPARE(scrollArea.verticalScrollBar()->minimum(), -100); QCOMPARE(scrollArea.verticalScrollBar()->maximum(), 100); QCOMPARE(scrollArea.verticalScrollBar()->pageStep(), 42); QCOMPARE(scrollArea.verticalScrollBar()->singleStep(), 3); QCOMPARE(scrollArea.verticalScrollBar()->value(), 43); QVERIFY(scrollArea.horizontalScrollBar()->invertedAppearance()); QVERIFY(scrollArea.horizontalScrollBar()->invertedControls()); QVERIFY(scrollArea.horizontalScrollBar()->hasTracking()); QVERIFY(scrollArea.horizontalScrollBar()->isVisible()); QCOMPARE(scrollArea.horizontalScrollBar()->minimum(), -100); QCOMPARE(scrollArea.horizontalScrollBar()->maximum(), 100); QCOMPARE(scrollArea.horizontalScrollBar()->pageStep(), 42); QCOMPARE(scrollArea.horizontalScrollBar()->singleStep(), 3); QCOMPARE(scrollArea.horizontalScrollBar()->value(), 43); }
// Setup widget void MyWidget::setup(int layoutMargin, QString borderColor, QString backgroundColor) { // Some styling visibleArea = QSize(600,400); this->borderColor = borderColor; this->backgroundColor = (backgroundColor == "" ? "rgba(0,0,0,200)" : backgroundColor); borderLeftRight = -1; borderTopDown = -1; fullscreen = false; // The different QRects rectShown = QRect(); rectHidden = QRect(0,-10,10,10); rectAni = QRect(); // The current geometry and position isShown = false; this->setGeometry(rectHidden); // Fading backOpacityShow = 0.5; backOpacityCur = 0; centerOpacityCur = 0; fade = new QTimeLine; fadeIN = true; fadeEffectCenter = new QGraphicsOpacityEffect; connect(fade, SIGNAL(valueChanged(qreal)), this, SLOT(fadeStep())); connect(fade, SIGNAL(finished()), this, SLOT(aniFinished())); // The current widget look this->setStyleSheet(QString("background: rgba(0,0,0,%1);").arg(255*backOpacityShow)); // the central widget containing all the information center = new QWidget(this); center->setGraphicsEffect(fadeEffectCenter); center->setObjectName("center"); // For some reason, if the border is not defined right here at the beginning, it wont be visible... if(borderColor == "") center->setStyleSheet(QString("#center { background: %1; border-radius: 10px; font-size: 12pt; }").arg(this->backgroundColor)); else center->setStyleSheet(QString("#center {background: %1; border-radius: 15px; font-size: 12pt; border: 2px solid %2; }").arg(this->backgroundColor).arg(borderColor)); // Create and set the scrollarea with main layout QVBoxLayout *central = new QVBoxLayout; central->setMargin(layoutMargin); QScrollArea *scroll = new QScrollArea(this); scroll->setObjectName("scrollWidget"); scroll->setStyleSheet("QWidget#scrollWidget { background: transparent; padding-bottom: 3px; border-radius: 0px; }"); QWidget *scrollWidget = new QWidget(scroll->widget()); scrollWidget->setStyleSheet("background: transparent;"); scroll->setWidgetResizable(true); scroll->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); scrollWidget->setLayout(central); scroll->setWidget(scrollWidget); mainlayout = new QVBoxLayout; if(layoutMargin == 0) mainlayout->setMargin(0); center->setLayout(mainlayout); mainlayout->addWidget(scroll); // This widget gets the main layout set to centralWidget = new QWidget; central->addWidget(centralWidget); // And set the custom scrollbar scrollbar = new CustomScrollbar; scroll->setVerticalScrollBar(scrollbar); // And in case the monitor resolution is so small, that the horizontal scrollbar is visible: CustomScrollbar *scrollbarHor = new CustomScrollbar; scroll->setHorizontalScrollBar(scrollbarHor); }
SettingsTabOther::SettingsTabOther(QWidget *parent, QMap<QString, QVariant> set, bool v) : QWidget(parent) { // The global settings globSet = set; verbose = v; this->setObjectName("tabother"); this->setStyleSheet("#tabother { background: transparent; color: white; }"); tabs = new TabWidget; tabs->expand(false); tabs->setBorderTop("rgba(150,150,150,100)",2); tabs->setBorderBot("rgba(150,150,150,100)",2); QVBoxLayout *mainLay = new QVBoxLayout; mainLay->addWidget(tabs); this->setLayout(mainLay); // the main scroll widget for all LOOK content scrollbarOther = new CustomScrollbar; QScrollArea *scrollOther = new QScrollArea; QVBoxLayout *layOther = new QVBoxLayout(scrollOther); QWidget *scrollWidgOther = new QWidget(scrollOther); scrollWidgOther->setLayout(layOther); scrollOther->setWidget(scrollWidgOther); scrollOther->setWidgetResizable(true); scrollOther->setVerticalScrollBar(scrollbarOther); // the main scroll widget for all FEEL content scrollbarFile = new CustomScrollbar; QScrollArea *scrollFile = new QScrollArea; QVBoxLayout *layFile = new QVBoxLayout(scrollFile); QWidget *scrollWidgFile = new QWidget(scrollFile); scrollWidgFile->setLayout(layFile); scrollFile->setWidget(scrollWidgFile); scrollFile->setWidgetResizable(true); scrollFile->setVerticalScrollBar(scrollbarFile); tabOther = new QWidget; tabFile = new QWidget; QVBoxLayout *scrollLayOther = new QVBoxLayout; scrollLayOther->addWidget(scrollOther); tabOther->setLayout(scrollLayOther); QVBoxLayout *scrollLayFile = new QVBoxLayout; scrollLayFile->addWidget(scrollFile); tabFile->setLayout(scrollLayFile); tabs->addTab(tabOther,tr("Other")); tabs->addTab(tabFile,tr("File Types")); // The titles CustomLabel *titleOther = new CustomLabel("<center><h1>" + tr("Other Settings") + "</h1></center>"); layOther->addWidget(titleOther); layOther->addSpacing(20); CustomLabel *titleFile = new CustomLabel("<center><h1>" + tr("Known File Types") + "</h1></center>"); layFile->addWidget(titleFile); layFile->addSpacing(20); // CHOOSE A LANGUAGE CustomLabel *langLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Choose Language") + "</span></b><br><br>" + tr("There are a good few different languages available. Thanks to everybody who took the time to translate PhotoQt!")); langLabel->setWordWrap(true); layOther->addWidget(langLabel); layOther->addSpacing(15); // All the languages available. They are sorted according to their language code (except English) // A GOOD FEW OF THE TRANSLATIONS HAVEN'T BEEN UPDATED IN A LONG TIME AND ARE STANDING AT 0-5% // These translations are NOT included! langDesc << "English"; langShort << "en"; // Arabic // langDesc << QString::fromUtf8("العربية (Amar T.)"); // langShort << "ar"; // Czech langDesc << QString::fromUtf8("Čeština (Robin H. & Petr Š.)"); langShort << "cs"; // German langDesc << "Deutsch"; langShort << "de"; // Greek langDesc << QString::fromUtf8("Ελληνικά (Dimitrios G.)"); langShort << "el"; // Spanish langDesc << QString::fromUtf8("Español (Hector C. & Victoria P.)"); langShort << "es_ES"; // Finnish langDesc << QString::fromUtf8("Suomen kieli (Jiri G.)"); langShort << "fi"; // French langDesc << QString::fromUtf8("Français (Olivier D. & Tubuntu)"); langShort << "fr"; // Hungarian // langDesc << QString::fromUtf8("Magyar (Zoltan H.)"); // langShort << "hu"; // Hebrew langDesc << QString::fromUtf8("עברית (GenghisKhan)"); langShort << "he"; // Italian langDesc << "Italiano (Vincenzo C. & Fabio M.)"; langShort << "it"; // Japanese langDesc << QString::fromUtf8("日本語 (Obytetest)"); langShort << "ja"; // Norwegian Bokmal // langDesc << QString::fromUtf8("Bokmål (Ola Haugen H.)"); // langShort << "nb_NO"; // Norwegian Nynorsk // langDesc << "Nynorsk (Ola Haugen H.)"; // langShort << "nn_NO"; // Polish // langDesc << "Polski (Daniel K.)"; // langShort << "pl"; // Portugal (Brazil) langDesc << QString::fromUtf8("Português (Brasil) (Rafael N. & Everton)"); langShort << "pt_BR"; // Portugal (Portugal) langDesc << QString::fromUtf8("Português (Portugal) (Sérgio M. & Manuela S. & Willow)"); langShort << "pt_PT"; // Russian langDesc << QString::fromUtf8("Pусский (Yuriy T.)"); langShort << "ru_RU"; //Slovak langDesc << QString::fromUtf8("Slovenčina (Lukáš D.)"); langShort << "sk"; // Serbian // langDesc << QString::fromUtf8("српски екавски (Mladen Pejaković)"); // langShort << "sr_RS"; // Turkish // langDesc << QString::fromUtf8("Türkçe (Onuralp SEZER)"); // langShort << "tr"; // Ukrainian langDesc << QString::fromUtf8("Українська (neeesdfsdf & zubr139)"); langShort << "uk_UA"; // Viatnemese // langDesc << QString::fromUtf8("Tiếng Việt (Nguyễn Hữu Tài)"); // langShort << "vi"; // Chinese (China) langDesc << "Chinese (Min Zhang)"; langShort << "zh_CN"; langDesc << "Chinese (traditional) (Min Zhang)"; langShort << "zh_TW"; FlowLayout *langLay = new FlowLayout; QButtonGroup *langButGrp = new QButtonGroup; for(int i = 0; i < langDesc.length(); ++i) { SettingsTabOtherLanguageTiles *tile = new SettingsTabOtherLanguageTiles(langDesc.at(i), langShort.at(i)); allLangTiles << tile; langButGrp->addButton(tile->button); langLay->addWidget(tile); } QHBoxLayout *langWidgLay = new QHBoxLayout; langWidgLay->addSpacing(50); langWidgLay->addLayout(langLay); langWidgLay->addSpacing(50); layOther->addLayout(langWidgLay); layOther->addSpacing(30); // Adjust quick settings trigering CustomLabel *quickSetLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Quick Settings") + "</span></b><br><br>" + tr("The 'Quick Settings' is a widget hidden on the right side of the screen. When you move the cursor there, it shows up, and you can adjust a few simple settings on the spot without having to go through this settings dialog. Of course, only a small subset of settings is available (the ones needed most often). Here you can disable the dialog so that it doesn't show on mouse movement anymore.")); quickSet = new CustomCheckBox(tr("Show 'Quick Settings' on mouse hovering")); QHBoxLayout *quickSetLay = new QHBoxLayout; quickSetLay->addStretch(); quickSetLay->addWidget(quickSet); quickSetLay->addStretch(); layOther->addWidget(quickSetLabel); layOther->addSpacing(20); layOther->addLayout(quickSetLay); layOther->addSpacing(30); // Adjust context menu CustomLabel *contextMenuLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Adjust Context Menu") + "</span></b><br><br>" + tr("Here you can adjust the context menu. You can simply drag and drop the entries, edit them, add a new one and remove an existing one.")); context = new Context; QHBoxLayout *contextLay = new QHBoxLayout; contextLay->addStretch(); contextLay->addWidget(context); contextLay->addStretch(); CustomPushButton *addNew = new CustomPushButton("+ " + tr("Add new Entry"),this); QHBoxLayout *addNewLay = new QHBoxLayout; connect(addNew, SIGNAL(clicked()), context, SLOT(addNewEntry())); addNewLay->addStretch(); addNewLay->addWidget(addNew); addNewLay->addStretch(); layOther->addWidget(contextMenuLabel); layOther->addSpacing(10); layOther->addLayout(contextLay); layOther->addLayout(addNewLay); layOther->addSpacing(20); allCheckQt.clear(); allCheckGm.clear(); allCheckGmUnstable.clear(); // Adjust known file formats CustomLabel *titleQt = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("File Types - Qt") + "</span></b><br><br>" + tr("These are the standard file types supported by Qt. Depending on your system, this list can vary a little.") + "<br>" + tr("If you want to add a file type not in the list, you can add them in the text box below. You have to enter the formats like '*.ending', all seperated by commas.") + "</b>"); titleQt->setWordWrap(true); FlowLayout *layQt = new FlowLayout; QStringList formatsQt; formatsQt << ".bmp" << ".gif" << ".tif" << ".tiff" << ".jpeg2000" << ".jpeg" << ".jpg" << ".png" << ".pbm" << ".pgm" << ".ppm" << ".xbm" << ".xpm"; formatsQt.sort(); for(int i = 0; i < formatsQt.length(); ++i) { SettingsTabOtherFileTypesTiles *check = new SettingsTabOtherFileTypesTiles(formatsQt.at(i)); check->setToolTip(formatsQt.at(i)); allCheckQt.insert(formatsQt.at(i),check); layQt->addWidget(check); } QHBoxLayout *layQtBut = new QHBoxLayout; CustomLabel *extraQt = new CustomLabel(tr("Extra File Types:")); extraQt->setWordWrap(false); extraQtEdit = new CustomLineEdit; CustomPushButton *qtMarkAll = new CustomPushButton(tr("Mark All")); CustomPushButton *qtMarkNone = new CustomPushButton(tr("Mark None")); layQtBut->addWidget(extraQt); layQtBut->addWidget(extraQtEdit); layQtBut->addStretch(); layQtBut->addWidget(qtMarkAll); layQtBut->addWidget(qtMarkNone); layFile->addWidget(titleQt); layFile->addSpacing(10); layFile->addLayout(layQt); layFile->addSpacing(5); layFile->addLayout(layQtBut); layFile->addSpacing(35); QSignalMapper *mapQtMark = new QSignalMapper; mapQtMark->setMapping(qtMarkAll,"qtMark"); connect(qtMarkAll, SIGNAL(clicked()), mapQtMark, SLOT(map())); connect(mapQtMark, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); QSignalMapper *mapQtNone = new QSignalMapper; mapQtNone->setMapping(qtMarkNone,"qtNone"); connect(qtMarkNone, SIGNAL(clicked()), mapQtNone, SLOT(map())); connect(mapQtNone, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); #ifndef GM CustomLabel *gmDisabled = new CustomLabel("<b><i>" + tr("Use of GraphicsMagick has been disabled as PhotoQt was compiled/installed!") + "</i></b>"); gmDisabled->setWordWrap(true); #endif CustomLabel *titleGmWorking = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("File Types - GraphicsMagick") + "</span></b><br><br>" + tr("PhotoQt makes use of GraphicsMagick for support of many different file types. Not all of the formats supported by GraphicsMagick make sense in an image viewer. There are some that aren't quite working at the moment, you can find them in the 'Unstable' category below.") + "<br>" + tr("If you want to add a file type not in the list, you can add them in the text box below. You have to enter the formats like '*.ending', all seperated by commas.") + "</b>"); titleGmWorking->setWordWrap(true); FlowLayout *layGm = new FlowLayout; QStringList formatsGm; formatsGm << ".art" << ".avs" << ".x" << ".cals" << ".cgm" << ".cur" << ".cut" << ".acr" << ".dcm" << ".dicom" << ".dic" << ".dcx" << ".dib" << ".dpx" << ".emf" << ".epdf" << ".epi" << ".eps" << ".eps2" << ".eps3" << ".epsf" << ".epsi" << ".ept" << ".fax" << ".fig" << ".fits" << ".fts" << ".fit" << ".fpx" << ".gplt" << ".ico" << ".jbg" << ".jbig" << ".jng" << ".jp2" << ".j2k" << ".jpf" << ".jpx" << ".jpm" << ".mj2" << ".jpc" << ".mat" << ".miff" << ".mng" << ".mpc" << ".mtv" << ".otb" << ".p7" << ".palm" << ".pam" << ".pcd" << ".pcds" << ".pcx" << ".pdb" << ".pdf" << ".picon" << ".pict" << ".pct" << ".pic" << ".pix" << ".pnm" << ".ps" << ".ps2" << ".ps3" << ".psd" << ".ptif" << ".ras" << ".rast" << ".rad" << ".sgi" << ".sun" << ".svg" << ".tga" << ".vicar" << ".viff" << ".wbmp" << ".wbm" << ".xcf" << ".xwd"; formatsGm.sort(); for(int i = 0; i < formatsGm.length(); ++i) { SettingsTabOtherFileTypesTiles *check = new SettingsTabOtherFileTypesTiles(formatsGm.at(i)); allCheckGm.insert(formatsGm.at(i),check); check->setToolTip(formatsGm.at(i)); layGm->addWidget(check); #ifndef GM check->setEnabled(false); #endif } QHBoxLayout *layGmBut = new QHBoxLayout; CustomLabel *extraGm = new CustomLabel(tr("Extra File Types:")); extraGm->setWordWrap(false); extraGmEdit = new CustomLineEdit; CustomPushButton *gmMarkAll = new CustomPushButton(tr("Mark All")); CustomPushButton *gmMarkNone = new CustomPushButton(tr("Mark None")); layGmBut->addWidget(extraGm); layGmBut->addWidget(extraGmEdit); layGmBut->addStretch(); layGmBut->addWidget(gmMarkAll); layGmBut->addWidget(gmMarkNone); #ifndef GM titleGmWorking->setEnabled(false); gmMarkAll->setEnabled(false); gmMarkNone->setEnabled(false); extraGm->setEnabled(false); extraGmEdit->setEnabled(false); layFile->addWidget(gmDisabled); layFile->addSpacing(10); #endif layFile->addWidget(titleGmWorking); layFile->addSpacing(10); layFile->addLayout(layGm); layFile->addSpacing(5); layFile->addLayout(layGmBut); layFile->addSpacing(35); QSignalMapper *mapGmMark = new QSignalMapper; mapGmMark->setMapping(gmMarkAll,"gmMark"); connect(gmMarkAll, SIGNAL(clicked()), mapGmMark, SLOT(map())); connect(mapGmMark, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); QSignalMapper *mapGmNone = new QSignalMapper; mapGmNone->setMapping(gmMarkNone,"gmNone"); connect(gmMarkNone, SIGNAL(clicked()), mapGmNone, SLOT(map())); connect(mapGmNone, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); CustomLabel *titleGmUnstable = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("File Types - GraphicsMagick (Unstable)") + "</span></b><br><br>" + tr("The following file types are supported by GraphicsMagick, but aren't quite working in PhotoQt just yet. If you want to experiment around a little, feel free to enable some of them. They shouldn't cause PhotoQt to crash, but you might see an error image instead of the actual image.") + "</b>"); titleGmUnstable->setWordWrap(true); FlowLayout *layGmUnstable = new FlowLayout; QStringList formatsGmUnstable; formatsGmUnstable << ".gray" << ".hpgl" << ".mono" << ".msl" << ".mvg" << ".pcl" << ".pfa" << ".pfb" << ".pwp" << ".rgb" << ".rgba" << ".rla" << ".rle" << ".sct" << ".sfw" << ".tim" << ".uil" << ".uyvy" << ".wmf" << ".wpg" << ".yuv"; formatsGmUnstable.sort(); for(int i = 0; i < formatsGmUnstable.length(); ++i) { SettingsTabOtherFileTypesTiles *check = new SettingsTabOtherFileTypesTiles(formatsGmUnstable.at(i)); check->setToolTip(formatsGmUnstable.at(i)); allCheckGmUnstable.insert(formatsGmUnstable.at(i),check); layGmUnstable->addWidget(check); #ifndef GM check->setEnabled(false); #endif } QHBoxLayout *layGmButUnstable = new QHBoxLayout; CustomPushButton *gmMarkAllUnstable = new CustomPushButton(tr("Mark All")); CustomPushButton *gmMarkNoneUnstable = new CustomPushButton(tr("Mark None")); layGmButUnstable->addStretch(); layGmButUnstable->addWidget(gmMarkAllUnstable); layGmButUnstable->addWidget(gmMarkNoneUnstable); layFile->addWidget(titleGmUnstable); layFile->addSpacing(10); layFile->addLayout(layGmUnstable); layFile->addSpacing(5); layFile->addLayout(layGmButUnstable); layFile->addSpacing(35); #ifndef GM titleGmUnstable->setEnabled(false); gmMarkAllUnstable->setEnabled(false); gmMarkNoneUnstable->setEnabled(false); #endif QSignalMapper *mapGmMarkUnst = new QSignalMapper; mapGmMarkUnst->setMapping(gmMarkAllUnstable,"gmunstMark"); connect(gmMarkAllUnstable, SIGNAL(clicked()), mapGmMarkUnst, SLOT(map())); connect(mapGmMarkUnst, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); QSignalMapper *mapGmNoneUnst = new QSignalMapper; mapGmNoneUnst->setMapping(gmMarkNoneUnstable,"gmunstNone"); connect(gmMarkNoneUnstable, SIGNAL(clicked()), mapGmNoneUnst, SLOT(map())); connect(mapGmNoneUnst, SIGNAL(mapped(QString)), this, SLOT(markAllNone(QString))); layOther->addStretch(); layFile->addStretch(); }
SettingsTabThumbnail::SettingsTabThumbnail(QWidget *parent, QMap<QString, QVariant> set, bool v) : QWidget(parent) { // The global settings globSet = set; this->setObjectName("tabthumb"); verbose = v; // Opening the thumbnail database db = QSqlDatabase::database("thumbDB"); // Style the widget this->setStyleSheet("#tabthumb { background: transparent; color: white; }"); tabs = new TabWidget; tabs->expand(false); tabs->setBorderTop("rgba(150,150,150,100)",2); tabs->setBorderBot("rgba(150,150,150,100)",2); QVBoxLayout *mainLay = new QVBoxLayout; mainLay->addWidget(tabs); this->setLayout(mainLay); // the main scroll widget for all LOOK content scrollbarLook = new CustomScrollbar; QScrollArea *scrollLook = new QScrollArea; QVBoxLayout *layLook = new QVBoxLayout(scrollLook); QWidget *scrollWidgLook = new QWidget(scrollLook); scrollWidgLook->setLayout(layLook); scrollLook->setWidget(scrollWidgLook); scrollLook->setWidgetResizable(true); scrollLook->setVerticalScrollBar(scrollbarLook); // the main scroll widget for all FEEL content scrollbarTune = new CustomScrollbar; QScrollArea *scrollTune = new QScrollArea; QVBoxLayout *layTune = new QVBoxLayout(scrollTune); QWidget *scrollWidgTune = new QWidget(scrollTune); scrollWidgTune->setLayout(layTune); scrollTune->setWidget(scrollWidgTune); scrollTune->setWidgetResizable(true); scrollTune->setVerticalScrollBar(scrollbarTune); tabLook = new QWidget; tabTune = new QWidget; QVBoxLayout *scrollLayLook = new QVBoxLayout; scrollLayLook->addWidget(scrollLook); tabLook->setLayout(scrollLayLook); QVBoxLayout *scrollLayTune = new QVBoxLayout; scrollLayTune->addWidget(scrollTune); tabTune->setLayout(scrollLayTune); tabs->addTab(tabLook,tr("Look")); tabs->addTab(tabTune,tr("Fine-Tuning")); // The titles CustomLabel *titleLook = new CustomLabel("<center><h1>" + tr("Thumbnail Look") + "</h1></center>"); layLook->addWidget(titleLook); layLook->addSpacing(20); CustomLabel *titleTune = new CustomLabel("<center><h1>" + tr("Fine-Tuning of Thumbnails") + "</h1></center>"); layTune->addWidget(titleTune); layTune->addSpacing(20); // OPTION TO CHANGE THUMBNAIL SIZE CustomLabel *thumbSizeLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Thumbnail Size") + "</span></b><br><br>" + tr("Here you can adjust the thumbnail size. You can set it to any size between 20 and 256 pixel. Per default it is set to 80 pixel, but with different screen resolutions it might be nice to have them larger/smaller.")); thumbSizeLabel->setWordWrap(true); QHBoxLayout *thumbSizeLay = new QHBoxLayout; thumbSizeSlider = new CustomSlider; thumbSizeSlider->setMinimum(20); thumbSizeSlider->setMaximum(256); thumbSizeSpin = new CustomSpinBox; thumbSizeSpin->setMinimum(20); thumbSizeSpin->setMaximum(256); thumbSizeLay->addStretch(); thumbSizeLay->addWidget(thumbSizeSlider); thumbSizeLay->addWidget(thumbSizeSpin); thumbSizeLay->addStretch(); layLook->addWidget(thumbSizeLabel); layLook->addSpacing(5); layLook->addLayout(thumbSizeLay); layLook->addSpacing(20); connect(thumbSizeSlider, SIGNAL(valueChanged(int)), thumbSizeSpin, SLOT(setValue(int))); connect(thumbSizeSpin, SIGNAL(valueChanged(int)), thumbSizeSlider, SLOT(setValue(int))); // OPTION TO SET SPACING BETWEEN THUMBNAILS borderAroundSlider = new CustomSlider; borderAroundSlider->setMinimum(0); borderAroundSlider->setMaximum(30); borderAroundSlider->setTickInterval(4); borderAroundSpin = new CustomSpinBox; borderAroundSpin->setMinimum(0); borderAroundSpin->setMaximum(30); borderAroundSpin->setSuffix(" px"); CustomLabel *thbBorderAroundLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Spacing Between Thumbnail Images") + "</span></b><br><br>" + tr("The thumbnails are shown in a row at the lower or upper edge (depending on your setup). They are lined up side by side. Per default, there's no empty space between them, however exactly that can be changed here.")); thbBorderAroundLabel->setWordWrap(true); QHBoxLayout *thbBorderLay = new QHBoxLayout; thbBorderLay->addStretch(); thbBorderLay->addWidget(borderAroundSlider); thbBorderLay->addWidget(borderAroundSpin); thbBorderLay->addStretch(); layLook->addWidget(thbBorderAroundLabel); layLook->addSpacing(5); layLook->addLayout(thbBorderLay); layLook->addSpacing(20); connect(borderAroundSlider, SIGNAL(valueChanged(int)), borderAroundSpin, SLOT(setValue(int))); connect(borderAroundSpin, SIGNAL(valueChanged(int)), borderAroundSlider, SLOT(setValue(int))); // OPTION TO ADJUST THE LIFTUP OF HOVERED THUMBNAIL thbLiftUpSlider = new CustomSlider; thbLiftUpSlider->setMinimum(0); thbLiftUpSlider->setMaximum(40); thbLiftUpSlider->setTickInterval(4); thbLiftUpSpin = new CustomSpinBox; thbLiftUpSpin->setMinimum(0); thbLiftUpSpin->setMaximum(40); thbLiftUpSpin->setSuffix(" px"); CustomLabel *thbLiftUpLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Lift-up of Thumbnail Images on Hovering") + "</span></b><br><br>" + tr("When a thumbnail is hovered, it is lifted up some pixels (default 10). Here you can increase/decrease this value according to your personal preference.")); thbLiftUpLabel->setWordWrap(true); QHBoxLayout *thbLiftUpLay = new QHBoxLayout; thbLiftUpLay->addStretch(); thbLiftUpLay->addWidget(thbLiftUpSlider); thbLiftUpLay->addWidget(thbLiftUpSpin); thbLiftUpLay->addStretch(); layLook->addWidget(thbLiftUpLabel); layLook->addSpacing(5); layLook->addLayout(thbLiftUpLay); layLook->addSpacing(20); connect(thbLiftUpSlider, SIGNAL(valueChanged(int)), thbLiftUpSpin, SLOT(setValue(int))); connect(thbLiftUpSpin, SIGNAL(valueChanged(int)), thbLiftUpSlider, SLOT(setValue(int))); // ADJUST THE POSITION OF THE THUMBNAILS CustomLabel *thbPosLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Change Thumbnail Position") + "</span></b><br><bR>" + tr("Per default the bar with the thumbnails is shown at the lower edge. However, some might find it nice and handy to have the thumbnail bar at the upper edge, so that's what can be changed here.")); thbPosLabel->setWordWrap(true); QHBoxLayout *thbPosLay = new QHBoxLayout; thbPosTop = new CustomRadioButton(tr("Show Thumbnails at upper edge")); thbPosBot = new CustomRadioButton(tr("Show Thumbnails at lower edge")); QButtonGroup *thbPosGroup = new QButtonGroup; thbPosGroup->addButton(thbPosTop); thbPosGroup->addButton(thbPosBot); thbPosLay->addStretch(); thbPosLay->addWidget(thbPosTop); thbPosLay->addWidget(thbPosBot); thbPosLay->addStretch(); layLook->addWidget(thbPosLabel); layLook->addSpacing(5); layLook->addLayout(thbPosLay); layLook->addSpacing(20); // OPTION TO KEEP THUMBNAILS VISIBLE OR FADE THEM OUT CustomLabel *thbKeepVisibleLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Keep Thumbnails Visible") + "</span></b><br><bR>" + tr("Per default the Thumbnails slide out over the edge of the screen. Here you can force them to stay visible. The big image is shrunk to fit into the empty space. Note, that the thumbnails will be hidden (and only shown on mouse hovering) once you zoomed the image in/out. Resetting the zoom restores the original visibility of the thumbnails.")); thbKeepVisibleLabel->setWordWrap(true); QHBoxLayout *thbKeepLay = new QHBoxLayout; keepVisible = new CustomCheckBox(tr("Keep Thumbnails Visible")); thbKeepLay->addStretch(); thbKeepLay->addWidget(keepVisible); thbKeepLay->addStretch(); layTune->addWidget(thbKeepVisibleLabel); layTune->addSpacing(5); layTune->addLayout(thbKeepLay); layTune->addSpacing(20); // OPTION TO ENABLE DYNAMIC THUMBNAIL CREATION (handy for faster harddrives) CustomLabel *dynamicThumbnailsLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Dynamic Thumbnail Creation") + "</span></b><br><bR>" + tr("Dynamic thumbnail creation means, that PhotoQt only sets up those thumbnail images that are actually needed, i.e. it stops once it reaches the end of the visible area and sits idle until you scroll left/right.") + "<br><br>" + tr("This feature is very handy, especially if you have bigger directories, since it doesn't occupy the CPU too long, and it doesn't create thumbnails that might never be needed.")); dynamicThumbnailsLabel->setWordWrap(true); QHBoxLayout *dynamicThbLay = new QHBoxLayout; dynamicThumbnails = new CustomCheckBox(tr("Enable Dynamic Thumbnails")); dynamicThbLay->addStretch(); dynamicThbLay->addWidget(dynamicThumbnails); dynamicThbLay->addStretch(); layTune->addWidget(dynamicThumbnailsLabel); layTune->addSpacing(10); layTune->addLayout(dynamicThbLay); layTune->addSpacing(20); // OPTION TO ONLY USE FILENAME AND NO ACTUAL THUMBNAIL CustomLabel *filenameInsteadThbLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Use file-name-only Thumbnails") + "</span></b><br><bR>" + tr("If you don't want PhotoQt to always load the actual image thumbnail in the background, but you still want to have something for better navigating, then you can set a file-name-only thumbnail, i.e. PhotoQt wont load any thumbnail images but simply puts the file name into the box. You can also adjust the font size of this text.")); filenameInsteadThbLabel->setWordWrap(true); filenameInsteadThb = new CustomCheckBox(tr("Use file-name-only Thumbnail")); filenameInsteadThb->setChecked(false); QHBoxLayout *filenameCheckLay = new QHBoxLayout; filenameCheckLay->addStretch(); filenameCheckLay->addWidget(filenameInsteadThb); filenameCheckLay->addStretch(); filenameFontSizeSlider = new CustomSlider; filenameFontSizeSpin = new CustomSpinBox; filenameFontSizeSlider->setEnabled(false); filenameFontSizeSpin->setEnabled(false); filenameFontSizeSlider->setMinimum(6); filenameFontSizeSlider->setMaximum(20); filenameFontSizeSlider->setValue(globSet.value("ThumbnailFilenameInsteadFontSize").toInt()); filenameFontSizeSpin->setMinimum(6); filenameFontSizeSpin->setMaximum(20); filenameFontSizeSpin->setSuffix("pt"); filenameFontSizeSpin->setValue(globSet.value("ThumbnailFilenameInsteadFontSize").toInt()); QHBoxLayout *filenameSpinSliderLay = new QHBoxLayout; filenameSpinSliderLay->addStretch(); filenameSpinSliderLay->addWidget(filenameFontSizeSlider); filenameSpinSliderLay->addWidget(filenameFontSizeSpin); filenameSpinSliderLay->addStretch(); layLook->addWidget(filenameInsteadThbLabel); layLook->addSpacing(5); layLook->addLayout(filenameCheckLay); layLook->addLayout(filenameSpinSliderLay); layLook->addSpacing(20); connect(filenameInsteadThb, SIGNAL(toggled(bool)), filenameFontSizeSlider, SLOT(setEnabled(bool))); connect(filenameInsteadThb, SIGNAL(toggled(bool)), filenameFontSizeSpin, SLOT(setEnabled(bool))); connect(filenameFontSizeSlider, SIGNAL(valueChanged(int)), filenameFontSizeSpin, SLOT(setValue(int))); connect(filenameFontSizeSpin, SIGNAL(valueChanged(int)), filenameFontSizeSlider, SLOT(setValue(int))); // OPTION TO SWITCH BETWEEN FILENAME DIMENSION OR BOTH FOR WRITING ON THUMBNAILS CustomLabel *writeFilenameDimensionsLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Filename? Resolution? Or both?") + "</span></b><br><bR>" + tr("When thumbnails are displayed at the top/bottom, PhotoQt usually writes the filename on them. If wanted, this can be switched to the image resolution. Or even both can be displayed, whatever you want.")); writeFilename = new CustomCheckBox(tr("Write Filename")); writeDimensions = new CustomCheckBox(tr("Write Resolution")); QHBoxLayout *writeCheckLay = new QHBoxLayout; writeCheckLay->addStretch(); writeCheckLay->addWidget(writeFilename); writeCheckLay->addWidget(writeDimensions); writeCheckLay->addStretch(); layLook->addWidget(writeFilenameDimensionsLabel); layLook->addSpacing(5); layLook->addLayout(writeCheckLay); layLook->addSpacing(20); // OPTION TO DISABLE THUMBNAILS ALLTOGETHER CustomLabel *thumbnailDisableLabel = new CustomLabel("<b><span style=\"font-size: 12pt\">" + tr("Disable Thumbnails") + "</span></b><br><bR>" + tr("If you just don't need or don't want any thumbnails whatsoever, then you can disable them here completely. This option can also be toggled remotely via command line (run 'photoqt --help' for more information on that). This might increase the speed of PhotoQt a good bit, however, navigating through a folder might be a little harder without thumbnails.")); thumbnailDisableLabel->setWordWrap(true); thumbDisable = new CustomCheckBox(tr("Disable Thumbnails altogether")); thumbDisable->setChecked(false); QHBoxLayout *thumbDisableLay = new QHBoxLayout; thumbDisableLay->addStretch(); thumbDisableLay->addWidget(thumbDisable); thumbDisableLay->addStretch(); layTune->addWidget(thumbnailDisableLabel); layTune->addSpacing(5); layTune->addLayout(thumbDisableLay); layTune->addSpacing(20); // OPTION FOR THUMBNAIL CACHE CustomLabel *thumbCacheLabel = new CustomLabel("<b><span style=\"font-size:12pt\">" + tr("Thumbnail Cache") + "</span></b><hr>" + tr("Thumbnails can be cached in two different ways:<br>1) File Caching (following the freedesktop.org standard) or<br>2) Database Caching (better performance and management, default option).") + "<br><br>" + tr("Both ways have their advantages and disadvantages:") + "<br>" + tr("File Caching is done according to the freedesktop.org standard and thus different applications can share the same thumbnail for the same image file. However, it's not possible to check for obsolete thumbnails (thus this may lead to many unneeded thumbnail files).") + "<br>" + tr("Database Caching doesn't have the advantage of sharing thumbnails with other applications (and thus every thumbnails has to be newly created for PhotoQt), but it brings a slightly better performance, and it allows a better handling of existing thumbnails (e.g. deleting obsolete thumbnails).") + "<br><br>" + tr("PhotoQt works with either option, though the second way is set as default.") + "<br><br>" + tr("Although everybody is encouraged to use at least one of the two options, caching can be completely disabled altogether. However, that does affect the performance and usability of PhotoQt, since thumbnails have to be newly re-created every time they are needed.")); thumbCacheLabel->setWordWrap(true); QHBoxLayout *thumbCacheLay = new QHBoxLayout; thumbCache = new CustomCheckBox(tr("Enable Thumbnail Cache")); thumbCacheLay->addStretch(); thumbCacheLay->addWidget(thumbCache); thumbCacheLay->addStretch(); // OPTION TO SELECT CACHE TYPE QHBoxLayout *cacheOption = new QHBoxLayout; QButtonGroup *thbCacheGroup = new QButtonGroup; cacheFile = new CustomRadioButton(tr("File caching")); cacheDatabase = new CustomRadioButton(tr("Database caching")); thbCacheGroup->addButton(cacheFile); thbCacheGroup->addButton(cacheDatabase); cacheOption->addStretch(); cacheOption->addWidget(cacheFile); cacheOption->addWidget(cacheDatabase); cacheOption->addStretch(); cacheDatabase->setChecked(true); layTune->addWidget(thumbCacheLabel); layTune->addSpacing(5); layTune->addLayout(thumbCacheLay); layTune->addSpacing(5); layTune->addLayout(cacheOption); layTune->addSpacing(5); connect(thumbCache, SIGNAL(toggled(bool)), this, SLOT(updateCacheStuff())); // Some info about database QHBoxLayout *dbInfoLay = new QHBoxLayout; dbInfo = new CustomLabel; dbInfo->setAlignment(Qt::AlignCenter); dbInfoLay->addStretch(); dbInfoLay->addWidget(dbInfo); dbInfoLay->addStretch(); layTune->addLayout(dbInfoLay); // The database can be cleaned and erased cleanDatabase = new CustomPushButton(tr("CLEAN up Database")); eraseDatabase = new CustomPushButton(tr("ERASE Database")); QHBoxLayout *dbLay = new QHBoxLayout; dbLay->addStretch(); dbLay->addWidget(cleanDatabase); dbLay->addWidget(eraseDatabase); dbLay->addStretch(); layTune->addSpacing(10); layTune->addLayout(dbLay); layTune->addSpacing(10); connect(cacheDatabase, SIGNAL(toggled(bool)), cleanDatabase, SLOT(setEnabled(bool))); connect(cacheDatabase, SIGNAL(toggled(bool)), eraseDatabase, SLOT(setEnabled(bool))); connect(cacheDatabase, SIGNAL(toggled(bool)), dbInfo, SLOT(setEnabled(bool))); // We ask for confirmation before cleaning up the database confirmClean = new CustomConfirm(tr("Clean Database"),tr("Do you really want to clean up the database? This removes all obsolete thumbnails, thus possibly making PhotoQt a little faster.") + "<bR><br>" + tr("This process might take a little while."),tr("Yes, clean is good"),tr("No, don't have time for that"),QSize(450,250),"default","default",this->parentWidget()); confirmClean->show(); // We ask for confirmation before erasing the entire database confirmErase = new CustomConfirm(tr("Erase Database"),tr("Do you really want to ERASE the entire database? This removes every single item in the database! This step should never really be necessarily. After that, every thumbnail has to be newly re-created. This step cannot be reversed!"),tr("Yes, get rid of it all"),tr("Nooo, I want to keep it"),QSize(450,250),"default","default",this->parentWidget()); confirmErase->show(); connect(cleanDatabase, SIGNAL(clicked()), confirmClean, SLOT(animate())); connect(eraseDatabase, SIGNAL(clicked()), confirmErase, SLOT(animate())); connect(confirmClean, SIGNAL(confirmed()), this, SLOT(doCleanDatabase())); connect(confirmErase, SIGNAL(confirmed()), this, SLOT(doEraseDatabase())); layLook->addStretch(); layTune->addStretch(); }