From e3edad83a1e6e99a551d40d4118352435c6dd710 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 7 Oct 2010 14:16:50 +0200 Subject: Revert the integration of the merge request 2286. The merge request 2286 will be integrated in master. This should let an angry developer calm down and resume his work. --- tools/qtconfig/colorbutton.cpp | 9 +- tools/qtconfig/main.cpp | 1 + tools/qtconfig/mainwindow.cpp | 785 ++++++++------- tools/qtconfig/mainwindow.h | 19 +- tools/qtconfig/mainwindow.ui | 1388 -------------------------- tools/qtconfig/mainwindowbase.cpp | 250 +++++ tools/qtconfig/mainwindowbase.h | 95 ++ tools/qtconfig/mainwindowbase.ui | 1384 +++++++++++++++++++++++++ tools/qtconfig/paletteeditoradvanced.cpp | 579 +++++++---- tools/qtconfig/paletteeditoradvanced.h | 66 +- tools/qtconfig/paletteeditoradvanced.ui | 416 -------- tools/qtconfig/paletteeditoradvancedbase.cpp | 144 +++ tools/qtconfig/paletteeditoradvancedbase.h | 78 ++ tools/qtconfig/paletteeditoradvancedbase.ui | 617 ++++++++++++ tools/qtconfig/previewframe.cpp | 18 +- tools/qtconfig/previewframe.h | 13 +- tools/qtconfig/previewwidget.cpp | 29 +- tools/qtconfig/previewwidget.h | 18 +- tools/qtconfig/previewwidget.ui | 252 ----- tools/qtconfig/previewwidgetbase.cpp | 88 ++ tools/qtconfig/previewwidgetbase.h | 68 ++ tools/qtconfig/previewwidgetbase.ui | 340 +++++++ tools/qtconfig/qtconfig.pro | 19 +- tools/tools.pro | 2 +- 24 files changed, 3990 insertions(+), 2688 deletions(-) delete mode 100644 tools/qtconfig/mainwindow.ui create mode 100644 tools/qtconfig/mainwindowbase.cpp create mode 100644 tools/qtconfig/mainwindowbase.h create mode 100644 tools/qtconfig/mainwindowbase.ui delete mode 100644 tools/qtconfig/paletteeditoradvanced.ui create mode 100644 tools/qtconfig/paletteeditoradvancedbase.cpp create mode 100644 tools/qtconfig/paletteeditoradvancedbase.h create mode 100644 tools/qtconfig/paletteeditoradvancedbase.ui delete mode 100644 tools/qtconfig/previewwidget.ui create mode 100644 tools/qtconfig/previewwidgetbase.cpp create mode 100644 tools/qtconfig/previewwidgetbase.h create mode 100644 tools/qtconfig/previewwidgetbase.ui diff --git a/tools/qtconfig/colorbutton.cpp b/tools/qtconfig/colorbutton.cpp index 443effa..30617e4 100644 --- a/tools/qtconfig/colorbutton.cpp +++ b/tools/qtconfig/colorbutton.cpp @@ -52,20 +52,19 @@ QT_BEGIN_NAMESPACE ColorButton::ColorButton(QWidget *parent) - : QAbstractButton(parent) - , mousepressed(false) - , col(Qt::black) + : QAbstractButton(parent), mousepressed(false) { setAcceptDrops(true); + col = Qt::black; connect(this, SIGNAL(clicked()), SLOT(changeColor())); } ColorButton::ColorButton(const QColor &c, QWidget *parent) : QAbstractButton(parent) - , col(c) { setAcceptDrops(true); + col = c; connect(this, SIGNAL(clicked()), SLOT(changeColor())); } @@ -183,7 +182,7 @@ void ColorButton::mouseReleaseEvent(QMouseEvent *e) void ColorButton::mouseMoveEvent(QMouseEvent *e) { - if (!mousepressed) + if (! mousepressed) return; if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { diff --git a/tools/qtconfig/main.cpp b/tools/qtconfig/main.cpp index 47b0994..928cf01 100644 --- a/tools/qtconfig/main.cpp +++ b/tools/qtconfig/main.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "ui_previewwidgetbase.h" #include "mainwindow.h" #include #include diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index f07da4f..9675f99 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -40,8 +40,6 @@ ****************************************************************************/ #include "mainwindow.h" -#include "ui_mainwindow.h" - #include "colorbutton.h" #include "previewframe.h" #include "paletteeditoradvanced.h" @@ -61,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -155,20 +154,36 @@ static const char *phonon_text = "

It is reccommended to leave all settings on \"Auto\" to let " "Phonon determine your settings automatically."; +static QColorGroup::ColorRole centralFromItem( int item ) +{ + switch( item ) { + case 0: return QColorGroup::Window; + case 1: return QColorGroup::WindowText; + case 2: return QColorGroup::Button; + case 3: return QColorGroup::Base; + case 4: return QColorGroup::Text; + case 5: return QColorGroup::BrightText; + case 6: return QColorGroup::ButtonText; + case 7: return QColorGroup::Highlight; + case 8: return QColorGroup::HighlightedText; + default: return QColorGroup::NColorRoles; + } +} + -QPalette::ColorGroup MainWindow::groupFromIndex(int item) +static QColorGroup::ColorRole effectFromItem( int item ) { - switch (item) { - case 0: - default: - return QPalette::Active; - case 1: - return QPalette::Inactive; - case 2: - return QPalette::Disabled; + switch( item ) { + case 0: return QColorGroup::Light; + case 1: return QColorGroup::Midlight; + case 2: return QColorGroup::Mid; + case 3: return QColorGroup::Dark; + case 4: return QColorGroup::Shadow; + default: return QColorGroup::NColorRoles; } } + static void setStyleHelper(QWidget *w, QStyle *s) { const QObjectList children = w->children(); @@ -180,140 +195,99 @@ static void setStyleHelper(QWidget *w, QStyle *s) w->setStyle(s); } -MainWindow::MainWindow() - : ui(new Ui::MainWindow), - editPalette(palette()), - previewPalette(palette()), - previewstyle(0) -{ - ui->setupUi(this); - statusBar(); - - // signals and slots connections - connect(ui->fontPathLineEdit, SIGNAL(returnPressed()), SLOT(addFontpath())); - connect(ui->addFontPathButton, SIGNAL(clicked()), SLOT(addFontpath())); - connect(ui->addSubstitutionButton, SIGNAL(clicked()), SLOT(addSubstitute())); - connect(ui->browseFontPathButton, SIGNAL(clicked()), SLOT(browseFontpath())); - connect(ui->fontStyleCombo, SIGNAL(activated(int)), SLOT(buildFont())); - connect(ui->pointSizeCombo, SIGNAL(activated(int)), SLOT(buildFont())); - connect(ui->downFontpathButton, SIGNAL(clicked()), SLOT(downFontpath())); - connect(ui->downSubstitutionButton, SIGNAL(clicked()), SLOT(downSubstitute())); - connect(ui->fontFamilyCombo, SIGNAL(activated(QString)), SLOT(familySelected(QString))); - connect(ui->fileExitAction, SIGNAL(activated()), SLOT(fileExit())); - connect(ui->fileSaveAction, SIGNAL(activated()), SLOT(fileSave())); - connect(ui->helpAboutAction, SIGNAL(activated()), SLOT(helpAbout())); - connect(ui->helpAboutQtAction, SIGNAL(activated()), SLOT(helpAboutQt())); - connect(ui->mainTabWidget, SIGNAL(currentChanged(QWidget*)), SLOT(pageChanged(QWidget*))); - connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int))); - connect(ui->removeFontpathButton, SIGNAL(clicked()), SLOT(removeFontpath())); - connect(ui->removeSubstitutionButton, SIGNAL(clicked()), SLOT(removeSubstitute())); - connect(ui->toolBoxEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->doubleClickIntervalSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); - connect(ui->cursorFlashTimeSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); - connect(ui->wheelScrollLinesSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); - connect(ui->menuEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->comboEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->audiosinkCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->videomodeCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->toolTipEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->strutWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); - connect(ui->strutHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified())); - connect(ui->effectsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); - connect(ui->resolveLinksCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); - connect(ui->fontEmbeddingCheckBox, SIGNAL(clicked()), SLOT(somethingModified())); - connect(ui->rtlExtensionsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified())); - connect(ui->inputStyleCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->inputMethodCombo, SIGNAL(activated(int)), SLOT(somethingModified())); - connect(ui->guiStyleCombo, SIGNAL(activated(QString)), SLOT(styleSelected(QString))); - connect(ui->familySubstitutionCombo, SIGNAL(activated(QString)), SLOT(substituteSelected(QString))); - connect(ui->tunePaletteButton, SIGNAL(clicked()), SLOT(tunePalette())); - connect(ui->upFontpathButton, SIGNAL(clicked()), SLOT(upFontpath())); - connect(ui->upSubstitutionButton, SIGNAL(clicked()), SLOT(upSubstitute())); +MainWindow::MainWindow() + : MainWindowBase(0, "main window"), + editPalette(palette()), previewPalette(palette()), previewstyle(0) +{ modified = true; desktopThemeName = tr("Desktop Settings (Default)"); QStringList gstyles = QStyleFactory::keys(); gstyles.sort(); - ui->guiStyleCombo->addItem(desktopThemeName); - ui->guiStyleCombo->setItemData(ui->guiStyleCombo->findText(desktopThemeName), - tr("Choose style and palette based on your desktop settings."), - Qt::ToolTipRole); - ui->guiStyleCombo->addItems(gstyles); + gstylecombo->addItem(desktopThemeName); + gstylecombo->setItemData(gstylecombo->findText(desktopThemeName), + tr("Choose style and palette based on your desktop settings."), Qt::ToolTipRole); + gstylecombo->insertStringList(gstyles); QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); QString currentstyle = settings.value(QLatin1String("style")).toString(); if (currentstyle.isEmpty()) { - ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->findText(desktopThemeName)); - currentstyle = QApplication::style()->objectName(); + gstylecombo->setCurrentItem(gstylecombo->findText(desktopThemeName)); + currentstyle = QLatin1String(QApplication::style()->name()); } else { - int index = ui->guiStyleCombo->findText(currentstyle, Qt::MatchFixedString); + int index = gstylecombo->findText(currentstyle, Qt::MatchFixedString); if (index != -1) { - ui->guiStyleCombo->setCurrentIndex(index); + gstylecombo->setCurrentItem(index); } else { // we give up - ui->guiStyleCombo->addItem(tr("Unknown")); - ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->count() - 1); + gstylecombo->insertItem(QLatin1String("Unknown")); + gstylecombo->setCurrentItem(gstylecombo->count() - 1); } } - ui->buttonMainColor->setColor(palette().color(QPalette::Active, QPalette::Button)); - ui->buttonWindowColor->setColor(palette().color(QPalette::Active, QPalette::Window)); - connect(ui->buttonMainColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); - connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); + buttonMainColor->setColor(palette().color(QPalette::Active, + QColorGroup::Button)); + buttonMainColor2->setColor(palette().color(QPalette::Active, + QColorGroup::Window)); + connect(buttonMainColor, SIGNAL(colorChanged(QColor)), + this, SLOT(buildPalette())); + connect(buttonMainColor2, SIGNAL(colorChanged(QColor)), + this, SLOT(buildPalette())); if (X11->desktopEnvironment == DE_KDE) - ui->colorConfig->hide(); + colorConfig->hide(); else - ui->kdeNoteLabel->hide(); + labelKDENote->hide(); QFontDatabase db; QStringList families = db.families(); - ui->fontFamilyCombo->addItems(families); + familycombo->insertStringList(families); QStringList fs = families; QStringList fs2 = QFont::substitutions(); QStringList::Iterator fsit = fs2.begin(); while (fsit != fs2.end()) { - if (!fs.contains(*fsit)) + if (! fs.contains(*fsit)) fs += *fsit; fsit++; } fs.sort(); - ui->familySubstitutionCombo->addItems(fs); + familysubcombo->insertStringList(fs); - ui->chooseSubstitutionCombo->addItems(families); - QList sizes = db.standardSizes(); - foreach(int i, sizes) - ui->pointSizeCombo->addItem(QString::number(i)); + choosesubcombo->insertStringList(families); + Q3ValueList sizes = db.standardSizes(); + Q3ValueList::Iterator it = sizes.begin(); + while (it != sizes.end()) + psizecombo->insertItem(QString::number(*it++)); - ui->doubleClickIntervalSpinBox->setValue(QApplication::doubleClickInterval()); - ui->cursorFlashTimeSpinBox->setValue(QApplication::cursorFlashTime()); - ui->wheelScrollLinesSpinBox->setValue(QApplication::wheelScrollLines()); + dcispin->setValue(QApplication::doubleClickInterval()); + cfispin->setValue(QApplication::cursorFlashTime()); + wslspin->setValue(QApplication::wheelScrollLines()); // ############# - // resolveLinksCheckBox->setChecked(qt_resolve_symlinks); +// resolvelinks->setChecked(qt_resolve_symlinks); - ui->effectsCheckBox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); - ui->effectsFrame->setEnabled(ui->effectsCheckBox->isChecked()); + effectcheckbox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); + effectbase->setEnabled(effectcheckbox->isChecked()); if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)) - ui->menuEffectCombo->setCurrentIndex(2); + menueffect->setCurrentItem(2); else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) - ui->menuEffectCombo->setCurrentIndex(1); + menueffect->setCurrentItem(1); if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)) - ui->comboEffectCombo->setCurrentIndex(1); + comboeffect->setCurrentItem(1); if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) - ui->toolTipEffectCombo->setCurrentIndex(2); + tooltipeffect->setCurrentItem(2); else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) - ui->toolTipEffectCombo->setCurrentIndex(1); + tooltipeffect->setCurrentItem(1); - if (QApplication::isEffectEnabled(Qt::UI_AnimateToolBox)) - ui->toolBoxEffectCombo->setCurrentIndex(1); + if ( QApplication::isEffectEnabled( Qt::UI_AnimateToolBox ) ) + toolboxeffect->setCurrentItem( 1 ); QSize globalStrut = QApplication::globalStrut(); - ui->strutWidthSpinBox->setValue(globalStrut.width()); - ui->strutHeightSpinBox->setValue(globalStrut.height()); + strutwidth->setValue(globalStrut.width()); + strutheight->setValue(globalStrut.height()); // find the default family QStringList::Iterator sit = families.begin(); @@ -332,10 +306,10 @@ MainWindow::MainWindow() if (i == -1) // no clue about the current font i = 0; - ui->fontFamilyCombo->setCurrentIndex(i); + familycombo->setCurrentItem(i); - QStringList styles = db.styles(ui->fontFamilyCombo->currentText()); - ui->fontStyleCombo->addItems(styles); + QStringList styles = db.styles(familycombo->currentText()); + stylecombo->insertStringList(styles); QString stylestring = db.styleString(QApplication::font()); sit = styles.begin(); @@ -354,98 +328,91 @@ MainWindow::MainWindow() i = possible; if (i == -1) // no clue about the current font i = 0; - ui->fontStyleCombo->setCurrentIndex(i); + stylecombo->setCurrentItem(i); i = 0; - for (int psize = QApplication::font().pointSize(); i < ui->pointSizeCombo->count(); ++i) { - const int sz = ui->pointSizeCombo->itemText(i).toInt(); + for (int psize = QApplication::font().pointSize(); i < psizecombo->count(); ++i) { + const int sz = psizecombo->text(i).toInt(); if (sz == psize) { - ui->pointSizeCombo->setCurrentIndex(i); + psizecombo->setCurrentItem(i); break; } else if(sz > psize) { - ui->pointSizeCombo->insertItem(i, QString::number(psize)); - ui->pointSizeCombo->setCurrentIndex(i); + psizecombo->insertItem(i, QString::number(psize)); + psizecombo->setCurrentItem(i); break; } } - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); - ui->rtlExtensionsCheckBox->setChecked(settings.value(QLatin1String("useRtlExtensions"), false) - .toBool()); + rtlExtensions->setChecked(settings.value(QLatin1String("useRtlExtensions"), false).toBool()); #ifdef Q_WS_X11 - QString settingsInputStyle = settings.value(QLatin1String("XIMInputStyle")).toString(); - if (!settingsInputStyle.isEmpty()) - ui->inputStyleCombo->setCurrentIndex(ui->inputStyleCombo->findText(settingsInputStyle)); + inputStyle->setCurrentText(settings.value(QLatin1String("XIMInputStyle"), trUtf8("On The Spot")).toString()); #else - ui->inputStyleCombo->hide(); - ui->inputStyleComboLabel->hide(); + inputStyle->hide(); + inputStyleLabel->hide(); #endif #if defined(Q_WS_X11) && !defined(QT_NO_XIM) - QStringList inputMethodCombo = QInputContextFactory::keys(); - int inputMethodComboIndex = -1; + QStringList inputMethods = QInputContextFactory::keys(); + int inputMethodIndex = -1; QString defaultInputMethod = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString(); - for (int i = inputMethodCombo.size()-1; i >= 0; --i) { - const QString &im = inputMethodCombo.at(i); + for (int i = inputMethods.size()-1; i >= 0; --i) { + const QString &im = inputMethods.at(i); if (im.contains(QLatin1String("imsw"))) { - inputMethodCombo.removeAt(i); - if (inputMethodComboIndex > i) - --inputMethodComboIndex; + inputMethods.removeAt(i); + if (inputMethodIndex > i) + --inputMethodIndex; } else if (im == defaultInputMethod) { - inputMethodComboIndex = i; + inputMethodIndex = i; } } - if (inputMethodComboIndex == -1 && !inputMethodCombo.isEmpty()) - inputMethodComboIndex = 0; - ui->inputMethodCombo->addItems(inputMethodCombo); - ui->inputMethodCombo->setCurrentIndex(inputMethodComboIndex); + if (inputMethodIndex == -1 && !inputMethods.isEmpty()) + inputMethodIndex = 0; + inputMethod->addItems(inputMethods); + inputMethod->setCurrentIndex(inputMethodIndex); #else - ui->inputMethodCombo->hide(); - ui->inputMethodComboLabel->hide(); + inputMethod->hide(); + inputMethodLabel->hide(); #endif - ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true) - .toBool()); + fontembeddingcheckbox->setChecked(settings.value(QLatin1String("embedFonts"), true).toBool()); fontpaths = settings.value(QLatin1String("fontPath")).toStringList(); - ui->fontpathListBox->insertItems(0, fontpaths); - - ui->audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); - ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(tr("Auto (default)")), - tr("Choose audio output automatically."), Qt::ToolTipRole); - ui->audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); - ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(tr("aRts")), - tr("Experimental aRts support for GStreamer."), - Qt::ToolTipRole); + fontpathlistbox->insertStringList(fontpaths); + + audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + audiosinkCombo->setItemData(audiosinkCombo->findText(tr("Auto (default)")), + tr("Choose audio output automatically."), Qt::ToolTipRole); + audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); + audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")), + tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole); #ifdef HAVE_PHONON - ui->phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); + phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); #endif #ifndef QT_NO_GSTREAMER if (gst_init_check(0, 0, 0)) { gchar *versionString = gst_version_string(); - ui->gstVersionLabel->setText(QLatin1String(versionString)); + gstversionLabel->setText(QLatin1String(versionString)); g_free(versionString); - GList *factoryList = gst_registry_get_feature_list(gst_registry_get_default(), - GST_TYPE_ELEMENT_FACTORY); + GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); QString name, klass, description; - for (GList *iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { + for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data); klass = QLatin1String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature))); if (klass == QLatin1String("Sink/Audio")) { name = QLatin1String(GST_PLUGIN_FEATURE_NAME(feature)); if (name == QLatin1String("sfsink")) - continue; // useless to output audio to file when you cannot set the file path + continue; //useless to output audio to file when you cannot set the file path else if (name == QLatin1String("autoaudiosink")) continue; //This is used implicitly from the auto setting GstElement *sink = gst_element_factory_make (qPrintable(name), NULL); if (sink) { - description = QLatin1String(gst_element_factory_get_description(GST_ELEMENT_FACTORY(feature))); - ui->audiosinkCombo->addItem(name, name); - ui->audiosinkCombo->setItemData(ui->audiosinkCombo->findText(name), description, - Qt::ToolTipRole); + description = QLatin1String(gst_element_factory_get_description (GST_ELEMENT_FACTORY(feature))); + audiosinkCombo->addItem(name, name); + audiosinkCombo->setItemData(audiosinkCombo->findText(name), description, Qt::ToolTipRole); gst_object_unref (sink); } } @@ -453,43 +420,39 @@ MainWindow::MainWindow() g_list_free(factoryList); } #else - ui->phononTab->setEnabled(false); - ui->phononLabel->setText(tr("Phonon GStreamer backend not available.")); + tab4->setEnabled(false); + phononLabel->setText(tr("Phonon GStreamer backend not available.")); #endif - ui->videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); - ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("Auto (default)")), - tr("Choose render method automatically"), Qt::ToolTipRole); + videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("Auto (default)")), tr("Choose render method automatically"), Qt::ToolTipRole); #ifdef Q_WS_X11 - ui->videomodeCombo->addItem(tr("X11"), QLatin1String("X11")); - ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("X11")), - tr("Use X11 Overlays"), Qt::ToolTipRole); + videomodeCombo->addItem(tr("X11"), QLatin1String("X11")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("X11")), tr("Use X11 Overlays"), Qt::ToolTipRole); #endif #ifndef QT_NO_OPENGL - ui->videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); - ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("OpenGL")), - tr("Use OpenGL if available"), Qt::ToolTipRole); + videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if available"), Qt::ToolTipRole); #endif - ui->videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); - ui->videomodeCombo->setItemData(ui->videomodeCombo->findText(tr("Software")), - tr("Use simple software rendering"), Qt::ToolTipRole); + videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("Software")), tr("Use simple software rendering"), Qt::ToolTipRole); QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); - ui->audiosinkCombo->setCurrentIndex(ui->audiosinkCombo->findData(audioSink)); - ui->videomodeCombo->setCurrentIndex(ui->videomodeCombo->findData(videoMode)); + audiosinkCombo->setCurrentItem(audiosinkCombo->findData(audioSink)); + videomodeCombo->setCurrentItem(videomodeCombo->findData(videoMode)); settings.endGroup(); // Qt - ui->helpView->setText(tr(appearance_text)); + helpview->setText(tr(appearance_text)); setModified(false); updateStyleLayout(); } + MainWindow::~MainWindow() { - delete ui; } #ifdef Q_WS_X11 @@ -509,23 +472,23 @@ void MainWindow::fileSave() QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); QFontDatabase db; - QFont font = db.font(ui->fontFamilyCombo->currentText(), - ui->fontStyleCombo->currentText(), - ui->pointSizeCombo->currentText().toInt()); + QFont font = db.font(familycombo->currentText(), + stylecombo->currentText(), + psizecombo->currentText().toInt()); QStringList actcg, inactcg, discg; - bool overrideDesktopSettings = (ui->guiStyleCombo->currentText() != desktopThemeName); + bool overrideDesktopSettings = (gstylecombo->currentText() != desktopThemeName); if (overrideDesktopSettings) { int i; - for (i = 0; i < QPalette::NColorRoles; i++) + for (i = 0; i < QColorGroup::NColorRoles; i++) actcg << editPalette.color(QPalette::Active, - QPalette::ColorRole(i)).name(); - for (i = 0; i < QPalette::NColorRoles; i++) + (QColorGroup::ColorRole) i).name(); + for (i = 0; i < QColorGroup::NColorRoles; i++) inactcg << editPalette.color(QPalette::Inactive, - QPalette::ColorRole(i)).name(); - for (i = 0; i < QPalette::NColorRoles; i++) + (QColorGroup::ColorRole) i).name(); + for (i = 0; i < QColorGroup::NColorRoles; i++) discg << editPalette.color(QPalette::Disabled, - QPalette::ColorRole(i)).name(); + (QColorGroup::ColorRole) i).name(); } settings.setValue(QLatin1String("font"), font.toString()); @@ -534,63 +497,59 @@ void MainWindow::fileSave() settings.setValue(QLatin1String("Palette/disabled"), discg); settings.setValue(QLatin1String("fontPath"), fontpaths); - settings.setValue(QLatin1String("embedFonts"), ui->fontEmbeddingCheckBox->isChecked()); - settings.setValue(QLatin1String("style"), - overrideDesktopSettings ? ui->guiStyleCombo->currentText() : QString()); + settings.setValue(QLatin1String("embedFonts"), fontembeddingcheckbox->isChecked()); + settings.setValue(QLatin1String("style"), overrideDesktopSettings ? gstylecombo->currentText() : QString()); - settings.setValue(QLatin1String("doubleClickInterval"), ui->doubleClickIntervalSpinBox->value()); - settings.setValue(QLatin1String("cursorFlashTime"), - ui->cursorFlashTimeSpinBox->value() == 9 ? 0 : ui->cursorFlashTimeSpinBox->value()); - settings.setValue(QLatin1String("wheelScrollLines"), ui->wheelScrollLinesSpinBox->value()); - settings.setValue(QLatin1String("resolveSymlinks"), ui->resolveLinksCheckBox->isChecked()); + settings.setValue(QLatin1String("doubleClickInterval"), dcispin->value()); + settings.setValue(QLatin1String("cursorFlashTime"), cfispin->value() == 9 ? 0 : cfispin->value() ); + settings.setValue(QLatin1String("wheelScrollLines"), wslspin->value()); + settings.setValue(QLatin1String("resolveSymlinks"), resolvelinks->isChecked()); - QSize strut(ui->strutWidthSpinBox->value(), ui->strutHeightSpinBox->value()); + QSize strut(strutwidth->value(), strutheight->value()); settings.setValue(QLatin1String("globalStrut/width"), strut.width()); settings.setValue(QLatin1String("globalStrut/height"), strut.height()); - settings.setValue(QLatin1String("useRtlExtensions"), ui->rtlExtensionsCheckBox->isChecked()); + settings.setValue(QLatin1String("useRtlExtensions"), rtlExtensions->isChecked()); #ifdef Q_WS_X11 - QString style = ui->inputStyleCombo->currentText(); + QString style = inputStyle->currentText(); QString str = QLatin1String("On The Spot"); - if (style == tr("Over The Spot")) + if ( style == trUtf8( "Over The Spot" ) ) str = QLatin1String("Over The Spot"); - else if (style == tr("Off The Spot")) + else if ( style == trUtf8( "Off The Spot" ) ) str = QLatin1String("Off The Spot"); - else if (style == tr("Root")) + else if ( style == trUtf8( "Root" ) ) str = QLatin1String("Root"); - settings.setValue(QLatin1String("XIMInputStyle"), str); + settings.setValue( QLatin1String("XIMInputStyle"), str ); #endif #if defined(Q_WS_X11) && !defined(QT_NO_XIM) - settings.setValue(QLatin1String("DefaultInputMethod"), ui->inputMethodCombo->currentText()); + settings.setValue(QLatin1String("DefaultInputMethod"), inputMethod->currentText()); #endif QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); - settings.setValue(QLatin1String("audiosink"), - ui->audiosinkCombo->itemData(ui->audiosinkCombo->currentIndex())); - settings.setValue(QLatin1String("videomode"), - ui->videomodeCombo->itemData(ui->videomodeCombo->currentIndex())); + settings.setValue(QLatin1String("audiosink"), audiosinkCombo->itemData(audiosinkCombo->currentIndex())); + settings.setValue(QLatin1String("videomode"), videomodeCombo->itemData(videomodeCombo->currentIndex())); QStringList effects; - if (ui->effectsCheckBox->isChecked()) { + if (effectcheckbox->isChecked()) { effects << QLatin1String("general"); - switch (ui->menuEffectCombo->currentIndex()) { + switch (menueffect->currentItem()) { case 1: effects << QLatin1String("animatemenu"); break; case 2: effects << QLatin1String("fademenu"); break; } - switch (ui->comboEffectCombo->currentIndex()) { + switch (comboeffect->currentItem()) { case 1: effects << QLatin1String("animatecombo"); break; } - switch (ui->toolTipEffectCombo->currentIndex()) { + switch (tooltipeffect->currentItem()) { case 1: effects << QLatin1String("animatetooltip"); break; case 2: effects << QLatin1String("fadetooltip"); break; } - switch (ui->toolBoxEffectCombo->currentIndex()) { + switch ( toolboxeffect->currentItem() ) { case 1: effects << QLatin1String("animatetoolbox"); break; } } else @@ -614,63 +573,189 @@ void MainWindow::fileSave() #endif // Q_WS_X11 setModified(false); - statusBar()->showMessage(tr("Saved changes.")); + statusBar()->showMessage(QLatin1String("Saved changes.")); } + void MainWindow::fileExit() { qApp->closeAllWindows(); } + void MainWindow::setModified(bool m) { if (modified == m) return; modified = m; - ui->fileSaveAction->setEnabled(m); + fileSaveAction->setEnabled(m); } + void MainWindow::buildPalette() { - QPalette temp(ui->buttonMainColor->color(), ui->buttonWindowColor->color()); - for (int i = 0; i < QPalette::NColorGroups; i++) - temp = PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup(i), temp); + int i; + QColorGroup cg; + QColor btn = buttonMainColor->color(); + QColor back = buttonMainColor2->color(); + QPalette automake( btn, back ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) ); + + editPalette.setActive( cg ); + buildActiveEffect(); + + cg = editPalette.inactive(); + + QPalette temp( editPalette.active().color( QColorGroup::Button ), + editPalette.active().color( QColorGroup::Window ) ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) ); + + editPalette.setInactive( cg ); + buildInactiveEffect(); + + cg = editPalette.disabled(); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) ); + + editPalette.setDisabled( cg ); + buildDisabledEffect(); - editPalette = temp; - setPreviewPalette(editPalette); updateColorButtons(); setModified(true); } -void MainWindow::setPreviewPalette(const QPalette &pal) + +void MainWindow::buildActiveEffect() { - QPalette::ColorGroup colorGroup = groupFromIndex(ui->paletteCombo->currentIndex()); + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); - for (int i = 0; i < QPalette::NColorGroups; i++) { - for (int j = 0; j < QPalette::NColorRoles; j++) { - QPalette::ColorGroup targetGroup = QPalette::ColorGroup(i); - QPalette::ColorRole targetRole = QPalette::ColorRole(j); - previewPalette.setColor(targetGroup, targetRole, pal.color(colorGroup, targetRole)); - } + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateColorButtons(); +} + + +void MainWindow::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + buildInactiveEffect(); +} + + +void MainWindow::buildInactiveEffect() +{ + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + + +void MainWindow::buildDisabled() +{ + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); + cg.setColor( QColorGroup::WindowText, Qt::darkGray ); + cg.setColor( QColorGroup::Text, Qt::darkGray ); + cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); +} + + +void MainWindow::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + + +void MainWindow::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (paletteCombo->currentItem()) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); - ui->previewFrame->setPreviewPalette(previewPalette); + previewFrame->setPreviewPalette(previewPalette); } + void MainWindow::updateColorButtons() { - ui->buttonMainColor->setColor(editPalette.color(QPalette::Active, QPalette::Button)); - ui->buttonWindowColor->setColor(editPalette.color(QPalette::Active, QPalette::Window)); + buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button )); + buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Window )); } + void MainWindow::tunePalette() { bool ok; QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette, - backgroundRole(), this); - if (!ok) + backgroundMode(), this); + if (! ok) return; editPalette = pal; @@ -678,6 +763,7 @@ void MainWindow::tunePalette() setModified(true); } + void MainWindow::paletteSelected(int) { setPreviewPalette(editPalette); @@ -685,10 +771,10 @@ void MainWindow::paletteSelected(int) void MainWindow::updateStyleLayout() { - QString currentStyle = ui->guiStyleCombo->currentText(); + QString currentStyle = gstylecombo->currentText(); bool autoStyle = (currentStyle == desktopThemeName); - ui->previewFrame->setPreviewVisible(!autoStyle); - ui->buildPaletteGroup->setEnabled(currentStyle.toLower() != QLatin1String("gtk") && !autoStyle); + previewFrame->setPreviewVisible(!autoStyle); + groupAutoPalette->setEnabled(currentStyle.toLower() != QLatin1String("gtk") && !autoStyle); } void MainWindow::styleSelected(const QString &stylename) @@ -700,7 +786,7 @@ void MainWindow::styleSelected(const QString &stylename) style = QStyleFactory::create(stylename); if (!style) return; - setStyleHelper(ui->previewFrame, style); + setStyleHelper(previewFrame, style); delete previewstyle; previewstyle = style; setModified(true); @@ -708,191 +794,210 @@ void MainWindow::styleSelected(const QString &stylename) updateStyleLayout(); } + void MainWindow::familySelected(const QString &family) { QFontDatabase db; QStringList styles = db.styles(family); - ui->fontStyleCombo->clear(); - ui->fontStyleCombo->addItems(styles); - ui->familySubstitutionCombo->addItem(family); + stylecombo->clear(); + stylecombo->insertStringList(styles); + familysubcombo->insertItem(family); buildFont(); } + void MainWindow::buildFont() { QFontDatabase db; - QFont font = db.font(ui->fontFamilyCombo->currentText(), - ui->fontStyleCombo->currentText(), - ui->pointSizeCombo->currentText().toInt()); - ui->sampleLineEdit->setFont(font); + QFont font = db.font(familycombo->currentText(), + stylecombo->currentText(), + psizecombo->currentText().toInt()); + samplelineedit->setFont(font); setModified(true); } + void MainWindow::substituteSelected(const QString &family) { QStringList subs = QFont::substitutes(family); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); + sublistbox->clear(); + sublistbox->insertStringList(subs); } + void MainWindow::removeSubstitute() { - if (!ui->substitutionsListBox->currentItem()) + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) > sublistbox->count()) return; - int row = ui->substitutionsListBox->currentRow(); - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - subs.removeAt(ui->substitutionsListBox->currentRow()); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); - if (row > ui->substitutionsListBox->count()) - row = ui->substitutionsListBox->count() - 1; - ui->substitutionsListBox->setCurrentRow(row); - QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); - QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + subs.removeAt(sublistbox->currentItem()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + if (uint(item) > sublistbox->count()) + item = int(sublistbox->count()) - 1; + sublistbox->setCurrentItem(item); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); setModified(true); } + void MainWindow::addSubstitute() { - if (!ui->substitutionsListBox->currentItem()) { - QFont::insertSubstitution(ui->familySubstitutionCombo->currentText(), - ui->chooseSubstitutionCombo->currentText()); - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) > sublistbox->count()) { + QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); setModified(true); return; } - int row = ui->substitutionsListBox->currentRow(); - QFont::insertSubstitution(ui->familySubstitutionCombo->currentText(), ui->chooseSubstitutionCombo->currentText()); - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); - ui->substitutionsListBox->setCurrentRow(row); + int item = sublistbox->currentItem(); + QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item); setModified(true); } + void MainWindow::downSubstitute() { - if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() >= ui->substitutionsListBox->count()) + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) >= sublistbox->count()) return; - int row = ui->substitutionsListBox->currentRow(); - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - QString fam = subs.at(row); - subs.removeAt(row); - subs.insert(row + 1, fam); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); - ui->substitutionsListBox->setCurrentRow(row + 1); - QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); - QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + QString fam = subs.at(item); + subs.removeAt(item); + subs.insert(item+1, fam); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item + 1); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); setModified(true); } + void MainWindow::upSubstitute() { - if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() < 1) + if (sublistbox->currentItem() < 1) return; - int row = ui->substitutionsListBox->currentRow(); - QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); - QString fam = subs.at(row); - subs.removeAt(row); - subs.insert(row-1, fam); - ui->substitutionsListBox->clear(); - ui->substitutionsListBox->insertItems(0, subs); - ui->substitutionsListBox->setCurrentRow(row - 1); - QFont::removeSubstitution(ui->familySubstitutionCombo->currentText()); - QFont::insertSubstitutions(ui->familySubstitutionCombo->currentText(), subs); + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + QString fam = subs.at(item); + subs.removeAt(item); + subs.insert(item-1, fam); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item - 1); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); setModified(true); } + void MainWindow::removeFontpath() { - if (!ui->fontpathListBox->currentItem()) + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) return; - int row = ui->fontpathListBox->currentRow(); - fontpaths.removeAt(row); - ui->fontpathListBox->clear(); - ui->fontpathListBox->insertItems(0, fontpaths); - if (row > ui->fontpathListBox->count()) - row = ui->fontpathListBox->count() - 1; - ui->fontpathListBox->setCurrentRow(row); + int item = fontpathlistbox->currentItem(); + fontpaths.removeAt(fontpathlistbox->currentItem()); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + if (uint(item) > fontpathlistbox->count()) + item = int(fontpathlistbox->count()) - 1; + fontpathlistbox->setCurrentItem(item); setModified(true); } + void MainWindow::addFontpath() { - if (ui->fontPathLineEdit->text().isEmpty()) + if (fontpathlineedit->text().isEmpty()) return; - if (!ui->fontpathListBox->currentItem()) { - fontpaths.append(ui->fontPathLineEdit->text()); - ui->fontpathListBox->clear(); - ui->fontpathListBox->insertItems(0, fontpaths); + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) { + fontpaths.append(fontpathlineedit->text()); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); setModified(true); return; } - int row = ui->fontpathListBox->currentRow(); - fontpaths.insert(row + 1, ui->fontPathLineEdit->text()); - ui->fontpathListBox->clear(); - ui->fontpathListBox->insertItems(0, fontpaths); - ui->fontpathListBox->setCurrentRow(row); + int item = fontpathlistbox->currentItem(); + fontpaths.insert(fontpathlistbox->currentItem()+1, + fontpathlineedit->text()); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item); setModified(true); } + void MainWindow::downFontpath() { - if (!ui->fontpathListBox->currentItem() - || ui->fontpathListBox->currentRow() >= (ui->fontpathListBox->count() - 1)) { + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) >= fontpathlistbox->count() - 1) return; - } - int row = ui->fontpathListBox->currentRow(); - QString fam = fontpaths.at(row); - fontpaths.removeAt(row); - fontpaths.insert(row + 1, fam); - ui->fontpathListBox->clear(); - ui->fontpathListBox->insertItems(0, fontpaths); - ui->fontpathListBox->setCurrentRow(row + 1); + int item = fontpathlistbox->currentItem(); + QString fam = fontpaths.at(item); + fontpaths.removeAt(item); + fontpaths.insert(item+1, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item + 1); setModified(true); } + void MainWindow::upFontpath() { - if (!ui->fontpathListBox->currentItem() || ui->fontpathListBox->currentRow() < 1) + if (fontpathlistbox->currentItem() < 1) return; - int row = ui->fontpathListBox->currentRow(); - QString fam = fontpaths.at(row); - fontpaths.removeAt(row); - fontpaths.insert(row - 1, fam); - ui->fontpathListBox->clear(); - ui->fontpathListBox->insertItems(0, fontpaths); - ui->fontpathListBox->setCurrentRow(row - 1); + int item = fontpathlistbox->currentItem(); + QString fam = fontpaths.at(item); + fontpaths.removeAt(item); + fontpaths.insert(item-1, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item - 1); setModified(true); } + void MainWindow::browseFontpath() { - QString dirname = QFileDialog::getExistingDirectory(this, tr("Select a Directory")); + QString dirname = QFileDialog::getExistingDirectory(QString(), this, 0, + tr("Select a Directory")); if (dirname.isNull()) return; - ui->fontPathLineEdit->setText(dirname); + fontpathlineedit->setText(dirname); } + void MainWindow::somethingModified() { setModified(true); } + void MainWindow::helpAbout() { QMessageBox box(this); @@ -905,42 +1010,44 @@ void MainWindow::helpAbout() box.exec(); } + void MainWindow::helpAboutQt() { QMessageBox::aboutQt(this, tr("Qt Configuration")); } + void MainWindow::pageChanged(QWidget *page) { - if (page == ui->interfaceTab) - ui->helpView->setText(tr(interface_text)); - else if (page == ui->appearanceTab) - ui->helpView->setText(tr(appearance_text)); - else if (page == ui->fontsTab) - ui->helpView->setText(tr(font_text)); - else if (page == ui->printerTab) - ui->helpView->setText(tr(printer_text)); - else if (page == ui->phononTab) - ui->helpView->setText(tr(phonon_text)); + if (page == tab) + helpview->setText(tr(interface_text)); + else if (page == tab1) + helpview->setText(tr(appearance_text)); + else if (page == tab2) + helpview->setText(tr(font_text)); + else if (page == tab3) + helpview->setText(tr(printer_text)); + else if (page == tab4) + helpview->setText(tr(phonon_text)); } + void MainWindow::closeEvent(QCloseEvent *e) { if (modified) { - switch (QMessageBox::warning(this, tr("Save Changes"), - tr("Save changes to settings?"), - (QMessageBox::Yes | QMessageBox::No - | QMessageBox::Cancel))) { - case QMessageBox::Yes: // save + switch(QMessageBox::warning(this, tr("Save Changes"), + tr("Save changes to settings?"), + tr("&Yes"), tr("&No"), tr("&Cancel"), 0, 2)) { + case 0: // save qApp->processEvents(); fileSave(); // fall through intended - case QMessageBox::No: // don't save + case 1: // don't save e->accept(); break; - case QMessageBox::Cancel: // cancel + case 2: // cancel e->ignore(); break; diff --git a/tools/qtconfig/mainwindow.h b/tools/qtconfig/mainwindow.h index 50d73f9..9bc8068 100644 --- a/tools/qtconfig/mainwindow.h +++ b/tools/qtconfig/mainwindow.h @@ -42,15 +42,11 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include "mainwindowbase.h" QT_BEGIN_NAMESPACE -namespace Ui { - class MainWindow; -} - -class MainWindow : public QMainWindow +class MainWindow : public MainWindowBase { Q_OBJECT @@ -60,6 +56,7 @@ public: void closeEvent(QCloseEvent *); + public slots: virtual void buildPalette(); virtual void buildFont(); @@ -86,17 +83,21 @@ public slots: private: + void buildActive(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); + void updateColorButtons(); void updateFontSample(); void updateStyleLayout(); - static QPalette::ColorGroup groupFromIndex(int); - void setPreviewPalette(const QPalette &); void setModified(bool); - Ui::MainWindow *ui; QString desktopThemeName; QPalette editPalette, previewPalette; QStyle *previewstyle; diff --git a/tools/qtconfig/mainwindow.ui b/tools/qtconfig/mainwindow.ui deleted file mode 100644 index 2ca9101..0000000 --- a/tools/qtconfig/mainwindow.ui +++ /dev/null @@ -1,1388 +0,0 @@ - - - ********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -********************************************************************* - MainWindow - - - - 0 - 0 - 815 - 716 - - - - Qt Configuration - - - - - 8 - - - - - - 200 - 0 - - - - true - - - - - - - 0 - - - - Appearance - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - GUI Style - - - - 4 - - - 8 - - - - - - 0 - 0 - - - - Select GUI &Style: - - - guiStyleCombo - - - - - - - - - - - - - - 0 - 0 - - - - Preview - - - - - - Select &Palette: - - - paletteCombo - - - - - - - - Active Palette - - - - - Inactive Palette - - - - - Disabled Palette - - - - - - - - - 0 - 0 - - - - - 410 - 260 - - - - - - - - - - - - 0 - 0 - - - - - 400 - 0 - - - - Build Palette - - - - - - - 0 - - - - - &Button Background: - - - buttonMainColor - - - - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - 1 - - - 0 - - - Window Back&ground: - - - Qt::AlignVCenter - - - 0 - - - buttonWindowColor - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 70 - 20 - - - - - - - - &Tune Palette... - - - - - - - - - - Please use the KDE Control Center to set the palette. - - - - - - - - - - - Fonts - - - - - - Default Font - - - - 8 - - - 4 - - - - - true - - - false - - - - - - - true - - - false - - - - - - - true - - - true - - - false - - - - - - - &Style: - - - fontStyleCombo - - - - - - - &Point Size: - - - pointSizeCombo - - - - - - - F&amily: - - - fontFamilyCombo - - - - - - - Sample Text - - - Qt::AlignHCenter - - - - - - - - - - Font Substitution - - - - 4 - - - 8 - - - - - 4 - - - 0 - - - - - S&elect or Enter a Family: - - - familySubstitutionCombo - - - - - - - true - - - true - - - false - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - Qt::Horizontal - - - - - - - Current Substitutions: - - - - - - - - - - 4 - - - 0 - - - - - Up - - - - - - - Down - - - - - - - Remove - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - Qt::Horizontal - - - - - - - 4 - - - 0 - - - - - Select s&ubstitute Family: - - - chooseSubstitutionCombo - - - - - - - true - - - false - - - - - - - Add - - - - - - - - - - - - - Interface - - - - - - Feel Settings - - - - 8 - - - 4 - - - - - ms - - - 10 - - - 10000 - - - - - - - &Double Click Interval: - - - doubleClickIntervalSpinBox - - - - - - - No blinking - - - ms - - - 9 - - - 10000 - - - - - - - &Cursor Flash Time: - - - cursorFlashTimeSpinBox - - - - - - - lines - - - 1 - - - 20 - - - - - - - Wheel &Scroll Lines: - - - wheelScrollLinesSpinBox - - - - - - - Resolve symlinks in URLs - - - - - - - - - - GUI Effects - - - - 4 - - - 8 - - - - - &Enable - - - Alt+E - - - - - - - - 4 - - - - - &Menu Effect: - - - menuEffectCombo - - - - - - - C&omboBox Effect: - - - comboEffectCombo - - - - - - - &ToolTip Effect: - - - toolTipEffectCombo - - - - - - - Tool&Box Effect: - - - toolBoxEffectCombo - - - - - - - 0 - - - true - - - - Disable - - - - - Animate - - - - - Fade - - - - - - - - - Disable - - - - - Animate - - - - - - - - - Disable - - - - - Animate - - - - - Fade - - - - - - - - - Disable - - - - - Animate - - - - - - - - - - - - - - Global Strut - - - - 8 - - - 4 - - - - - Minimum &Width: - - - strutWidthSpinBox - - - - - - - Minimum Hei&ght: - - - strutHeightSpinBox - - - - - - - pixels - - - 1000 - - - - - - - pixels - - - 1000 - - - - - - - - - - Enhanced support for languages written right-to-left - - - - - - - XIM Input Style: - - - - - - - 0 - - - - On The Spot - - - - - Over The Spot - - - - - Off The Spot - - - - - Root - - - - - - - - Default Input Method: - - - - - - - -1 - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - Printer - - - - - - Enable Font embedding - - - true - - - - - - - - 0 - 0 - - - - Font Paths - - - - 4 - - - 8 - - - - - 0 - - - 4 - - - - - Up - - - - - - - Remove - - - - - - - Down - - - - - - - - - - - - 0 - - - 4 - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 20 - 20 - - - - - - - - Add - - - - - - - Browse... - - - - - - - Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. - - - - - - - - - - - - - - - - Phonon - - - - - - About Phonon - - - - - - Current Version: - - - - - - - Not available - - - - - - - Website: - - - - - - - <a href="http://phonon.kde.org">http://phonon.kde.org/</a> - - - true - - - - - - - - - - About GStreamer - - - - - - Current Version: - - - - - - - Not available - - - - - - - Website: - - - - - - - <a href="http://gstreamer.freedesktop.org/">http://gstreamer.freedesktop.org/</a> - - - true - - - - - - - - - - GStreamer backend settings - - - - - - Preferred audio sink: - - - audiosinkCombo - - - - - - - - - - Preferred render method: - - - videomodeCombo - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html> - - - Qt::RichText - - - false - - - true - - - 2 - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - 0 - 0 - 815 - 19 - - - - - - 203 - 114 - 161 - 110 - - - - &File - - - - - - - - - 543 - 98 - 161 - 106 - - - - &Help - - - - - - - - - - - &Save - - - Save - - - Ctrl+S - - - - - E&xit - - - Exit - - - Ctrl+Q - - - - - &About - - - About - - - - - - - - About &Qt - - - About Qt - - - - - - ColorButton - -

colorbutton.h
- - - PreviewFrame - -
previewframe.h
-
- - - helpView - mainTabWidget - guiStyleCombo - tunePaletteButton - paletteCombo - fontFamilyCombo - fontStyleCombo - pointSizeCombo - sampleLineEdit - familySubstitutionCombo - substitutionsListBox - upSubstitutionButton - downSubstitutionButton - removeSubstitutionButton - chooseSubstitutionCombo - addSubstitutionButton - doubleClickIntervalSpinBox - cursorFlashTimeSpinBox - wheelScrollLinesSpinBox - resolveLinksCheckBox - effectsCheckBox - menuEffectCombo - comboEffectCombo - toolTipEffectCombo - toolBoxEffectCombo - strutWidthSpinBox - strutHeightSpinBox - rtlExtensionsCheckBox - inputStyleCombo - inputMethodCombo - fontEmbeddingCheckBox - fontpathListBox - upFontpathButton - downFontpathButton - removeFontpathButton - fontPathLineEdit - browseFontPathButton - addFontPathButton - audiosinkCombo - videomodeCombo - - - - - effectsCheckBox - toggled(bool) - effectsFrame - setEnabled(bool) - - - 417 - 257 - - - 578 - 379 - - - - - fontEmbeddingCheckBox - toggled(bool) - fontPathsGroup - setEnabled(bool) - - - 449 - 69 - - - 447 - 94 - - - - - diff --git a/tools/qtconfig/mainwindowbase.cpp b/tools/qtconfig/mainwindowbase.cpp new file mode 100644 index 0000000..2460bca --- /dev/null +++ b/tools/qtconfig/mainwindowbase.cpp @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindowbase.h" +#include "colorbutton.h" +#include "previewframe.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/* + * Constructs a MainWindowBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + */ +MainWindowBase::MainWindowBase(QWidget* parent, const char* name, Qt::WindowFlags fl) + : Q3MainWindow(parent, name, fl) +{ + setupUi(this); + + (void)statusBar(); + + // signals and slots connections + connect(fontpathlineedit, SIGNAL(returnPressed()), this, SLOT(addFontpath())); + connect(PushButton15, SIGNAL(clicked()), this, SLOT(addFontpath())); + connect(PushButton1, SIGNAL(clicked()), this, SLOT(addSubstitute())); + connect(PushButton14, SIGNAL(clicked()), this, SLOT(browseFontpath())); + connect(stylecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); + connect(psizecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); + connect(PushButton12, SIGNAL(clicked()), this, SLOT(downFontpath())); + connect(PushButton3, SIGNAL(clicked()), this, SLOT(downSubstitute())); + connect(familycombo, SIGNAL(activated(QString)), this, SLOT(familySelected(QString))); + connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); + connect(fileSaveAction, SIGNAL(activated()), this, SLOT(fileSave())); + connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); + connect(helpAboutQtAction, SIGNAL(activated()), this, SLOT(helpAboutQt())); + connect(TabWidget3, SIGNAL(currentChanged(QWidget*)), this, SLOT(pageChanged(QWidget*))); + connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); + connect(PushButton13, SIGNAL(clicked()), this, SLOT(removeFontpath())); + connect(PushButton4, SIGNAL(clicked()), this, SLOT(removeSubstitute())); + connect(effectcheckbox, SIGNAL(toggled(bool)), effectbase, SLOT(setEnabled(bool))); + connect(fontembeddingcheckbox, SIGNAL(toggled(bool)), GroupBox10, SLOT(setEnabled(bool))); + connect(toolboxeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(dcispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(cfispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(wslspin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(menueffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(comboeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(audiosinkCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(videomodeCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(tooltipeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(strutwidth, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(strutheight, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(effectcheckbox, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(resolvelinks, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(fontembeddingcheckbox, SIGNAL(clicked()), this, SLOT(somethingModified())); + connect(rtlExtensions, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(inputStyle, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(inputMethod, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(gstylecombo, SIGNAL(activated(QString)), this, SLOT(styleSelected(QString))); + connect(familysubcombo, SIGNAL(activated(QString)), this, SLOT(substituteSelected(QString))); + connect(btnAdvanced, SIGNAL(clicked()), this, SLOT(tunePalette())); + connect(PushButton11, SIGNAL(clicked()), this, SLOT(upFontpath())); + connect(PushButton2, SIGNAL(clicked()), this, SLOT(upSubstitute())); + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +MainWindowBase::~MainWindowBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void MainWindowBase::languageChange() +{ + retranslateUi(this); +} + +void MainWindowBase::init() +{ +} + +void MainWindowBase::destroy() +{ +} + +void MainWindowBase::addFontpath() +{ + qWarning("MainWindowBase::addFontpath(): Not implemented yet"); +} + +void MainWindowBase::addSubstitute() +{ + qWarning("MainWindowBase::addSubstitute(): Not implemented yet"); +} + +void MainWindowBase::browseFontpath() +{ + qWarning("MainWindowBase::browseFontpath(): Not implemented yet"); +} + +void MainWindowBase::buildFont() +{ + qWarning("MainWindowBase::buildFont(): Not implemented yet"); +} + +void MainWindowBase::buildPalette() +{ + qWarning("MainWindowBase::buildPalette(): Not implemented yet"); +} + +void MainWindowBase::downFontpath() +{ + qWarning("MainWindowBase::downFontpath(): Not implemented yet"); +} + +void MainWindowBase::downSubstitute() +{ + qWarning("MainWindowBase::downSubstitute(): Not implemented yet"); +} + +void MainWindowBase::familySelected( const QString &) +{ + qWarning("MainWindowBase::familySelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::fileExit() +{ + qWarning("MainWindowBase::fileExit(): Not implemented yet"); +} + +void MainWindowBase::fileSave() +{ + qWarning("MainWindowBase::fileSave(): Not implemented yet"); +} + +void MainWindowBase::helpAbout() +{ + qWarning("MainWindowBase::helpAbout(): Not implemented yet"); +} + +void MainWindowBase::helpAboutQt() +{ + qWarning("MainWindowBase::helpAboutQt(): Not implemented yet"); +} + +void MainWindowBase::new_slot() +{ + qWarning("MainWindowBase::new_slot(): Not implemented yet"); +} + +void MainWindowBase::pageChanged( QWidget *) +{ + qWarning("MainWindowBase::pageChanged( QWidget *): Not implemented yet"); +} + +void MainWindowBase::paletteSelected(int) +{ + qWarning("MainWindowBase::paletteSelected(int): Not implemented yet"); +} + +void MainWindowBase::removeFontpath() +{ + qWarning("MainWindowBase::removeFontpath(): Not implemented yet"); +} + +void MainWindowBase::removeSubstitute() +{ + qWarning("MainWindowBase::removeSubstitute(): Not implemented yet"); +} + +void MainWindowBase::somethingModified() +{ + qWarning("MainWindowBase::somethingModified(): Not implemented yet"); +} + +void MainWindowBase::styleSelected( const QString &) +{ + qWarning("MainWindowBase::styleSelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::substituteSelected( const QString &) +{ + qWarning("MainWindowBase::substituteSelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::tunePalette() +{ + qWarning("MainWindowBase::tunePalette(): Not implemented yet"); +} + +void MainWindowBase::upFontpath() +{ + qWarning("MainWindowBase::upFontpath(): Not implemented yet"); +} + +void MainWindowBase::upSubstitute() +{ + qWarning("MainWindowBase::upSubstitute(): Not implemented yet"); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/mainwindowbase.h b/tools/qtconfig/mainwindowbase.h new file mode 100644 index 0000000..1e1dabf --- /dev/null +++ b/tools/qtconfig/mainwindowbase.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOWBASE_H +#define MAINWINDOWBASE_H + +#include "ui_mainwindowbase.h" +#include + +QT_BEGIN_NAMESPACE + +class ColorButton; +class PreviewFrame; + +class MainWindowBase : public Q3MainWindow, public Ui::MainWindowBase +{ + Q_OBJECT + +public: + MainWindowBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::Window); + ~MainWindowBase(); + +public slots: + virtual void addFontpath(); + virtual void addSubstitute(); + virtual void browseFontpath(); + virtual void buildFont(); + virtual void buildPalette(); + virtual void downFontpath(); + virtual void downSubstitute(); + virtual void familySelected( const QString & ); + virtual void fileExit(); + virtual void fileSave(); + virtual void helpAbout(); + virtual void helpAboutQt(); + virtual void new_slot(); + virtual void pageChanged( QWidget * ); + virtual void paletteSelected( int ); + virtual void removeFontpath(); + virtual void removeSubstitute(); + virtual void somethingModified(); + virtual void styleSelected( const QString & ); + virtual void substituteSelected( const QString & ); + virtual void tunePalette(); + virtual void upFontpath(); + virtual void upSubstitute(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); +}; + +QT_END_NAMESPACE + +#endif // MAINWINDOWBASE_H diff --git a/tools/qtconfig/mainwindowbase.ui b/tools/qtconfig/mainwindowbase.ui new file mode 100644 index 0000000..b09abd0 --- /dev/null +++ b/tools/qtconfig/mainwindowbase.ui @@ -0,0 +1,1384 @@ + + + ********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +********************************************************************* + MainWindowBase + + + + 0 + 0 + 815 + 716 + + + + Qt Configuration + + + + + 0 + 26 + 815 + 690 + + + + + 8 + + + + + + 200 + 0 + + + + true + + + + + + + 0 + + + + Appearance + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + GUI Style + + + + 4 + + + 8 + + + + + + 0 + 0 + + + + Select GUI &Style: + + + gstylecombo + + + + + + + + + + + + + + 0 + 0 + + + + Preview + + + + + + Select &Palette: + + + paletteCombo + + + + + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + + + + + + 0 + 0 + + + + + 410 + 260 + + + + + + + + + + + + 0 + 0 + + + + + 400 + 0 + + + + Build Palette + + + + + + + 0 + + + + + &3-D Effects: + + + buttonMainColor + + + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + 1 + + + 0 + + + Window Back&ground: + + + Qt::AlignVCenter + + + 0 + + + buttonMainColor2 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 70 + 20 + + + + + + + + &Tune Palette... + + + + + + + + + + Please use the KDE Control Center to set the palette. + + + + + + + + + + + Fonts + + + + + + Default Font + + + + 8 + + + 4 + + + + + true + + + false + + + + + + + true + + + false + + + + + + + true + + + true + + + false + + + + + + + &Style: + + + stylecombo + + + + + + + &Point Size: + + + psizecombo + + + + + + + F&amily: + + + familycombo + + + + + + + Sample Text + + + Qt::AlignHCenter + + + + + + + + + + Font Substitution + + + + 4 + + + 8 + + + + + 4 + + + 0 + + + + + S&elect or Enter a Family: + + + familysubcombo + + + + + + + true + + + true + + + false + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + + Current Substitutions: + + + + + + + + + + 4 + + + 0 + + + + + Up + + + + + + + Down + + + + + + + Remove + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + + 4 + + + 0 + + + + + Select s&ubstitute Family: + + + choosesubcombo + + + + + + + true + + + false + + + + + + + Add + + + + + + + + + + + + + Interface + + + + + + Feel Settings + + + + 8 + + + 4 + + + + + ms + + + 10 + + + 10000 + + + + + + + &Double Click Interval: + + + dcispin + + + + + + + No blinking + + + ms + + + 9 + + + 10000 + + + + + + + &Cursor Flash Time: + + + cfispin + + + + + + + lines + + + 1 + + + 20 + + + + + + + Wheel &Scroll Lines: + + + wslspin + + + + + + + Resolve symlinks in URLs + + + + + + + + + + GUI Effects + + + + 4 + + + 8 + + + + + &Enable + + + Alt+E + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 4 + + + + + &Menu Effect: + + + menueffect + + + + + + + C&omboBox Effect: + + + comboeffect + + + + + + + &ToolTip Effect: + + + tooltipeffect + + + + + + + Tool&Box Effect: + + + toolboxeffect + + + + + + + 0 + + + true + + + + Disable + + + + + Animate + + + + + Fade + + + + + + + + + Disable + + + + + Animate + + + + + + + + + Disable + + + + + Animate + + + + + Fade + + + + + + + + + Disable + + + + + Animate + + + + + + + + + + + + + + Global Strut + + + + 8 + + + 4 + + + + + Minimum &Width: + + + strutwidth + + + + + + + Minimum Hei&ght: + + + strutheight + + + + + + + pixels + + + 1000 + + + + + + + pixels + + + 1000 + + + + + + + + + + Enhanced support for languages written right-to-left + + + + + + + XIM Input Style: + + + + + + + 0 + + + + On The Spot + + + + + Over The Spot + + + + + Off The Spot + + + + + Root + + + + + + + + Default Input Method: + + + + + + + -1 + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + Printer + + + + + + Enable Font embedding + + + true + + + + + + + + 0 + 0 + + + + Font Paths + + + + 4 + + + 8 + + + + + 0 + + + 4 + + + + + Up + + + + + + + Remove + + + + + + + Down + + + + + + + + + + + + 0 + + + 4 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + Add + + + + + + + Browse... + + + + + + + Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. + + + + + + + + + + + + + + + + Phonon + + + + + + About Phonon + + + + + + Current Version: + + + + + + + Not available + + + + + + + Website: + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html> + + + true + + + + + + + + + + About GStreamer + + + + + + Current Version: + + + + + + + Not available + + + + + + + Website: + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html> + + + true + + + + + + + + + + GStreamer backend settings + + + + + + Preferred audio sink: + + + audiosinkCombo + + + + + + + + + + Preferred render method: + + + videomodeCombo + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html> + + + Qt::RichText + + + false + + + true + + + 2 + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + 0 + 0 + 815 + 26 + + + + + + 0 + 0 + 123 + 92 + + + + &File + + + + + + + + + + + + 0 + 0 + 123 + 90 + + + + &Help + + + + + + + + + + + + + + &Save + + + Save + + + Ctrl+S + + + + + E&xit + + + Exit + + + + + + + + &About + + + About + + + + + + + + About &Qt + + + About Qt + + + + + + Q3Frame + QFrame +
Qt3Support/Q3Frame
+ 1 +
+ + Q3MainWindow + QWidget +
q3mainwindow.h
+ 1 +
+ + Q3ListBox + Q3Frame +
q3listbox.h
+
+ + ColorButton + +
colorbutton.h
+
+ + PreviewFrame + +
previewframe.h
+
+
+ + helpview + familycombo + stylecombo + psizecombo + samplelineedit + familysubcombo + PushButton2 + PushButton3 + PushButton4 + choosesubcombo + PushButton1 + dcispin + cfispin + wslspin + effectcheckbox + menueffect + comboeffect + tooltipeffect + strutwidth + strutheight + sublistbox + + + +
diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp index a700b8d..f59584e 100644 --- a/tools/qtconfig/paletteeditoradvanced.cpp +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -38,74 +38,58 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "ui_paletteeditoradvanced.h" + #include "paletteeditoradvanced.h" #include "colorbutton.h" +#include +#include +#include +#include +#include +#include + QT_BEGIN_NAMESPACE -PaletteEditorAdvanced::PaletteEditorAdvanced(QWidget *parent) - : QDialog(parent), ui(new Ui::PaletteEditorAdvanced), selectedPalette(0) +PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent, + const char * name, bool modal, Qt::WindowFlags f ) + : PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0) { - ui->setupUi(this); - - // create a ColorButton's - buttonCentral = new ColorButton(ui->groupCentral); - buttonCentral->setToolTip(tr("Choose a color")); - buttonCentral->setWhatsThis(tr("Choose a color for the selected central color role.")); - ui->layoutCentral->addWidget(buttonCentral); - ui->labelCentral->setBuddy(buttonCentral); - - buttonEffect = new ColorButton(ui->groupEffect); - buttonEffect->setToolTip(tr("Choose a color")); - buttonEffect->setWhatsThis(tr("Choose a color for the selected effect color role.")); + // work around buggy UI file + comboEffect->setEnabled(false); buttonEffect->setEnabled(false); - ui->layoutEffect->addWidget(buttonEffect); - ui->labelEffect->setBuddy(buttonEffect); - - // signals and slots connections - connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int))); - connect(ui->comboCentral, SIGNAL(activated(int)), SLOT(onCentral(int))); - connect(buttonCentral, SIGNAL(clicked()), SLOT(onChooseCentralColor())); - connect(buttonEffect, SIGNAL(clicked()), SLOT(onChooseEffectColor())); - connect(ui->comboEffect, SIGNAL(activated(int)), SLOT(onEffect(int))); - connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), SLOT(onToggleBuildEffects(bool))); - connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool))); - connect(ui->checkBuildInactive, SIGNAL(toggled(bool)), SLOT(onToggleBuildInactive(bool))); - connect(ui->checkBuildDisabled, SIGNAL(toggled(bool)), SLOT(onToggleBuildDisabled(bool))); - onToggleBuildEffects(true); editPalette = QApplication::palette(); + setPreviewPalette( editPalette ); } PaletteEditorAdvanced::~PaletteEditorAdvanced() { - delete ui; } -void PaletteEditorAdvanced::onToggleBuildInactive(bool v) +void PaletteEditorAdvanced::onToggleBuildInactive( bool v ) { if (selectedPalette == 1) { - ui->groupCentral->setDisabled(v); - ui->groupEffect->setDisabled(v); + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); } if (v) { - build(QPalette::Inactive); + buildInactive(); updateColorButtons(); } } -void PaletteEditorAdvanced::onToggleBuildDisabled(bool v) +void PaletteEditorAdvanced::onToggleBuildDisabled( bool v ) { if (selectedPalette == 2) { - ui->groupCentral->setDisabled(v); - ui->groupEffect->setDisabled(v); + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); } if (v) { - build(QPalette::Disabled); + buildDisabled(); updateColorButtons(); } } @@ -115,204 +99,402 @@ void PaletteEditorAdvanced::paletteSelected(int p) selectedPalette = p; if(p == 1) { // inactive - ui->groupCentral->setDisabled(ui->checkBuildInactive->isChecked()); - ui->groupEffect->setDisabled(ui->checkBuildInactive->isChecked()); - } else if (p == 2) { // disabled - ui->groupCentral->setDisabled(ui->checkBuildDisabled->isChecked()); - ui->groupEffect->setDisabled(ui->checkBuildDisabled->isChecked()); - } else { - ui->groupCentral->setEnabled(true); - ui->groupEffect->setEnabled(true); + groupCentral->setDisabled(checkBuildInactive->isChecked()); + groupEffect->setDisabled(checkBuildInactive->isChecked()); + } + else if (p == 2) { // disabled + groupCentral->setDisabled(checkBuildDisabled->isChecked()); + groupEffect->setDisabled(checkBuildDisabled->isChecked()); + } + else { + groupCentral->setEnabled(true); + groupEffect->setEnabled(true); } updateColorButtons(); } void PaletteEditorAdvanced::onChooseCentralColor() { - QPalette::ColorGroup group = groupFromIndex(selectedPalette); - editPalette.setColor(group, centralFromIndex(ui->comboCentral->currentIndex()), - buttonCentral->color()); - - buildEffect(group); - if (group == QPalette::Active) { - if(ui->checkBuildInactive->isChecked()) - build(QPalette::Inactive); - if(ui->checkBuildDisabled->isChecked()) - build(QPalette::Disabled); + switch(selectedPalette) { + case 0: + default: + mapToActiveCentralRole( buttonCentral->color() ); + break; + case 1: + mapToInactiveCentralRole( buttonCentral->color() ); + break; + case 2: + mapToDisabledCentralRole( buttonCentral->color() ); + break; } - updateColorButtons(); } void PaletteEditorAdvanced::onChooseEffectColor() { - QPalette::ColorGroup group = groupFromIndex(selectedPalette); - editPalette.setColor(group, effectFromIndex(ui->comboEffect->currentIndex()), - buttonEffect->color()); - - if (group == QPalette::Active) { - if(ui->checkBuildInactive->isChecked()) - build(QPalette::Inactive); - if(ui->checkBuildDisabled->isChecked()) - build(QPalette::Disabled); + switch(selectedPalette) { + case 0: + default: + mapToActiveEffectRole( buttonEffect->color() ); + break; + case 1: + mapToInactiveEffectRole( buttonEffect->color() ); + break; + case 2: + mapToDisabledEffectRole( buttonEffect->color() ); + break; } - updateColorButtons(); } -void PaletteEditorAdvanced::onToggleBuildEffects(bool on) +void PaletteEditorAdvanced::onToggleBuildEffects( bool on ) { - if (on) { - for (int i = 0; i < QPalette::NColorGroups; i++) - buildEffect(QPalette::ColorGroup(i)); - } + if (!on) return; + buildActiveEffect(); + buildInactiveEffect(); + buildDisabledEffect(); } -QPalette::ColorGroup PaletteEditorAdvanced::groupFromIndex(int item) +QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item ) { - switch (item) { - case 0: - default: - return QPalette::Active; - case 1: - return QPalette::Inactive; - case 2: - return QPalette::Disabled; + switch( item ) { + case 0: + return QColorGroup::Window; + case 1: + return QColorGroup::WindowText; + case 2: + return QColorGroup::Button; + case 3: + return QColorGroup::Base; + case 4: + return QColorGroup::Text; + case 5: + return QColorGroup::BrightText; + case 6: + return QColorGroup::ButtonText; + case 7: + return QColorGroup::Highlight; + case 8: + return QColorGroup::HighlightedText; + default: + return QColorGroup::NColorRoles; } } -QPalette::ColorRole PaletteEditorAdvanced::centralFromIndex(int item) +QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item ) + { - switch (item) { + switch( item ) { case 0: - return QPalette::Window; + return QColorGroup::Light; case 1: - return QPalette::WindowText; + return QColorGroup::Midlight; case 2: - return QPalette::Base; + return QColorGroup::Mid; case 3: - return QPalette::AlternateBase; + return QColorGroup::Dark; case 4: - return QPalette::ToolTipBase; - case 5: - return QPalette::ToolTipText; - case 6: - return QPalette::Text; - case 7: - return QPalette::Button; - case 8: - return QPalette::ButtonText; - case 9: - return QPalette::BrightText; - case 10: - return QPalette::Highlight; - case 11: - return QPalette::HighlightedText; - case 12: - return QPalette::Link; - case 13: - return QPalette::LinkVisited; + return QColorGroup::Shadow; default: - return QPalette::NoRole; + return QColorGroup::NColorRoles; } } -QPalette::ColorRole PaletteEditorAdvanced::effectFromIndex(int item) +void PaletteEditorAdvanced::onCentral( int item ) { - switch (item) { + QColor c; + + switch(selectedPalette) { case 0: - return QPalette::Light; + default: + c = editPalette.active().color( centralFromItem(item) ); + break; case 1: - return QPalette::Midlight; + c = editPalette.inactive().color( centralFromItem(item) ); + break; case 2: - return QPalette::Mid; - case 3: - return QPalette::Dark; - case 4: - return QPalette::Shadow; + c = editPalette.disabled().color( centralFromItem(item) ); + break; + } + + buttonCentral->setColor(c); +} + +void PaletteEditorAdvanced::onEffect( int item ) +{ + QColor c; + switch(selectedPalette) { + case 0: default: - return QPalette::NoRole; + c = editPalette.active().color( effectFromItem(item) ); + break; + case 1: + editPalette.inactive().color( effectFromItem(item) ); + break; + case 2: + editPalette.disabled().color( effectFromItem(item) ); + break; } + buttonEffect->setColor(c); } -void PaletteEditorAdvanced::onCentral(int item) +void PaletteEditorAdvanced::mapToActiveCentralRole( const QColor& c ) { - QColor c = editPalette.color(groupFromIndex(selectedPalette), centralFromIndex(item)); - buttonCentral->setColor(c); + QColorGroup cg = editPalette.active(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setActive( cg ); + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); } -void PaletteEditorAdvanced::onEffect(int item) +void PaletteEditorAdvanced::mapToActiveEffectRole( const QColor& c ) { - QColor c = editPalette.color(groupFromIndex(selectedPalette), effectFromIndex(item)); - buttonEffect->setColor(c); + QColorGroup cg = editPalette.active(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setActive( cg ); + + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.active(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setActive( cg ); + + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); } -QPalette PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup, - const QPalette &basePalette) +void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c ) { - QPalette result(basePalette); + QColorGroup cg = editPalette.inactive(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setInactive( cg ); - if (colorGroup == QPalette::Active) { - QPalette calculatedPalette(basePalette.color(colorGroup, QPalette::Button), - basePalette.color(colorGroup, QPalette::Window)); + buildInactiveEffect(); - for (int i = 0; i < 5; i++) { - QPalette::ColorRole effectRole = effectFromIndex(i); - result.setColor(colorGroup, effectRole, - calculatedPalette.color(colorGroup, effectRole)); - } - } else { - QColor btn = basePalette.color(colorGroup, QPalette::Button); + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactiveEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.inactive(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} - result.setColor(colorGroup, QPalette::Light, btn.lighter()); - result.setColor(colorGroup, QPalette::Midlight, btn.lighter(115)); - result.setColor(colorGroup, QPalette::Mid, btn.darker(150)); - result.setColor(colorGroup, QPalette::Dark, btn.darker()); - result.setColor(colorGroup, QPalette::Shadow, Qt::black); +void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.inactive(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledPixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.disabled(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::buildActiveEffect() +{ + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); + + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateColorButtons(); +} + +void PaletteEditorAdvanced::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + if ( checkBuildEffect->isChecked() ) + buildInactiveEffect(); + else { + setPreviewPalette( editPalette ); + updateColorButtons(); } - return result; } -void PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup) +void PaletteEditorAdvanced::buildInactiveEffect() { - editPalette = buildEffect(colorGroup, editPalette); + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); updateColorButtons(); } -void PaletteEditorAdvanced::build(QPalette::ColorGroup colorGroup) +void PaletteEditorAdvanced::buildDisabled() { - if (colorGroup != QPalette::Active) { - for (int i = 0; i < QPalette::NColorRoles; i++) - editPalette.setColor(colorGroup, QPalette::ColorRole(i), - editPalette.color(QPalette::Active, QPalette::ColorRole(i))); + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); + cg.setColor( QColorGroup::WindowText, Qt::darkGray ); + cg.setColor( QColorGroup::Text, Qt::darkGray ); + cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); + editPalette.setDisabled( cg ); + + if ( checkBuildEffect->isChecked() ) + buildDisabledEffect(); + else { + setPreviewPalette( editPalette ); + updateColorButtons(); + } +} + +void PaletteEditorAdvanced::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; - if (colorGroup == QPalette::Disabled) { - editPalette.setColor(colorGroup, QPalette::ButtonText, Qt::darkGray); - editPalette.setColor(colorGroup, QPalette::WindowText, Qt::darkGray); - editPalette.setColor(colorGroup, QPalette::Text, Qt::darkGray); - editPalette.setColor(colorGroup, QPalette::HighlightedText, Qt::darkGray); - } + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); - if (ui->checkBuildEffect->isChecked()) - buildEffect(colorGroup); - else - updateColorButtons(); + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + +void PaletteEditorAdvanced::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (selectedPalette) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); } void PaletteEditorAdvanced::updateColorButtons() { - QPalette::ColorGroup colorGroup = groupFromIndex(selectedPalette); - buttonCentral->setColor(editPalette.color(colorGroup, - centralFromIndex(ui->comboCentral->currentIndex()))); - buttonEffect->setColor(editPalette.color(colorGroup, - effectFromIndex(ui->comboEffect->currentIndex()))); + QColor central, effect; + switch (selectedPalette) { + case 0: + default: + central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) ); + break; + case 1: + central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) ); + break; + case 2: + central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) ); + break; + } + + buttonCentral->setColor(central); + buttonEffect->setColor(effect); } -void PaletteEditorAdvanced::setPal(const QPalette &pal) +void PaletteEditorAdvanced::setPal( const QPalette& pal ) { editPalette = pal; + setPreviewPalette( pal ); updateColorButtons(); } @@ -321,51 +503,51 @@ QPalette PaletteEditorAdvanced::pal() const return editPalette; } -void PaletteEditorAdvanced::setupBackgroundRole(QPalette::ColorRole role) +void PaletteEditorAdvanced::setupBackgroundMode( Qt::BackgroundMode mode ) { int initRole = 0; - switch (role) { - case QPalette::Window: + switch( mode ) { + case Qt::PaletteBackground: initRole = 0; break; - case QPalette::WindowText: + case Qt::PaletteForeground: initRole = 1; break; - case QPalette::Base: + case Qt::PaletteButton: initRole = 2; break; - case QPalette::AlternateBase: + case Qt::PaletteBase: initRole = 3; break; - case QPalette::ToolTipBase: + case Qt::PaletteText: initRole = 4; break; - case QPalette::ToolTipText: + case Qt::PaletteBrightText: initRole = 5; break; - case QPalette::Text: + case Qt::PaletteButtonText: initRole = 6; break; - case QPalette::Button: + case Qt::PaletteHighlight: initRole = 7; break; - case QPalette::ButtonText: + case Qt::PaletteHighlightedText: initRole = 8; break; - case QPalette::BrightText: + case Qt::PaletteLight: initRole = 9; break; - case QPalette::Highlight: + case Qt::PaletteMidlight: initRole = 10; break; - case QPalette::HighlightedText: + case Qt::PaletteDark: initRole = 11; break; - case QPalette::Link: + case Qt::PaletteMid: initRole = 12; break; - case QPalette::LinkVisited: + case Qt::PaletteShadow: initRole = 13; break; default: @@ -373,27 +555,36 @@ void PaletteEditorAdvanced::setupBackgroundRole(QPalette::ColorRole role) break; } - if (initRole != -1) - ui->comboCentral->setCurrentIndex(initRole); + if ( initRole <= -1 ) return; + + if (initRole > 8 ) { + comboEffect->setCurrentItem( initRole - 9 ); + } + else { + comboCentral->setCurrentItem( initRole ); + } } -QPalette PaletteEditorAdvanced::getPalette(bool *ok, const QPalette &init, - QPalette::ColorRole backgroundRole, QWidget *parent) +QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init, + Qt::BackgroundMode mode, QWidget* parent, + const char* name ) { - PaletteEditorAdvanced *dlg = new PaletteEditorAdvanced(parent); - dlg->setupBackgroundRole(backgroundRole); + PaletteEditorAdvanced* dlg = new PaletteEditorAdvanced( parent, name, true ); + dlg->setupBackgroundMode( mode ); - if (init != QPalette()) - dlg->setPal(init); + if ( init != QPalette() ) + dlg->setPal( init ); int resultCode = dlg->exec(); QPalette result = init; - if (resultCode == QDialog::Accepted) + if ( resultCode == QDialog::Accepted ) { + if ( ok ) + *ok = true; result = dlg->pal(); - - if (ok) - *ok = resultCode; - + } else { + if ( ok ) + *ok = false; + } delete dlg; return result; } diff --git a/tools/qtconfig/paletteeditoradvanced.h b/tools/qtconfig/paletteeditoradvanced.h index 2bdb95d..a1eb8e7 100644 --- a/tools/qtconfig/paletteeditoradvanced.h +++ b/tools/qtconfig/paletteeditoradvanced.h @@ -42,65 +42,69 @@ #ifndef PALETTEEDITORADVANCED_H #define PALETTEEDITORADVANCED_H -#include +#include "paletteeditoradvancedbase.h" QT_BEGIN_NAMESPACE -namespace Ui { - class PaletteEditorAdvanced; -} - -class ColorButton; - -class PaletteEditorAdvanced : public QDialog +class PaletteEditorAdvanced : public PaletteEditorAdvancedBase { Q_OBJECT public: - PaletteEditorAdvanced(QWidget *parent = 0); + PaletteEditorAdvanced( QWidget * parent=0, const char * name=0, + bool modal=false, Qt::WindowFlags f=0 ); ~PaletteEditorAdvanced(); - static QPalette getPalette(bool *ok, const QPalette &pal, - QPalette::ColorRole backgroundRole = QPalette::Window, - QWidget *parent = 0); - - static QPalette buildEffect(QPalette::ColorGroup colorGroup, const QPalette &basePalette); + static QPalette getPalette( bool *ok, const QPalette &pal, Qt::BackgroundMode mode = Qt::PaletteBackground, + QWidget* parent = 0, const char* name = 0 ); protected slots: void paletteSelected(int); - void onCentral(int); - void onEffect(int); + void onCentral( int ); + void onEffect( int ); void onChooseCentralColor(); void onChooseEffectColor(); - void onToggleBuildEffects(bool); - void onToggleBuildInactive(bool); - void onToggleBuildDisabled(bool); + void onToggleBuildEffects( bool ); + void onToggleBuildInactive( bool ); + void onToggleBuildDisabled( bool ); protected: - void buildEffect(QPalette::ColorGroup); - void build(QPalette::ColorGroup); + void mapToActiveCentralRole( const QColor& ); + void mapToActiveEffectRole( const QColor& ); + void mapToActivePixmapRole( const QPixmap& ); + void mapToInactiveCentralRole( const QColor& ); + void mapToInactiveEffectRole( const QColor& ); + void mapToInactivePixmapRole( const QPixmap& ); + void mapToDisabledCentralRole( const QColor& ); + void mapToDisabledEffectRole( const QColor& ); + void mapToDisabledPixmapRole( const QPixmap& ); + + + void buildPalette(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); private: + void setPreviewPalette( const QPalette& ); void updateColorButtons(); - void setupBackgroundRole(QPalette::ColorRole); + void setupBackgroundMode( Qt::BackgroundMode ); QPalette pal() const; - void setPal(const QPalette &); + void setPal( const QPalette& ); - static QPalette::ColorGroup groupFromIndex(int); - static QPalette::ColorRole centralFromIndex(int); - static QPalette::ColorRole effectFromIndex(int); + QColorGroup::ColorRole centralFromItem( int ); + QColorGroup::ColorRole effectFromItem( int ); QPalette editPalette; - - Ui::PaletteEditorAdvanced *ui; + QPalette previewPalette; int selectedPalette; - ColorButton *buttonCentral; - ColorButton *buttonEffect; }; QT_END_NAMESPACE -#endif // PALETTEEDITORADVANCED_H +#endif diff --git a/tools/qtconfig/paletteeditoradvanced.ui b/tools/qtconfig/paletteeditoradvanced.ui deleted file mode 100644 index b1d6b95..0000000 --- a/tools/qtconfig/paletteeditoradvanced.ui +++ /dev/null @@ -1,416 +0,0 @@ - - - ********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -********************************************************************* - PaletteEditorAdvanced - - - - 0 - 0 - 239 - 344 - - - - Tune Palette - - - - - - - - Select &Palette: - - - paletteCombo - - - - - - - - Active Palette - - - - - Inactive Palette - - - - - Disabled Palette - - - - - - - - - - - 0 - 0 - - - - Auto - - - - - - Build inactive palette from active - - - true - - - - - - - Build disabled palette from active - - - true - - - - - - - - - - Central color &roles - - - - - - Choose central color role - - - <b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p> - - - - Window - - - - - WindowText - - - - - Base - - - - - AlternateBase - - - - - ToolTipBase - - - - - ToolTipText - - - - - Text - - - - - Button - - - - - ButtonText - - - - - BrightText - - - - - Highlight - - - - - HighlightedText - - - - - Link - - - - - LinkVisited - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - &Select Color: - - - - - - - - - - - - 3-D shadow &effects - - - - - - - - Generate shadings - - - Check to let 3D-effect colors be calculated from button-color. - - - Build &from button color - - - true - - - - - - - false - - - Choose 3D-effect color role - - - <b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> - - - - Light - - - - - Midlight - - - - - Mid - - - - - Dark - - - - - Shadow - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Select Co&lor: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - PaletteEditorAdvanced - accept() - - - 238 - 384 - - - 157 - 274 - - - - - buttonBox - rejected() - PaletteEditorAdvanced - reject() - - - 306 - 390 - - - 286 - 274 - - - - - checkBuildEffect - toggled(bool) - comboEffect - setDisabled(bool) - - - 82 - 262 - - - 190 - 262 - - - - - diff --git a/tools/qtconfig/paletteeditoradvancedbase.cpp b/tools/qtconfig/paletteeditoradvancedbase.cpp new file mode 100644 index 0000000..708c834 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "paletteeditoradvancedbase.h" +#include "colorbutton.h" + +#include + +QT_BEGIN_NAMESPACE + +/* + * Constructs a PaletteEditorAdvancedBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * true to construct a modal dialog. + */ +PaletteEditorAdvancedBase::PaletteEditorAdvancedBase(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) + : QDialog(parent, name, modal, fl) +{ + setupUi(this); + + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); + connect(comboCentral, SIGNAL(activated(int)), this, SLOT(onCentral(int))); + connect(buttonCentral, SIGNAL(clicked()), this, SLOT(onChooseCentralColor())); + connect(buttonEffect, SIGNAL(clicked()), this, SLOT(onChooseEffectColor())); + connect(comboEffect, SIGNAL(activated(int)), this, SLOT(onEffect(int))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildEffects(bool))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), comboEffect, SLOT(setDisabled(bool))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool))); + connect(checkBuildInactive, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildInactive(bool))); + connect(checkBuildDisabled, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildDisabled(bool))); + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +PaletteEditorAdvancedBase::~PaletteEditorAdvancedBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void PaletteEditorAdvancedBase::languageChange() +{ + retranslateUi(this); +} + +void PaletteEditorAdvancedBase::init() +{ +} + +void PaletteEditorAdvancedBase::destroy() +{ +} + +void PaletteEditorAdvancedBase::onCentral(int) +{ + qWarning("PaletteEditorAdvancedBase::onCentral(int): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onChooseCentralColor() +{ + qWarning("PaletteEditorAdvancedBase::onChooseCentralColor(): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onChooseEffectColor() +{ + qWarning("PaletteEditorAdvancedBase::onChooseEffectColor(): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onEffect(int) +{ + qWarning("PaletteEditorAdvancedBase::onEffect(int): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildDisabled(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildDisabled(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildEffects(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildEffects(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildInactive(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildInactive(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::paletteSelected(int) +{ + qWarning("PaletteEditorAdvancedBase::paletteSelected(int): Not implemented yet"); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/paletteeditoradvancedbase.h b/tools/qtconfig/paletteeditoradvancedbase.h new file mode 100644 index 0000000..ee14a26 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PALETTEEDITORADVANCEDBASE_H +#define PALETTEEDITORADVANCEDBASE_H + +#include "ui_paletteeditoradvancedbase.h" +#include + +QT_BEGIN_NAMESPACE + +class ColorButton; + +class PaletteEditorAdvancedBase : public QDialog, public Ui::PaletteEditorAdvancedBase +{ + Q_OBJECT + +public: + PaletteEditorAdvancedBase(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + ~PaletteEditorAdvancedBase(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); + virtual void onCentral(int); + virtual void onChooseCentralColor(); + virtual void onChooseEffectColor(); + virtual void onEffect(int); + virtual void onToggleBuildDisabled(bool); + virtual void onToggleBuildEffects(bool); + virtual void onToggleBuildInactive(bool); + virtual void paletteSelected(int); + +}; + +QT_END_NAMESPACE + +#endif // PALETTEEDITORADVANCEDBASE_H diff --git a/tools/qtconfig/paletteeditoradvancedbase.ui b/tools/qtconfig/paletteeditoradvancedbase.ui new file mode 100644 index 0000000..12c5a7d --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.ui @@ -0,0 +1,617 @@ + + + ********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +********************************************************************* + + PaletteEditorAdvancedBase + + + PaletteEditorAdvancedBase + + + true + + + + 0 + 0 + 295 + 346 + + + + Tune Palette + + + true + + + <b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p> + + + + unnamed + + + 11 + + + 6 + + + + + unnamed + + + 0 + + + 6 + + + + + TextLabel1 + + + Select &Palette: + + + paletteCombo + + + + + + + paletteCombo + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + + + + + + + ButtonGroup1 + + + + 5 + 4 + 0 + 0 + + + + Auto + + + + unnamed + + + 11 + + + 6 + + + + + checkBuildInactive + + + Build inactive palette from active + + + true + + + + + + + checkBuildDisabled + + + Build disabled palette from active + + + true + + + + + + + + + + groupCentral + + + Central color &roles + + + + unnamed + + + 11 + + + 6 + + + + + comboCentral + + + Choose central color role + + + <b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p> + + + + Window + + + + + WindowText + + + + + Button + + + + + Base + + + + + Text + + + + + BrightText + + + + + ButtonText + + + + + Highlight + + + + + HighlightedText + + + + + + + + unnamed + + + 0 + + + 6 + + + + + + 20 + 20 + + + + Expanding + + + Horizontal + + + + + + + labelCentral + + + + 1 + 1 + 0 + 0 + + + + + 0 + 0 + + + + &Select Color: + + + buttonCentral + + + + + + + buttonCentral + + + + 0 + 0 + 0 + 0 + + + + Qt::TabFocus + + + Choose a color + + + Choose a color for the selected central color role. + + + + + + + + + + + + groupEffect + + + 3-D shadow &effects + + + + unnamed + + + 11 + + + 6 + + + + + unnamed + + + 0 + + + 6 + + + + + checkBuildEffect + + + Build &from button color + + + true + + + Generate shadings + + + Check to let 3D-effect colors be calculated from button-color. + + + + + + + comboEffect + + + Choose 3D-effect color role + + + <b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> + + + + Light + + + + + Midlight + + + + + Mid + + + + + Dark + + + + + Shadow + + + + + + + + + + unnamed + + + 0 + + + 6 + + + + + + 20 + 20 + + + + Expanding + + + Horizontal + + + + + + + labelEffect + + + + 1 + 1 + 0 + 0 + + + + + 0 + 0 + + + + Select Co&lor: + + + buttonEffect + + + + + + + buttonEffect + + + + 0 + 0 + 0 + 0 + + + + Qt::TabFocus + + + Choose a color + + + Choose a color for the selected effect color role. + + + + + + + + + + + + unnamed + + + 0 + + + 6 + + + + + + 20 + 20 + + + + Expanding + + + Horizontal + + + + + + + buttonOk + + + OK + + + true + + + true + + + Close dialog and apply all changes. + + + + + + + buttonCancel + + + Cancel + + + true + + + Close dialog and discard all changes. + + + + + + + + + + + ColorButton + +
colorbutton.h
+ + 40 + 25 + + 0 + + 5 + 5 + + image0 + + color + pixmap + +
+
+ + buttonOk + buttonCancel + paletteCombo + checkBuildInactive + checkBuildDisabled + comboCentral + buttonCentral + checkBuildEffect + comboEffect + buttonEffect + + + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + +
diff --git a/tools/qtconfig/previewframe.cpp b/tools/qtconfig/previewframe.cpp index f37ac78..3b46e8d 100644 --- a/tools/qtconfig/previewframe.cpp +++ b/tools/qtconfig/previewframe.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "previewframe.h" -#include "previewwidget.h" #include #include @@ -48,8 +47,8 @@ QT_BEGIN_NAMESPACE -PreviewFrame::PreviewFrame(QWidget *parent) - : QFrame(parent) +PreviewFrame::PreviewFrame( QWidget *parent, const char *name ) + : QFrame( parent, name ) { setMinimumSize(200, 200); setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); @@ -83,22 +82,23 @@ void PreviewFrame::setPreviewVisible(bool visible) workspace->viewport()->update(); } -Workspace::Workspace(PreviewFrame *parent) +Workspace::Workspace(PreviewFrame* parent, const char* name) : QMdiArea(parent) { previewFrame = parent; PreviewWidget *previewWidget = previewFrame->widget(); + setObjectName(QLatin1String(name)); QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); - frame->move(10, 10); + frame->move(10,10); frame->show(); } -void Workspace::paintEvent(QPaintEvent *) +void Workspace::paintEvent( QPaintEvent* ) { - QPainter p(viewport()); + QPainter p (viewport()); p.fillRect(rect(), palette().color(backgroundRole()).dark()); - p.setPen(QPen(Qt::white)); - p.drawText(0, height() / 2, width(), height(), Qt::AlignHCenter, previewFrame->previewText()); + p.setPen( QPen( Qt::white ) ); + p.drawText ( 0, height() / 2, width(), height(), Qt::AlignHCenter, previewFrame->previewText()); } QT_END_NAMESPACE diff --git a/tools/qtconfig/previewframe.h b/tools/qtconfig/previewframe.h index 41c5030..de364e4 100644 --- a/tools/qtconfig/previewframe.h +++ b/tools/qtconfig/previewframe.h @@ -42,6 +42,8 @@ #ifndef PREVIEWFRAME_H #define PREVIEWFRAME_H +#include "previewwidget.h" + #include QT_BEGIN_NAMESPACE @@ -52,29 +54,28 @@ class Workspace : public QMdiArea Q_OBJECT public: - Workspace(PreviewFrame *parent = 0); + Workspace( PreviewFrame* parent = 0, const char* name = 0 ); ~Workspace() {} protected: - void paintEvent(QPaintEvent *); + void paintEvent( QPaintEvent* ); private: PreviewFrame *previewFrame; }; -class PreviewWidget; class PreviewFrame : public QFrame { Q_OBJECT public: - PreviewFrame(QWidget *parent = 0); + PreviewFrame( QWidget *parent = 0, const char *name = 0 ); void setPreviewPalette(QPalette); void setPreviewVisible(bool val); QString previewText() const; PreviewWidget *widget() const { return previewWidget; } private: - Workspace *workspace; - PreviewWidget *previewWidget; + Workspace *workspace; + PreviewWidget *previewWidget; QString m_previewWindowText; }; diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp index 0573846..757b448 100644 --- a/tools/qtconfig/previewwidget.cpp +++ b/tools/qtconfig/previewwidget.cpp @@ -40,32 +40,32 @@ ****************************************************************************/ #include "previewwidget.h" -#include "ui_previewwidget.h" #include QT_BEGIN_NAMESPACE -PreviewWidget::PreviewWidget(QWidget *parent) - : QWidget(parent), ui(new Ui::PreviewWidget) +PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) + : PreviewWidgetBase( parent, name ) { - ui->setupUi(this); - // install event filter on child widgets - QList l = findChildren(); - foreach(QWidget *w, l) { - w->installEventFilter(this); - w->setFocusPolicy(Qt::NoFocus); + QObjectList l = queryList("QWidget"); + for (int i = 0; i < l.size(); ++i) { + QObject * obj = l.at(i); + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus); } } -PreviewWidget::~PreviewWidget() + +void PreviewWidget::closeEvent(QCloseEvent *e) { - delete ui; + e->ignore(); } + bool PreviewWidget::eventFilter(QObject *, QEvent *e) { - switch (e->type()) { + switch ( e->type() ) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: @@ -81,9 +81,4 @@ bool PreviewWidget::eventFilter(QObject *, QEvent *e) return false; } -void PreviewWidget::closeEvent(QCloseEvent *e) -{ - e->ignore(); -} - QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidget.h b/tools/qtconfig/previewwidget.h index e7707cd..37e9cba 100644 --- a/tools/qtconfig/previewwidget.h +++ b/tools/qtconfig/previewwidget.h @@ -42,29 +42,21 @@ #ifndef PREVIEWWIDGET_H #define PREVIEWWIDGET_H -#include +#include "previewwidgetbase.h" QT_BEGIN_NAMESPACE -namespace Ui { - class PreviewWidget; -} - - -class PreviewWidget : public QWidget +class PreviewWidget : public PreviewWidgetBase { Q_OBJECT public: - PreviewWidget(QWidget *parent = 0); - ~PreviewWidget(); + PreviewWidget( QWidget *parent = 0, const char *name = 0 ); - bool eventFilter(QObject *, QEvent *); -private: void closeEvent(QCloseEvent *); - Ui::PreviewWidget *ui; + bool eventFilter(QObject *, QEvent *); }; QT_END_NAMESPACE -#endif // PREVIEWWIDGET_H +#endif diff --git a/tools/qtconfig/previewwidget.ui b/tools/qtconfig/previewwidget.ui deleted file mode 100644 index 2e0789f..0000000 --- a/tools/qtconfig/previewwidget.ui +++ /dev/null @@ -1,252 +0,0 @@ - - - ********************************************************************* -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -********************************************************************* - PreviewWidget - - - - 0 - 0 - 398 - 282 - - - - - 0 - 0 - - - - Preview Window - - - - - - - - 6 - - - 0 - - - - - GroupBox - - - - 6 - - - 11 - - - - - RadioButton1 - - - true - - - - - - - RadioButton2 - - - - - - - RadioButton3 - - - - - - - - - - GroupBox2 - - - - 6 - - - 11 - - - - - CheckBox1 - - - true - - - - - - - CheckBox2 - - - - - - - - - - 50 - - - - - - - - - 6 - - - 0 - - - - - LineEdit - - - - - - - - ComboBox - - - - - - - - 6 - - - 0 - - - - - - - - PushButton - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - - - - - - 32767 - 55 - - - - true - - - <p><a href="http://qt.nokia.com">http://qt.nokia.com</a></p> -<p><a href="http://www.kde.org">http://www.kde.org</a></p> - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 0 - - - - - - - - - diff --git a/tools/qtconfig/previewwidgetbase.cpp b/tools/qtconfig/previewwidgetbase.cpp new file mode 100644 index 0000000..9234b6f --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewwidgetbase.h" + +#include + +QT_BEGIN_NAMESPACE + +/* + * Constructs a PreviewWidgetBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +PreviewWidgetBase::PreviewWidgetBase(QWidget* parent, const char* name, Qt::WindowFlags fl) + : QWidget(parent, name, fl) +{ + setupUi(this); + + + // signals and slots connections + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +PreviewWidgetBase::~PreviewWidgetBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void PreviewWidgetBase::languageChange() +{ + retranslateUi(this); +} + +void PreviewWidgetBase::init() +{ +} + +void PreviewWidgetBase::destroy() +{ +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidgetbase.h b/tools/qtconfig/previewwidgetbase.h new file mode 100644 index 0000000..829415e --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWWIDGETBASE_H +#define PREVIEWWIDGETBASE_H + +#include "ui_previewwidgetbase.h" +#include + +QT_BEGIN_NAMESPACE + +class PreviewWidgetBase : public QWidget, public Ui::PreviewWidgetBase +{ + Q_OBJECT + +public: + PreviewWidgetBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0); + ~PreviewWidgetBase(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); + +}; + +QT_END_NAMESPACE + +#endif // PREVIEWWIDGETBASE_H diff --git a/tools/qtconfig/previewwidgetbase.ui b/tools/qtconfig/previewwidgetbase.ui new file mode 100644 index 0000000..701bf84 --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.ui @@ -0,0 +1,340 @@ + + + ********************************************************************* +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +********************************************************************* + + PreviewWidgetBase + + + PreviewWidgetBase + + + + 0 + 0 + 378 + 236 + + + + + 1 + 1 + 0 + 0 + + + + Preview Window + + + + unnamed + + + 11 + + + 6 + + + + + unnamed + + + 0 + + + 6 + + + + + unnamed + + + 0 + + + 6 + + + + + ButtonGroup1 + + + ButtonGroup + + + + unnamed + + + 11 + + + 6 + + + + + RadioButton1 + + + RadioButton1 + + + true + + + + + + + RadioButton2 + + + RadioButton2 + + + + + + + RadioButton3 + + + RadioButton3 + + + + + + + + + + ButtonGroup2 + + + ButtonGroup2 + + + + unnamed + + + 11 + + + 6 + + + + + CheckBox1 + + + CheckBox1 + + + true + + + + + + + CheckBox2 + + + CheckBox2 + + + + + + + + + + ProgressBar1 + + + 50 + + + + + + + + + unnamed + + + 0 + + + 6 + + + + + LineEdit1 + + + LineEdit + + + + + + + ComboBox1 + + + + ComboBox + + + + + + + + unnamed + + + 0 + + + 6 + + + + + SpinBox1 + + + + + + + PushButton1 + + + PushButton + + + + + + + + + ScrollBar1 + + + Qt::Horizontal + + + + + + + Slider1 + + + Qt::Horizontal + + + + + + + textView + + + + 32767 + 50 + + + + true + + + <p> +<a href="http://qt.nokia.com">http://qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p> + + + + + + + + + + + + 20 + 20 + + + + Expanding + + + Vertical + + + + + + qPixmapFromMimeSource + diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index cb06e5a..d1fd320 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -1,10 +1,11 @@ TEMPLATE = app -CONFIG += qt warn_on x11 +CONFIG += qt warn_on x11 build_all:!build_pass { CONFIG -= build_all CONFIG += release } LANGUAGE = C++ +QT += qt3support contains(QT_CONFIG, gstreamer):LIBS += $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 contains(QT_CONFIG, gstreamer):QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER @@ -12,17 +13,19 @@ contains(QT_CONFIG, phonon) { QT += phonon DEFINES += HAVE_PHONON } -SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp -HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h +SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \ + mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp +HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h \ + mainwindowbase.h paletteeditoradvancedbase.h previewwidgetbase.h -FORMS = mainwindow.ui paletteeditoradvanced.ui previewwidget.ui +FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui RESOURCES = qtconfig.qrc PROJECTNAME = Qt Configuration -TARGET = qtconfig -DESTDIR = ../../bin +TARGET = qtconfig +DESTDIR = ../../bin target.path=$$[QT_INSTALL_BINS] INSTALLS += target -INCLUDEPATH += . -DBFILE = qtconfig.db +INCLUDEPATH += . +DBFILE = qtconfig.db diff --git a/tools/tools.pro b/tools/tools.pro index c64fe25..8f23fe4 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -20,7 +20,7 @@ TEMPLATE = subdirs SUBDIRS += designer } } - unix:!mac:!embedded:SUBDIRS += qtconfig + unix:!mac:!embedded:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt } contains(QT_CONFIG, declarative):SUBDIRS += qml -- cgit v0.12