File indexing completed on 2024-05-12 13:53:16
0001 /***************************************************************************** 0002 * Copyright 2007 - 2010 Craig Drummond <craig.p.drummond@gmail.com> * 0003 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Lesser General Public License as * 0007 * published by the Free Software Foundation; either version 2.1 of the * 0008 * License, or (at your option) version 3, or any later version accepted * 0009 * by the membership of KDE e.V. (or its successor approved by the * 0010 * membership of KDE e.V.), which shall act as a proxy defined in * 0011 * Section 6 of version 3 of the license. * 0012 * * 0013 * This program is distributed in the hope that it will be useful, * 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0016 * Lesser General Public License for more details. * 0017 * * 0018 * You should have received a copy of the GNU Lesser General Public * 0019 * License along with this library. If not, * 0020 * see <http://www.gnu.org/licenses/>. * 0021 *****************************************************************************/ 0022 // config 0023 #include "config.h" 0024 0025 // local 0026 #include "qtcurveconfig.h" 0027 #include "imagepropertiesdialog.h" 0028 // TODO 0029 #ifdef QTC_QT5_STYLE_SUPPORT 0030 # include "exportthemedialog.h" 0031 #endif 0032 0033 // other qt5 0034 #include <kwinconfig/qtcurvekwinconfig.h> 0035 #include <style/qtcurve.h> 0036 0037 // common 0038 #include <common/kf5_utils.h> 0039 #include <common/config_file.h> 0040 0041 // libs 0042 #include <qtcurve-utils/dirs.h> 0043 #include <qtcurve-utils/process.h> 0044 #include <qtcurve-utils/qtutils.h> 0045 #include <qtcurve-utils/x11base.h> 0046 0047 // Qt 0048 #include <QCheckBox> 0049 #include <QComboBox> 0050 #include <QFrame> 0051 #include <QFileInfo> 0052 #include <QBoxLayout> 0053 #include <QTreeWidget> 0054 #include <QPainter> 0055 #include <QSettings> 0056 #include <QDBusConnection> 0057 #include <QDBusMessage> 0058 #include <QTextStream> 0059 #include <QMdiArea> 0060 #include <QMdiSubWindow> 0061 #include <QMimeDatabase> 0062 #include <QMimeType> 0063 #include <QStyleFactory> 0064 #include <QCloseEvent> 0065 #include <QRegExp> 0066 #include <QRegExpValidator> 0067 #include <QMenu> 0068 #include <QTemporaryDir> 0069 #include <QTemporaryFile> 0070 #include <QStatusBar> 0071 #include <QActionGroup> 0072 0073 // KDE 0074 #include <kwidgetsaddons_version.h> 0075 #include <klocalizedstring.h> 0076 #include <kactioncollection.h> 0077 #include <kguiitem.h> 0078 #include <kmessagebox.h> 0079 #include <kcharselect.h> 0080 #include <kstandardaction.h> 0081 #include <ktoolbar.h> 0082 #include <kzip.h> 0083 #include <kcolorscheme.h> 0084 #include <ksharedconfig.h> 0085 #include <kconfig.h> 0086 #include <kconfiggroup.h> 0087 #include <kaboutdata.h> 0088 0089 #include <algorithm> 0090 0091 #define EXTENSION ".qtcurve" 0092 #define VERSION_WITH_KWIN_SETTINGS qtcMakeVersion(1, 5) 0093 0094 #define THEME_IMAGE_PREFIX "style" 0095 #define BGND_FILE "-bgnd" 0096 #define IMAGE_FILE "-img" 0097 #define MENU_FILE "-menu" 0098 0099 extern "C" Q_DECL_EXPORT QWidget* 0100 allocate_kstyle_config(QWidget* parent) 0101 { 0102 return new QtCurveConfig(parent); 0103 } 0104 0105 static QString getExt(const QString &file) 0106 { 0107 int dotPos=file.lastIndexOf('.'); 0108 0109 return dotPos!=-1 ? file.mid(dotPos) : QString(); 0110 } 0111 0112 static inline QString getFileName(const QString &f) 0113 { 0114 return QFileInfo(f).fileName(); 0115 } 0116 0117 static QString getThemeFile(const QString &file) 0118 { 0119 QLatin1String doubleSlash("//"); 0120 QLatin1String slash("/"); 0121 if (file.startsWith(THEME_IMAGE_PREFIX BGND_FILE)) { 0122 QString f(QtCurve::getConfDir() + file); 0123 0124 if (QFile::exists(f)) { 0125 return f.replace(doubleSlash, slash); 0126 } 0127 } 0128 if (!file.startsWith(slash)) { 0129 QString f(QtCurve::qtcSaveDir() + file); 0130 if (QFile::exists(f)) { 0131 return f.replace(doubleSlash, slash); 0132 } 0133 } 0134 return QString(file).replace(doubleSlash, slash); 0135 } 0136 0137 static void removeFile(const QString &f) 0138 { 0139 if(QFile::exists(f)) 0140 QFile::remove(f); 0141 } 0142 0143 static void copyFile(const QString &src, const QString &dest) 0144 { 0145 if(QFile::exists(src)) 0146 { 0147 // QFile::copy will not overwrite existing files. If destination exists, it needs to be removed first. 0148 removeFile(dest); 0149 QFile::copy(src, dest); 0150 } 0151 } 0152 0153 static QString installThemeFile(const QString &src, const QString &dest) 0154 { 0155 QString source(getThemeFile(src)), 0156 name(QLatin1String(THEME_IMAGE_PREFIX)+dest+getExt(source)), 0157 destination(QtCurve::getConfDir()+name); 0158 0159 // printf("INST THM \"%s\" \"%s\"", source.toLatin1().constData(), destination.toLatin1().constData()); 0160 if(source!=destination) 0161 copyFile(source, destination); 0162 0163 return name; 0164 } 0165 0166 static QString saveThemeFile(const QString &src, const QString &dest, const QString &themeName) 0167 { 0168 QString source(getThemeFile(src)); 0169 QString destination = 0170 QtCurve::qtcSaveDir() + themeName + dest + getExt(source); 0171 0172 // printf("SAVE THM \"%s\" \"%s\"", source.toLatin1().constData(), 0173 // destination.toLatin1().constData()); 0174 if (source != destination) 0175 copyFile(source, destination); 0176 0177 return destination; 0178 } 0179 0180 static void removeInstalledThemeFile(const QString &file) 0181 { 0182 removeFile(QtCurve::getConfDir()+QLatin1String(THEME_IMAGE_PREFIX)+file); 0183 } 0184 0185 static void 0186 removeThemeImages(const QString &themeFile) 0187 { 0188 QString themeName(getFileName(themeFile).remove(EXTENSION).replace(' ', '_')); 0189 QDir dir(QtCurve::qtcSaveDir()); 0190 foreach (const QString &file, dir.entryList()) { 0191 if (file.startsWith(themeName + BGND_FILE)) { 0192 QFile::remove(dir.path() + "/" + file); 0193 } 0194 } 0195 } 0196 0197 static void setStyleRecursive(QWidget *w, QStyle *s) 0198 { 0199 if (!w) { 0200 return; 0201 } 0202 w->setStyle(s); 0203 foreach (QObject *child, w->children()) { 0204 if (child && child->isWidgetType()) { 0205 setStyleRecursive((QWidget*)child, s); 0206 } 0207 } 0208 } 0209 0210 static const KStandardAction::StandardAction standardAction[] = 0211 { 0212 KStandardAction::New, KStandardAction::Open, KStandardAction::OpenRecent, KStandardAction::Save, KStandardAction::SaveAs, KStandardAction::Revert, KStandardAction::Close, KStandardAction::Quit, 0213 KStandardAction::Cut, KStandardAction::Copy, KStandardAction::Paste, 0214 KStandardAction::ActionNone 0215 }; 0216 0217 static QString toString(const QSet<QString> &set) 0218 { 0219 QStringList list = set.values(); 0220 0221 std::sort(list.begin(), list.end()); 0222 return list.join(", "); 0223 } 0224 0225 static QSet<QString> toSet(const QString &str) 0226 { 0227 QStringList list=str.simplified().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); 0228 QStringList::Iterator it(list.begin()), 0229 end(list.end()); 0230 0231 for(; it!=end; ++it) 0232 (*it)=(*it).simplified(); 0233 0234 return QtCurve::qSetFromList(list); 0235 } 0236 0237 CStylePreview::CStylePreview(QWidget *parent) 0238 : KXmlGuiWindow(parent), 0239 m_aboutData(new KAboutData("QtCurve", i18n("QtCurve"), qtcVersion(), 0240 i18n("Unified widget style."), 0241 KAboutLicense::LicenseKey::LGPL, 0242 i18n("(C) Craig Drummond, 2003-2011 & " 0243 "Yichao Yu, 2013-2015"))) 0244 { 0245 setWindowIcon(QIcon::fromTheme("preferences-desktop-theme", qApp->windowIcon())); 0246 0247 QWidget *main = new QWidget(this); 0248 setObjectName("QtCurvePreview"); 0249 setupUi(main); 0250 setCentralWidget(main); 0251 setComponentName("QtCurve", i18n("QtCurve")); 0252 for (uint i = 0; standardAction[i] != KStandardAction::ActionNone; ++i) 0253 actionCollection()->addAction(standardAction[i]); 0254 createGUI(); 0255 statusBar()->setSizeGripEnabled(true); 0256 toolBar()->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 0257 setCaption(i18n("Preview Window")); 0258 // implement the exclusive nature of the items supposed to be mutually exclusive 0259 // This can still be done in .ui files but would have to be maintained by hand 0260 // as Qt's Designer no longer supports QActionGroups. 0261 QActionGroup *aGroup = new QActionGroup(menu2SubMenu); 0262 aGroup->addAction(exclusiveItem1); 0263 aGroup->addAction(exclusiveItem2); 0264 aGroup->addAction(exclusiveItem3); 0265 } 0266 0267 CStylePreview::~CStylePreview() 0268 { 0269 // So that the header doesn't have to include the full definition of 0270 // KAboutData 0271 } 0272 0273 void CStylePreview::closeEvent(QCloseEvent *e) 0274 { 0275 emit closePressed(); 0276 e->ignore(); 0277 } 0278 0279 QSize CStylePreview::sizeHint() const 0280 { 0281 return QSize(500, 260); 0282 } 0283 0284 class CWorkspace : public QMdiArea 0285 { 0286 Q_OBJECT 0287 public: 0288 0289 CWorkspace(QWidget *parent) : QMdiArea(parent) 0290 { 0291 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 0292 } 0293 0294 QSize sizeHint() const override 0295 { 0296 return QSize(200, 200); 0297 } 0298 0299 void paintEvent(QPaintEvent *) override 0300 { 0301 QPainter p(viewport()); 0302 p.fillRect(rect(), palette().color(backgroundRole()).darker(110)); 0303 } 0304 }; 0305 0306 class CharSelectDialog : public QDialog { 0307 Q_OBJECT 0308 public: 0309 CharSelectDialog(QWidget *parent, int v) 0310 : QDialog(parent) 0311 { 0312 if (QWidget *win = window()) { 0313 win->setWindowTitle(i18n("Select Password Character")); 0314 } 0315 setModal(true); 0316 auto mainLayout = new QVBoxLayout(this); 0317 auto buttonBox = QtCurve::createDialogButtonBox(this); 0318 auto page = new QFrame(this); 0319 QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, page); 0320 layout->setMargin(0); 0321 layout->setSpacing(QApplication::style() 0322 ->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); 0323 0324 m_selector = new KCharSelect(page, nullptr); 0325 m_selector->setCurrentChar(QChar(v)); 0326 layout->addWidget(m_selector); 0327 0328 mainLayout->addWidget(page); 0329 mainLayout->addWidget(buttonBox); 0330 } 0331 0332 int 0333 currentChar() const 0334 { 0335 return m_selector->currentChar().unicode(); 0336 } 0337 private: 0338 KCharSelect *m_selector; 0339 }; 0340 0341 class CGradItem : public QTreeWidgetItem { 0342 public: 0343 CGradItem(QTreeWidget *p, const QStringList &vals) 0344 : QTreeWidgetItem(p, vals) 0345 { 0346 setFlags(flags()|Qt::ItemIsEditable); 0347 } 0348 0349 bool operator<(const QTreeWidgetItem &i) const override 0350 { 0351 return (text(0).toDouble() < i.text(0).toDouble() || 0352 (qtcEqual(text(0).toDouble(), i.text(0).toDouble()) && 0353 (text(1).toDouble()<i.text(1).toDouble() || 0354 (qtcEqual(text(1).toDouble(), i.text(1).toDouble()) && 0355 (text(2).toDouble()<i.text(2).toDouble()))))); 0356 } 0357 }; 0358 0359 static QStringList 0360 toList(const QString &str) 0361 { 0362 QStringList lst; 0363 lst.append(str); 0364 return lst; 0365 } 0366 0367 class CStackItem : public QTreeWidgetItem { 0368 public: 0369 CStackItem(QTreeWidget *p, const QString &text, int s) 0370 : QTreeWidgetItem(p, toList(text)), 0371 stackId(s) 0372 { 0373 if (s == 0) { 0374 QFont fnt(font(0)); 0375 0376 fnt.setBold(true); 0377 setFont(0, fnt); 0378 } 0379 setTextAlignment(0, Qt::AlignRight); 0380 } 0381 0382 bool operator<(const QTreeWidgetItem &o) const override 0383 { 0384 return stackId < ((CStackItem&)o).stackId; 0385 } 0386 int 0387 stack() 0388 { 0389 return stackId; 0390 } 0391 private: 0392 int stackId; 0393 }; 0394 0395 CGradientPreview::CGradientPreview(QtCurveConfig *c, QWidget *p) 0396 : QWidget(p), 0397 cfg(c), 0398 style(0L) 0399 { 0400 // setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); 0401 setObjectName("QtCurveConfigDialog-GradientPreview"); 0402 } 0403 0404 CGradientPreview::~CGradientPreview() 0405 { 0406 delete style; 0407 } 0408 0409 QSize CGradientPreview::sizeHint() const 0410 { 0411 return QSize(64, 24); 0412 } 0413 0414 QSize CGradientPreview::minimumSizeHint() const 0415 { 0416 return sizeHint(); 0417 } 0418 0419 void CGradientPreview::paintEvent(QPaintEvent *) 0420 { 0421 QPainter p(this); 0422 0423 if(!style) 0424 style=QStyleFactory::create("qtcurve"); 0425 0426 if(style) 0427 { 0428 QtCurve::Style::PreviewOption styleOpt; 0429 0430 styleOpt.init(this); 0431 0432 cfg->setOptions(styleOpt.opts); 0433 styleOpt.opts.appearance=APPEARANCE_CUSTOM1; 0434 styleOpt.opts.customGradient[APPEARANCE_CUSTOM1]=grad; 0435 styleOpt.palette.setColor(QPalette::Button, color); 0436 styleOpt.state|=QStyle::State_Raised; 0437 style->drawControl((QStyle::ControlElement)QtCurve::Style::CE_QtC_Preview, &styleOpt, &p, this); 0438 } 0439 p.end(); 0440 } 0441 0442 void CGradientPreview::setGrad(const Gradient &g) 0443 { 0444 grad=g; 0445 repaint(); 0446 } 0447 0448 void CGradientPreview::setColor(const QColor &col) 0449 { 0450 if(col!=color) 0451 { 0452 color=col; 0453 repaint(); 0454 } 0455 } 0456 0457 static QString readEnvPath(const char *env) 0458 { 0459 const char *path = getenv(env); 0460 0461 return path ? QFile::decodeName(path) : QString(); 0462 } 0463 0464 static QString 0465 kdeHome(bool kde3) 0466 { 0467 static QString kdeHome[2]; 0468 0469 // Execute kde-config to ascertain users KDEHOME 0470 if (kdeHome[kde3 ? 0 : 1].isEmpty()) { 0471 size_t len = 0; 0472 const char *kde_config = kde3 ? "kde-config" : "kde4-config"; 0473 const char *const argv[] = {kde_config, "--localprefix", nullptr}; 0474 char *res = qtcPopenStdout(kde_config, argv, 300, &len); 0475 if (res) { 0476 res[len] = '\0'; 0477 kdeHome[kde3 ? 0 : 1] = QFile::decodeName(res).replace("\n", ""); 0478 free(res); 0479 } 0480 } 0481 0482 // Try env vars... 0483 if (kdeHome[kde3 ? 0 : 1].isEmpty()) { 0484 kdeHome[kde3 ? 0 : 1] = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME"); 0485 if (kdeHome[kde3 ? 0 : 1].isEmpty()) { 0486 QDir homeDir(QDir::homePath()); 0487 QString kdeConfDir("/.kde"); 0488 if (!kde3 && homeDir.exists(".kde4")) 0489 kdeConfDir = QString("/.kde4"); 0490 kdeHome[kde3 ? 0 : 1] = QDir::homePath() + kdeConfDir; 0491 } 0492 } 0493 return kdeHome[kde3 ? 0 : 1]; 0494 } 0495 0496 static int toInt(const QString &str) 0497 { 0498 return str.length()>1 ? str[0].unicode() : 0; 0499 } 0500 0501 static int getHideFlags(const QCheckBox *kbd, const QCheckBox *kwin) 0502 { 0503 return (kbd->isChecked() ? HIDE_KEYBOARD : HIDE_NONE)+ 0504 (kwin->isChecked() ? HIDE_KWIN : HIDE_NONE); 0505 } 0506 0507 enum ShadeWidget { 0508 SW_MENUBAR, 0509 SW_SLIDER, 0510 SW_CHECK_RADIO, 0511 SW_MENU_STRIPE, 0512 SW_COMBO, 0513 SW_LV_HEADER, 0514 SW_CR_BGND, 0515 SW_PROGRESS 0516 }; 0517 0518 static QString uiString(EShade shade, ShadeWidget sw) 0519 { 0520 switch (shade) { 0521 case SHADE_NONE: 0522 switch(sw) { 0523 case SW_MENUBAR: 0524 case SW_PROGRESS: 0525 return i18n("Background"); 0526 case SW_COMBO: 0527 case SW_SLIDER: 0528 return i18n("Button"); 0529 case SW_CHECK_RADIO: 0530 return i18n("Text"); 0531 case SW_CR_BGND: 0532 case SW_LV_HEADER: 0533 case SW_MENU_STRIPE: 0534 default: 0535 return i18n("None"); 0536 } 0537 default: 0538 return i18n("<unknown>"); 0539 case SHADE_CUSTOM: 0540 return i18n("Custom:"); 0541 case SHADE_SELECTED: 0542 return i18n("Selected background"); 0543 case SHADE_BLEND_SELECTED: 0544 return i18n("Blended selected background"); 0545 case SHADE_DARKEN: 0546 return SW_MENU_STRIPE==sw ? i18n("Menu background") : i18n("Darken"); 0547 case SHADE_WINDOW_BORDER: 0548 return i18n("Titlebar"); 0549 } 0550 } 0551 0552 static void insertShadeEntries(QComboBox *combo, ShadeWidget sw) 0553 { 0554 combo->insertItem(SHADE_NONE, uiString(SHADE_NONE, sw)); 0555 combo->insertItem(SHADE_CUSTOM, uiString(SHADE_CUSTOM, sw)); 0556 combo->insertItem(SHADE_SELECTED, uiString(SHADE_SELECTED, sw)); 0557 if(SW_CHECK_RADIO!=sw) // For check/radio, we dont blend, and dont allow darken 0558 { 0559 combo->insertItem(SHADE_BLEND_SELECTED, uiString(SHADE_BLEND_SELECTED, sw)); 0560 if(SW_PROGRESS!=sw) 0561 combo->insertItem(SHADE_DARKEN, uiString(SHADE_DARKEN, sw)); 0562 } 0563 if(SW_MENUBAR==sw) 0564 combo->insertItem(SHADE_WINDOW_BORDER, uiString(SHADE_WINDOW_BORDER, sw)); 0565 } 0566 0567 static QString uiString(EAppearance app, EAppAllow allow=APP_ALLOW_BASIC, bool sameAsApp=false) 0568 { 0569 if(app>=APPEARANCE_CUSTOM1 && app<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD)) 0570 return i18n("Custom gradient %1", (app-APPEARANCE_CUSTOM1)+1); 0571 0572 switch(app) 0573 { 0574 case APPEARANCE_FLAT: return i18n("Flat"); 0575 case APPEARANCE_RAISED: return i18n("Raised"); 0576 case APPEARANCE_DULL_GLASS: return i18n("Dull glass"); 0577 case APPEARANCE_SHINY_GLASS: return i18n("Shiny glass"); 0578 case APPEARANCE_AGUA: return i18n("Agua"); 0579 case APPEARANCE_SOFT_GRADIENT: return i18n("Soft gradient"); 0580 case APPEARANCE_GRADIENT: return i18n("Standard gradient"); 0581 case APPEARANCE_HARSH_GRADIENT: return i18n("Harsh gradient"); 0582 case APPEARANCE_INVERTED: return i18n("Inverted gradient"); 0583 case APPEARANCE_DARK_INVERTED: return i18n("Dark inverted gradient"); 0584 case APPEARANCE_SPLIT_GRADIENT: return i18n("Split gradient"); 0585 case APPEARANCE_BEVELLED: return i18n("Bevelled"); 0586 case APPEARANCE_FADE: 0587 switch(allow) 0588 { 0589 case APP_ALLOW_FADE: 0590 return i18n("Fade out (popup menuitems)"); 0591 case APP_ALLOW_STRIPED: 0592 return i18n("Striped"); 0593 default: 0594 case APP_ALLOW_NONE: 0595 return sameAsApp ? i18n("Same as general setting") : i18n("None"); 0596 } 0597 case APPEARANCE_FILE: 0598 return i18n("Tiled image"); 0599 default: 0600 return i18n("<unknown>"); 0601 } 0602 } 0603 0604 static void insertAppearanceEntries(QComboBox *combo, EAppAllow allow=APP_ALLOW_BASIC, bool sameAsApp=false) 0605 { 0606 int max=APP_ALLOW_BASIC==allow 0607 ? APPEARANCE_FADE 0608 : APP_ALLOW_STRIPED==allow 0609 ? APPEARANCE_FADE+2 0610 : APPEARANCE_FADE+1; 0611 0612 for(int i=APPEARANCE_CUSTOM1; i<max; ++i) 0613 combo->insertItem(i, uiString((EAppearance)i, allow, sameAsApp)); 0614 } 0615 0616 static void insertLineEntries(QComboBox *combo, bool singleDot, bool dashes) 0617 { 0618 combo->insertItem(LINE_NONE, i18n("None")); 0619 combo->insertItem(LINE_SUNKEN, i18n("Sunken lines")); 0620 combo->insertItem(LINE_FLAT, i18n("Flat lines")); 0621 combo->insertItem(LINE_DOTS, i18n("Dots")); 0622 if(singleDot) 0623 { 0624 combo->insertItem(LINE_1DOT, i18n("Single dot")); 0625 if(dashes) 0626 combo->insertItem(LINE_DASHES, i18n("Dashes")); 0627 } 0628 } 0629 0630 static void insertDefBtnEntries(QComboBox *combo) 0631 { 0632 combo->insertItem(IND_CORNER, i18n("Corner indicator")); 0633 combo->insertItem(IND_FONT_COLOR, i18n("Font color thin border")); 0634 combo->insertItem(IND_COLORED, i18n("Selected background thick border")); 0635 combo->insertItem(IND_TINT, i18n("Selected background tinting")); 0636 combo->insertItem(IND_GLOW, i18n("A slight glow")); 0637 combo->insertItem(IND_DARKEN, i18n("Darken")); 0638 combo->insertItem(IND_SELECTED, i18n("Use selected background color")); 0639 combo->insertItem(IND_NONE, i18n("No indicator")); 0640 } 0641 0642 static void insertScrollbarEntries(QComboBox *combo) 0643 { 0644 combo->insertItem(SCROLLBAR_KDE, i18n("KDE")); 0645 combo->insertItem(SCROLLBAR_WINDOWS, i18n("MS Windows")); 0646 combo->insertItem(SCROLLBAR_PLATINUM, i18n("Platinum")); 0647 combo->insertItem(SCROLLBAR_NEXT, i18n("NeXT")); 0648 combo->insertItem(SCROLLBAR_NONE, i18n("No buttons")); 0649 } 0650 0651 static void insertRoundEntries(QComboBox *combo) 0652 { 0653 combo->insertItem(ROUND_NONE, i18n("Square")); 0654 combo->insertItem(ROUND_SLIGHT, i18n("Slightly rounded")); 0655 combo->insertItem(ROUND_FULL, i18n("Fully rounded")); 0656 combo->insertItem(ROUND_EXTRA, i18n("Extra rounded")); 0657 combo->insertItem(ROUND_MAX, i18n("Max rounded")); 0658 } 0659 0660 static void insertMouseOverEntries(QComboBox *combo) 0661 { 0662 combo->insertItem(MO_NONE, i18n("No coloration")); 0663 combo->insertItem(MO_COLORED, i18n("Color border")); 0664 combo->insertItem(MO_COLORED_THICK, i18n("Thick color border")); 0665 combo->insertItem(MO_PLASTIK, i18n("Plastik style")); 0666 combo->insertItem(MO_GLOW, i18n("Glow")); 0667 } 0668 0669 static void insertToolbarBorderEntries(QComboBox *combo) 0670 { 0671 combo->insertItem(TB_NONE, i18n("None")); 0672 combo->insertItem(TB_LIGHT, i18n("Light")); 0673 combo->insertItem(TB_DARK, i18n("Dark")); 0674 combo->insertItem(TB_LIGHT_ALL, i18n("Light (all sides)")); 0675 combo->insertItem(TB_DARK_ALL, i18n("Dark (all sides)")); 0676 } 0677 0678 static void insertEffectEntries(QComboBox *combo, bool sameAsApp=false) 0679 { 0680 combo->insertItem(EFFECT_NONE, sameAsApp ? i18n("Same as general setting") : i18n("Plain")); 0681 combo->insertItem(EFFECT_ETCH, i18n("Etched")); 0682 combo->insertItem(EFFECT_SHADOW, i18n("Shadowed")); 0683 } 0684 0685 static void insertShadingEntries(QComboBox *combo) 0686 { 0687 combo->insertItem(int(Shading::Simple), i18n("Simple")); 0688 combo->insertItem(int(Shading::HSL), i18n("Use HSL color space")); 0689 combo->insertItem(int(Shading::HSV), i18n("Use HSV color space")); 0690 combo->insertItem(int(Shading::HCY), i18n("Use HCY color space")); 0691 } 0692 0693 static void insertStripeEntries(QComboBox *combo) 0694 { 0695 combo->insertItem(STRIPE_NONE, i18n("Plain")); 0696 combo->insertItem(STRIPE_PLAIN, i18n("Stripes")); 0697 combo->insertItem(STRIPE_DIAGONAL, i18n("Diagonal stripes")); 0698 combo->insertItem(STRIPE_FADE, i18n("Faded stripes")); 0699 } 0700 0701 static void insertSliderStyleEntries(QComboBox *combo) 0702 { 0703 combo->insertItem(SLIDER_PLAIN, i18n("Plain")); 0704 combo->insertItem(SLIDER_ROUND, i18n("Round")); 0705 combo->insertItem(SLIDER_PLAIN_ROTATED, i18n("Plain - rotated")); 0706 combo->insertItem(SLIDER_ROUND_ROTATED, i18n("Round - rotated")); 0707 combo->insertItem(SLIDER_TRIANGULAR, i18n("Triangular")); 0708 combo->insertItem(SLIDER_CIRCULAR, i18n("Circular")); 0709 } 0710 0711 static void insertEColorEntries(QComboBox *combo) 0712 { 0713 combo->insertItem(ECOLOR_BASE, i18n("Base color")); 0714 combo->insertItem(ECOLOR_BACKGROUND, i18n("Background color")); 0715 combo->insertItem(ECOLOR_DARK, i18n("Darkened background color")); 0716 } 0717 0718 static void insertFocusEntries(QComboBox *combo) 0719 { 0720 combo->insertItem(FOCUS_STANDARD, i18n("Standard (dotted)")); 0721 combo->insertItem(FOCUS_RECTANGLE, i18n("Highlight color")); 0722 combo->insertItem(FOCUS_FULL, i18n("Highlight color (full size)")); 0723 combo->insertItem(FOCUS_FILLED, i18n("Highlight color, and fill")); 0724 combo->insertItem(FOCUS_LINE, i18n("Line drawn with highlight color")); 0725 combo->insertItem(FOCUS_GLOW, i18n("Glow")); 0726 combo->insertItem(FOCUS_NONE, i18n("Nothing")); 0727 } 0728 0729 static void insertGradBorderEntries(QComboBox *combo) 0730 { 0731 combo->insertItem(GB_NONE, i18n("No border")); 0732 combo->insertItem(GB_LIGHT, i18n("Light border")); 0733 combo->insertItem(GB_3D, i18n("3D border (light only)")); 0734 combo->insertItem(GB_3D_FULL, i18n("3D border (dark and light)")); 0735 combo->insertItem(GB_SHINE, i18n("Shine")); 0736 } 0737 0738 static void insertAlignEntries(QComboBox *combo) 0739 { 0740 combo->insertItem(ALIGN_LEFT, i18n("Left")); 0741 combo->insertItem(ALIGN_CENTER, i18n("Center (between controls)")); 0742 combo->insertItem(ALIGN_FULL_CENTER, i18n("Center (full width)")); 0743 combo->insertItem(ALIGN_RIGHT, i18n("Right")); 0744 } 0745 0746 enum ETitleBarButtonColoration 0747 { 0748 TITLE_BTN_COL_BACKGROUND, 0749 TITLE_BTN_COL_BUTTON, 0750 TITLE_BTN_COL_CUSTOM 0751 }; 0752 0753 static void insertTitlebarIconEntries(QComboBox *combo) 0754 { 0755 combo->insertItem(TITLEBAR_ICON_NONE, i18n("Do not show")); 0756 combo->insertItem(TITLEBAR_ICON_MENU_BUTTON, i18n("Place on menu button")); 0757 combo->insertItem(TITLEBAR_ICON_NEXT_TO_TITLE, i18n("Place next to title")); 0758 } 0759 0760 static void insertTabMoEntries(QComboBox *combo) 0761 { 0762 combo->insertItem(TAB_MO_TOP, i18n("Highlight on top")); 0763 combo->insertItem(TAB_MO_BOTTOM, i18n("Highlight on bottom")); 0764 combo->insertItem(TAB_MO_GLOW, i18n("Add a slight glow")); 0765 } 0766 0767 static void insertGradTypeEntries(QComboBox *combo) 0768 { 0769 combo->insertItem(GT_HORIZ, i18n("Top to bottom")); 0770 combo->insertItem(GT_VERT, i18n("Left to right")); 0771 } 0772 0773 #if 0 0774 static void insertLvLinesEntries(QComboBox *combo) 0775 { 0776 combo->insertItem(LV_NONE, i18n("None")); 0777 combo->insertItem(LV_NEW, i18n("New style (KDE and Gtk2 similar)")); 0778 combo->insertItem(LV_OLD, i18n("Old style (KDE and Gtk2 different)")); 0779 } 0780 #endif 0781 0782 static void insertImageEntries(QComboBox *combo) 0783 { 0784 combo->insertItem(IMG_NONE, i18n("None")); 0785 combo->insertItem(IMG_BORDERED_RINGS, i18n("Bordered rings")); 0786 combo->insertItem(IMG_PLAIN_RINGS, i18n("Plain rings")); 0787 combo->insertItem(IMG_SQUARE_RINGS, i18n("Square rings")); 0788 combo->insertItem(IMG_FILE, i18n("File")); 0789 } 0790 0791 static void insertGlowEntries(QComboBox *combo) 0792 { 0793 combo->insertItem(GLOW_NONE, i18n("No glow")); 0794 combo->insertItem(GLOW_START, i18n("Add glow at the start")); 0795 combo->insertItem(GLOW_MIDDLE, i18n("Add glow in the middle")); 0796 combo->insertItem(GLOW_END, i18n("Add glow at the end")); 0797 } 0798 0799 static void insertCrSizeEntries(QComboBox *combo) 0800 { 0801 combo->insertItem(0, i18n("Small (%1 pixels)", CR_SMALL_SIZE)); 0802 combo->insertItem(1, i18n("Large (%1 pixels)", CR_LARGE_SIZE)); 0803 } 0804 0805 static void setCrSize(QComboBox *combo, int size) 0806 { 0807 combo->setCurrentIndex(CR_SMALL_SIZE==size ? 0 : 1); 0808 } 0809 0810 static int getCrSize(QComboBox *combo) 0811 { 0812 return 0==combo->currentIndex() ? CR_SMALL_SIZE : CR_LARGE_SIZE; 0813 } 0814 0815 static void insertDragEntries(QComboBox *combo) 0816 { 0817 combo->insertItem(WM_DRAG_NONE, i18n("Titlebar only")); 0818 combo->insertItem(WM_DRAG_MENUBAR, i18n("Titlebar and menubar")); 0819 combo->insertItem(WM_DRAG_MENU_AND_TOOLBAR, i18n("Titlebar, menubar, and toolbars")); 0820 combo->insertItem(WM_DRAG_ALL, i18n("All empty areas")); 0821 } 0822 0823 0824 static void insertFrameEntries(QComboBox *combo) 0825 { 0826 combo->insertItem(FRAME_NONE, i18n("No border")); 0827 combo->insertItem(FRAME_PLAIN, i18n("Standard frame border")); 0828 combo->insertItem(FRAME_LINE, i18n("Single separator line")); 0829 combo->insertItem(FRAME_SHADED, i18n("Shaded background")); 0830 combo->insertItem(FRAME_FADED, i18n("Faded background")); 0831 } 0832 0833 enum EGBLabelVPos 0834 { 0835 GBV_OUTSIDE, 0836 GBV_STANDARD, 0837 GBV_INSIDE 0838 }; 0839 0840 static void insertGbLabelEntries(QComboBox *combo) 0841 { 0842 combo->insertItem(GBV_OUTSIDE, i18n("Outside frame")); 0843 combo->insertItem(GBV_STANDARD, i18n("On frame")); 0844 combo->insertItem(GBV_INSIDE, i18n("Inside frame")); 0845 } 0846 0847 static void insertTBarBtnEntries(QComboBox *combo) 0848 { 0849 combo->insertItem(TBTN_STANDARD, i18n("Standard (auto-raise)")); 0850 combo->insertItem(TBTN_RAISED, i18n("Raised")); 0851 combo->insertItem(TBTN_JOINED, i18n("Raised and joined")); 0852 } 0853 0854 QtCurveConfig::QtCurveConfig(QWidget *parent) 0855 : QWidget(parent), 0856 workSpace(nullptr), 0857 stylePreview(nullptr), 0858 mdiWindow(nullptr), 0859 #ifdef QTC_QT5_STYLE_SUPPORT 0860 exportDialog(nullptr), 0861 #endif 0862 gradPreview(nullptr), 0863 readyForPreview(false) 0864 { 0865 setupUi(this); 0866 setObjectName("QtCurveConfigDialog"); 0867 titleLabel->setText(QString("QtCurve %1 - (C) Craig Drummond, 2003-2010 & " 0868 "Yichao Yu, 2013-2015").arg(qtcVersion())); 0869 insertShadeEntries(shadeSliders, SW_SLIDER); 0870 insertShadeEntries(shadeMenubars, SW_MENUBAR); 0871 insertShadeEntries(shadeCheckRadio, SW_CHECK_RADIO); 0872 insertShadeEntries(menuStripe, SW_MENU_STRIPE); 0873 insertShadeEntries(comboBtn, SW_COMBO); 0874 insertShadeEntries(sortedLv, SW_LV_HEADER); 0875 insertShadeEntries(crColor, SW_CR_BGND); 0876 insertShadeEntries(progressColor, SW_PROGRESS); 0877 insertAppearanceEntries(appearance); 0878 insertAppearanceEntries(menubarAppearance); 0879 insertAppearanceEntries(toolbarAppearance); 0880 insertAppearanceEntries(lvAppearance); 0881 insertAppearanceEntries(sliderAppearance); 0882 insertAppearanceEntries(tabAppearance); 0883 insertAppearanceEntries(activeTabAppearance); 0884 insertAppearanceEntries(progressAppearance); 0885 insertAppearanceEntries(progressGrooveAppearance); 0886 insertAppearanceEntries(grooveAppearance); 0887 insertAppearanceEntries(sunkenAppearance); 0888 insertAppearanceEntries(menuitemAppearance, APP_ALLOW_FADE); 0889 insertAppearanceEntries(menuBgndAppearance, APP_ALLOW_STRIPED); 0890 insertAppearanceEntries(titlebarAppearance, APP_ALLOW_NONE); 0891 insertAppearanceEntries(inactiveTitlebarAppearance, APP_ALLOW_NONE); 0892 insertAppearanceEntries(titlebarButtonAppearance); 0893 insertAppearanceEntries(selectionAppearance); 0894 insertAppearanceEntries(menuStripeAppearance); 0895 insertAppearanceEntries(sbarBgndAppearance); 0896 insertAppearanceEntries(sliderFill); 0897 insertAppearanceEntries(bgndAppearance, APP_ALLOW_STRIPED); 0898 insertAppearanceEntries(dwtAppearance); 0899 insertAppearanceEntries(tooltipAppearance); 0900 insertAppearanceEntries(tbarBtnAppearance, APP_ALLOW_NONE, true); 0901 insertLineEntries(handles, true, true); 0902 insertLineEntries(sliderThumbs, true, false); 0903 insertLineEntries(toolbarSeparators, false, false); 0904 insertLineEntries(splitters, true, true); 0905 insertDefBtnEntries(defBtnIndicator); 0906 insertScrollbarEntries(scrollbarType); 0907 insertRoundEntries(round); 0908 insertMouseOverEntries(coloredMouseOver); 0909 insertToolbarBorderEntries(toolbarBorders); 0910 insertEffectEntries(buttonEffect); 0911 insertEffectEntries(tbarBtnEffect, true); 0912 insertShadingEntries(shading); 0913 insertStripeEntries(stripedProgress); 0914 insertSliderStyleEntries(sliderStyle); 0915 insertEColorEntries(progressGrooveColor); 0916 insertFocusEntries(focus); 0917 insertGradBorderEntries(gradBorder); 0918 insertAlignEntries(titlebarAlignment); 0919 insertEffectEntries(titlebarEffect); 0920 insertTitlebarIconEntries(titlebarIcon); 0921 insertTabMoEntries(tabMouseOver); 0922 insertGradTypeEntries(bgndGrad); 0923 insertGradTypeEntries(menuBgndGrad); 0924 //insertLvLinesEntries(lvLines); 0925 insertImageEntries(bgndImage); 0926 insertImageEntries(menuBgndImage); 0927 insertGlowEntries(glowProgress); 0928 insertCrSizeEntries(crSize); 0929 insertDragEntries(windowDrag); 0930 insertFrameEntries(groupBox); 0931 insertGbLabelEntries(gbLabel_textPos); 0932 insertTBarBtnEntries(tbarBtns); 0933 0934 highlightFactor->setRange(MIN_HIGHLIGHT_FACTOR, MAX_HIGHLIGHT_FACTOR); 0935 highlightFactor->setValue(DEFAULT_HIGHLIGHT_FACTOR); 0936 0937 crHighlight->setRange(MIN_HIGHLIGHT_FACTOR, MAX_HIGHLIGHT_FACTOR); 0938 crHighlight->setValue(DEFAULT_CR_HIGHLIGHT_FACTOR); 0939 0940 splitterHighlight->setRange(MIN_HIGHLIGHT_FACTOR, MAX_HIGHLIGHT_FACTOR); 0941 splitterHighlight->setValue(DEFAULT_SPLITTER_HIGHLIGHT_FACTOR); 0942 0943 lighterPopupMenuBgnd->setRange(MIN_LIGHTER_POPUP_MENU, MAX_LIGHTER_POPUP_MENU); 0944 lighterPopupMenuBgnd->setValue(DEF_POPUPMENU_LIGHT_FACTOR); 0945 0946 expanderHighlight->setRange(MIN_HIGHLIGHT_FACTOR, MAX_HIGHLIGHT_FACTOR); 0947 expanderHighlight->setValue(DEFAULT_EXPANDER_HIGHLIGHT_FACTOR); 0948 0949 menuDelay->setRange(MIN_MENU_DELAY, MAX_MENU_DELAY); 0950 menuDelay->setValue(DEFAULT_MENU_DELAY); 0951 0952 menuCloseDelay->setRange(MIN_MENU_CLOSE_DELAY, MAX_MENU_CLOSE_DELAY); 0953 menuCloseDelay->setValue(DEFAULT_MENU_CLOSE_DELAY); 0954 0955 gbFactor->setRange(MIN_GB_FACTOR, MAX_GB_FACTOR); 0956 gbFactor->setValue(DEF_GB_FACTOR); 0957 0958 bgndOpacity->setRange(0, 100); 0959 bgndOpacity->setSingleStep(5); 0960 bgndOpacity->setValue(100); 0961 dlgOpacity->setRange(0, 100); 0962 dlgOpacity->setSingleStep(5); 0963 dlgOpacity->setValue(100); 0964 menuBgndOpacity->setRange(0, 100); 0965 menuBgndOpacity->setSingleStep(5); 0966 menuBgndOpacity->setValue(100); 0967 dropShadowSize->setRange(0, 100); 0968 dropShadowSize->setSingleStep(1); 0969 dropShadowSize->setValue(qtcX11ShadowSize()); 0970 if (!qtcX11Enabled()) { 0971 dropShadowSize->setEnabled(false); 0972 } 0973 0974 0975 sliderWidth->setRange(MIN_SLIDER_WIDTH, MAX_SLIDER_WIDTH); 0976 sliderWidth->setSingleStep(2); 0977 sliderWidth->setValue(DEFAULT_SLIDER_WIDTH); 0978 sliderWidth->setSuffix(i18n(" pixels")); 0979 0980 tabBgnd->setRange(MIN_TAB_BGND, MAX_TAB_BGND); 0981 tabBgnd->setValue(DEF_TAB_BGND); 0982 0983 colorSelTab->setRange(MIN_COLOR_SEL_TAB_FACTOR, MAX_COLOR_SEL_TAB_FACTOR); 0984 colorSelTab->setValue(DEF_COLOR_SEL_TAB_FACTOR); 0985 0986 stopPosition->setValue(0); 0987 stopValue->setValue(100); 0988 stopAlpha->setValue(100); 0989 0990 bgndPixmapDlg=new CImagePropertiesDialog(i18n("Background"), this, CImagePropertiesDialog::BASIC); 0991 menuBgndPixmapDlg=new CImagePropertiesDialog(i18n("Menu Background"), this, CImagePropertiesDialog::BASIC); 0992 bgndImageDlg=new CImagePropertiesDialog(i18n("Background Image"), this, 0993 CImagePropertiesDialog::POS| 0994 CImagePropertiesDialog::SCALE| 0995 CImagePropertiesDialog::BORDER); 0996 menuBgndImageDlg=new CImagePropertiesDialog(i18n("Menu Image"), this, 0997 CImagePropertiesDialog::POS| 0998 CImagePropertiesDialog::SCALE); 0999 1000 for (auto *w: {lighterPopupMenuBgnd, tabBgnd, menuDelay, menuCloseDelay, crHighlight, 1001 expanderHighlight, colorSelTab, highlightFactor, bgndOpacity, 1002 dlgOpacity, menuBgndOpacity, splitterHighlight, gbFactor, dropShadowSize}) { 1003 connect(qtcSlot(w, valueChanged, (int)), qtcSlot(this, updateChanged)); 1004 } 1005 1006 for (auto *w: {menuStripeAppearance, bgndGrad, menuBgndGrad, 1007 toolbarBorders, handles, appearance, menubarAppearance, 1008 toolbarAppearance, lvAppearance, sliderAppearance, 1009 tabAppearance, toolbarSeparators, splitters, sliderStyle, 1010 glowProgress, crSize, progressAppearance, 1011 progressGrooveAppearance, grooveAppearance, sunkenAppearance, 1012 progressGrooveColor, menuitemAppearance, titlebarAppearance, 1013 inactiveTitlebarAppearance, titlebarButtonAppearance, 1014 selectionAppearance, scrollbarType, windowDrag, 1015 sbarBgndAppearance, sliderFill, dwtAppearance, 1016 tooltipAppearance, gbLabel_textPos, titlebarAlignment, 1017 titlebarEffect, titlebarIcon, tbarBtns, tbarBtnAppearance, 1018 tbarBtnEffect}) { 1019 connect(qtcSlot(w, currentIndexChanged, (int)), 1020 qtcSlot(this, updateChanged)); 1021 } 1022 1023 for (auto *w: std::initializer_list<QAbstractButton*>{ 1024 animatedProgress, highlightTab, fillSlider, stripedSbar, 1025 roundMbTopOnly, statusbarHiding_keyboard, statusbarHiding_kwin, 1026 darkerBorders, comboSplitter, unifyCombo, vArrows, xCheck, 1027 crButton, roundAllTabs, borderTab, borderInactiveTab, 1028 invertBotTab, doubleGtkComboArrow, stdSidebarButtons, 1029 toolbarTabs, centerTabText, borderMenuitems, popupBorder, 1030 windowBorder_fill, windowBorder_separator, lvLines, lvButton, 1031 drawStatusBarFrames, menubarMouseOver, 1032 shadeMenubarOnlyWhenActive, thin_menuitems, thin_buttons, 1033 thin_frames, hideShortcutUnderline, gtkScrollViews, 1034 highlightScrollViews, etchEntry, flatSbarButtons, 1035 colorSliderMouseOver, windowBorder_addLightBorder, 1036 dwtBtnAsPerTitleBar, dwtColAsPerTitleBar, 1037 dwtIconColAsPerTitleBar, dwtFontAsPerTitleBar, 1038 dwtTextAsPerTitleBar, dwtEffectAsPerTitleBar, dwtRoundTopOnly, 1039 smallRadio, gtkComboMenus, mapKdeIcons, colorMenubarMouseOver, 1040 useHighlightForMenu, gbLabel_bold, gbLabel_centred, fadeLines, 1041 menuIcons, onlyTicksInMenu, buttonStyleMenuSections, stdBtnSizes, forceAlternateLvCols, boldProgress, 1042 coloredTbarMo, borderSelection, squareEntry, squareLvSelection, 1043 squareScrollViews, squareFrame, squareTabFrame, squareSlider, 1044 squareScrollbarSlider, squareWindows, squareTooltips, 1045 squarePopupMenus, titlebarButtons_button, 1046 titlebarButtons_customIcon, titlebarButtons_noFrame, 1047 titlebarButtons_round, titlebarButtons_hoverFrame, 1048 titlebarButtons_hoverSymbol, titlebarButtons_hoverSymbolFull, 1049 titlebarButtons_sunkenBackground, titlebarButtons_arrowMinMax, 1050 titlebarButtons_colorOnMouseOver, 1051 titlebarButtons_colorSymbolsOnly, titlebarButtons_colorInactive, 1052 titlebarButtons_hideOnInactiveWindow}) { 1053 connect(qtcSlot(w, toggled), qtcSlot(this, updateChanged)); 1054 } 1055 1056 for (auto *w: {customComboBtnColor, customSortedLvColor, 1057 customProgressColor, customMenuStripeColor, 1058 customCheckRadioColor, customSlidersColor, customMenubarsColor, 1059 customMenuSelTextColor, customMenuNormTextColor, 1060 customCrBgndColor, titlebarButtons_colorClose, 1061 titlebarButtons_colorMin, titlebarButtons_colorMax, 1062 titlebarButtons_colorKeepAbove, titlebarButtons_colorKeepBelow, 1063 titlebarButtons_colorHelp, titlebarButtons_colorMenu, 1064 titlebarButtons_colorShade, titlebarButtons_colorAllDesktops, 1065 titlebarButtons_colorCloseIcon, titlebarButtons_colorMinIcon, 1066 titlebarButtons_colorMaxIcon, 1067 titlebarButtons_colorKeepAboveIcon, 1068 titlebarButtons_colorKeepBelowIcon, 1069 titlebarButtons_colorHelpIcon, titlebarButtons_colorMenuIcon, 1070 titlebarButtons_colorShadeIcon, 1071 titlebarButtons_colorAllDesktopsIcon, 1072 titlebarButtons_colorCloseInactiveIcon, 1073 titlebarButtons_colorMinInactiveIcon, 1074 titlebarButtons_colorMaxInactiveIcon, 1075 titlebarButtons_colorKeepAboveInactiveIcon, 1076 titlebarButtons_colorKeepBelowInactiveIcon, 1077 titlebarButtons_colorHelpInactiveIcon, 1078 titlebarButtons_colorMenuInactiveIcon, 1079 titlebarButtons_colorShadeInactiveIcon, 1080 titlebarButtons_colorAllDesktopsInactiveIcon}) { 1081 connect(qtcSlot(w, changed), qtcSlot(this, updateChanged)); 1082 } 1083 1084 for (auto *w: {noBgndGradientApps, noBgndOpacityApps, 1085 noMenuBgndOpacityApps, noBgndImageApps, useQtFileDialogApps, 1086 menubarApps, statusbarApps, noMenuStripeApps, nonnativeMenubarApps}) { 1087 connect(qtcSlot(w, editingFinished), qtcSlot(this, updateChanged)); 1088 } 1089 1090 connect(qtcSlot(sliderWidth, valueChanged, (int)), 1091 qtcSlot(this, sliderWidthChanged)); 1092 connect(qtcSlot(menuStripe, currentIndexChanged, (int)), 1093 qtcSlot(this, menuStripeChanged)); 1094 connect(qtcSlot(round, currentIndexChanged, (int)), 1095 qtcSlot(this, roundChanged)); 1096 connect(qtcSlot(sliderThumbs, currentIndexChanged, (int)), 1097 qtcSlot(this, sliderThumbChanged)); 1098 connect(qtcSlot(customMenuTextColor, toggled), 1099 qtcSlot(this, customMenuTextColorChanged)); 1100 connect(qtcSlot(stripedProgress, currentIndexChanged, (int)), 1101 qtcSlot(this, stripedProgressChanged)); 1102 connect(qtcSlot(embolden, toggled), qtcSlot(this, emboldenToggled)); 1103 connect(qtcSlot(defBtnIndicator, currentIndexChanged, (int)), 1104 qtcSlot(this, defBtnIndicatorChanged)); 1105 connect(qtcSlot(activeTabAppearance, currentIndexChanged, (int)), 1106 qtcSlot(this, activeTabAppearanceChanged)); 1107 connect(qtcSlot(menubarHiding_keyboard, toggled), 1108 qtcSlot(this, menubarHidingChanged)); 1109 connect(qtcSlot(menubarHiding_kwin, toggled), 1110 qtcSlot(this, menubarHidingChanged)); 1111 connect(qtcSlot(comboBtn, currentIndexChanged, (int)), 1112 qtcSlot(this, comboBtnChanged)); 1113 connect(qtcSlot(sortedLv, currentIndexChanged, (int)), 1114 qtcSlot(this, sortedLvChanged)); 1115 connect(qtcSlot(unifySpinBtns, toggled), 1116 qtcSlot(this, unifySpinBtnsToggled)); 1117 connect(qtcSlot(unifySpin, toggled), qtcSlot(this, unifySpinToggled)); 1118 connect(qtcSlot(tabMouseOver, currentIndexChanged, (int)), 1119 qtcSlot(this, tabMoChanged)); 1120 connect(qtcSlot(shadePopupMenu, toggled), 1121 qtcSlot(this, shadePopupMenuChanged)); 1122 connect(qtcSlot(progressColor, currentIndexChanged, (int)), 1123 qtcSlot(this, progressColorChanged)); 1124 connect(qtcSlot(menuBgndAppearance, currentIndexChanged, (int)), 1125 qtcSlot(this, menuBgndAppearanceChanged)); 1126 connect(qtcSlot(windowBorder_colorTitlebarOnly, toggled), 1127 qtcSlot(this, windowBorder_colorTitlebarOnlyChanged)); 1128 connect(qtcSlot(windowBorder_blend, toggled), 1129 qtcSlot(this, windowBorder_blendChanged)); 1130 connect(qtcSlot(windowBorder_menuColor, toggled), 1131 qtcSlot(this, windowBorder_menuColorChanged)); 1132 connect(qtcSlot(shadeCheckRadio, currentIndexChanged, (int)), 1133 qtcSlot(this, shadeCheckRadioChanged)); 1134 connect(qtcSlot(focus, currentIndexChanged, (int)), 1135 qtcSlot(this, focusChanged)); 1136 connect(qtcSlot(buttonEffect, currentIndexChanged, (int)), 1137 qtcSlot(this, buttonEffectChanged)); 1138 connect(qtcSlot(coloredMouseOver, currentIndexChanged, (int)), 1139 qtcSlot(this, coloredMouseOverChanged)); 1140 connect(qtcSlot(shadeSliders, currentIndexChanged, (int)), 1141 qtcSlot(this, shadeSlidersChanged)); 1142 connect(qtcSlot(shadeMenubars, currentIndexChanged, (int)), 1143 qtcSlot(this, shadeMenubarsChanged)); 1144 connect(qtcSlot(shading, currentIndexChanged, (int)), 1145 qtcSlot(this, shadingChanged)); 1146 connect(qtcSlot(borderSbarGroove, toggled), 1147 qtcSlot(this, borderSbarGrooveChanged)); 1148 connect(qtcSlot(thinSbarGroove, toggled), 1149 qtcSlot(this, thinSbarGrooveChanged)); 1150 connect(qtcSlot(bgndAppearance, currentIndexChanged, (int)), 1151 qtcSlot(this, bgndAppearanceChanged)); 1152 connect(qtcSlot(bgndImage, currentIndexChanged, (int)), 1153 qtcSlot(this, bgndImageChanged)); 1154 connect(qtcSlot(menuBgndImage, currentIndexChanged, (int)), 1155 qtcSlot(this, menuBgndImageChanged)); 1156 connect(qtcSlot(crColor, currentIndexChanged, (int)), 1157 qtcSlot(this, crColorChanged)); 1158 connect(qtcSlot(gtkButtonOrder, toggled), 1159 qtcSlot(this, gtkButtonOrderChanged)); 1160 connect(qtcSlot(reorderGtkButtons, toggled), 1161 qtcSlot(this, reorderGtkButtonsChanged)); 1162 connect(qtcSlot(passwordChar, clicked), qtcSlot(this, passwordCharClicked)); 1163 connect(qtcSlot(groupBox, currentIndexChanged, (int)), 1164 qtcSlot(this, groupBoxChanged)); 1165 connect(qtcSlot(titlebarButtons_custom, toggled), 1166 qtcSlot(this, titlebarButtons_customChanged)); 1167 connect(qtcSlot(titlebarButtons_useHover, toggled), 1168 qtcSlot(this, titlebarButtons_useHoverChanged)); 1169 connect(qtcSlot(borderProgress, toggled), 1170 qtcSlot(this, borderProgressChanged)); 1171 connect(qtcSlot(fillProgress, toggled), qtcSlot(this, fillProgressChanged)); 1172 connect(qtcSlot(squareProgress, toggled), 1173 qtcSlot(this, squareProgressChanged)); 1174 1175 // TODO 1176 menubarBlend->setIcon(QtCurve::loadKIcon("configure")); 1177 connect(qtcSlot(menubarBlend, clicked), 1178 qtcSlot(this, menubarTitlebarBlend)); 1179 connect(qtcSlot(previewControlButton, clicked), 1180 qtcSlot(this, previewControlPressed)); 1181 1182 connect(qtcSlot(bgndAppearance_btn, clicked), 1183 qtcSlot(this, configureBgndAppearanceFile)); 1184 connect(qtcSlot(bgndImage_btn, clicked), 1185 qtcSlot(this, configureBgndImageFile)); 1186 connect(qtcSlot(menuBgndAppearance_btn, clicked), 1187 qtcSlot(this, configureMenuBgndAppearanceFile)); 1188 connect(qtcSlot(menuBgndImage_btn, clicked), 1189 qtcSlot(this, configureMenuBgndImageFile)); 1190 1191 bgndAppearance_btn->setAutoRaise(true); 1192 bgndAppearance_btn->setVisible(false); 1193 bgndAppearance_btn->setIcon(QtCurve::loadKIcon("configure")); 1194 bgndImage_btn->setAutoRaise(true); 1195 bgndImage_btn->setVisible(false); 1196 bgndImage_btn->setIcon(QtCurve::loadKIcon("configure")); 1197 menuBgndAppearance_btn->setAutoRaise(true); 1198 menuBgndAppearance_btn->setVisible(false); 1199 menuBgndAppearance_btn->setIcon(QtCurve::loadKIcon("configure")); 1200 menuBgndImage_btn->setAutoRaise(true); 1201 menuBgndImage_btn->setVisible(false); 1202 menuBgndImage_btn->setIcon(QtCurve::loadKIcon("configure")); 1203 1204 setupStack(); 1205 1206 if (kwin->ok()) { 1207 Options currentStyle; 1208 Options defaultStyle; 1209 1210 kwin->load(nullptr); 1211 qtcDefaultSettings(&defaultStyle); 1212 if (!qtcReadConfig(nullptr, ¤tStyle, &defaultStyle)) 1213 currentStyle = defaultStyle; 1214 1215 previewStyle = currentStyle; 1216 setupShadesTab(); 1217 setWidgetOptions(currentStyle); 1218 1219 setupGradientsTab(); 1220 setupPresets(currentStyle, defaultStyle); 1221 setupPreview(); 1222 readyForPreview = true; 1223 updatePreview(); 1224 } else { 1225 stack->setCurrentIndex(kwinPage); 1226 titleLabel->setVisible(false); 1227 stackList->setVisible(false); 1228 } 1229 } 1230 1231 QtCurveConfig::~QtCurveConfig() 1232 { 1233 // Remove QTCURVE_PREVIEW_CONFIG setting, so that main kcmstyle preview 1234 // does not revert to default settings! 1235 qputenv(QTCURVE_PREVIEW_CONFIG, ""); 1236 previewFrame->hide(); 1237 previewFrame->setParent(0); 1238 delete previewFrame; 1239 if (!mdiWindow) { 1240 delete stylePreview; 1241 } 1242 } 1243 1244 QSize QtCurveConfig::sizeHint() const 1245 { 1246 return QSize(700, 500); 1247 } 1248 1249 void QtCurveConfig::save() 1250 { 1251 if (!kwin->ok()) 1252 return; 1253 1254 Options opts = presets[currentText].opts; 1255 1256 setOptions(opts); 1257 1258 if (IMG_FILE == opts.bgndImage.type) { 1259 opts.bgndImage.pixmap.file = installThemeFile(bgndImageDlg->fileName(), 1260 BGND_FILE IMAGE_FILE); 1261 } else { 1262 removeInstalledThemeFile(BGND_FILE IMAGE_FILE); 1263 } 1264 if (APPEARANCE_FILE == opts.bgndAppearance) { 1265 opts.bgndPixmap.file = installThemeFile(bgndPixmapDlg->fileName(), 1266 BGND_FILE); 1267 } else { 1268 removeInstalledThemeFile(BGND_FILE); 1269 } 1270 if(IMG_FILE==opts.menuBgndImage.type) 1271 { 1272 opts.menuBgndImage.pixmap.file=installThemeFile(menuBgndImageDlg->fileName(), BGND_FILE MENU_FILE IMAGE_FILE); 1273 // printf("SAVE MENU:%s\n", opts.menuBgndImage.pixmap.file.toLatin1().constData()); 1274 } 1275 else 1276 removeInstalledThemeFile(BGND_FILE MENU_FILE IMAGE_FILE); 1277 if(APPEARANCE_FILE==opts.menuBgndAppearance) 1278 opts.menuBgndPixmap.file=installThemeFile(menuBgndPixmapDlg->fileName(), BGND_FILE MENU_FILE); 1279 else 1280 removeInstalledThemeFile(BGND_FILE MENU_FILE); 1281 1282 // avoid surprises and always save the full config 1283 qtcWriteConfig(nullptr, opts, presets[defaultText].opts, true); 1284 1285 // This is only read by KDE3... 1286 KConfig k3globals(kdeHome(true)+"/share/config/kdeglobals", KConfig::CascadeConfig); 1287 KConfigGroup kde(&k3globals, "KDE"); 1288 1289 if(opts.gtkButtonOrder) 1290 kde.writeEntry("ButtonLayout", 2); 1291 else 1292 kde.deleteEntry("ButtonLayout"); 1293 1294 kwin->save(0L); 1295 // If using QtCurve window decoration, get this to update... 1296 KConfig kwin("kwinrc", KConfig::CascadeConfig); 1297 KConfigGroup style(&kwin, "Style"); 1298 1299 if (style.readEntry("PluginLib", QString()) == "kwin3_qtcurve") { 1300 QDBusConnection::sessionBus().send( 1301 QDBusMessage::createSignal("/KWin", "org.kde.KWin", 1302 "reloadConfig")); 1303 } 1304 1305 // Remove QTCURVE_PREVIEW_CONFIG setting, so that main kcmstyle 1306 // preview does not revert to default settings! 1307 qputenv(QTCURVE_PREVIEW_CONFIG, ""); 1308 } 1309 1310 void QtCurveConfig::defaults() 1311 { 1312 if(!kwin->ok()) 1313 return; 1314 1315 int index=-1; 1316 1317 for(int i=0; i<presetsCombo->count() && -1==index; ++i) 1318 if(presetsCombo->itemText(i)==defaultText) 1319 index=i; 1320 1321 presetsCombo->setCurrentIndex(index); 1322 setPreset(); 1323 kwin->defaults(); 1324 } 1325 1326 void QtCurveConfig::emboldenToggled() 1327 { 1328 if(!embolden->isChecked() && IND_NONE==defBtnIndicator->currentIndex()) 1329 defBtnIndicator->setCurrentIndex(IND_TINT); 1330 updateChanged(); 1331 } 1332 1333 void QtCurveConfig::defBtnIndicatorChanged() 1334 { 1335 if(IND_NONE==defBtnIndicator->currentIndex() && !embolden->isChecked()) 1336 embolden->setChecked(true); 1337 else if(IND_GLOW==defBtnIndicator->currentIndex() && EFFECT_NONE==buttonEffect->currentIndex()) 1338 buttonEffect->setCurrentIndex(EFFECT_SHADOW); 1339 1340 if(IND_COLORED==defBtnIndicator->currentIndex() && round->currentIndex()>ROUND_FULL) 1341 round->setCurrentIndex(ROUND_FULL); 1342 1343 updateChanged(); 1344 } 1345 1346 void QtCurveConfig::buttonEffectChanged() 1347 { 1348 if(EFFECT_NONE==buttonEffect->currentIndex()) 1349 { 1350 if(IND_GLOW==defBtnIndicator->currentIndex()) 1351 defBtnIndicator->setCurrentIndex(IND_TINT); 1352 if(MO_GLOW==coloredMouseOver->currentIndex()) 1353 coloredMouseOver->setCurrentIndex(MO_PLASTIK); 1354 } 1355 1356 updateChanged(); 1357 } 1358 1359 void QtCurveConfig::coloredMouseOverChanged() 1360 { 1361 if(MO_GLOW==coloredMouseOver->currentIndex() && 1362 EFFECT_NONE==buttonEffect->currentIndex()) 1363 buttonEffect->setCurrentIndex(EFFECT_SHADOW); 1364 1365 updateChanged(); 1366 } 1367 1368 void QtCurveConfig::shadeSlidersChanged() 1369 { 1370 customSlidersColor->setEnabled(SHADE_CUSTOM==shadeSliders->currentIndex()); 1371 updateChanged(); 1372 if(gradPreview) 1373 gradPreview->repaint(); 1374 } 1375 1376 void QtCurveConfig::shadeMenubarsChanged() 1377 { 1378 customMenubarsColor->setEnabled(SHADE_CUSTOM==shadeMenubars->currentIndex()); 1379 customMenuNormTextColor->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex()); 1380 customMenuSelTextColor->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex()); 1381 customMenuTextColor->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex()); 1382 shadeMenubarOnlyWhenActive->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex()); 1383 if(SHADE_WINDOW_BORDER==shadeMenubars->currentIndex()) 1384 windowBorder_menuColor->setChecked(false); 1385 updateChanged(); 1386 } 1387 1388 void QtCurveConfig::shadeCheckRadioChanged() 1389 { 1390 customCheckRadioColor->setEnabled(SHADE_CUSTOM==shadeCheckRadio->currentIndex()); 1391 updateChanged(); 1392 } 1393 1394 void QtCurveConfig::customMenuTextColorChanged() 1395 { 1396 customMenuNormTextColor->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex() && customMenuTextColor->isChecked()); 1397 customMenuSelTextColor->setEnabled(SHADE_WINDOW_BORDER!=shadeMenubars->currentIndex() && customMenuTextColor->isChecked()); 1398 updateChanged(); 1399 } 1400 1401 void QtCurveConfig::menuStripeChanged() 1402 { 1403 customMenuStripeColor->setEnabled(SHADE_CUSTOM==menuStripe->currentIndex()); 1404 menuStripeAppearance->setEnabled(SHADE_NONE!=menuStripe->currentIndex()); 1405 updateChanged(); 1406 } 1407 1408 void QtCurveConfig::shadePopupMenuChanged() 1409 { 1410 lighterPopupMenuBgnd->setEnabled(!shadePopupMenu->isChecked()); 1411 } 1412 1413 void QtCurveConfig::progressColorChanged() 1414 { 1415 customProgressColor->setEnabled(SHADE_CUSTOM==progressColor->currentIndex()); 1416 updateChanged(); 1417 } 1418 1419 void QtCurveConfig::comboBtnChanged() 1420 { 1421 customComboBtnColor->setEnabled(SHADE_CUSTOM==comboBtn->currentIndex()); 1422 updateChanged(); 1423 } 1424 1425 void QtCurveConfig::sortedLvChanged() 1426 { 1427 customSortedLvColor->setEnabled(SHADE_CUSTOM==sortedLv->currentIndex()); 1428 updateChanged(); 1429 } 1430 1431 void QtCurveConfig::crColorChanged() 1432 { 1433 customCrBgndColor->setEnabled(SHADE_CUSTOM==crColor->currentIndex()); 1434 updateChanged(); 1435 } 1436 1437 void QtCurveConfig::stripedProgressChanged() 1438 { 1439 bool allowAnimation=STRIPE_NONE!=stripedProgress->currentIndex() && 1440 STRIPE_FADE!=stripedProgress->currentIndex(); 1441 1442 animatedProgress->setEnabled(allowAnimation); 1443 if(animatedProgress->isChecked() && !allowAnimation) 1444 animatedProgress->setChecked(false); 1445 updateChanged(); 1446 } 1447 1448 void QtCurveConfig::activeTabAppearanceChanged() 1449 { 1450 int current(activeTabAppearance->currentIndex()); 1451 bool disableCol(APPEARANCE_FLAT==current || APPEARANCE_RAISED==current); 1452 1453 if(colorSelTab->value() && disableCol) 1454 colorSelTab->setValue(MIN_COLOR_SEL_TAB_FACTOR); 1455 colorSelTab->setEnabled(!disableCol); 1456 updateChanged(); 1457 } 1458 1459 void QtCurveConfig::tabMoChanged() 1460 { 1461 if(TAB_MO_GLOW==tabMouseOver->currentIndex()) 1462 roundAllTabs->setChecked(true); 1463 roundAllTabs->setEnabled(TAB_MO_GLOW!=tabMouseOver->currentIndex()); 1464 roundAllTabs_false->setEnabled(TAB_MO_GLOW!=tabMouseOver->currentIndex()); 1465 updateChanged(); 1466 } 1467 1468 void QtCurveConfig::shadingChanged() 1469 { 1470 updateChanged(); 1471 if(gradPreview) 1472 gradPreview->repaint(); 1473 } 1474 1475 void QtCurveConfig::passwordCharClicked() 1476 { 1477 int cur(toInt(passwordChar->text())); 1478 CharSelectDialog dlg(this, cur); 1479 1480 if(QDialog::Accepted==dlg.exec() && dlg.currentChar()!=cur) 1481 { 1482 setPasswordChar(dlg.currentChar()); 1483 updateChanged(); 1484 } 1485 } 1486 1487 void QtCurveConfig::unifySpinBtnsToggled() 1488 { 1489 if(unifySpinBtns->isChecked()) 1490 unifySpin->setChecked(false); 1491 unifySpin->setDisabled(unifySpinBtns->isChecked()); 1492 updateChanged(); 1493 } 1494 1495 void QtCurveConfig::unifySpinToggled() 1496 { 1497 if(unifySpin->isChecked()) 1498 unifySpinBtns->setChecked(false); 1499 unifySpinBtns->setDisabled(unifySpin->isChecked()); 1500 updateChanged(); 1501 } 1502 1503 void QtCurveConfig::sliderThumbChanged() 1504 { 1505 if(LINE_NONE!=sliderThumbs->currentIndex() && sliderWidth->value()<DEFAULT_SLIDER_WIDTH) 1506 sliderWidth->setValue(DEFAULT_SLIDER_WIDTH); 1507 updateChanged(); 1508 } 1509 1510 void QtCurveConfig::sliderWidthChanged() 1511 { 1512 if(0==sliderWidth->value()%2) 1513 sliderWidth->setValue(sliderWidth->value()+1); 1514 1515 if(LINE_NONE!=sliderThumbs->currentIndex() && sliderWidth->value()<DEFAULT_SLIDER_WIDTH) 1516 sliderThumbs->setCurrentIndex(LINE_NONE); 1517 updateChanged(); 1518 } 1519 1520 void QtCurveConfig::menubarHidingChanged() 1521 { 1522 updateChanged(); 1523 } 1524 1525 void QtCurveConfig::windowBorder_colorTitlebarOnlyChanged() 1526 { 1527 if(!windowBorder_colorTitlebarOnly->isChecked()) 1528 windowBorder_blend->setChecked(false); 1529 updateChanged(); 1530 } 1531 1532 void QtCurveConfig::windowBorder_blendChanged() 1533 { 1534 if(windowBorder_blend->isChecked()) 1535 { 1536 windowBorder_colorTitlebarOnly->setChecked(true); 1537 windowBorder_menuColor->setChecked(false); 1538 } 1539 updateChanged(); 1540 } 1541 1542 void QtCurveConfig::windowBorder_menuColorChanged() 1543 { 1544 if(windowBorder_menuColor->isChecked()) 1545 { 1546 windowBorder_colorTitlebarOnly->setChecked(false); 1547 if(SHADE_WINDOW_BORDER==shadeMenubars->currentIndex()) 1548 shadeMenubars->setCurrentIndex(SHADE_NONE); 1549 } 1550 updateChanged(); 1551 } 1552 1553 void QtCurveConfig::thinSbarGrooveChanged() 1554 { 1555 if(thinSbarGroove->isChecked()) 1556 borderSbarGroove->setChecked(true); 1557 updateChanged(); 1558 } 1559 1560 void QtCurveConfig::borderSbarGrooveChanged() 1561 { 1562 if(!borderSbarGroove->isChecked()) 1563 thinSbarGroove->setChecked(false); 1564 updateChanged(); 1565 } 1566 1567 void QtCurveConfig::borderProgressChanged() 1568 { 1569 if(!borderProgress->isChecked()) 1570 { 1571 squareProgress->setChecked(true); 1572 fillProgress->setChecked(true); 1573 } 1574 updateChanged(); 1575 } 1576 1577 void QtCurveConfig::squareProgressChanged() 1578 { 1579 if(!fillProgress->isChecked() || !squareProgress->isChecked()) 1580 borderProgress->setChecked(true); 1581 updateChanged(); 1582 } 1583 1584 void QtCurveConfig::fillProgressChanged() 1585 { 1586 if(!fillProgress->isChecked() || !squareProgress->isChecked()) 1587 borderProgress->setChecked(true); 1588 updateChanged(); 1589 } 1590 1591 void QtCurveConfig::titlebarButtons_customChanged() 1592 { 1593 if(titlebarButtons_custom->isChecked()) 1594 titlebarButtons_useHover->setChecked(false); 1595 updateChanged(); 1596 } 1597 1598 void QtCurveConfig::titlebarButtons_useHoverChanged() 1599 { 1600 if(titlebarButtons_useHover->isChecked()) 1601 titlebarButtons_custom->setChecked(false); 1602 updateChanged(); 1603 } 1604 1605 void QtCurveConfig::bgndAppearanceChanged() 1606 { 1607 if(APPEARANCE_STRIPED==bgndAppearance->currentIndex()) 1608 bgndGrad->setCurrentIndex(GT_HORIZ); 1609 bgndGrad->setEnabled(APPEARANCE_STRIPED!=bgndAppearance->currentIndex() && APPEARANCE_FILE!=bgndAppearance->currentIndex()); 1610 bgndAppearance_btn->setVisible(APPEARANCE_FILE==bgndAppearance->currentIndex()); 1611 updateChanged(); 1612 } 1613 1614 void QtCurveConfig::bgndImageChanged() 1615 { 1616 bgndImage_btn->setVisible(IMG_FILE==bgndImage->currentIndex()); 1617 updateChanged(); 1618 } 1619 1620 void QtCurveConfig::menuBgndAppearanceChanged() 1621 { 1622 if(APPEARANCE_STRIPED==menuBgndAppearance->currentIndex()) 1623 menuBgndGrad->setCurrentIndex(GT_HORIZ); 1624 menuBgndGrad->setEnabled(APPEARANCE_STRIPED!=menuBgndAppearance->currentIndex() && APPEARANCE_FILE!=menuBgndAppearance->currentIndex()); 1625 menuBgndAppearance_btn->setVisible(APPEARANCE_FILE==menuBgndAppearance->currentIndex()); 1626 updateChanged(); 1627 } 1628 1629 void QtCurveConfig::menuBgndImageChanged() 1630 { 1631 menuBgndImage_btn->setVisible(IMG_FILE==menuBgndImage->currentIndex()); 1632 updateChanged(); 1633 } 1634 1635 void QtCurveConfig::configureBgndAppearanceFile() 1636 { 1637 if(bgndPixmapDlg->run()) 1638 updateChanged(); 1639 } 1640 1641 void QtCurveConfig::configureBgndImageFile() 1642 { 1643 if(bgndImageDlg->run()) 1644 updateChanged(); 1645 } 1646 1647 void QtCurveConfig::configureMenuBgndAppearanceFile() 1648 { 1649 if(menuBgndPixmapDlg->run()) 1650 updateChanged(); 1651 } 1652 1653 void QtCurveConfig::configureMenuBgndImageFile() 1654 { 1655 if(menuBgndImageDlg->run()) 1656 updateChanged(); 1657 } 1658 1659 void QtCurveConfig::groupBoxChanged() 1660 { 1661 gbFactor->setEnabled(FRAME_SHADED==groupBox->currentIndex() || FRAME_FADED==groupBox->currentIndex()); 1662 updateChanged(); 1663 } 1664 1665 void QtCurveConfig::setupStack() 1666 { 1667 int i=0; 1668 CStackItem *first=new CStackItem(stackList, i18n("Presets and Preview"), i++); 1669 new CStackItem(stackList, i18n("General"), i++); 1670 new CStackItem(stackList, i18n("Rounding"), i++); 1671 new CStackItem(stackList, i18n("Opacity"), i++); 1672 new CStackItem(stackList, i18n("Group Boxes"), i++); 1673 new CStackItem(stackList, i18n("Combos"), i++); 1674 new CStackItem(stackList, i18n("Spin Buttons"), i++); 1675 new CStackItem(stackList, i18n("Splitters"), i++); 1676 new CStackItem(stackList, i18n("Sliders and Scrollbars"), i++); 1677 new CStackItem(stackList, i18n("Progressbars"), i++); 1678 new CStackItem(stackList, i18n("Default Button"),i++); 1679 new CStackItem(stackList, i18n("Mouse-over"), i++); 1680 new CStackItem(stackList, i18n("Item Views"), i++); 1681 new CStackItem(stackList, i18n("Scrollviews"), i++); 1682 new CStackItem(stackList, i18n("Tabs"), i++); 1683 new CStackItem(stackList, i18n("Checks and Radios"), i++); 1684 new CStackItem(stackList, i18n("Windows"), i++); 1685 1686 kwin = new QtCurve::KWinConfig(nullptr, this); 1687 kwinPage = i; 1688 1689 if (kwin->ok()) { 1690 kwin->setNote(i18n("<p><b>NOTE:</b><i>The settings here affect the borders drawn around application windows and dialogs - and " 1691 "not internal (or MDI) windows. Therefore, these settings will <b>not</b> be reflected in the Preview " 1692 "page.</i></p>")); 1693 connect(qtcSlot(kwin, changed), qtcSlot(this, updateChanged)); 1694 } 1695 stack->insertWidget(i, kwin); 1696 new CStackItem(stackList, i18n("Window Manager"), i++); 1697 1698 new CStackItem(stackList, i18n("Window buttons"), i++); 1699 new CStackItem(stackList, i18n("Window button colors"), i++); 1700 new CStackItem(stackList, i18n("Menubars"), i++); 1701 new CStackItem(stackList, i18n("Popup menus"), i++); 1702 new CStackItem(stackList, i18n("Toolbars"), i++); 1703 new CStackItem(stackList, i18n("Statusbars"), i++); 1704 new CStackItem(stackList, i18n("Dock windows"), i++); 1705 new CStackItem(stackList, i18n("Advanced Settings"), i++); 1706 new CStackItem(stackList, i18n("Applications"), i++); 1707 new CStackItem(stackList, i18n("Legacy"), i++); 1708 new CStackItem(stackList, i18n("Custom Gradients"), i++); 1709 new CStackItem(stackList, i18n("Custom Shades"), i++); 1710 1711 stackList->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 1712 stackList->setSelectionMode(QAbstractItemView::SingleSelection); 1713 first->setSelected(true); 1714 connect(qtcSlot(stackList, itemSelectionChanged), 1715 qtcSlot(this, changeStack)); 1716 } 1717 1718 void 1719 QtCurveConfig::setupPresets(const Options ¤tStyle, 1720 const Options &defaultStyle) 1721 { 1722 // TODO custom filter and figure out what directory to use. 1723 QStringList files; 1724 { 1725 // Make unique list of relative paths 1726 QHash<QString, QString> files_map; 1727 QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, 1728 QStringLiteral("QtCurve"), 1729 QStandardPaths::LocateDirectory); 1730 for (const QString &dir: dirs) { 1731 const QDir d(dir); 1732 const QStringList fileNames = d.entryList(QStringList() << QStringLiteral("*" EXTENSION)); 1733 for (const QString &file: fileNames) { 1734 if (!files_map.contains(file)) { 1735 auto abspath = d.absoluteFilePath(file); 1736 files_map.insert(file, abspath); 1737 files.append(file); 1738 } 1739 } 1740 } 1741 } 1742 files.sort(); 1743 1744 QStringList::Iterator it(files.begin()), 1745 end(files.end()); 1746 1747 KGuiItem::assign(saveButton, KGuiItem(i18n("Save"), "document-save")); 1748 KGuiItem::assign(deleteButton, KGuiItem(i18n("Delete"), "edit-delete")); 1749 KGuiItem::assign(importButton, KGuiItem(i18n("Import..."), 1750 "document-import")); 1751 KGuiItem::assign(exportButton, KGuiItem(i18n("Export..."), 1752 "document-export")); 1753 1754 deleteButton->setEnabled(false); 1755 1756 currentText=i18n("(Current)"); 1757 defaultText=i18n("(Default)"); 1758 presets[currentText]=Preset(currentStyle); 1759 presets[defaultText]=Preset(defaultStyle); 1760 for (;it != end;++it) { 1761 QString name(getFileName(*it).remove(EXTENSION).replace('_', ' ')); 1762 1763 if (!name.isEmpty() && name != currentText && name != defaultText) { 1764 presetsCombo->insertItem(0, name); 1765 presets[name] = Preset(*it); 1766 } 1767 } 1768 1769 presetsCombo->insertItem(0, currentText); 1770 presetsCombo->insertItem(0, defaultText); 1771 presetsCombo->model()->sort(0); 1772 connect(qtcSlot(presetsCombo, currentIndexChanged, (int)), 1773 qtcSlot(this, setPreset)); 1774 connect(qtcSlot(saveButton, clicked), qtcSlot(this, savePreset, ())); 1775 connect(qtcSlot(deleteButton, clicked), qtcSlot(this, deletePreset)); 1776 connect(qtcSlot(importButton, clicked), qtcSlot(this, importPreset)); 1777 connect(qtcSlot(exportButton, clicked), qtcSlot(this, exportPreset)); 1778 1779 int index = -1; 1780 1781 for (int i = 0;i < presetsCombo->count() && -1 == index;++i) { 1782 if (presetsCombo->itemText(i) == currentText) { 1783 index = i; 1784 } 1785 } 1786 1787 presetsCombo->setCurrentIndex(index); 1788 setPreset(); 1789 } 1790 1791 void QtCurveConfig::setupPreview() 1792 { 1793 QVBoxLayout *layout = new QVBoxLayout(previewFrame); 1794 1795 workSpace = new CWorkspace(previewFrame); 1796 layout->setMargin(0); 1797 layout->addWidget(workSpace); 1798 1799 previewControlPressed(); 1800 } 1801 1802 void QtCurveConfig::changeStack() 1803 { 1804 CStackItem *item=(CStackItem *)(stackList->currentItem()); 1805 1806 if(item && !item->isSelected()) 1807 item->setSelected(true); 1808 1809 if(item) 1810 { 1811 if(0==item->stack() && settingsChanged(previewStyle)) 1812 updatePreview(); 1813 stack->setCurrentIndex(item->stack()); 1814 } 1815 } 1816 1817 void QtCurveConfig::gradChanged(int i) 1818 { 1819 GradientCont::const_iterator it(customGradient.find((EAppearance)i)); 1820 1821 gradStops->clear(); 1822 1823 if(it!=customGradient.end()) 1824 { 1825 gradPreview->setGrad((*it).second); 1826 gradBorder->setCurrentIndex((*it).second.border); 1827 1828 GradientStopCont::const_iterator git((*it).second.stops.begin()), 1829 gend((*it).second.stops.end()); 1830 CGradItem *first=0L; 1831 1832 gradStops->blockSignals(true); 1833 for(; git!=gend; ++git) 1834 { 1835 QStringList details; 1836 1837 details << QString().setNum((*git).pos*100.0) 1838 << QString().setNum((*git).val*100.0) 1839 << QString().setNum((*git).alpha*100.0); 1840 CGradItem *grad=new CGradItem(gradStops, details); 1841 if(!first) 1842 first=grad; 1843 } 1844 gradStops->blockSignals(false); 1845 gradStops->sortItems(0, Qt::AscendingOrder); 1846 if(first) 1847 gradStops->setCurrentItem(first); 1848 } 1849 else 1850 { 1851 gradPreview->setGrad(Gradient()); 1852 gradBorder->setCurrentIndex(GB_3D); 1853 } 1854 1855 gradBorder->setEnabled(NUM_CUSTOM_GRAD!=i); 1856 } 1857 1858 void QtCurveConfig::borderChanged(int i) 1859 { 1860 GradientCont::iterator it=customGradient.find((EAppearance)gradCombo->currentIndex()); 1861 if(it!=customGradient.end()) 1862 { 1863 (*it).second.border=(EGradientBorder)i; 1864 gradPreview->setGrad((*it).second); 1865 emit changed(true); 1866 } 1867 } 1868 1869 static double prev=-1.0; 1870 1871 void QtCurveConfig::editItem(QTreeWidgetItem *i, int col) 1872 { 1873 bool ok; 1874 prev=i->text(col).toDouble(&ok); 1875 if(!ok) 1876 prev=-1.0; 1877 1878 gradStops->editItem(i, col); 1879 } 1880 1881 void QtCurveConfig::itemChanged(QTreeWidgetItem *i, int col) 1882 { 1883 bool ok; 1884 double val=i->text(col).toDouble(&ok)/100.0; 1885 1886 if(prev<0 || (ok && qtcEqual(val, prev))) 1887 return; 1888 1889 if(!ok || ((0==col || 2==col) && (val<0.0 || val>1.0)) || (1==col && (val<0.0 || val>2.0))) 1890 i->setText(col, QString().setNum(prev)); 1891 else 1892 { 1893 double other=i->text(col ? 0 : 1).toDouble(&ok)/100.0; 1894 1895 GradientCont::iterator it=customGradient.find((EAppearance)gradCombo->currentIndex()); 1896 1897 if(it!=customGradient.end()) 1898 { 1899 (*it).second.stops.erase(GradientStop(0==col ? prev : other, 1==col ? prev : other, 2==col ? prev : other)); 1900 (*it).second.stops.insert(GradientStop(0==col ? val : other, 1==col ? val : other, 2==col ? val : other)); 1901 gradPreview->setGrad((*it).second); 1902 i->setText(col, QString().setNum(val*100.0)); 1903 emit changed(true); 1904 } 1905 } 1906 } 1907 1908 void QtCurveConfig::addGradStop() 1909 { 1910 GradientCont::iterator cg=customGradient.find((EAppearance)gradCombo->currentIndex()); 1911 1912 if(cg==customGradient.end()) 1913 { 1914 Gradient cust; 1915 1916 cust.border=(EGradientBorder)gradBorder->currentIndex(); 1917 cust.stops.insert(GradientStop(stopPosition->value()/100.0, stopValue->value()/100.0, stopAlpha->value()/100.0)); 1918 customGradient[(EAppearance)gradCombo->currentIndex()]=cust; 1919 gradChanged(gradCombo->currentIndex()); 1920 emit changed(true); 1921 } 1922 else 1923 { 1924 GradientStopCont::const_iterator it((*cg).second.stops.begin()), 1925 end((*cg).second.stops.end()); 1926 double pos(stopPosition->value()/100.0), 1927 val(stopValue->value()/100.0), 1928 alpha(stopAlpha->value()/100.0); 1929 1930 for(; it!=end; ++it) 1931 if(qtcEqual(pos, (*it).pos)) 1932 { 1933 if(qtcEqual(val, (*it).val) && qtcEqual(alpha, (*it).alpha)) 1934 return; 1935 else 1936 { 1937 (*cg).second.stops.erase(it); 1938 break; 1939 } 1940 } 1941 1942 unsigned int b4=(*cg).second.stops.size(); 1943 (*cg).second.stops.insert(GradientStop(pos, val, alpha)); 1944 if((*cg).second.stops.size()!=b4) 1945 { 1946 gradPreview->setGrad((*cg).second); 1947 1948 QStringList details; 1949 1950 details << QString().setNum(pos*100.0) 1951 << QString().setNum(val*100.0) 1952 << QString().setNum(alpha*100.0); 1953 1954 QTreeWidgetItem *i=new CGradItem(gradStops, details); 1955 1956 gradStops->setCurrentItem(i); 1957 gradStops->sortItems(0, Qt::AscendingOrder); 1958 } 1959 } 1960 } 1961 1962 void QtCurveConfig::removeGradStop() 1963 { 1964 QTreeWidgetItem *cur=gradStops->currentItem(); 1965 1966 if(cur) 1967 { 1968 QTreeWidgetItem *next=gradStops->itemBelow(cur); 1969 1970 if(!next) 1971 next=gradStops->itemAbove(cur); 1972 1973 GradientCont::iterator it=customGradient.find((EAppearance)gradCombo->currentIndex()); 1974 1975 if(it!=customGradient.end()) 1976 { 1977 bool ok; 1978 double pos=cur->text(0).toDouble(&ok)/100.0, 1979 val=cur->text(1).toDouble(&ok)/100.0, 1980 alpha=cur->text(2).toDouble(&ok)/100.0; 1981 1982 (*it).second.stops.erase(GradientStop(pos, val, alpha)); 1983 gradPreview->setGrad((*it).second); 1984 emit changed(true); 1985 1986 delete cur; 1987 if(next) 1988 gradStops->setCurrentItem(next); 1989 } 1990 } 1991 } 1992 1993 void QtCurveConfig::updateGradStop() 1994 { 1995 QTreeWidgetItem *i=gradStops->selectedItems().size() ? *(gradStops->selectedItems().begin()) : 0L; 1996 1997 GradientCont::iterator cg=customGradient.find((EAppearance)gradCombo->currentIndex()); 1998 1999 if(i) 2000 { 2001 double curPos=i->text(0).toDouble()/100.0, 2002 curVal=i->text(1).toDouble()/100.0, 2003 curAlpha=i->text(2).toDouble()/100.0, 2004 newPos(stopPosition->value()/100.0), 2005 newVal(stopValue->value()/100.0), 2006 newAlpha(stopAlpha->value()/100.0); 2007 2008 if(!qtcEqual(newPos, curPos) || !qtcEqual(newVal, curVal) || !qtcEqual(newAlpha, curAlpha)) 2009 { 2010 (*cg).second.stops.erase(GradientStop(curPos, curVal, curAlpha)); 2011 (*cg).second.stops.insert(GradientStop(newPos, newVal, newAlpha)); 2012 2013 i->setText(0, QString().setNum(stopPosition->value())); 2014 i->setText(1, QString().setNum(stopValue->value())); 2015 i->setText(2, QString().setNum(stopAlpha->value())); 2016 gradPreview->setGrad((*cg).second); 2017 emit changed(true); 2018 } 2019 } 2020 else 2021 addGradStop(); 2022 } 2023 2024 void QtCurveConfig::stopSelected() 2025 { 2026 QTreeWidgetItem *i=gradStops->selectedItems().size() ? *(gradStops->selectedItems().begin()) : 0L; 2027 2028 removeButton->setEnabled(i); 2029 updateButton->setEnabled(i); 2030 2031 if(i) 2032 { 2033 stopPosition->setValue(i->text(0).toInt()); 2034 stopValue->setValue(i->text(1).toInt()); 2035 stopAlpha->setValue(i->text(2).toInt()); 2036 } 2037 else 2038 { 2039 stopPosition->setValue(0); 2040 stopValue->setValue(100); 2041 stopAlpha->setValue(100); 2042 } 2043 } 2044 2045 void QtCurveConfig::exportKDE3() 2046 { 2047 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2048 if(KMessageBox::PrimaryAction==KMessageBox::questionTwoActions(this, 2049 #else 2050 if(KMessageBox::Yes==KMessageBox::questionYesNo(this, 2051 #endif 2052 i18n("Export your current KDE4 color palette, and font, so " 2053 "that they can be used by KDE3 applications?"), 2054 QString(), 2055 KGuiItem(i18nc("@action:button", "Export"), "document-export"), 2056 KStandardGuiItem::cancel())) 2057 { 2058 QString kde3Home(kdeHome(true)); 2059 KConfig k3globals(kde3Home+"/share/config/kdeglobals", KConfig::NoGlobals); 2060 KConfigGroup general(&k3globals, "General"); 2061 KConfigGroup wm(&k3globals, "WM"); 2062 2063 general.writeEntry("alternateBackground", palette().color(QPalette::Active, QPalette::AlternateBase)); 2064 general.writeEntry("background", palette().color(QPalette::Active, QPalette::Window)); 2065 general.writeEntry("buttonBackground", palette().color(QPalette::Active, QPalette::Button)); 2066 general.writeEntry("buttonForeground", palette().color(QPalette::Active, QPalette::ButtonText)); 2067 general.writeEntry("foreground", palette().color(QPalette::Active, QPalette::WindowText)); 2068 general.writeEntry("selectBackground", palette().color(QPalette::Active, QPalette::Highlight)); 2069 general.writeEntry("selectForeground", palette().color(QPalette::Active, QPalette::HighlightedText)); 2070 general.writeEntry("windowBackground", palette().color(QPalette::Active, QPalette::Base)); 2071 general.writeEntry("windowForeground", palette().color(QPalette::Active, QPalette::Text)); 2072 general.writeEntry("linkColor", palette().color(QPalette::Active, QPalette::Link)); 2073 general.writeEntry("visitedLinkColor", palette().color(QPalette::Active, QPalette::LinkVisited)); 2074 2075 if (kdeHome(false)!=kde3Home) { 2076 KConfigGroup k4General(KSharedConfig::openConfig(), "General"); 2077 KConfigGroup k4wm(KSharedConfig::openConfig(), "WM"); 2078 2079 // Mainly for K3B... 2080 wm.writeEntry("activeBackground", k4wm.readEntry("activeBackground", 2081 palette().color(QPalette::Active, QPalette::Window))); 2082 wm.writeEntry("activeForeground", k4wm.readEntry("activeForeground", 2083 palette().color(QPalette::Active, QPalette::WindowText))); 2084 wm.writeEntry("inactiveBackground", k4wm.readEntry("inactiveBackground", 2085 palette().color(QPalette::Inactive, QPalette::Window))); 2086 wm.writeEntry("inactiveForeground", k4wm.readEntry("inactiveForeground", 2087 palette().color(QPalette::Inactive, QPalette::WindowText))); 2088 // Font settings... 2089 general.writeEntry("font", k4General.readEntry("font", font())); 2090 general.writeEntry("fixed", k4General.readEntry("fixed", font())); 2091 general.writeEntry("desktopFont", k4General.readEntry("desktopFont", font())); 2092 general.writeEntry("taskbarFont", k4General.readEntry("taskbarFont", font())); 2093 general.writeEntry("toolBarFont", k4General.readEntry("toolBarFont", font())); 2094 } 2095 } 2096 } 2097 2098 void QtCurveConfig::exportQt() 2099 { 2100 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2101 if(KMessageBox::PrimaryAction==KMessageBox::questionTwoActions(this, 2102 #else 2103 if(KMessageBox::Yes==KMessageBox::questionYesNo(this, 2104 #endif 2105 i18n("Export your current KDE4 color palette, and font, so " 2106 "that they can be used by pure-Qt3 applications?"), 2107 QString(), 2108 KGuiItem(i18nc("@action:button", "Export"), "document-export"), 2109 KStandardGuiItem::cancel())) 2110 { 2111 KConfig cfg(QDir::homePath()+"/.qt/qtrc", KConfig::NoGlobals); 2112 KConfigGroup gen(&cfg, "General"); 2113 KConfigGroup pal(&cfg, "Palette"); 2114 KConfigGroup kde(&cfg, "KDE"); 2115 const QPalette &p=palette(); 2116 int i; 2117 QStringList act, 2118 inact, 2119 dis; 2120 QString sep("^e"); 2121 2122 QPalette::ColorRole roles[]={QPalette::Foreground, 2123 QPalette::Button, 2124 QPalette::Light, 2125 QPalette::Midlight, 2126 QPalette::Dark, 2127 QPalette::Mid, 2128 QPalette::Text, 2129 QPalette::BrightText, 2130 QPalette::ButtonText, 2131 QPalette::Base, 2132 QPalette::Background, 2133 QPalette::Shadow, 2134 QPalette::Highlight, 2135 QPalette::HighlightedText, 2136 QPalette::Link, 2137 QPalette::LinkVisited, 2138 QPalette::NColorRoles 2139 }; 2140 2141 for (i = 0; roles[i] != QPalette::NColorRoles; i++) 2142 { 2143 act << p.color(QPalette::Active, roles[i]).name(); 2144 inact << p.color(QPalette::Inactive, roles[i]).name(); 2145 dis << p.color(QPalette::Disabled, roles[i]).name(); 2146 } 2147 2148 KConfigGroup k4General(KSharedConfig::openConfig(), "General"); 2149 gen.writeEntry("font", k4General.readEntry("font", font())); 2150 gen.writeEntry("font", font()); 2151 pal.writeEntry("active", act.join(sep)); 2152 pal.writeEntry("disabled", dis.join(sep)); 2153 pal.writeEntry("inactive", inact.join(sep)); 2154 kde.writeEntry("contrast", QSettings(QLatin1String("Trolltech")).value("/Qt/KDE/contrast", 7).toInt()); 2155 } 2156 } 2157 2158 void QtCurveConfig::menubarTitlebarBlend() 2159 { 2160 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2161 if(KMessageBox::PrimaryAction==KMessageBox::questionTwoActions(this, 2162 #else 2163 if(KMessageBox::Yes==KMessageBox::questionYesNo(this, 2164 #endif 2165 i18n("<p>Set the following config items so that window titlebar and menubars appear blended?</p>" 2166 "<ul><li>Menubar, titlebar, and inactive titlebar gradient to \"%1\"</li>" 2167 "<li>Disable \"Blend titlebar color into background color\"</li>" 2168 "<li>Set menubar coloration to \"%2\"</li>" 2169 "<li>Extend window dragging into menubar</li>", 2170 uiString((EAppearance)menubarAppearance->currentIndex()), 2171 uiString(SHADE_WINDOW_BORDER, SW_MENUBAR)), 2172 QString(), 2173 KGuiItem(i18nc("@action:button", "Set"), "dialog-ok"), 2174 KStandardGuiItem::cancel())) 2175 { 2176 titlebarAppearance->setCurrentIndex(menubarAppearance->currentIndex()); 2177 inactiveTitlebarAppearance->setCurrentIndex(menubarAppearance->currentIndex()); 2178 windowBorder_blend->setChecked(false); 2179 windowBorder_fill->setChecked(true); 2180 shadeMenubars->setCurrentIndex(SHADE_WINDOW_BORDER); 2181 if(windowDrag->currentIndex()<WM_DRAG_MENUBAR) 2182 windowDrag->setCurrentIndex(WM_DRAG_MENUBAR); 2183 } 2184 } 2185 2186 void QtCurveConfig::updatePreview() 2187 { 2188 if(!readyForPreview) 2189 return; 2190 2191 setOptions(previewStyle); 2192 2193 qputenv(QTCURVE_PREVIEW_CONFIG, mdiWindow ? QTCURVE_PREVIEW_CONFIG : QTCURVE_PREVIEW_CONFIG_FULL); 2194 QStyle *style = QStyleFactory::create("qtcurve"); 2195 qputenv(QTCURVE_PREVIEW_CONFIG, ""); 2196 if (!style) 2197 return; 2198 2199 // Very hacky way to pass preview options to style!!! 2200 QtCurve::Style::PreviewOption styleOpt; 2201 styleOpt.opts=previewStyle; 2202 2203 style->drawControl((QStyle::ControlElement)QtCurve::Style::CE_QtC_SetOptions, &styleOpt, 0L, this); 2204 2205 setStyleRecursive(mdiWindow ? (QWidget *)previewFrame : (QWidget *)stylePreview, style); 2206 } 2207 2208 static const char * constGradValProp="qtc-grad-val"; 2209 2210 void QtCurveConfig::copyGradient(QAction *act) 2211 { 2212 int val=act->property(constGradValProp).toInt(); 2213 const Gradient *copy=nullptr; 2214 2215 if(val>=APPEARANCE_CUSTOM1 && val <(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD)) 2216 { 2217 // Custom gradient! 2218 if(val!=gradCombo->currentIndex()) 2219 { 2220 GradientCont::const_iterator grad(customGradient.find((EAppearance)val)); 2221 2222 if(grad!=customGradient.end()) 2223 copy=&((*grad).second); 2224 } 2225 } 2226 else 2227 copy=qtcGetGradient((EAppearance)val, &previewStyle); 2228 2229 if(copy) 2230 { 2231 customGradient[(EAppearance)gradCombo->currentIndex()]=*copy; 2232 gradChanged(gradCombo->currentIndex()); 2233 emit changed(true); 2234 } 2235 } 2236 2237 void QtCurveConfig::previewControlPressed() 2238 { 2239 if(mdiWindow) 2240 { 2241 previewControlButton->setText(i18n("Reattach")); 2242 workSpace->removeSubWindow(stylePreview); 2243 if(stylePreview) 2244 stylePreview->deleteLater(); 2245 mdiWindow->deleteLater(); 2246 mdiWindow=0L; 2247 stylePreview = new CStylePreview(this); 2248 stylePreview->show(); 2249 } 2250 else 2251 { 2252 if(stylePreview) 2253 stylePreview->deleteLater(); 2254 stylePreview = new CStylePreview; 2255 mdiWindow = workSpace->addSubWindow(stylePreview, Qt::Window); 2256 mdiWindow->move(4, 4); 2257 mdiWindow->showMaximized(); 2258 previewControlButton->setText(i18n("Detach")); 2259 } 2260 connect(qtcSlot(stylePreview, closePressed), 2261 qtcSlot(this, previewControlPressed)); 2262 updatePreview(); 2263 } 2264 2265 void QtCurveConfig::setupGradientsTab() 2266 { 2267 QMenu *menu=new QMenu(copyGradientButton); 2268 2269 for(int i=0; i<appearance->count(); ++i) 2270 menu->addAction(appearance->itemText(i))->setProperty(constGradValProp, i); 2271 2272 for(int i=APPEARANCE_CUSTOM1; i<(APPEARANCE_CUSTOM1+NUM_CUSTOM_GRAD); ++i) 2273 gradCombo->insertItem(i-APPEARANCE_CUSTOM1, i18n("Custom gradient %1", (i-APPEARANCE_CUSTOM1)+1)); 2274 2275 gradCombo->setCurrentIndex(APPEARANCE_CUSTOM1); 2276 2277 copyGradientButton->setIcon(QtCurve::loadKIcon("edit-copy")); 2278 copyGradientButton->setToolTip(i18n("Copy settings from another gradient")); 2279 copyGradientButton->setMenu(menu); 2280 copyGradientButton->setPopupMode(QToolButton::InstantPopup); 2281 connect(qtcSlot(menu, triggered), qtcSlot(this, copyGradient)); 2282 2283 gradPreview=new CGradientPreview(this, previewWidgetContainer); 2284 QBoxLayout *layout=new QBoxLayout(QBoxLayout::TopToBottom, previewWidgetContainer); 2285 layout->addWidget(gradPreview); 2286 layout->setMargin(0); 2287 layout->setSpacing(0); 2288 QColor col(palette().color(QPalette::Active, QPalette::Button)); 2289 previewColor->setColor(col); 2290 gradPreview->setColor(col); 2291 gradChanged(APPEARANCE_CUSTOM1); 2292 KGuiItem::assign(addButton, KGuiItem(i18n("Add"), "list-add")); 2293 KGuiItem::assign(removeButton, KGuiItem(i18n("Remove"), "list-remove")); 2294 KGuiItem::assign(updateButton, KGuiItem(i18n("Update"), "dialog-ok")); 2295 2296 stopPosition->setRange(0, 100); 2297 stopPosition->setSingleStep(5); 2298 stopValue->setRange(0, 200); 2299 stopValue->setSingleStep(5); 2300 stopAlpha->setRange(0, 100); 2301 stopAlpha->setSingleStep(5); 2302 removeButton->setEnabled(false); 2303 updateButton->setEnabled(false); 2304 connect(qtcSlot(gradCombo, currentIndexChanged, (int)), 2305 qtcSlot(this, gradChanged)); 2306 connect(qtcSlot(gradBorder, currentIndexChanged, (int)), 2307 qtcSlot(this, borderChanged)); 2308 connect(qtcSlot(previewColor, changed), 2309 qtcSlot(gradPreview, setColor)); 2310 connect(qtcSlot(gradStops, itemDoubleClicked), qtcSlot(this, editItem)); 2311 connect(qtcSlot(gradStops, itemChanged), qtcSlot(this, itemChanged)); 2312 connect(qtcSlot(addButton, clicked), qtcSlot(this, addGradStop)); 2313 connect(qtcSlot(removeButton, clicked), qtcSlot(this, removeGradStop)); 2314 connect(qtcSlot(updateButton, clicked), qtcSlot(this, updateGradStop)); 2315 connect(qtcSlot(gradStops, itemSelectionChanged), 2316 qtcSlot(this, stopSelected)); 2317 } 2318 2319 void QtCurveConfig::setupShadesTab() 2320 { 2321 int shade(0); 2322 2323 setupShade(shade0, shade++); 2324 setupShade(shade1, shade++); 2325 setupShade(shade2, shade++); 2326 setupShade(shade3, shade++); 2327 setupShade(shade4, shade++); 2328 setupShade(shade5, shade++); 2329 connect(qtcSlot(customShading, toggled), qtcSlot(this, updateChanged)); 2330 shade=0; 2331 setupAlpha(alpha0, shade++); 2332 setupAlpha(alpha1, shade++); 2333 connect(qtcSlot(customAlphas, toggled), qtcSlot(this, updateChanged)); 2334 } 2335 2336 void QtCurveConfig::setupShade(QDoubleSpinBox *w, int shade) 2337 { 2338 w->setRange(0.0, 2.0); 2339 w->setSingleStep(0.05); 2340 connect(qtcSlot(w, valueChanged, (double)), qtcSlot(this, updateChanged)); 2341 shadeVals[shade] = w; 2342 } 2343 2344 void QtCurveConfig::setupAlpha(QDoubleSpinBox *w, int alpha) 2345 { 2346 w->setRange(0.0, 1.0); 2347 w->setSingleStep(0.05); 2348 connect(qtcSlot(w, valueChanged, (double)), qtcSlot(this, updateChanged)); 2349 alphaVals[alpha] = w; 2350 } 2351 2352 void QtCurveConfig::populateShades(const Options &opts) 2353 { 2354 int contrast = (QSettings(QLatin1String("Trolltech")) 2355 .value("/Qt/KDE/contrast", 7).toInt()); 2356 2357 if(contrast<0 || contrast>10) 2358 contrast=7; 2359 2360 customShading->setChecked(USE_CUSTOM_SHADES(opts)); 2361 2362 for(int i=0; i<QTC_NUM_STD_SHADES; ++i) 2363 shadeVals[i]->setValue(USE_CUSTOM_SHADES(opts) ? opts.customShades[i] : 2364 qtc_intern_shades[shading->currentIndex() == 2365 int(Shading::Simple) ? 1 : 0] 2366 [contrast][i]); 2367 2368 customAlphas->setChecked(USE_CUSTOM_ALPHAS(opts)); 2369 alphaVals[0]->setValue(USE_CUSTOM_ALPHAS(opts) ? opts.customAlphas[0] : ETCH_TOP_ALPHA); 2370 alphaVals[1]->setValue(USE_CUSTOM_ALPHAS(opts) ? opts.customAlphas[1] : ETCH_BOTTOM_ALPHA); 2371 } 2372 2373 bool QtCurveConfig::diffShades(const Options &opts) 2374 { 2375 if( (!USE_CUSTOM_SHADES(opts) && customShading->isChecked()) || 2376 (USE_CUSTOM_SHADES(opts) && !customShading->isChecked()) ) 2377 return true; 2378 2379 if(customShading->isChecked()) 2380 { 2381 for(int i=0; i<QTC_NUM_STD_SHADES; ++i) 2382 if(!qtcEqual(shadeVals[i]->value(), opts.customShades[i])) 2383 return true; 2384 } 2385 2386 if( (!USE_CUSTOM_ALPHAS(opts) && customAlphas->isChecked()) || 2387 (USE_CUSTOM_ALPHAS(opts) && !customAlphas->isChecked()) ) 2388 return true; 2389 2390 if(customAlphas->isChecked()) 2391 { 2392 for(int i=0; i<NUM_STD_ALPHAS; ++i) 2393 if(!qtcEqual(alphaVals[i]->value(), opts.customAlphas[i])) 2394 return true; 2395 } 2396 return false; 2397 } 2398 2399 bool QtCurveConfig::haveImages() 2400 { 2401 return IMG_FILE==bgndImage->currentIndex() || 2402 IMG_FILE==menuBgndImage->currentIndex() || 2403 APPEARANCE_FILE==bgndAppearance->currentIndex() || 2404 APPEARANCE_FILE==menuBgndAppearance->currentIndex(); 2405 } 2406 2407 bool QtCurveConfig::diffImages(const Options &opts) 2408 { 2409 return (IMG_FILE==bgndImage->currentIndex() && 2410 ( getThemeFile(bgndImageDlg->fileName())!=getThemeFile(opts.bgndImage.pixmap.file) || 2411 bgndImageDlg->imgWidth()!=opts.bgndImage.width || 2412 bgndImageDlg->imgHeight()!=opts.bgndImage.height || 2413 bgndImageDlg->onWindowBorder()!=opts.bgndImage.onBorder || 2414 bgndImageDlg->imgPos()!=opts.bgndImage.pos ) ) || 2415 (IMG_FILE==menuBgndImage->currentIndex() && 2416 ( getThemeFile(menuBgndImageDlg->fileName())!=getThemeFile(opts.menuBgndImage.pixmap.file) || 2417 menuBgndImageDlg->imgWidth()!=opts.menuBgndImage.width || 2418 menuBgndImageDlg->imgHeight()!=opts.menuBgndImage.height || 2419 menuBgndImageDlg->imgPos()!=opts.menuBgndImage.pos ) ) || 2420 (APPEARANCE_FILE==bgndAppearance->currentIndex() && 2421 (getThemeFile(bgndPixmapDlg->fileName())!=getThemeFile(opts.bgndPixmap.file))) || 2422 (APPEARANCE_FILE==menuBgndAppearance->currentIndex() && 2423 (getThemeFile(menuBgndPixmapDlg->fileName())!=getThemeFile(opts.menuBgndPixmap.file))); 2424 } 2425 2426 void QtCurveConfig::setPasswordChar(int ch) 2427 { 2428 QString str; 2429 QTextStream s(&str); 2430 2431 s.setIntegerBase(16); 2432 s << QChar(ch) << " (" << ch << ')'; 2433 passwordChar->setText(str); 2434 } 2435 2436 void QtCurveConfig::updateChanged() 2437 { 2438 // Check if we have a floating preview! 2439 if(!mdiWindow && settingsChanged(previewStyle)) 2440 updatePreview(); 2441 2442 if (settingsChanged()) 2443 emit changed(true); 2444 } 2445 2446 void QtCurveConfig::gtkButtonOrderChanged() 2447 { 2448 if(gtkButtonOrder->isChecked()) 2449 reorderGtkButtons->setChecked(false); 2450 updateChanged(); 2451 } 2452 2453 void QtCurveConfig::reorderGtkButtonsChanged() 2454 { 2455 if(reorderGtkButtons->isChecked()) 2456 gtkButtonOrder->setChecked(false); 2457 updateChanged(); 2458 } 2459 2460 void QtCurveConfig::focusChanged() 2461 { 2462 if(ROUND_MAX==round->currentIndex() && FOCUS_LINE!=focus->currentIndex() && !(EFFECT_NONE!=buttonEffect->currentIndex() && FOCUS_GLOW==focus->currentIndex())) 2463 round->setCurrentIndex(ROUND_EXTRA); 2464 updateChanged(); 2465 } 2466 2467 void QtCurveConfig::roundChanged() 2468 { 2469 if (ROUND_MAX == round->currentIndex() && 2470 FOCUS_LINE != focus->currentIndex() && 2471 !(EFFECT_NONE != buttonEffect->currentIndex() && 2472 FOCUS_GLOW == focus->currentIndex())) { 2473 focus->setCurrentIndex(EFFECT_NONE == buttonEffect->currentIndex() ? 2474 FOCUS_LINE : FOCUS_GLOW); 2475 } 2476 2477 if(round->currentIndex()>ROUND_FULL && IND_COLORED==defBtnIndicator->currentIndex()) 2478 defBtnIndicator->setCurrentIndex(IND_TINT); 2479 updateChanged(); 2480 } 2481 2482 void QtCurveConfig::setPreset() 2483 { 2484 readyForPreview=false; 2485 Preset &p(presets[presetsCombo->currentText()]); 2486 2487 if(!p.loaded) 2488 qtcReadConfig(p.fileName, &p.opts, &presets[defaultText].opts, false); 2489 2490 setWidgetOptions(p.opts); 2491 2492 if(defaultText==presetsCombo->currentText()) 2493 kwin->defaults(); 2494 else if(currentText==presetsCombo->currentText()) 2495 kwin->load(nullptr); 2496 else if(p.opts.version>=VERSION_WITH_KWIN_SETTINGS) 2497 { 2498 KConfig cfg(p.fileName, KConfig::SimpleConfig); 2499 2500 if(cfg.hasGroup(KWIN_GROUP)) 2501 kwin->load(&cfg); 2502 } 2503 2504 readyForPreview=true; 2505 if (settingsChanged(previewStyle)) 2506 updatePreview(); 2507 if (settingsChanged()) 2508 emit changed(true); 2509 2510 deleteButton->setEnabled(currentText!=presetsCombo->currentText() && 2511 defaultText!=presetsCombo->currentText() && 2512 0==presets[presetsCombo->currentText()].fileName.indexOf(QDir::homePath())); 2513 gradChanged(gradCombo->currentIndex()); 2514 } 2515 2516 void QtCurveConfig::savePreset() 2517 { 2518 QString name=getPresetName(i18n("Save Preset"), i18n("Please enter a name for the preset:"), 2519 currentText==presetsCombo->currentText() || defaultText==presetsCombo->currentText() 2520 ? i18n("New preset") 2521 : 0==presets[presetsCombo->currentText()].fileName.indexOf(QDir::homePath()) 2522 ? presetsCombo->currentText() 2523 : i18n("%1 New", presetsCombo->currentText())); 2524 2525 if(!name.isEmpty() && !savePreset(name)) 2526 KMessageBox::error(this, i18n("Sorry, failed to save preset")); 2527 } 2528 2529 bool QtCurveConfig::savePreset(const QString &name) 2530 { 2531 if(!kwin->ok()) 2532 return false; 2533 2534 QString fname=QString(name).replace(' ', '_'); 2535 QString dir(QtCurve::qtcSaveDir()); 2536 2537 KConfig cfg(dir+fname+EXTENSION, KConfig::NoGlobals); 2538 Options opts; 2539 2540 setOptions(opts); 2541 2542 if(IMG_FILE==opts.bgndImage.type) 2543 opts.bgndImage.pixmap.file=saveThemeFile(bgndImageDlg->fileName(), BGND_FILE IMAGE_FILE, fname); 2544 if(APPEARANCE_FILE==opts.bgndAppearance) 2545 opts.bgndPixmap.file=saveThemeFile(bgndPixmapDlg->fileName(), BGND_FILE, fname); 2546 if(IMG_FILE==opts.menuBgndImage.type) 2547 opts.menuBgndImage.pixmap.file=saveThemeFile(menuBgndImageDlg->fileName(), BGND_FILE MENU_FILE IMAGE_FILE, fname); 2548 if(APPEARANCE_FILE==opts.menuBgndAppearance) 2549 opts.menuBgndPixmap.file=saveThemeFile(menuBgndPixmapDlg->fileName(), BGND_FILE MENU_FILE, fname); 2550 2551 if(qtcWriteConfig(&cfg, opts, presets[defaultText].opts, true)) 2552 { 2553 kwin->save(&cfg); 2554 2555 QMap<QString, Preset>::iterator it(presets.find(name)), 2556 end(presets.end()); 2557 2558 presets[name]=Preset(opts, dir+fname+EXTENSION); 2559 if(it==end) 2560 { 2561 presetsCombo->insertItem(0, name); 2562 presetsCombo->model()->sort(0); 2563 int index=-1; 2564 2565 for(int i=0; i<presetsCombo->count() && -1==index; ++i) 2566 if(presetsCombo->itemText(i)==name) 2567 index=i; 2568 2569 presetsCombo->setCurrentIndex(index); 2570 setPreset(); 2571 } 2572 2573 return true; 2574 } 2575 2576 return false; 2577 } 2578 2579 QString 2580 QtCurveConfig::getPresetName(const QString &cap, QString label, QString def, 2581 QString name) 2582 { 2583 QRegExp exp("\\w+[^\\0042\\0044\\0045\\0046\\0047\\0052\\0057\\0077\\0137\\0140]*"); 2584 QRegExpValidator validator(exp, this); 2585 2586 while (true) { 2587 if (name.isEmpty()) { 2588 name = QtCurve::InputDialog::getText(this, cap, label, def, 2589 &validator); 2590 } 2591 2592 if (!name.isEmpty()) { 2593 name = name.replace('\"', ' ') 2594 .replace('$', ' ') 2595 .replace('%', ' ') 2596 .replace('&', ' ') 2597 .replace('\'', ' ') 2598 .replace('*', ' ') 2599 .replace('/', ' ') 2600 .replace('?', ' ') 2601 .replace('_', ' ') 2602 .replace('`', ' ') 2603 .simplified(); 2604 2605 if (name == currentText || name == defaultText) { 2606 label = i18n("<p>You cannot use the name \"%1\".</p>" 2607 "<p>Please enter a different name:</p>", name); 2608 def = i18n("%1 New", name); 2609 name = QString(); 2610 } else { 2611 QMap<QString, Preset>::iterator it(presets.find(name)); 2612 2613 if (it != presets.end()) { 2614 if ((*it).fileName.indexOf(QDir::homePath()) != 0) { 2615 label = i18n("<p>A system defined preset named " 2616 "\"%1\" already exists.</p>" 2617 "<p>Please enter a new name:</p>", name); 2618 def = i18n("%1 New", name); 2619 name = QString(); 2620 } else if (name == presetsCombo->currentText() || 2621 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2622 KMessageBox::warningTwoActions( 2623 #else 2624 KMessageBox::warningYesNo( 2625 #endif 2626 this, i18n("<p>A preset named \"%1\" " 2627 "already exists.</p><p>Do you " 2628 "wish to overwrite this?</p>", 2629 name), 2630 QString(), 2631 KStandardGuiItem::overwrite(), 2632 KStandardGuiItem::cancel()) 2633 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2634 == KMessageBox::PrimaryAction) { 2635 #else 2636 == KMessageBox::Yes) { 2637 #endif 2638 return name; 2639 } else { 2640 label = i18n("<p>Please enter a new name:</p>"); 2641 def = i18n("%1 New", name); 2642 name = QString(); 2643 } 2644 } else { 2645 return name; 2646 } 2647 } 2648 } else { 2649 return QString(); 2650 } 2651 } 2652 2653 return QString(); 2654 } 2655 2656 void QtCurveConfig::deletePreset() 2657 { 2658 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2659 if(KMessageBox::PrimaryAction==KMessageBox::warningTwoActions(this, 2660 #else 2661 if(KMessageBox::Yes==KMessageBox::warningYesNo(this, 2662 #endif 2663 i18n("<p>Are you sure you wish to delete:</p><p><b>%1</b></p>", 2664 presetsCombo->currentText()), 2665 QString(), 2666 KStandardGuiItem::del(), 2667 KStandardGuiItem::cancel())) 2668 { 2669 if(QFile::remove(presets[presetsCombo->currentText()].fileName)) 2670 { 2671 removeThemeImages(presets[presetsCombo->currentText()].fileName); 2672 presets.remove(presetsCombo->currentText()); 2673 presetsCombo->removeItem(presetsCombo->currentIndex()); 2674 } 2675 else 2676 KMessageBox::error(this, i18n("<p>Sorry, failed to remove the preset file:</p><p><i>%1</i></p>", 2677 presets[presetsCombo->currentText()].fileName)); 2678 } 2679 } 2680 2681 void QtCurveConfig::importPreset() 2682 { 2683 auto file = QFileDialog::getOpenFileName(this, i18n("Open"), QString(), 2684 i18n("QtCurve Settings Files (*" EXTENSION ");;" 2685 "QtCurve KDE Theme Files (" THEME_PREFIX "*" THEME_SUFFIX ")")); 2686 2687 if (!file.isEmpty()) { 2688 QMimeDatabase mime_db; 2689 auto mimeType = mime_db.mimeTypeForFile(file, QMimeDatabase::MatchContent); 2690 bool compressed(mimeType.isValid() && !mimeType.inherits("text/plain")); 2691 QString fileName(getFileName(file)), 2692 baseName(fileName.remove(EXTENSION).replace(' ', '_')), 2693 name(QString(baseName).replace('_', ' ')); 2694 Options opts; 2695 2696 if (name.isEmpty()) 2697 KMessageBox::error(this, i18n("<p>Sorry, failed to load file.</p><p><i>Empty preset name?</i></p>")); 2698 else if (name == currentText || name == defaultText) { 2699 KMessageBox::error(this, i18n("<p>Sorry, failed to load file.</p><p><i>Cannot have a preset named " 2700 "\"%1\"</i></p>", name)); 2701 } else { 2702 QString qtcFile(file); 2703 std::unique_ptr<KZip> zip(compressed ? new KZip(file) : nullptr); 2704 std::unique_ptr<QTemporaryDir> tmpDir; 2705 if (compressed) { 2706 qtcFile = QString(); 2707 if (!zip->open(QIODevice::ReadOnly)) { 2708 KMessageBox::error(this, i18n("Sorry, failed to open " 2709 "compressed file.")); 2710 } else { 2711 const KArchiveDirectory *zipDir=zip->directory(); 2712 2713 if (zipDir) { 2714 tmpDir.reset(new QTemporaryDir(QDir::tempPath() + 2715 "/qtcurve")); 2716 tmpDir->setAutoRemove(false); // true); 2717 zipDir->copyTo(tmpDir->path(), false); 2718 2719 // Find settings file... 2720 QDir dir(tmpDir->path()); 2721 foreach (const QString &file, dir.entryList()) { 2722 if (file.endsWith(EXTENSION)) { 2723 qtcFile = dir.path() + "/" + file; 2724 } 2725 } 2726 if (qtcFile.isEmpty()) 2727 KMessageBox::error(this, i18n("Invalid compressed settings file.\n(Could not locate settings file.)")); 2728 } else { 2729 KMessageBox::error(this, i18n("Invalid compressed settings file.\n(Could not list ZIP contents.)")); 2730 } 2731 } 2732 } 2733 2734 if (!qtcFile.isEmpty()) { 2735 if (qtcReadConfig(qtcFile, &opts, &presets[defaultText].opts, 2736 false)) { 2737 name = getPresetName(i18n("Import Preset"), QString(), 2738 name, name); 2739 if (!name.isEmpty()) { 2740 QString qtcDir(QtCurve::qtcSaveDir()); 2741 name=name.replace(' ', '_'); 2742 2743 if (compressed && tmpDir) { 2744 // printf("IMPORT\n"); 2745 if (opts.bgndImage.type == IMG_FILE) { 2746 auto &bgndFile = opts.bgndImage.pixmap.file; 2747 QString fileName(name + BGND_FILE IMAGE_FILE + 2748 getExt(bgndFile)); 2749 saveThemeFile(tmpDir->path() + '/' + 2750 getFileName(bgndFile), 2751 BGND_FILE IMAGE_FILE, name); 2752 bgndFile = fileName; 2753 } 2754 if (opts.menuBgndImage.type == IMG_FILE) { 2755 auto &menuBgndFile = 2756 opts.menuBgndImage.pixmap.file; 2757 QString fileName(name + 2758 BGND_FILE MENU_FILE 2759 IMAGE_FILE + 2760 getExt(menuBgndFile)); 2761 saveThemeFile(tmpDir->path() + '/' + 2762 getFileName(menuBgndFile), 2763 BGND_FILE MENU_FILE IMAGE_FILE, 2764 name); 2765 menuBgndFile = fileName; 2766 } 2767 if (opts.bgndAppearance == APPEARANCE_FILE) { 2768 auto &bgndFile = opts.bgndPixmap.file; 2769 QString fileName(name + BGND_FILE + 2770 getExt(bgndFile)); 2771 bgndFile = fileName; 2772 saveThemeFile(tmpDir->path() + '/' + 2773 getFileName(bgndFile), BGND_FILE, 2774 name); 2775 } 2776 if (opts.menuBgndAppearance == APPEARANCE_FILE) { 2777 auto &menuBgndFile = opts.menuBgndPixmap.file; 2778 QString fileName(name + BGND_FILE MENU_FILE + 2779 getExt(menuBgndFile)); 2780 saveThemeFile(tmpDir->path() + '/' + 2781 getFileName(menuBgndFile), 2782 BGND_FILE MENU_FILE, name); 2783 menuBgndFile = fileName; 2784 } 2785 } 2786 2787 readyForPreview = false; 2788 setWidgetOptions(opts); 2789 savePreset(name); 2790 2791 // Load kwin options - if present 2792 KConfig cfg(qtcFile, KConfig::SimpleConfig); 2793 2794 if(cfg.hasGroup(KWIN_GROUP)) 2795 { 2796 KConfigGroup grp(&cfg, SETTINGS_GROUP); 2797 QStringList ver(grp.readEntry("version", QString()).split('.')); 2798 2799 if (ver.count() >= 3 && 2800 qtcMakeVersion(ver[0].toInt(), 2801 ver[1].toInt()) >= 2802 VERSION_WITH_KWIN_SETTINGS) { 2803 kwin->load(&cfg); 2804 } 2805 } 2806 readyForPreview = true; 2807 updatePreview(); 2808 } 2809 } else { 2810 KMessageBox::error(this, 2811 i18n("Sorry, failed to load file.")); 2812 } 2813 } 2814 } 2815 } 2816 } 2817 2818 void QtCurveConfig::exportPreset() 2819 { 2820 #ifdef QTC_QT5_STYLE_SUPPORT 2821 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2822 switch (KMessageBox::questionTwoActionsCancel( 2823 #else 2824 switch (KMessageBox::questionYesNoCancel( 2825 #endif 2826 this, i18n("<p>In which format would you like to export the " 2827 "QtCurve settings?<ul><li><i>QtCurve settings " 2828 "file</i> - a file to be imported via this config " 2829 "dialog.</li><li><i>Standalone theme</i> - " 2830 "a style that user\'s can select from the KDE " 2831 "style panel.</li></ul></p>"), 2832 i18n("Export Settings"), 2833 KGuiItem(i18n("QtCurve Settings File")), 2834 KGuiItem(i18n("Standalone Theme")))) { 2835 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2836 case KMessageBox::SecondaryAction: 2837 #else 2838 case KMessageBox::No: 2839 #endif 2840 exportTheme(); 2841 case KMessageBox::Cancel: 2842 return; 2843 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) 2844 case KMessageBox::PrimaryAction: 2845 #else 2846 case KMessageBox::Yes: 2847 #endif 2848 break; 2849 } 2850 #endif 2851 2852 bool compressed = haveImages(); 2853 auto file = QFileDialog::getSaveFileName(this, i18n("Save As"), QString(), 2854 i18n("QtCurve Settings Files (*" EXTENSION ")")); 2855 2856 if (!file.isEmpty()) { 2857 bool rv = [&] { 2858 std::unique_ptr<KZip> zip(compressed ? new KZip(file) : nullptr); 2859 if (zip && zip->open(QIODevice::WriteOnly)) 2860 return false; 2861 std::unique_ptr<QTemporaryFile> temp( 2862 compressed ? new QTemporaryFile() : nullptr); 2863 if (temp && !temp->open()) 2864 return false; 2865 KConfig cfg(compressed ? temp->fileName() : file, 2866 KConfig::NoGlobals); 2867 Options opts; 2868 QString bgndImageName; 2869 QString menuBgndImageName; 2870 QString bgndPixmapName; 2871 QString menuBgndPixmapName; 2872 QString themeName(getFileName(file).remove(EXTENSION) 2873 .replace(' ', '_')); 2874 setOptions(opts); 2875 if (compressed) { 2876 if (opts.bgndImage.type == IMG_FILE) { 2877 bgndImageName = getThemeFile(opts.bgndImage.pixmap.file); 2878 opts.bgndImage.pixmap.file = (themeName + 2879 BGND_FILE IMAGE_FILE + 2880 getExt(bgndImageName)); 2881 } 2882 if (opts.menuBgndImage.type == IMG_FILE) { 2883 menuBgndImageName = 2884 getThemeFile(opts.menuBgndImage.pixmap.file); 2885 opts.menuBgndImage.pixmap.file = 2886 (themeName + BGND_FILE MENU_FILE IMAGE_FILE + 2887 getExt(menuBgndImageName)); 2888 } 2889 if (opts.bgndAppearance == APPEARANCE_FILE) { 2890 bgndPixmapName = getThemeFile(opts.bgndPixmap.file); 2891 opts.bgndPixmap.file = 2892 themeName + BGND_FILE + getExt(bgndPixmapName); 2893 } 2894 if (opts.menuBgndAppearance == APPEARANCE_FILE) { 2895 menuBgndPixmapName = getThemeFile(opts.menuBgndPixmap.file); 2896 opts.menuBgndPixmap.file = 2897 themeName + BGND_FILE MENU_FILE + 2898 getExt(menuBgndPixmapName); 2899 } 2900 } 2901 if (!qtcWriteConfig(&cfg, opts, presets[defaultText].opts, true)) 2902 return false; 2903 kwin->save(&cfg); 2904 if (compressed) { 2905 zip->addLocalFile(temp->fileName(), themeName + EXTENSION); 2906 if (!bgndImageName.isEmpty()) 2907 zip->addLocalFile(bgndImageName, 2908 opts.bgndImage.pixmap.file); 2909 if (!menuBgndImageName.isEmpty()) 2910 zip->addLocalFile(menuBgndImageName, 2911 opts.menuBgndImage.pixmap.file); 2912 if (!bgndPixmapName.isEmpty()) 2913 zip->addLocalFile(bgndPixmapName, opts.bgndPixmap.file); 2914 if (!menuBgndPixmapName.isEmpty()) 2915 zip->addLocalFile(menuBgndPixmapName, 2916 opts.menuBgndPixmap.file); 2917 zip->close(); 2918 } 2919 return true; 2920 }(); 2921 if (!rv) { 2922 KMessageBox::error(this, i18n("Could not write to file:\n%1", 2923 file)); 2924 } 2925 } 2926 } 2927 2928 void QtCurveConfig::exportTheme() 2929 { 2930 #ifdef QTC_QT5_STYLE_SUPPORT 2931 if(!exportDialog) 2932 exportDialog=new CExportThemeDialog(this); 2933 2934 Options opts; 2935 2936 setOptions(opts); 2937 exportDialog->run(opts); 2938 #endif 2939 } 2940 2941 int QtCurveConfig::getTitleBarButtonFlags() 2942 { 2943 int titlebarButtons=0; 2944 2945 if(titlebarButtons_button->isChecked()) 2946 titlebarButtons+=TITLEBAR_BUTTON_STD_COLOR; 2947 if(titlebarButtons_custom->isChecked()) 2948 titlebarButtons+=TITLEBAR_BUTTON_COLOR; 2949 if(titlebarButtons_customIcon->isChecked()) 2950 titlebarButtons+=TITLEBAR_BUTTON_ICON_COLOR; 2951 if(titlebarButtons_noFrame->isChecked()) 2952 titlebarButtons+=TITLEBAR_BUTTON_NO_FRAME; 2953 if(titlebarButtons_round->isChecked()) 2954 titlebarButtons+=TITLEBAR_BUTTON_ROUND; 2955 if(titlebarButtons_hoverFrame->isChecked()) 2956 titlebarButtons+=TITLEBAR_BUTTON_HOVER_FRAME; 2957 if(titlebarButtons_hoverSymbol->isChecked()) 2958 titlebarButtons+=TITLEBAR_BUTTON_HOVER_SYMBOL; 2959 if(titlebarButtons_hoverSymbolFull->isChecked()) 2960 titlebarButtons+=TITLEBAR_BUTTON_HOVER_SYMBOL_FULL; 2961 if(titlebarButtons_colorOnMouseOver->isChecked()) 2962 titlebarButtons+=TITLEBAR_BUTTON_COLOR_MOUSE_OVER; 2963 if(titlebarButtons_colorInactive->isChecked()) 2964 titlebarButtons+=TITLEBAR_BUTTON_COLOR_INACTIVE; 2965 if(titlebarButtons_colorSymbolsOnly->isChecked()) 2966 titlebarButtons+=TITLEBAR_BUTTON_COLOR_SYMBOL; 2967 if(titlebarButtons_sunkenBackground->isChecked()) 2968 titlebarButtons+=TITLEBAR_BUTTON_SUNKEN_BACKGROUND; 2969 if(titlebarButtons_arrowMinMax->isChecked()) 2970 titlebarButtons+=TITLEBAR_BUTTOM_ARROW_MIN_MAX; 2971 if(titlebarButtons_hideOnInactiveWindow->isChecked()) 2972 titlebarButtons+=TITLEBAR_BUTTOM_HIDE_ON_INACTIVE_WINDOW; 2973 if(titlebarButtons_useHover->isChecked()) 2974 titlebarButtons+=TITLEBAR_BUTTON_USE_HOVER_COLOR; 2975 return titlebarButtons; 2976 } 2977 2978 int QtCurveConfig::getGroupBoxLabelFlags() 2979 { 2980 int flags=0; 2981 if(gbLabel_bold->isChecked()) 2982 flags+=GB_LBL_BOLD; 2983 if(gbLabel_centred->isChecked()) 2984 flags+=GB_LBL_CENTRED; 2985 switch(gbLabel_textPos->currentIndex()) 2986 { 2987 case GBV_INSIDE: 2988 flags+=GB_LBL_INSIDE; 2989 break; 2990 case GBV_OUTSIDE: 2991 flags+=GB_LBL_OUTSIDE; 2992 default: 2993 break; 2994 } 2995 return flags; 2996 } 2997 2998 void QtCurveConfig::setOptions(Options &opts) 2999 { 3000 opts.round=(ERound)round->currentIndex(); 3001 opts.toolbarBorders=(ETBarBorder)toolbarBorders->currentIndex(); 3002 opts.appearance=(EAppearance)appearance->currentIndex(); 3003 opts.focus=(EFocus)focus->currentIndex(); 3004 opts.lvLines=lvLines->isChecked(); 3005 opts.lvButton=lvButton->isChecked(); 3006 opts.drawStatusBarFrames=drawStatusBarFrames->isChecked(); 3007 opts.buttonEffect=(EEffect)buttonEffect->currentIndex(); 3008 opts.coloredMouseOver=(EMouseOver)coloredMouseOver->currentIndex(); 3009 opts.menubarMouseOver=menubarMouseOver->isChecked(); 3010 opts.shadeMenubarOnlyWhenActive=shadeMenubarOnlyWhenActive->isChecked(); 3011 opts.thin=getThinFlags(); 3012 opts.animatedProgress=animatedProgress->isChecked(); 3013 opts.stripedProgress=(EStripe)stripedProgress->currentIndex(); 3014 opts.lighterPopupMenuBgnd=lighterPopupMenuBgnd->value(); 3015 opts.tabBgnd=tabBgnd->value(); 3016 opts.menuDelay=menuDelay->value(); 3017 opts.menuCloseDelay=menuCloseDelay->value(); 3018 opts.sliderWidth=sliderWidth->value(); 3019 opts.menuStripe=(EShade)menuStripe->currentIndex(); 3020 opts.customMenuStripeColor=customMenuStripeColor->color(); 3021 opts.menuStripeAppearance=(EAppearance)menuStripeAppearance->currentIndex(); 3022 opts.bgndGrad=(EGradType)bgndGrad->currentIndex(); 3023 opts.menuBgndGrad=(EGradType)menuBgndGrad->currentIndex(); 3024 opts.embolden=embolden->isChecked(); 3025 opts.scrollbarType=(EScrollbar)scrollbarType->currentIndex(); 3026 opts.defBtnIndicator=(EDefBtnIndicator)defBtnIndicator->currentIndex(); 3027 opts.sliderThumbs=(ELine)sliderThumbs->currentIndex(); 3028 opts.handles=(ELine)handles->currentIndex(); 3029 opts.highlightTab=highlightTab->isChecked(); 3030 opts.shadeSliders=(EShade)shadeSliders->currentIndex(); 3031 opts.shadeMenubars=(EShade)shadeMenubars->currentIndex(); 3032 opts.menubarAppearance=(EAppearance)menubarAppearance->currentIndex(); 3033 opts.toolbarAppearance=(EAppearance)toolbarAppearance->currentIndex(); 3034 opts.lvAppearance=(EAppearance)lvAppearance->currentIndex(); 3035 opts.sliderAppearance=(EAppearance)sliderAppearance->currentIndex(); 3036 opts.tabAppearance=(EAppearance)tabAppearance->currentIndex(); 3037 opts.activeTabAppearance=(EAppearance)activeTabAppearance->currentIndex(); 3038 opts.toolbarSeparators=(ELine)toolbarSeparators->currentIndex(); 3039 opts.splitters=(ELine)splitters->currentIndex(); 3040 opts.customSlidersColor=customSlidersColor->color(); 3041 opts.customMenubarsColor=customMenubarsColor->color(); 3042 opts.highlightFactor=highlightFactor->value(); 3043 opts.customMenuNormTextColor=customMenuNormTextColor->color(); 3044 opts.customMenuSelTextColor=customMenuSelTextColor->color(); 3045 opts.customMenuTextColor=customMenuTextColor->isChecked(); 3046 opts.fillSlider=fillSlider->isChecked(); 3047 opts.stripedSbar=stripedSbar->isChecked(); 3048 opts.sliderStyle=(ESliderStyle)sliderStyle->currentIndex(); 3049 opts.roundMbTopOnly=roundMbTopOnly->isChecked(); 3050 opts.menubarHiding=getHideFlags(menubarHiding_keyboard, menubarHiding_kwin); 3051 opts.statusbarHiding=getHideFlags(statusbarHiding_keyboard, statusbarHiding_kwin); 3052 opts.fillProgress=fillProgress->isChecked(); 3053 opts.glowProgress=(EGlow)glowProgress->currentIndex(); 3054 opts.darkerBorders=darkerBorders->isChecked(); 3055 opts.comboSplitter=comboSplitter->isChecked(); 3056 opts.comboBtn=(EShade)comboBtn->currentIndex(); 3057 opts.customComboBtnColor=customComboBtnColor->color(); 3058 opts.sortedLv=(EShade)sortedLv->currentIndex(); 3059 opts.customSortedLvColor=customSortedLvColor->color(); 3060 opts.unifySpinBtns=unifySpinBtns->isChecked(); 3061 opts.unifySpin=unifySpin->isChecked(); 3062 opts.unifyCombo=unifyCombo->isChecked(); 3063 opts.vArrows=vArrows->isChecked(); 3064 opts.xCheck=xCheck->isChecked(); 3065 opts.hideShortcutUnderline=hideShortcutUnderline->isChecked(); 3066 opts.crHighlight=crHighlight->value(); 3067 opts.expanderHighlight=expanderHighlight->value(); 3068 opts.crButton=crButton->isChecked(); 3069 opts.colorSelTab=colorSelTab->value(); 3070 opts.roundAllTabs=roundAllTabs->isChecked(); 3071 opts.borderTab=borderTab->isChecked(); 3072 opts.borderInactiveTab=borderInactiveTab->isChecked(); 3073 opts.invertBotTab=invertBotTab->isChecked(); 3074 opts.doubleGtkComboArrow=doubleGtkComboArrow->isChecked(); 3075 opts.tabMouseOver=(ETabMo)tabMouseOver->currentIndex(); 3076 opts.stdSidebarButtons=stdSidebarButtons->isChecked(); 3077 opts.toolbarTabs=toolbarTabs->isChecked(); 3078 opts.centerTabText=centerTabText->isChecked(); 3079 opts.borderMenuitems=borderMenuitems->isChecked(); 3080 opts.shadePopupMenu=shadePopupMenu->isChecked(); 3081 opts.popupBorder=popupBorder->isChecked(); 3082 opts.progressAppearance=(EAppearance)progressAppearance->currentIndex(); 3083 opts.progressColor=(EShade)progressColor->currentIndex(); 3084 opts.customProgressColor=customProgressColor->color(); 3085 opts.progressGrooveAppearance=(EAppearance)progressGrooveAppearance->currentIndex(); 3086 opts.grooveAppearance=(EAppearance)grooveAppearance->currentIndex(); 3087 opts.sunkenAppearance=(EAppearance)sunkenAppearance->currentIndex(); 3088 opts.progressGrooveColor=(EColor)progressGrooveColor->currentIndex(); 3089 opts.menuitemAppearance=(EAppearance)menuitemAppearance->currentIndex(); 3090 opts.menuBgndAppearance=(EAppearance)menuBgndAppearance->currentIndex(); 3091 opts.titlebarAppearance=(EAppearance)titlebarAppearance->currentIndex(); 3092 opts.inactiveTitlebarAppearance=(EAppearance)inactiveTitlebarAppearance->currentIndex(); 3093 opts.titlebarButtonAppearance=(EAppearance)titlebarButtonAppearance->currentIndex(); 3094 opts.windowBorder=getWindowBorderFlags(); 3095 opts.selectionAppearance=(EAppearance)selectionAppearance->currentIndex(); 3096 opts.shadeCheckRadio=(EShade)shadeCheckRadio->currentIndex(); 3097 opts.customCheckRadioColor=customCheckRadioColor->color(); 3098 opts.shading=(Shading)shading->currentIndex(); 3099 opts.gtkScrollViews=gtkScrollViews->isChecked(); 3100 opts.highlightScrollViews=highlightScrollViews->isChecked(); 3101 opts.etchEntry=etchEntry->isChecked(); 3102 opts.flatSbarButtons=flatSbarButtons->isChecked(); 3103 opts.borderSbarGroove=borderSbarGroove->isChecked(); 3104 opts.thinSbarGroove=thinSbarGroove->isChecked(); 3105 opts.colorSliderMouseOver=colorSliderMouseOver->isChecked(); 3106 opts.windowDrag=windowDrag->currentIndex(); 3107 opts.sbarBgndAppearance=(EAppearance)sbarBgndAppearance->currentIndex(); 3108 opts.sliderFill=(EAppearance)sliderFill->currentIndex(); 3109 opts.bgndAppearance=(EAppearance)bgndAppearance->currentIndex(); 3110 opts.bgndImage.type=(EImageType)bgndImage->currentIndex(); 3111 opts.bgndOpacity=bgndOpacity->value(); 3112 opts.dlgOpacity=dlgOpacity->value(); 3113 opts.menuBgndImage.type=(EImageType)menuBgndImage->currentIndex(); 3114 opts.menuBgndOpacity=menuBgndOpacity->value(); 3115 opts.shadowSize=dropShadowSize->value(); 3116 qtcX11SetShadowSize(opts.shadowSize); 3117 opts.dwtAppearance=(EAppearance)dwtAppearance->currentIndex(); 3118 opts.tooltipAppearance=(EAppearance)tooltipAppearance->currentIndex(); 3119 opts.crColor=(EShade)crColor->currentIndex(); 3120 opts.customCrBgndColor=customCrBgndColor->color(); 3121 opts.smallRadio=smallRadio->isChecked(); 3122 opts.splitterHighlight=splitterHighlight->value(); 3123 opts.gtkComboMenus=gtkComboMenus->isChecked(); 3124 opts.gtkButtonOrder=gtkButtonOrder->isChecked(); 3125 opts.reorderGtkButtons=reorderGtkButtons->isChecked(); 3126 opts.mapKdeIcons=mapKdeIcons->isChecked(); 3127 opts.passwordChar=toInt(passwordChar->text()); 3128 opts.groupBox=(EFrame)groupBox->currentIndex(); 3129 opts.gbFactor=gbFactor->value(); 3130 opts.customGradient=customGradient; 3131 opts.colorMenubarMouseOver=colorMenubarMouseOver->isChecked(); 3132 opts.useHighlightForMenu=useHighlightForMenu->isChecked(); 3133 opts.gbLabel=getGroupBoxLabelFlags(); 3134 opts.fadeLines=fadeLines->isChecked(); 3135 opts.menuIcons=menuIcons->isChecked(); 3136 opts.onlyTicksInMenu=onlyTicksInMenu->isChecked(); 3137 opts.buttonStyleMenuSections=buttonStyleMenuSections->isChecked(); 3138 opts.stdBtnSizes=stdBtnSizes->isChecked(); 3139 opts.boldProgress=boldProgress->isChecked(); 3140 opts.coloredTbarMo=coloredTbarMo->isChecked(); 3141 opts.tbarBtns=(ETBarBtn)tbarBtns->currentIndex(); 3142 opts.tbarBtnAppearance=(EAppearance)tbarBtnAppearance->currentIndex(); 3143 opts.tbarBtnEffect=(EEffect)tbarBtnEffect->currentIndex(); 3144 opts.borderSelection=borderSelection->isChecked(); 3145 opts.forceAlternateLvCols=forceAlternateLvCols->isChecked(); 3146 opts.titlebarAlignment=(EAlign)titlebarAlignment->currentIndex(); 3147 opts.titlebarEffect=(EEffect)titlebarEffect->currentIndex(); 3148 opts.titlebarIcon=(ETitleBarIcon)titlebarIcon->currentIndex(); 3149 opts.dwtSettings=getDwtSettingsFlags(); 3150 opts.crSize=getCrSize(crSize); 3151 opts.square=getSquareFlags(); 3152 3153 opts.borderProgress=borderProgress->isChecked(); 3154 3155 if(customShading->isChecked()) 3156 { 3157 for(int i=0; i<QTC_NUM_STD_SHADES; ++i) 3158 opts.customShades[i]=shadeVals[i]->value(); 3159 } 3160 else 3161 opts.customShades[0]=0; 3162 3163 if(customAlphas->isChecked()) 3164 { 3165 for(int i=0; i<NUM_STD_ALPHAS; ++i) 3166 opts.customAlphas[i]=alphaVals[i]->value(); 3167 } 3168 else 3169 opts.customAlphas[0]=0; 3170 3171 opts.titlebarButtons=getTitleBarButtonFlags(); 3172 // don't clear the options since we may not be setting all of them again 3173 // for the same reason we always update opts.titlebarButtonColors; they may not be 3174 // used but the colour info shouldn't be lost. 3175 opts.titlebarButtonColors[TITLEBAR_CLOSE]=titlebarButtons_colorClose->color(); 3176 opts.titlebarButtonColors[TITLEBAR_MIN]=titlebarButtons_colorMin->color(); 3177 opts.titlebarButtonColors[TITLEBAR_MAX]=titlebarButtons_colorMax->color(); 3178 opts.titlebarButtonColors[TITLEBAR_KEEP_ABOVE]=titlebarButtons_colorKeepAbove->color(); 3179 opts.titlebarButtonColors[TITLEBAR_KEEP_BELOW]=titlebarButtons_colorKeepBelow->color(); 3180 opts.titlebarButtonColors[TITLEBAR_HELP]=titlebarButtons_colorHelp->color(); 3181 opts.titlebarButtonColors[TITLEBAR_MENU]=titlebarButtons_colorMenu->color(); 3182 opts.titlebarButtonColors[TITLEBAR_SHADE]=titlebarButtons_colorShade->color(); 3183 opts.titlebarButtonColors[TITLEBAR_ALL_DESKTOPS]=titlebarButtons_colorAllDesktops->color(); 3184 3185 int offset=NUM_TITLEBAR_BUTTONS; 3186 opts.titlebarButtonColors[TITLEBAR_CLOSE+offset]=titlebarButtons_colorCloseIcon->color(); 3187 opts.titlebarButtonColors[TITLEBAR_MIN+offset]=titlebarButtons_colorMinIcon->color(); 3188 opts.titlebarButtonColors[TITLEBAR_MAX+offset]=titlebarButtons_colorMaxIcon->color(); 3189 opts.titlebarButtonColors[TITLEBAR_KEEP_ABOVE+offset]=titlebarButtons_colorKeepAboveIcon->color(); 3190 opts.titlebarButtonColors[TITLEBAR_KEEP_BELOW+offset]=titlebarButtons_colorKeepBelowIcon->color(); 3191 opts.titlebarButtonColors[TITLEBAR_HELP+offset]=titlebarButtons_colorHelpIcon->color(); 3192 opts.titlebarButtonColors[TITLEBAR_MENU+offset]=titlebarButtons_colorMenuIcon->color(); 3193 opts.titlebarButtonColors[TITLEBAR_SHADE+offset]=titlebarButtons_colorShadeIcon->color(); 3194 opts.titlebarButtonColors[TITLEBAR_ALL_DESKTOPS+offset]=titlebarButtons_colorAllDesktopsIcon->color(); 3195 offset+=NUM_TITLEBAR_BUTTONS; 3196 opts.titlebarButtonColors[TITLEBAR_CLOSE+offset]=titlebarButtons_colorCloseInactiveIcon->color(); 3197 opts.titlebarButtonColors[TITLEBAR_MIN+offset]=titlebarButtons_colorMinInactiveIcon->color(); 3198 opts.titlebarButtonColors[TITLEBAR_MAX+offset]=titlebarButtons_colorMaxInactiveIcon->color(); 3199 opts.titlebarButtonColors[TITLEBAR_KEEP_ABOVE+offset]=titlebarButtons_colorKeepAboveInactiveIcon->color(); 3200 opts.titlebarButtonColors[TITLEBAR_KEEP_BELOW+offset]=titlebarButtons_colorKeepBelowInactiveIcon->color(); 3201 opts.titlebarButtonColors[TITLEBAR_HELP+offset]=titlebarButtons_colorHelpInactiveIcon->color(); 3202 opts.titlebarButtonColors[TITLEBAR_MENU+offset]=titlebarButtons_colorMenuInactiveIcon->color(); 3203 opts.titlebarButtonColors[TITLEBAR_SHADE+offset]=titlebarButtons_colorShadeInactiveIcon->color(); 3204 opts.titlebarButtonColors[TITLEBAR_ALL_DESKTOPS+offset]=titlebarButtons_colorAllDesktopsInactiveIcon->color(); 3205 3206 opts.noBgndGradientApps=toSet(noBgndGradientApps->text()); 3207 opts.noBgndOpacityApps=toSet(noBgndOpacityApps->text()); 3208 opts.noMenuBgndOpacityApps=toSet(noMenuBgndOpacityApps->text()); 3209 opts.noBgndImageApps=toSet(noBgndImageApps->text()); 3210 opts.useQtFileDialogApps=toSet(useQtFileDialogApps->text()); 3211 opts.menubarApps=toSet(menubarApps->text()); 3212 opts.statusbarApps=toSet(statusbarApps->text()); 3213 opts.noMenuStripeApps=toSet(noMenuStripeApps->text()); 3214 opts.nonnativeMenubarApps=toSet(nonnativeMenubarApps->text()); 3215 3216 if(IMG_FILE==opts.bgndImage.type) 3217 { 3218 opts.bgndImage.pixmap.file=getThemeFile(bgndImageDlg->fileName()); 3219 // printf("SET OP BGND:%s\n", opts.menuBgndImage.pixmap.file.toLatin1().constData()); 3220 opts.bgndImage.width=bgndImageDlg->imgWidth(); 3221 opts.bgndImage.height=bgndImageDlg->imgHeight(); 3222 opts.bgndImage.onBorder=bgndImageDlg->onWindowBorder(); 3223 opts.bgndImage.pos=(EPixPos)bgndImageDlg->imgPos(); 3224 opts.bgndImage.loaded=false; 3225 } 3226 if(APPEARANCE_FILE==opts.bgndAppearance) 3227 { 3228 opts.bgndPixmap.file=getThemeFile(bgndPixmapDlg->fileName()); 3229 if((&opts) == (&previewStyle)) 3230 opts.bgndPixmap.img=QPixmap(opts.bgndPixmap.file); 3231 } 3232 if(IMG_FILE==opts.menuBgndImage.type) 3233 { 3234 opts.menuBgndImage.pixmap.file=getThemeFile(menuBgndImageDlg->fileName()); 3235 // printf("SET OP MENU:%s\n", opts.menuBgndImage.pixmap.file.toLatin1().constData()); 3236 opts.menuBgndImage.width=menuBgndImageDlg->imgWidth(); 3237 opts.menuBgndImage.height=menuBgndImageDlg->imgHeight(); 3238 opts.menuBgndImage.onBorder=false; // Not used!!! 3239 opts.menuBgndImage.pos=(EPixPos)menuBgndImageDlg->imgPos(); 3240 opts.menuBgndImage.loaded=false; 3241 } 3242 if(APPEARANCE_FILE==opts.menuBgndAppearance) 3243 { 3244 opts.menuBgndPixmap.file=getThemeFile(menuBgndPixmapDlg->fileName()); 3245 if((&opts) == (&previewStyle)) 3246 opts.menuBgndPixmap.img=QPixmap(opts.menuBgndPixmap.file); 3247 } 3248 } 3249 3250 static QColor getColor(const TBCols &cols, int btn, int offset=0, const QColor &def=Qt::black) 3251 { 3252 TBCols::const_iterator it=cols.find(btn+(NUM_TITLEBAR_BUTTONS*offset)); 3253 3254 return cols.end()==it ? def : (*it).second; 3255 } 3256 3257 void QtCurveConfig::setWidgetOptions(const Options &opts) 3258 { 3259 round->setCurrentIndex(opts.round); 3260 scrollbarType->setCurrentIndex(opts.scrollbarType); 3261 lighterPopupMenuBgnd->setValue(opts.lighterPopupMenuBgnd); 3262 tabBgnd->setValue(opts.tabBgnd); 3263 menuDelay->setValue(opts.menuDelay); 3264 menuCloseDelay->setValue(opts.menuCloseDelay); 3265 sliderWidth->setValue(opts.sliderWidth); 3266 menuStripe->setCurrentIndex(opts.menuStripe); 3267 customMenuStripeColor->setColor(opts.customMenuStripeColor); 3268 menuStripeAppearance->setCurrentIndex(opts.menuStripeAppearance); 3269 bgndGrad->setCurrentIndex(opts.bgndGrad); 3270 menuBgndGrad->setCurrentIndex(opts.menuBgndGrad); 3271 toolbarBorders->setCurrentIndex(opts.toolbarBorders); 3272 sliderThumbs->setCurrentIndex(opts.sliderThumbs); 3273 handles->setCurrentIndex(opts.handles); 3274 appearance->setCurrentIndex(opts.appearance); 3275 focus->setCurrentIndex(opts.focus); 3276 lvLines->setChecked(opts.lvLines); 3277 lvButton->setChecked(opts.lvButton); 3278 drawStatusBarFrames->setChecked(opts.drawStatusBarFrames); 3279 buttonEffect->setCurrentIndex(opts.buttonEffect); 3280 coloredMouseOver->setCurrentIndex(opts.coloredMouseOver); 3281 menubarMouseOver->setChecked(opts.menubarMouseOver); 3282 shadeMenubarOnlyWhenActive->setChecked(opts.shadeMenubarOnlyWhenActive); 3283 thin_menuitems->setChecked(opts.thin&THIN_MENU_ITEMS); 3284 thin_buttons->setChecked(opts.thin&THIN_BUTTONS); 3285 thin_frames->setChecked(opts.thin&THIN_FRAMES); 3286 animatedProgress->setChecked(opts.animatedProgress); 3287 stripedProgress->setCurrentIndex(opts.stripedProgress); 3288 embolden->setChecked(opts.embolden); 3289 defBtnIndicator->setCurrentIndex(opts.defBtnIndicator); 3290 highlightTab->setChecked(opts.highlightTab); 3291 menubarAppearance->setCurrentIndex(opts.menubarAppearance); 3292 toolbarAppearance->setCurrentIndex(opts.toolbarAppearance); 3293 lvAppearance->setCurrentIndex(opts.lvAppearance); 3294 sliderAppearance->setCurrentIndex(opts.sliderAppearance); 3295 tabAppearance->setCurrentIndex(opts.tabAppearance); 3296 activeTabAppearance->setCurrentIndex(opts.activeTabAppearance); 3297 toolbarSeparators->setCurrentIndex(opts.toolbarSeparators); 3298 splitters->setCurrentIndex(opts.splitters); 3299 shadeSliders->setCurrentIndex(opts.shadeSliders); 3300 shadeMenubars->setCurrentIndex(opts.shadeMenubars); 3301 highlightFactor->setValue(opts.highlightFactor); 3302 customSlidersColor->setColor(opts.customSlidersColor); 3303 customMenubarsColor->setColor(opts.customMenubarsColor); 3304 customMenuNormTextColor->setColor(opts.customMenuNormTextColor); 3305 customMenuSelTextColor->setColor(opts.customMenuSelTextColor); 3306 customMenuTextColor->setChecked(opts.customMenuTextColor); 3307 3308 customSlidersColor->setEnabled(SHADE_CUSTOM==opts.shadeSliders); 3309 customMenubarsColor->setEnabled(SHADE_CUSTOM==opts.shadeMenubars); 3310 customMenuNormTextColor->setEnabled(customMenuTextColor->isChecked()); 3311 customMenuSelTextColor->setEnabled(customMenuTextColor->isChecked()); 3312 customCheckRadioColor->setEnabled(SHADE_CUSTOM==opts.shadeCheckRadio); 3313 customMenuStripeColor->setEnabled(SHADE_CUSTOM==opts.menuStripe); 3314 menuStripeAppearance->setEnabled(SHADE_NONE!=opts.menuStripe); 3315 3316 animatedProgress->setEnabled(STRIPE_NONE!=stripedProgress->currentIndex() && 3317 STRIPE_FADE!=stripedProgress->currentIndex()); 3318 3319 fillSlider->setChecked(opts.fillSlider); 3320 stripedSbar->setChecked(opts.stripedSbar); 3321 sliderStyle->setCurrentIndex(opts.sliderStyle); 3322 roundMbTopOnly->setChecked(opts.roundMbTopOnly); 3323 menubarHiding_keyboard->setChecked(opts.menubarHiding&HIDE_KEYBOARD); 3324 menubarHiding_kwin->setChecked(opts.menubarHiding&HIDE_KWIN); 3325 statusbarHiding_keyboard->setChecked(opts.statusbarHiding&HIDE_KEYBOARD); 3326 statusbarHiding_kwin->setChecked(opts.statusbarHiding&HIDE_KWIN); 3327 fillProgress->setChecked(opts.fillProgress); 3328 glowProgress->setCurrentIndex(opts.glowProgress); 3329 darkerBorders->setChecked(opts.darkerBorders); 3330 comboSplitter->setChecked(opts.comboSplitter); 3331 comboBtn->setCurrentIndex(opts.comboBtn); 3332 customComboBtnColor->setColor(opts.customComboBtnColor); 3333 sortedLv->setCurrentIndex(opts.sortedLv); 3334 customSortedLvColor->setColor(opts.customSortedLvColor); 3335 unifySpinBtns->setChecked(opts.unifySpinBtns); 3336 unifySpin->setChecked(opts.unifySpin); 3337 unifyCombo->setChecked(opts.unifyCombo); 3338 vArrows->setChecked(opts.vArrows); 3339 xCheck->setChecked(opts.xCheck); 3340 xCheck_false->setChecked(!opts.xCheck); 3341 hideShortcutUnderline->setChecked(opts.hideShortcutUnderline); 3342 crHighlight->setValue(opts.crHighlight); 3343 expanderHighlight->setValue(opts.expanderHighlight); 3344 crButton->setChecked(opts.crButton); 3345 colorSelTab->setValue(opts.colorSelTab); 3346 roundAllTabs->setChecked(opts.roundAllTabs); 3347 roundAllTabs_false->setChecked(!opts.roundAllTabs); 3348 borderTab->setChecked(opts.borderTab); 3349 borderInactiveTab->setChecked(opts.borderInactiveTab); 3350 invertBotTab->setChecked(opts.invertBotTab); 3351 doubleGtkComboArrow->setChecked(opts.doubleGtkComboArrow); 3352 borderTab_false->setChecked(!opts.borderTab); 3353 borderInactiveTab_false->setChecked(!opts.borderInactiveTab); 3354 invertBotTab_false->setChecked(!opts.invertBotTab); 3355 tabMouseOver->setCurrentIndex(opts.tabMouseOver); 3356 stdSidebarButtons->setChecked(opts.stdSidebarButtons); 3357 toolbarTabs->setChecked(opts.toolbarTabs); 3358 toolbarTabs_false->setChecked(!opts.toolbarTabs); 3359 centerTabText->setChecked(opts.centerTabText); 3360 centerTabText_false->setChecked(!opts.centerTabText); 3361 borderMenuitems->setChecked(opts.borderMenuitems); 3362 shadePopupMenu->setChecked(opts.shadePopupMenu); 3363 popupBorder->setChecked(opts.popupBorder); 3364 progressAppearance->setCurrentIndex(opts.progressAppearance); 3365 progressColor->setCurrentIndex(opts.progressColor); 3366 customProgressColor->setColor(opts.customProgressColor); 3367 progressGrooveAppearance->setCurrentIndex(opts.progressGrooveAppearance); 3368 grooveAppearance->setCurrentIndex(opts.grooveAppearance); 3369 sunkenAppearance->setCurrentIndex(opts.sunkenAppearance); 3370 progressGrooveColor->setCurrentIndex(opts.progressGrooveColor); 3371 menuitemAppearance->setCurrentIndex(opts.menuitemAppearance); 3372 menuBgndAppearance->setCurrentIndex(opts.menuBgndAppearance); 3373 titlebarAppearance->setCurrentIndex(opts.titlebarAppearance); 3374 inactiveTitlebarAppearance->setCurrentIndex(opts.inactiveTitlebarAppearance); 3375 titlebarButtonAppearance->setCurrentIndex(opts.titlebarButtonAppearance); 3376 windowBorder_colorTitlebarOnly->setChecked(opts.windowBorder&WINDOW_BORDER_COLOR_TITLEBAR_ONLY); 3377 windowBorder_blend->setChecked(opts.windowBorder&WINDOW_BORDER_BLEND_TITLEBAR); 3378 windowBorder_fill->setChecked(opts.windowBorder&WINDOW_BORDER_FILL_TITLEBAR); 3379 windowBorder_menuColor->setChecked(opts.windowBorder&WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR); 3380 windowBorder_separator->setChecked(opts.windowBorder&WINDOW_BORDER_SEPARATOR); 3381 selectionAppearance->setCurrentIndex(opts.selectionAppearance); 3382 shadeCheckRadio->setCurrentIndex(opts.shadeCheckRadio); 3383 customCheckRadioColor->setColor(opts.customCheckRadioColor); 3384 colorMenubarMouseOver->setChecked(opts.colorMenubarMouseOver); 3385 useHighlightForMenu->setChecked(opts.useHighlightForMenu); 3386 gbLabel_bold->setChecked(opts.gbLabel&GB_LBL_BOLD); 3387 gbLabel_centred->setChecked(opts.gbLabel&GB_LBL_CENTRED); 3388 gbLabel_textPos->setCurrentIndex(opts.gbLabel&GB_LBL_INSIDE 3389 ? GBV_INSIDE 3390 : opts.gbLabel&GB_LBL_OUTSIDE 3391 ? GBV_OUTSIDE 3392 : GBV_STANDARD); 3393 fadeLines->setChecked(opts.fadeLines); 3394 menuIcons->setChecked(opts.menuIcons); 3395 onlyTicksInMenu->setChecked(opts.onlyTicksInMenu); 3396 buttonStyleMenuSections->setChecked(opts.buttonStyleMenuSections); 3397 stdBtnSizes->setChecked(opts.stdBtnSizes); 3398 boldProgress->setChecked(opts.boldProgress); 3399 boldProgress_false->setChecked(!opts.boldProgress); 3400 coloredTbarMo->setChecked(opts.coloredTbarMo); 3401 coloredTbarMo_false->setChecked(!opts.coloredTbarMo); 3402 tbarBtns->setCurrentIndex(opts.tbarBtns); 3403 tbarBtnAppearance->setCurrentIndex(opts.tbarBtnAppearance); 3404 tbarBtnEffect->setCurrentIndex(opts.tbarBtnEffect); 3405 borderSelection->setChecked(opts.borderSelection); 3406 forceAlternateLvCols->setChecked(opts.forceAlternateLvCols); 3407 titlebarAlignment->setCurrentIndex(opts.titlebarAlignment); 3408 titlebarEffect->setCurrentIndex(opts.titlebarEffect); 3409 titlebarIcon->setCurrentIndex(opts.titlebarIcon); 3410 3411 shading->setCurrentIndex(int(opts.shading)); 3412 gtkScrollViews->setChecked(opts.gtkScrollViews); 3413 highlightScrollViews->setChecked(opts.highlightScrollViews); 3414 etchEntry->setChecked(opts.etchEntry); 3415 flatSbarButtons->setChecked(opts.flatSbarButtons); 3416 borderSbarGroove->setChecked(opts.borderSbarGroove); 3417 thinSbarGroove->setChecked(opts.thinSbarGroove); 3418 colorSliderMouseOver->setChecked(opts.colorSliderMouseOver); 3419 windowBorder_addLightBorder->setChecked(opts.windowBorder&WINDOW_BORDER_ADD_LIGHT_BORDER); 3420 windowDrag->setCurrentIndex(opts.windowDrag); 3421 sbarBgndAppearance->setCurrentIndex(opts.sbarBgndAppearance); 3422 sliderFill->setCurrentIndex(opts.sliderFill); 3423 bgndAppearance->setCurrentIndex(opts.bgndAppearance); 3424 bgndImage->setCurrentIndex(opts.bgndImage.type); 3425 bgndOpacity->setValue(opts.bgndOpacity); 3426 dlgOpacity->setValue(opts.dlgOpacity); 3427 menuBgndImage->setCurrentIndex(opts.menuBgndImage.type); 3428 menuBgndOpacity->setValue(opts.menuBgndOpacity); 3429 dropShadowSize->setValue(qtcX11ShadowSize()); 3430 dwtAppearance->setCurrentIndex(opts.dwtAppearance); 3431 tooltipAppearance->setCurrentIndex(opts.tooltipAppearance); 3432 dwtBtnAsPerTitleBar->setChecked(opts.dwtSettings&DWT_BUTTONS_AS_PER_TITLEBAR); 3433 dwtColAsPerTitleBar->setChecked(opts.dwtSettings&DWT_COLOR_AS_PER_TITLEBAR); 3434 dwtIconColAsPerTitleBar->setChecked(opts.dwtSettings&DWT_ICON_COLOR_AS_PER_TITLEBAR); 3435 dwtFontAsPerTitleBar->setChecked(opts.dwtSettings&DWT_FONT_AS_PER_TITLEBAR); 3436 dwtTextAsPerTitleBar->setChecked(opts.dwtSettings&DWT_TEXT_ALIGN_AS_PER_TITLEBAR); 3437 dwtEffectAsPerTitleBar->setChecked(opts.dwtSettings&DWT_EFFECT_AS_PER_TITLEBAR); 3438 dwtRoundTopOnly->setChecked(opts.dwtSettings&DWT_ROUND_TOP_ONLY); 3439 crColor->setCurrentIndex(opts.crColor); 3440 customCrBgndColor->setColor(opts.customCrBgndColor); 3441 smallRadio->setChecked(opts.smallRadio); 3442 smallRadio_false->setChecked(!opts.smallRadio); 3443 splitterHighlight->setValue(opts.splitterHighlight); 3444 gtkComboMenus->setChecked(opts.gtkComboMenus); 3445 gtkButtonOrder->setChecked(opts.gtkButtonOrder); 3446 reorderGtkButtons->setChecked(opts.reorderGtkButtons); 3447 mapKdeIcons->setChecked(opts.mapKdeIcons); 3448 setPasswordChar(opts.passwordChar); 3449 groupBox->setCurrentIndex(opts.groupBox); 3450 gbFactor->setValue(opts.gbFactor); 3451 customGradient=opts.customGradient; 3452 gradCombo->setCurrentIndex(APPEARANCE_CUSTOM1); 3453 borderProgress->setChecked(opts.borderProgress); 3454 3455 setCrSize(crSize, opts.crSize); 3456 3457 squareLvSelection->setChecked(opts.square&SQUARE_LISTVIEW_SELECTION); 3458 squareScrollViews->setChecked(opts.square&SQUARE_SCROLLVIEW); 3459 squareEntry->setChecked(opts.square&SQUARE_ENTRY); 3460 squareProgress->setChecked(opts.square&SQUARE_PROGRESS); 3461 squareFrame->setChecked(opts.square&SQUARE_FRAME); 3462 squareTabFrame->setChecked(opts.square&SQUARE_TAB_FRAME); 3463 squareSlider->setChecked(opts.square&SQUARE_SLIDER); 3464 squareScrollbarSlider->setChecked(opts.square&SQUARE_SB_SLIDER); 3465 squareWindows->setChecked(opts.square&SQUARE_WINDOWS); 3466 squareTooltips->setChecked(opts.square&SQUARE_TOOLTIPS); 3467 squarePopupMenus->setChecked(opts.square&SQUARE_POPUP_MENUS); 3468 3469 // Always set all colours in the dialog, even if they're not used. 3470 titlebarButtons_colorClose->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE)); 3471 titlebarButtons_colorMin->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MIN)); 3472 titlebarButtons_colorMax->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MAX)); 3473 titlebarButtons_colorKeepAbove->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE)); 3474 titlebarButtons_colorKeepBelow->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW)); 3475 titlebarButtons_colorHelp->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_HELP)); 3476 titlebarButtons_colorMenu->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MENU)); 3477 titlebarButtons_colorShade->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_SHADE)); 3478 titlebarButtons_colorAllDesktops->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS)); 3479 // however, we can disable the widgets when their info isn't used. 3480 if (!(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR)) { 3481 titlebarButtons_colorClose->setEnabled(false); 3482 titlebarButtons_colorMin->setEnabled(false); 3483 titlebarButtons_colorMax->setEnabled(false); 3484 titlebarButtons_colorKeepAbove->setEnabled(false); 3485 titlebarButtons_colorKeepBelow->setEnabled(false); 3486 titlebarButtons_colorHelp->setEnabled(false); 3487 titlebarButtons_colorMenu->setEnabled(false); 3488 titlebarButtons_colorShade->setEnabled(false); 3489 titlebarButtons_colorAllDesktops->setEnabled(false); 3490 } 3491 3492 titlebarButtons_colorCloseIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE, 1)); 3493 titlebarButtons_colorMinIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MIN, 1)); 3494 titlebarButtons_colorMaxIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MAX, 1)); 3495 titlebarButtons_colorKeepAboveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE, 1)); 3496 titlebarButtons_colorKeepBelowIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW, 1)); 3497 titlebarButtons_colorHelpIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_HELP, 1)); 3498 titlebarButtons_colorMenuIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MENU, 1)); 3499 titlebarButtons_colorShadeIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_SHADE, 1)); 3500 titlebarButtons_colorAllDesktopsIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS, 1)); 3501 3502 titlebarButtons_colorCloseInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE, 2)); 3503 titlebarButtons_colorMinInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MIN, 2)); 3504 titlebarButtons_colorMaxInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MAX, 2)); 3505 titlebarButtons_colorKeepAboveInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE, 2)); 3506 titlebarButtons_colorKeepBelowInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW, 2)); 3507 titlebarButtons_colorHelpInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_HELP, 2)); 3508 titlebarButtons_colorMenuInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_MENU, 2)); 3509 titlebarButtons_colorShadeInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_SHADE, 2)); 3510 titlebarButtons_colorAllDesktopsInactiveIcon->setColor(getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS, 2)); 3511 if (!(opts.titlebarButtons&TITLEBAR_BUTTON_ICON_COLOR)) { 3512 titlebarButtons_colorCloseIcon->setEnabled(false); 3513 titlebarButtons_colorMinIcon->setEnabled(false); 3514 titlebarButtons_colorMaxIcon->setEnabled(false); 3515 titlebarButtons_colorKeepAboveIcon->setEnabled(false); 3516 titlebarButtons_colorKeepBelowIcon->setEnabled(false); 3517 titlebarButtons_colorHelpIcon->setEnabled(false); 3518 titlebarButtons_colorMenuIcon->setEnabled(false); 3519 titlebarButtons_colorShadeIcon->setEnabled(false); 3520 titlebarButtons_colorAllDesktopsIcon->setEnabled(false); 3521 3522 titlebarButtons_colorCloseInactiveIcon->setEnabled(false); 3523 titlebarButtons_colorMinInactiveIcon->setEnabled(false); 3524 titlebarButtons_colorMaxInactiveIcon->setEnabled(false); 3525 titlebarButtons_colorKeepAboveInactiveIcon->setEnabled(false); 3526 titlebarButtons_colorKeepBelowInactiveIcon->setEnabled(false); 3527 titlebarButtons_colorHelpInactiveIcon->setEnabled(false); 3528 titlebarButtons_colorMenuInactiveIcon->setEnabled(false); 3529 titlebarButtons_colorShadeInactiveIcon->setEnabled(false); 3530 titlebarButtons_colorAllDesktopsInactiveIcon->setEnabled(false); 3531 } 3532 3533 titlebarButtons_button->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_STD_COLOR); 3534 titlebarButtons_custom->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR); 3535 titlebarButtons_customIcon->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_ICON_COLOR); 3536 titlebarButtons_noFrame->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_NO_FRAME); 3537 titlebarButtons_round->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_ROUND); 3538 titlebarButtons_hoverFrame->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_HOVER_FRAME); 3539 titlebarButtons_hoverSymbol->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_HOVER_SYMBOL); 3540 titlebarButtons_hoverSymbolFull->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_HOVER_SYMBOL_FULL); 3541 titlebarButtons_colorOnMouseOver->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR_MOUSE_OVER); 3542 titlebarButtons_colorInactive->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR_INACTIVE); 3543 titlebarButtons_colorSymbolsOnly->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_COLOR_SYMBOL); 3544 titlebarButtons_sunkenBackground->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_SUNKEN_BACKGROUND); 3545 titlebarButtons_arrowMinMax->setChecked(opts.titlebarButtons&TITLEBAR_BUTTOM_ARROW_MIN_MAX); 3546 titlebarButtons_hideOnInactiveWindow->setChecked(opts.titlebarButtons&TITLEBAR_BUTTOM_HIDE_ON_INACTIVE_WINDOW); 3547 titlebarButtons_useHover->setChecked(opts.titlebarButtons&TITLEBAR_BUTTON_USE_HOVER_COLOR); 3548 3549 populateShades(opts); 3550 3551 noBgndGradientApps->setText(toString(opts.noBgndGradientApps)); 3552 noBgndOpacityApps->setText(toString(opts.noBgndOpacityApps)); 3553 noMenuBgndOpacityApps->setText(toString(opts.noMenuBgndOpacityApps)); 3554 noBgndImageApps->setText(toString(opts.noBgndImageApps)); 3555 useQtFileDialogApps->setText(toString(opts.useQtFileDialogApps)); 3556 menubarApps->setText(toString(opts.menubarApps)); 3557 statusbarApps->setText(toString(opts.statusbarApps)); 3558 noMenuStripeApps->setText(toString(opts.noMenuStripeApps)); 3559 nonnativeMenubarApps->setText(toString(opts.nonnativeMenubarApps)); 3560 3561 bgndImageDlg->set(getThemeFile(opts.bgndImage.pixmap.file), opts.bgndImage.width, opts.bgndImage.height, 3562 opts.bgndImage.pos, opts.bgndImage.onBorder); 3563 // printf("SET WO BGND \"%s\" \"%s\"", opts.bgndImage.pixmap.file.toLatin1().constData(), bgndImageDlg->fileName().toLatin1().constData()); 3564 bgndPixmapDlg->set(getThemeFile(opts.bgndPixmap.file)); 3565 menuBgndImageDlg->set(getThemeFile(opts.menuBgndImage.pixmap.file), opts.menuBgndImage.width, opts.menuBgndImage.height, 3566 opts.menuBgndImage.pos); 3567 // printf("SET WO MENU \"%s\" \"%s\"", opts.menuBgndImage.pixmap.file.toLatin1().constData(), menuBgndImageDlg->fileName().toLatin1().constData()); 3568 menuBgndPixmapDlg->set(getThemeFile(opts.menuBgndPixmap.file)); 3569 } 3570 3571 int QtCurveConfig::getDwtSettingsFlags() 3572 { 3573 int dwt(0); 3574 3575 if(dwtBtnAsPerTitleBar->isChecked()) 3576 dwt|=DWT_BUTTONS_AS_PER_TITLEBAR; 3577 if(dwtColAsPerTitleBar->isChecked()) 3578 dwt|=DWT_COLOR_AS_PER_TITLEBAR; 3579 if(dwtIconColAsPerTitleBar->isChecked()) 3580 dwt|=DWT_ICON_COLOR_AS_PER_TITLEBAR; 3581 if(dwtFontAsPerTitleBar->isChecked()) 3582 dwt|=DWT_FONT_AS_PER_TITLEBAR; 3583 if(dwtTextAsPerTitleBar->isChecked()) 3584 dwt|=DWT_TEXT_ALIGN_AS_PER_TITLEBAR; 3585 if(dwtEffectAsPerTitleBar->isChecked()) 3586 dwt|=DWT_EFFECT_AS_PER_TITLEBAR; 3587 if(dwtRoundTopOnly->isChecked()) 3588 dwt|=DWT_ROUND_TOP_ONLY; 3589 return dwt; 3590 } 3591 3592 int QtCurveConfig::getSquareFlags() 3593 { 3594 int square(0); 3595 3596 if(squareEntry->isChecked()) 3597 square|=SQUARE_ENTRY; 3598 if(squareProgress->isChecked()) 3599 square|=SQUARE_PROGRESS; 3600 if(squareScrollViews->isChecked()) 3601 square|=SQUARE_SCROLLVIEW; 3602 if(squareLvSelection->isChecked()) 3603 square|=SQUARE_LISTVIEW_SELECTION; 3604 if(squareFrame->isChecked()) 3605 square|=SQUARE_FRAME; 3606 if(squareTabFrame->isChecked()) 3607 square|=SQUARE_TAB_FRAME; 3608 if(squareSlider->isChecked()) 3609 square|=SQUARE_SLIDER; 3610 if(squareScrollbarSlider->isChecked()) 3611 square|=SQUARE_SB_SLIDER; 3612 if(squareWindows->isChecked()) 3613 square|=SQUARE_WINDOWS; 3614 if(squareTooltips->isChecked()) 3615 square|=SQUARE_TOOLTIPS; 3616 if(squarePopupMenus->isChecked()) 3617 square|=SQUARE_POPUP_MENUS; 3618 return square; 3619 } 3620 3621 int QtCurveConfig::getWindowBorderFlags() 3622 { 3623 int flags(0); 3624 3625 if(windowBorder_colorTitlebarOnly->isChecked()) 3626 flags|=WINDOW_BORDER_COLOR_TITLEBAR_ONLY; 3627 if(windowBorder_menuColor->isChecked()) 3628 flags|=WINDOW_BORDER_USE_MENUBAR_COLOR_FOR_TITLEBAR; 3629 if(windowBorder_addLightBorder->isChecked()) 3630 flags|=WINDOW_BORDER_ADD_LIGHT_BORDER; 3631 if(windowBorder_blend->isChecked()) 3632 flags|=WINDOW_BORDER_BLEND_TITLEBAR; 3633 if(windowBorder_separator->isChecked()) 3634 flags|=WINDOW_BORDER_SEPARATOR; 3635 if(windowBorder_fill->isChecked()) 3636 flags|=WINDOW_BORDER_FILL_TITLEBAR; 3637 return flags; 3638 } 3639 3640 int QtCurveConfig::getThinFlags() 3641 { 3642 int flags(0); 3643 3644 if(thin_buttons->isChecked()) 3645 flags|=THIN_BUTTONS; 3646 if(thin_menuitems->isChecked()) 3647 flags|=THIN_MENU_ITEMS; 3648 if(thin_frames->isChecked()) 3649 flags|=THIN_FRAMES; 3650 return flags; 3651 } 3652 3653 bool QtCurveConfig::diffTitleBarButtonColors(const Options &opts) 3654 { 3655 return (titlebarButtons_custom->isChecked() && 3656 ( titlebarButtons_colorClose->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE) || 3657 titlebarButtons_colorMin->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MIN) || 3658 titlebarButtons_colorMax->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MAX) || 3659 titlebarButtons_colorKeepAbove->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE) || 3660 titlebarButtons_colorKeepBelow->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW) || 3661 titlebarButtons_colorHelp->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_HELP) || 3662 titlebarButtons_colorMenu->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MENU) || 3663 titlebarButtons_colorShade->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_SHADE) || 3664 titlebarButtons_colorAllDesktops->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS))) || 3665 (titlebarButtons_customIcon->isChecked() && 3666 ( titlebarButtons_colorCloseIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE, 1) || 3667 titlebarButtons_colorMinIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MIN, 1) || 3668 titlebarButtons_colorMaxIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MAX, 1) || 3669 titlebarButtons_colorKeepAboveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE, 1) || 3670 titlebarButtons_colorKeepBelowIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW, 1) || 3671 titlebarButtons_colorHelpIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_HELP, 1) || 3672 titlebarButtons_colorMenuIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MENU, 1) || 3673 titlebarButtons_colorShadeIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_SHADE, 1) || 3674 titlebarButtons_colorAllDesktopsIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS, 1) || 3675 titlebarButtons_colorCloseInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_CLOSE, 2) || 3676 titlebarButtons_colorMinInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MIN, 2) || 3677 titlebarButtons_colorMaxInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MAX, 2) || 3678 titlebarButtons_colorKeepAboveInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_ABOVE, 2) || 3679 titlebarButtons_colorKeepBelowInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_KEEP_BELOW, 2) || 3680 titlebarButtons_colorHelpInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_HELP, 2) || 3681 titlebarButtons_colorMenuInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_MENU, 2) || 3682 titlebarButtons_colorShadeInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_SHADE, 2) || 3683 titlebarButtons_colorAllDesktopsInactiveIcon->color()!=getColor(opts.titlebarButtonColors, TITLEBAR_ALL_DESKTOPS, 2))); 3684 } 3685 3686 bool QtCurveConfig::settingsChanged(const Options &opts) 3687 { 3688 return round->currentIndex()!=opts.round || 3689 toolbarBorders->currentIndex()!=opts.toolbarBorders || 3690 appearance->currentIndex()!=(int)opts.appearance || 3691 focus->currentIndex()!=(int)opts.focus || 3692 lvLines->isChecked()!=opts.lvLines || 3693 lvButton->isChecked()!=opts.lvButton || 3694 drawStatusBarFrames->isChecked()!=opts.drawStatusBarFrames || 3695 buttonEffect->currentIndex()!=(EEffect)opts.buttonEffect || 3696 coloredMouseOver->currentIndex()!=(int)opts.coloredMouseOver || 3697 menubarMouseOver->isChecked()!=opts.menubarMouseOver || 3698 shadeMenubarOnlyWhenActive->isChecked()!=opts.shadeMenubarOnlyWhenActive || 3699 getThinFlags()!=opts.thin || 3700 animatedProgress->isChecked()!=opts.animatedProgress || 3701 stripedProgress->currentIndex()!=opts.stripedProgress || 3702 lighterPopupMenuBgnd->value()!=opts.lighterPopupMenuBgnd || 3703 tabBgnd->value()!=opts.tabBgnd || 3704 menuDelay->value()!=opts.menuDelay || 3705 sliderWidth->value()!=opts.sliderWidth || 3706 menuStripe->currentIndex()!=opts.menuStripe || 3707 menuStripeAppearance->currentIndex()!=opts.menuStripeAppearance || 3708 bgndGrad->currentIndex()!=opts.bgndGrad || 3709 menuBgndGrad->currentIndex()!=opts.menuBgndGrad || 3710 embolden->isChecked()!=opts.embolden || 3711 fillSlider->isChecked()!=opts.fillSlider || 3712 stripedSbar->isChecked()!=opts.stripedSbar || 3713 sliderStyle->currentIndex()!=opts.sliderStyle || 3714 roundMbTopOnly->isChecked()!=opts.roundMbTopOnly || 3715 getHideFlags(menubarHiding_keyboard, menubarHiding_kwin)!=opts.menubarHiding || 3716 getHideFlags(statusbarHiding_keyboard, statusbarHiding_kwin)!=opts.statusbarHiding || 3717 fillProgress->isChecked()!=opts.fillProgress || 3718 glowProgress->currentIndex()!=opts.glowProgress || 3719 darkerBorders->isChecked()!=opts.darkerBorders || 3720 comboSplitter->isChecked()!=opts.comboSplitter || 3721 comboBtn->currentIndex()!=(int)opts.comboBtn || 3722 sortedLv->currentIndex()!=(int)opts.sortedLv || 3723 unifySpinBtns->isChecked()!=opts.unifySpinBtns || 3724 unifySpin->isChecked()!=opts.unifySpin || 3725 unifyCombo->isChecked()!=opts.unifyCombo || 3726 vArrows->isChecked()!=opts.vArrows || 3727 xCheck->isChecked()!=opts.xCheck || 3728 hideShortcutUnderline->isChecked()!=opts.hideShortcutUnderline || 3729 crHighlight->value()!=opts.crHighlight || 3730 expanderHighlight->value()!=opts.expanderHighlight || 3731 crButton->isChecked()!=opts.crButton || 3732 colorSelTab->value()!=opts.colorSelTab || 3733 roundAllTabs->isChecked()!=opts.roundAllTabs || 3734 borderTab->isChecked()!=opts.borderTab || 3735 borderInactiveTab->isChecked()!=opts.borderInactiveTab || 3736 invertBotTab->isChecked()!=opts.invertBotTab || 3737 doubleGtkComboArrow->isChecked()!=opts.doubleGtkComboArrow || 3738 tabMouseOver->currentIndex()!=opts.tabMouseOver || 3739 stdSidebarButtons->isChecked()!=opts.stdSidebarButtons || 3740 toolbarTabs->isChecked()!=opts.toolbarTabs || 3741 centerTabText->isChecked()!=opts.centerTabText || 3742 borderMenuitems->isChecked()!=opts.borderMenuitems || 3743 shadePopupMenu->isChecked()!=opts.shadePopupMenu || 3744 popupBorder->isChecked()!=opts.popupBorder || 3745 defBtnIndicator->currentIndex()!=(int)opts.defBtnIndicator || 3746 sliderThumbs->currentIndex()!=(int)opts.sliderThumbs || 3747 handles->currentIndex()!=(int)opts.handles || 3748 scrollbarType->currentIndex()!=(int)opts.scrollbarType || 3749 highlightTab->isChecked()!=opts.highlightTab || 3750 shadeSliders->currentIndex()!=(int)opts.shadeSliders || 3751 shadeMenubars->currentIndex()!=(int)opts.shadeMenubars || 3752 shadeCheckRadio->currentIndex()!=(int)opts.shadeCheckRadio || 3753 menubarAppearance->currentIndex()!=opts.menubarAppearance || 3754 toolbarAppearance->currentIndex()!=opts.toolbarAppearance || 3755 lvAppearance->currentIndex()!=opts.lvAppearance || 3756 sliderAppearance->currentIndex()!=opts.sliderAppearance || 3757 tabAppearance->currentIndex()!=opts.tabAppearance || 3758 activeTabAppearance->currentIndex()!=opts.activeTabAppearance || 3759 progressAppearance->currentIndex()!=opts.progressAppearance || 3760 progressColor->currentIndex()!=opts.progressColor || 3761 progressGrooveAppearance->currentIndex()!=opts.progressGrooveAppearance || 3762 grooveAppearance->currentIndex()!=opts.grooveAppearance || 3763 sunkenAppearance->currentIndex()!=opts.sunkenAppearance || 3764 progressGrooveColor->currentIndex()!=opts.progressGrooveColor || 3765 menuitemAppearance->currentIndex()!=opts.menuitemAppearance || 3766 menuBgndAppearance->currentIndex()!=opts.menuBgndAppearance || 3767 titlebarAppearance->currentIndex()!=opts.titlebarAppearance || 3768 inactiveTitlebarAppearance->currentIndex()!=opts.inactiveTitlebarAppearance || 3769 titlebarButtonAppearance->currentIndex()!=opts.titlebarButtonAppearance || 3770 selectionAppearance->currentIndex()!=opts.selectionAppearance || 3771 toolbarSeparators->currentIndex()!=opts.toolbarSeparators || 3772 splitters->currentIndex()!=opts.splitters || 3773 colorMenubarMouseOver->isChecked()!=opts.colorMenubarMouseOver || 3774 useHighlightForMenu->isChecked()!=opts.useHighlightForMenu || 3775 getGroupBoxLabelFlags()!=opts.gbLabel || 3776 fadeLines->isChecked()!=opts.fadeLines || 3777 menuIcons->isChecked()!=opts.menuIcons || 3778 onlyTicksInMenu->isChecked()!=opts.onlyTicksInMenu || 3779 buttonStyleMenuSections->isChecked()!=opts.buttonStyleMenuSections || 3780 stdBtnSizes->isChecked()!=opts.stdBtnSizes || 3781 boldProgress->isChecked()!=opts.boldProgress || 3782 coloredTbarMo->isChecked()!=opts.coloredTbarMo || 3783 tbarBtns->currentIndex()!=opts.tbarBtns || 3784 tbarBtnAppearance->currentIndex()!=opts.tbarBtnAppearance || 3785 tbarBtnEffect->currentIndex()!=opts.tbarBtnEffect || 3786 borderSelection->isChecked()!=opts.borderSelection || 3787 forceAlternateLvCols->isChecked()!=opts.forceAlternateLvCols || 3788 titlebarAlignment->currentIndex()!=opts.titlebarAlignment || 3789 titlebarEffect->currentIndex()!=opts.titlebarEffect || 3790 titlebarIcon->currentIndex()!=opts.titlebarIcon || 3791 getCrSize(crSize)!=opts.crSize || 3792 borderProgress->isChecked()!=opts.borderProgress || 3793 shading->currentIndex()!=(int)opts.shading || 3794 gtkScrollViews->isChecked()!=opts.gtkScrollViews || 3795 highlightScrollViews->isChecked()!=opts.highlightScrollViews || 3796 etchEntry->isChecked()!=opts.etchEntry || 3797 flatSbarButtons->isChecked()!=opts.flatSbarButtons || 3798 borderSbarGroove->isChecked()!=opts.borderSbarGroove || 3799 thinSbarGroove->isChecked()!=opts.thinSbarGroove || 3800 colorSliderMouseOver->isChecked()!=opts.colorSliderMouseOver || 3801 getWindowBorderFlags()!=opts.windowBorder || 3802 windowDrag->currentIndex()!=opts.windowDrag || 3803 sbarBgndAppearance->currentIndex()!=opts.sbarBgndAppearance || 3804 sliderFill->currentIndex()!=opts.sliderFill || 3805 bgndAppearance->currentIndex()!=opts.bgndAppearance || 3806 bgndImage->currentIndex()!=opts.bgndImage.type || 3807 bgndOpacity->value()!=opts.bgndOpacity || 3808 dlgOpacity->value()!=opts.dlgOpacity || 3809 menuBgndImage->currentIndex()!=opts.menuBgndImage.type || 3810 menuBgndOpacity->value()!=opts.menuBgndOpacity || 3811 dropShadowSize->value()!=opts.shadowSize || 3812 dwtAppearance->currentIndex()!=opts.dwtAppearance || 3813 tooltipAppearance->currentIndex()!=opts.tooltipAppearance || 3814 crColor->currentIndex()!=opts.crColor || 3815 smallRadio->isChecked()!=opts.smallRadio || 3816 splitterHighlight->value()!=opts.splitterHighlight || 3817 gtkComboMenus->isChecked()!=opts.gtkComboMenus || 3818 gtkButtonOrder->isChecked()!=opts.gtkButtonOrder || 3819 reorderGtkButtons->isChecked()!=opts.reorderGtkButtons || 3820 mapKdeIcons->isChecked()!=opts.mapKdeIcons || 3821 groupBox->currentIndex()!=opts.groupBox || 3822 ((FRAME_SHADED==opts.groupBox || FRAME_FADED==opts.groupBox) && gbFactor->value()!=opts.gbFactor) || 3823 3824 toInt(passwordChar->text())!=opts.passwordChar || 3825 highlightFactor->value()!=opts.highlightFactor || 3826 getTitleBarButtonFlags()!=opts.titlebarButtons || 3827 3828 getDwtSettingsFlags()!=opts.dwtSettings || 3829 getSquareFlags()!=opts.square || 3830 3831 diffTitleBarButtonColors(opts) || 3832 3833 customMenuTextColor->isChecked()!=opts.customMenuTextColor || 3834 (SHADE_CUSTOM==opts.shadeSliders && 3835 customSlidersColor->color()!=opts.customSlidersColor) || 3836 (SHADE_CUSTOM==opts.shadeMenubars && 3837 customMenubarsColor->color()!=opts.customMenubarsColor) || 3838 (SHADE_CUSTOM==opts.shadeCheckRadio && 3839 customCheckRadioColor->color()!=opts.customCheckRadioColor) || 3840 (customMenuTextColor->isChecked() && 3841 customMenuNormTextColor->color()!=opts.customMenuNormTextColor) || 3842 (customMenuTextColor->isChecked() && 3843 customMenuSelTextColor->color()!=opts.customMenuSelTextColor) || 3844 (SHADE_CUSTOM==opts.menuStripe && 3845 customMenuStripeColor->color()!=opts.customMenuStripeColor) || 3846 (SHADE_CUSTOM==opts.comboBtn && 3847 customComboBtnColor->color()!=opts.customComboBtnColor) || 3848 (SHADE_CUSTOM==opts.sortedLv && 3849 customSortedLvColor->color()!=opts.customSortedLvColor) || 3850 (SHADE_CUSTOM==opts.crColor && 3851 customCrBgndColor->color()!=opts.customCrBgndColor) || 3852 (SHADE_CUSTOM==opts.progressColor && 3853 customProgressColor->color()!=opts.customProgressColor) || 3854 3855 customGradient!=opts.customGradient || 3856 3857 toSet(noBgndGradientApps->text())!=opts.noBgndGradientApps || 3858 toSet(noBgndOpacityApps->text())!=opts.noBgndOpacityApps || 3859 toSet(noMenuBgndOpacityApps->text())!=opts.noMenuBgndOpacityApps || 3860 toSet(noBgndImageApps->text())!=opts.noBgndImageApps || 3861 toSet(useQtFileDialogApps->text())!=opts.useQtFileDialogApps || 3862 toSet(menubarApps->text())!=opts.menubarApps || 3863 toSet(statusbarApps->text())!=opts.statusbarApps || 3864 toSet(noMenuStripeApps->text())!=opts.noMenuStripeApps || 3865 toSet(nonnativeMenubarApps->text())!=opts.nonnativeMenubarApps || 3866 3867 diffShades(opts) || 3868 3869 diffImages(opts); 3870 } 3871 3872 #include "qtcurveconfig.moc"