Changeset 11086c2def in tspsg for src/settingsdialog.cpp


Ignore:
Timestamp:
Feb 23, 2010, 9:21:44 PM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
6beb157497
Parents:
8203c075d5
Message:

+ Some Windows Vista and Windows 7 eyecandy with translucent windows thanks to http://labs.trolltech.com/blogs/2009/09/15/using-blur-behind-on-windows/ :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/settingsdialog.cpp

    r8203c075d5 r11086c2def  
    3131 */
    3232SettingsDialog::SettingsDialog(QWidget *parent)
    33         : QDialog(parent), newFont(false), newColor(false)
     33        : QDialog(parent), _newFont(false), _newColor(false), _translucency(0)
    3434{
    3535        setupUi(this);
     
    6868QVBoxLayout *vbox1, *vbox2;
    6969QHBoxLayout *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        }
    7080
    7181        cbSaveState = new QCheckBox(bgWhite);
     
    114124        vbox1 = static_cast<QVBoxLayout *>(tabGeneral->layout());
    115125        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
    116130
    117131        // Bottom part (with grey bg)
     
    146160        cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool());
    147161        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
    148166#ifndef Q_OS_WINCE
    149167        cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
     
    181199bool SettingsDialog::colorChanged() const
    182200{
    183         return newColor;
     201        return _newColor;
    184202}
    185203
     
    190208bool SettingsDialog::fontChanged() const
    191209{
    192         return newFont;
     210        return _newFont;
     211}
     212
     213/*!
     214 *
     215 */
     216qint8 SettingsDialog::translucencyChanged() const
     217{
     218        return _translucency;
    193219}
    194220
     
    200226        settings->setValue("SavePos", cbSaveState->isChecked());
    201227#endif // Q_OS_WINCE
     228#ifdef Q_OS_WIN32
     229        if (QtWin::isCompositionEnabled()) {
     230bool 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
    202238        settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked());
    203         settings->setValue("Autosize", cbAutosize->isChecked());
    204239
    205240        settings->beginGroup("Task");
     
    216251                settings->setValue("ShowMatrixLimit", spinCitiesLimit->value());
    217252        settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked());
    218         if (newFont)
     253        if (_newFont)
    219254                settings->setValue("Font", font);
    220         if (newColor)
     255        if (_newColor)
    221256                settings->setValue("Color", color);
    222257        settings->endGroup();
     
    229264        if (color.isValid() && (this->color != color)) {
    230265                this->color = color;
    231                 newColor = true;
     266                _newColor = true;
    232267        }
    233268}
     
    239274        if (ok && (this->font != font)) {
    240275                this->font = font;
    241                 newFont = true;
     276                _newFont = true;
    242277        }
    243278}
Note: See TracChangeset for help on using the changeset viewer.