- Timestamp:
- Feb 23, 2010, 9:21:44 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defaults.h
r87 r92 46 46 //! Default for "Save main window state and position" 47 47 #define DEF_SAVEPOS false 48 //! Default for "Use translucency effects in Vista/7" 49 #define DEF_USE_TRANSLUCENCY true 48 50 49 51 //////// TASK -
trunk/src/globals.h
r89 r92 39 39 // TSPSG Defaults 40 40 #include "defaults.h" 41 // Vista/7 Eyecandy 42 #include "qtwin.h" 41 43 42 44 // DEFINES -
trunk/src/main.cpp
r87 r92 33 33 #endif 34 34 35 #include "qtwin.h" 36 35 37 #ifdef STATIC_BUILD 36 38 Q_IMPORT_PLUGIN(qjpeg) -
trunk/src/mainwindow.cpp
r91 r92 225 225 { 226 226 QPrintPreviewDialog ppd(printer, this); 227 228 227 connect(&ppd,SIGNAL(paintRequested(QPrinter *)),SLOT(printPreview(QPrinter *))); 228 ppd.exec(); 229 229 } 230 230 … … 258 258 QApplication::restoreOverrideCursor(); 259 259 } 260 } 261 if (sd.translucencyChanged() != 0) { 262 toggleTranclucency(sd.translucencyChanged() == 1); 260 263 } 261 264 } … … 352 355 txtAbout->moveCursor(QTextCursor::Start); 353 356 357 bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor)); 358 354 359 vb->addLayout(hb); 355 360 vb->addWidget(txtAbout); … … 361 366 362 367 connect(bb, SIGNAL(accepted()), dlg, SLOT(accept())); 368 369 // Adding some eyecandy in Vista and 7 :-) 370 if (QtWin::isCompositionEnabled()) { 371 QtWin::enableBlurBehindWindow(dlg, true); 372 } 363 373 364 374 dlg->resize(410, 300); … … 758 768 759 769 #ifdef Q_OS_WINCE 770 menuBar()->setDefaultAction(menuFile->menuAction()); 771 #endif // Q_OS_WINCE 772 773 #ifdef Q_OS_WINCE 760 774 //! \hack HACK: A little hack for toolbar icons to have a sane size. 761 775 toolBar->setIconSize(QSize(logicalDpiX() / 4, logicalDpiY() / 4)); 762 #endif 776 #endif // Q_OS_WINCE 763 777 764 778 solutionText->document()->setDefaultFont(settings->value("Output/Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>()); … … 794 808 retranslateUi(false); 795 809 796 setCentralWidget(tabWidget); 810 // Adding some eyecandy in Vista and 7 :-) 811 if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()) { 812 toggleTranclucency(true); 813 } 797 814 } 798 815 … … 809 826 #endif // QT_NO_PRINTER 810 827 } 828 829 void MainWindow::toggleTranclucency(bool enable) 830 { 831 QtWin::enableBlurBehindWindow(this, enable); 832 QtWin::enableBlurBehindWindow(tabWidget, enable); 833 834 if (QtWin::enableBlurBehindWindow(tabTask, enable)) 835 tabTask->setAutoFillBackground(enable); 836 if (QtWin::enableBlurBehindWindow(tabSolution, enable)) 837 tabSolution->setAutoFillBackground(enable); 838 } -
trunk/src/mainwindow.h
r87 r92 101 101 void setupUi(); 102 102 void toggleSolutionActions(bool enable = true); 103 void toggleTranclucency(bool enable); 103 104 }; 104 105 -
trunk/src/settingsdialog.cpp
r87 r92 31 31 */ 32 32 SettingsDialog::SettingsDialog(QWidget *parent) 33 : QDialog(parent), newFont(false), newColor(false)33 : QDialog(parent), _newFont(false), _newColor(false), _translucency(0) 34 34 { 35 35 setupUi(this); … … 68 68 QVBoxLayout *vbox1, *vbox2; 69 69 QHBoxLayout *hbox1, *hbox2; 70 71 if (QtWin::isCompositionEnabled()) { 72 cbUseTranslucency = new QCheckBox(bgWhite); 73 cbUseTranslucency->setObjectName("cbUseTranslucency"); 74 #ifndef QT_NO_STATUSTIP 75 cbUseTranslucency->setStatusTip(tr("Use translucent effect on the Main Window under Windows Vista and 7")); 76 #endif // QT_NO_STATUSTIP 77 cbUseTranslucency->setText(tr("Use translucency effects")); 78 cbUseTranslucency->setCursor(QCursor(Qt::PointingHandCursor)); 79 } 70 80 71 81 cbSaveState = new QCheckBox(bgWhite); … … 114 124 vbox1 = static_cast<QVBoxLayout *>(tabGeneral->layout()); 115 125 vbox1->insertWidget(vbox1->indexOf(cbUseNativeDialogs) + 1, cbSaveState); 126 #ifdef Q_OS_WIN32 127 if (QtWin::isCompositionEnabled()) 128 vbox1->insertWidget(vbox1->indexOf(cbUseNativeDialogs) + 1, cbUseTranslucency); 129 #endif // Q_OS_WIN32 116 130 117 131 // Bottom part (with grey bg) … … 146 160 cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool()); 147 161 cbUseNativeDialogs->setChecked(settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool()); 162 #ifdef Q_OS_WIN32 163 if (QtWin::isCompositionEnabled()) 164 cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool()); 165 #endif // Q_OS_WIN32 148 166 #ifndef Q_OS_WINCE 149 167 cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool()); … … 181 199 bool SettingsDialog::colorChanged() const 182 200 { 183 return newColor;201 return _newColor; 184 202 } 185 203 … … 190 208 bool SettingsDialog::fontChanged() const 191 209 { 192 return newFont; 210 return _newFont; 211 } 212 213 /*! 214 * 215 */ 216 qint8 SettingsDialog::translucencyChanged() const 217 { 218 return _translucency; 193 219 } 194 220 … … 200 226 settings->setValue("SavePos", cbSaveState->isChecked()); 201 227 #endif // Q_OS_WINCE 228 #ifdef Q_OS_WIN32 229 if (QtWin::isCompositionEnabled()) { 230 bool old = settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool(); 231 if ((!old && cbUseTranslucency->isChecked()) || (old && !cbUseTranslucency->isChecked())) { 232 _translucency = old ? -1 : 1; 233 } else 234 _translucency = 0; 235 settings->setValue("UseTranslucency", cbUseTranslucency->isChecked()); 236 } 237 #endif // Q_OS_WIN32 202 238 settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked()); 203 settings->setValue("Autosize", cbAutosize->isChecked());204 239 205 240 settings->beginGroup("Task"); … … 216 251 settings->setValue("ShowMatrixLimit", spinCitiesLimit->value()); 217 252 settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked()); 218 if ( newFont)253 if (_newFont) 219 254 settings->setValue("Font", font); 220 if ( newColor)255 if (_newColor) 221 256 settings->setValue("Color", color); 222 257 settings->endGroup(); … … 229 264 if (color.isValid() && (this->color != color)) { 230 265 this->color = color; 231 newColor = true;266 _newColor = true; 232 267 } 233 268 } … … 239 274 if (ok && (this->font != font)) { 240 275 this->font = font; 241 newFont = true;276 _newFont = true; 242 277 } 243 278 } -
trunk/src/settingsdialog.h
r87 r92 44 44 bool colorChanged() const; 45 45 bool fontChanged() const; 46 qint8 translucencyChanged() const; 46 47 47 48 private: 49 bool _newFont; 50 bool _newColor; 51 qint8 _translucency; 52 48 53 QColor color; 49 54 QFont font; 50 bool newFont; 51 bool newColor; 55 52 56 QSettings *settings; 53 57 QHBoxLayout *layoutCitiesLimit; 58 #ifdef Q_OS_WIN32 59 QCheckBox *cbUseTranslucency; 60 #endif // Q_OS_WIN32 54 61 #ifndef Q_OS_WINCE 55 62 QCheckBox *cbSaveState; … … 59 66 60 67 bool event(QEvent *ev); 61 #endif // Q_OS_WINCE68 #endif 62 69 63 70 private slots:
Note: See TracChangeset
for help on using the changeset viewer.