diff options
Diffstat (limited to 'src/qtconfig')
-rw-r--r-- | src/qtconfig/colorbutton.cpp | 207 | ||||
-rw-r--r-- | src/qtconfig/colorbutton.h | 90 | ||||
-rw-r--r-- | src/qtconfig/images/appicon.png | bin | 0 -> 2238 bytes | |||
-rw-r--r-- | src/qtconfig/main.cpp | 69 | ||||
-rw-r--r-- | src/qtconfig/mainwindow.cpp | 956 | ||||
-rw-r--r-- | src/qtconfig/mainwindow.h | 109 | ||||
-rw-r--r-- | src/qtconfig/mainwindow.ui | 1388 | ||||
-rw-r--r-- | src/qtconfig/paletteeditoradvanced.cpp | 401 | ||||
-rw-r--r-- | src/qtconfig/paletteeditoradvanced.h | 106 | ||||
-rw-r--r-- | src/qtconfig/paletteeditoradvanced.ui | 416 | ||||
-rw-r--r-- | src/qtconfig/previewframe.cpp | 104 | ||||
-rw-r--r-- | src/qtconfig/previewframe.h | 83 | ||||
-rw-r--r-- | src/qtconfig/previewwidget.cpp | 89 | ||||
-rw-r--r-- | src/qtconfig/previewwidget.h | 70 | ||||
-rw-r--r-- | src/qtconfig/previewwidget.ui | 252 | ||||
-rw-r--r-- | src/qtconfig/qtconfig.pro | 28 | ||||
-rw-r--r-- | src/qtconfig/qtconfig.qrc | 5 |
17 files changed, 4373 insertions, 0 deletions
diff --git a/src/qtconfig/colorbutton.cpp b/src/qtconfig/colorbutton.cpp new file mode 100644 index 000000000..33c1b25df --- /dev/null +++ b/src/qtconfig/colorbutton.cpp @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "colorbutton.h" + +#include <QApplication> +#include <QtEvents> +#include <QColorDialog> +#include <QPainter> +#include <QMimeData> +#include <QStyle> +#include <QStyleOption> + +QT_BEGIN_NAMESPACE + +ColorButton::ColorButton(QWidget *parent) + : QAbstractButton(parent) + , col(Qt::black) + , mousepressed(false) +{ + setAcceptDrops(true); + connect(this, SIGNAL(clicked()), SLOT(changeColor())); +} + + +ColorButton::ColorButton(const QColor &c, QWidget *parent) + : QAbstractButton(parent) + , col(c) +{ + setAcceptDrops(true); + connect(this, SIGNAL(clicked()), SLOT(changeColor())); +} + + +void ColorButton::setColor(const QColor &c) +{ + col = c; + update(); +} + + +void ColorButton::changeColor() +{ + QColor c = QColorDialog::getColor(col, qApp->activeWindow()); + + if (c.isValid()) { + setColor(c); + emit colorChanged(color()); + } +} + + +QSize ColorButton::sizeHint() const +{ + return QSize(40, 25); +} + + +QSize ColorButton::minimumSizeHint() const +{ + return QSize(40, 25); +} + + +void ColorButton::drawButton(QPainter *p) +{ + QStyleOptionButton buttonOptions; + buttonOptions.init(this); + buttonOptions.features = QStyleOptionButton::None; + buttonOptions.rect = rect(); + buttonOptions.palette = palette(); + buttonOptions.state = (isDown() ? QStyle::State_Sunken : QStyle::State_Raised); + style()->drawPrimitive(QStyle::PE_PanelButtonBevel, &buttonOptions, p, this); + + p->save(); + drawButtonLabel(p); + p->restore(); + + QStyleOptionFocusRect frectOptions; + frectOptions.init(this); + frectOptions.rect = style()->subElementRect(QStyle::SE_PushButtonFocusRect, &buttonOptions, this); + if (hasFocus()) + style()->drawPrimitive(QStyle::PE_FrameFocusRect, &frectOptions, p, this); +} + + +void ColorButton::drawButtonLabel(QPainter *p) +{ + QPalette::ColorGroup cg = + (isEnabled() ? (hasFocus() ? QPalette::Active : QPalette::Inactive) : QPalette::Disabled); + + p->setPen(palette().color(cg, QPalette::ButtonText)); + p->setBrush(col); + p->drawRect(width() / 4, height() / 4, width() / 2 - 1, height() / 2 - 1); +} + + +void ColorButton::dragEnterEvent(QDragEnterEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } +} + + +void ColorButton::dragMoveEvent(QDragMoveEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } + + e->accept(); +} + + +void ColorButton::dropEvent(QDropEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } + + QColor c = qvariant_cast<QColor>(e->mimeData()->colorData()); + setColor(c); + emit colorChanged(color()); +} + + +void ColorButton::mousePressEvent(QMouseEvent *e) +{ + presspos = e->pos(); + mousepressed = true; + QAbstractButton::mousePressEvent(e); +} + + +void ColorButton::mouseReleaseEvent(QMouseEvent *e) +{ + mousepressed = false; + QAbstractButton::mouseReleaseEvent(e); +} + + +void ColorButton::mouseMoveEvent(QMouseEvent *e) +{ + if (!mousepressed) + return; + + if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { + mousepressed = false; + setDown(false); + + QDrag *drag = new QDrag(this); + QMimeData *data = new QMimeData; + data->setColorData(color()); + drag->setMimeData(data); + drag->start(Qt::CopyAction); + } +} + +void ColorButton::paintEvent(QPaintEvent *) +{ + QPainter p(this); + drawButton(&p); +} + +QT_END_NAMESPACE diff --git a/src/qtconfig/colorbutton.h b/src/qtconfig/colorbutton.h new file mode 100644 index 000000000..96ccbc8e2 --- /dev/null +++ b/src/qtconfig/colorbutton.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 COLORBUTTON_H +#define COLORBUTTON_H + +#include <QAbstractButton> + +QT_BEGIN_NAMESPACE + +class ColorButton : public QAbstractButton +{ + Q_OBJECT + +public: + ColorButton(QWidget *); + ColorButton(const QColor &, QWidget *); + + const QColor &color() const { return col; } + + void setColor(const QColor &); + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void dragEnterEvent(QDragEnterEvent *); + void dragMoveEvent(QDragMoveEvent *); + void dropEvent(QDropEvent *); + +signals: + void colorChanged(const QColor &); + +protected: + void paintEvent(QPaintEvent *); + void drawButton(QPainter *); + void drawButtonLabel(QPainter *); + +private slots: + void changeColor(); + + +private: + QColor col; + QPoint presspos; + bool mousepressed; +}; + +QT_END_NAMESPACE + +#endif // COLORBUTTON_H diff --git a/src/qtconfig/images/appicon.png b/src/qtconfig/images/appicon.png Binary files differnew file mode 100644 index 000000000..009317778 --- /dev/null +++ b/src/qtconfig/images/appicon.png diff --git a/src/qtconfig/main.cpp b/src/qtconfig/main.cpp new file mode 100644 index 000000000..38435d9bf --- /dev/null +++ b/src/qtconfig/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "mainwindow.h" +#include <QApplication> +#include <QLibraryInfo> +#include <QLocale> +#include <QTranslator> + +QT_USE_NAMESPACE + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(qtconfig); + + QApplication app(argc, argv); + + QTranslator translator; + QTranslator qtTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("qtconfig_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + } + + MainWindow mw; + mw.show(); + return app.exec(); +} diff --git a/src/qtconfig/mainwindow.cpp b/src/qtconfig/mainwindow.cpp new file mode 100644 index 000000000..059adb307 --- /dev/null +++ b/src/qtconfig/mainwindow.cpp @@ -0,0 +1,956 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "mainwindow.h" +#include "ui_mainwindow.h" + +#include "colorbutton.h" +#include "previewframe.h" +#include "paletteeditoradvanced.h" + +#include <QLabel> +#include <QApplication> +#include <QComboBox> +#include <QStyleFactory> +#include <QFontDatabase> +#include <QLineEdit> +#include <QSpinBox> +#include <QCheckBox> +#include <QFileDialog> +#include <QAction> +#include <QStatusBar> +#include <QSettings> +#include <QMessageBox> +#include <QStyle> +#include <QtEvents> +#include <QInputContext> +#include <QInputContextFactory> +#include <QtDebug> +#include <QPixmap> + +#include <stdlib.h> + +#ifndef QT_NO_GSTREAMER +#include <gst/gst.h> +#endif +#ifdef HAVE_PHONON +#include <phonon/phononnamespace.h> +#endif + +#include <QtGui/private/qt_x11_p.h> + +QT_BEGIN_NAMESPACE + +// from qapplication.cpp and qapplication_x11.cpp - These are NOT for +// external use ignore them +// extern bool Q_CORE_EXPORT qt_resolve_symlinks; + +static const char *appearance_text = QT_TRANSLATE_NOOP("MainWindow", +"<p><b><font size+=2>Appearance</font></b></p>" +"<hr>" +"<p>Use this tab to customize the appearance of your Qt applications.</p>" +"<p>You can select the default GUI Style from the drop down list and " +"customize the colors.</p>" +"<p>Any GUI Style plugins in your plugin path will automatically be added " +"to the list of built-in Qt styles. (See the Library Paths tab for " +"information on adding new plugin paths.)</p>" +"<p>When you choose 3-D Effects and Window Background colors, the Qt " +"Configuration program will automatically generate a palette for you. " +"To customize colors further, press the Tune Palette button to open " +"the advanced palette editor." +"<p>The Preview Window shows what the selected Style and colors look " +"like."); + +static const char *font_text = QT_TRANSLATE_NOOP("MainWindow", +"<p><b><font size+=2>Fonts</font></b></p>" +"<hr>" +"<p>Use this tab to select the default font for your Qt applications. " +"The selected font is shown (initially as 'Sample Text') in the line " +"edit below the Family, " +"Style and Point Size drop down lists.</p>" +"<p>Qt has a powerful font substitution feature that allows you to " +"specify a list of substitute fonts. Substitute fonts are used " +"when a font cannot be loaded, or if the specified font doesn't have " +"a particular character." +"<p>For example, if you select the font Lucida, which doesn't have Korean " +"characters, but need to show some Korean text using the Mincho font family " +"you can do so by adding Mincho to the list. Once Mincho is added, any " +"Korean characters that are not found in the Lucida font will be taken " +"from the Mincho font. Because the font substitutions are " +"lists, you can also select multiple families, such as Song Ti (for " +"use with Chinese text)."); + +static const char *interface_text = QT_TRANSLATE_NOOP("MainWindow", +"<p><b><font size+=2>Interface</font></b></p>" +"<hr>" +"<p>Use this tab to customize the feel of your Qt applications.</p>" +"<p>If the Resolve Symlinks checkbox is checked Qt will follow symlinks " +"when handling URLs. For example, in the file dialog, if this setting is turned " +"on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory " +"will cause the file dialog to change to /var/tmp. With this setting turned " +"off, symlinks are not resolved or followed.</p>" +"<p>The Global Strut setting is useful for people who require a " +"minimum size for all widgets (e.g. when using a touch panel or for users " +"who are visually impaired). Leaving the Global Strut width and height " +"at 0 will disable the Global Strut feature</p>" +"<p>XIM (Extended Input Methods) are used for entering characters in " +"languages that have large character sets, for example, Chinese and " +"Japanese."); +// ### What does the 'Enhanced support for languages written R2L do? + +static const char *printer_text = QT_TRANSLATE_NOOP("MainWindow", +"<p><b><font size+=2>Printer</font></b></p>" +"<hr>" +"<p>Use this tab to configure the way Qt generates output for the printer." +"You can specify if Qt should try to embed fonts into its generated output." +"If you enable font embedding, the resulting postscript will be more " +"portable and will more accurately reflect the " +"visual output on the screen; however the resulting postscript file " +"size will be bigger." +"<p>When using font embedding you can select additional directories where " +"Qt should search for embeddable font files. By default, the X " +"server font path is used."); + +static const char *phonon_text = QT_TRANSLATE_NOOP("MainWindow", +"<p><b><font size+=2>Phonon</font></b></p>" +"<hr>" +"<p>Use this tab to configure the Phonon GStreamer multimedia backend. " +"<p>It is reccommended to leave all settings on \"Auto\" to let " +"Phonon determine your settings automatically."); + + +QPalette::ColorGroup MainWindow::groupFromIndex(int item) +{ + switch (item) { + case 0: + default: + return QPalette::Active; + case 1: + return QPalette::Inactive; + case 2: + return QPalette::Disabled; + } +} + +static void setStyleHelper(QWidget *w, QStyle *s) +{ + const QObjectList children = w->children(); + for (int i = 0; i < children.size(); ++i) { + QObject *child = children.at(i); + if (child->isWidgetType()) + setStyleHelper((QWidget *) child, 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(triggered()), SLOT(fileExit())); + connect(ui->fileSaveAction, SIGNAL(triggered()), SLOT(fileSave())); + connect(ui->helpAboutAction, SIGNAL(triggered()), SLOT(helpAbout())); + connect(ui->helpAboutQtAction, SIGNAL(triggered()), SLOT(helpAboutQt())); + connect(ui->mainTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged(int))); + 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())); + + modified = true; + desktopThemeName = tr("Desktop Settings (Default)"); + setWindowIcon(QPixmap(":/trolltech/qtconfig/images/appicon.png")); + 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); + + 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(); + } else { + int index = ui->guiStyleCombo->findText(currentstyle, Qt::MatchFixedString); + if (index != -1) { + ui->guiStyleCombo->setCurrentIndex(index); + } else { // we give up + ui->guiStyleCombo->addItem(tr("Unknown")); + ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->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())); + + if (X11->desktopEnvironment == DE_KDE) + ui->colorConfig->hide(); + else + ui->kdeNoteLabel->hide(); + + QFontDatabase db; + QStringList families = db.families(); + ui->fontFamilyCombo->addItems(families); + + QStringList fs = families; + QStringList fs2 = QFont::substitutions(); + QStringList::Iterator fsit = fs2.begin(); + while (fsit != fs2.end()) { + if (!fs.contains(*fsit)) + fs += *fsit; + fsit++; + } + fs.sort(); + ui->familySubstitutionCombo->addItems(fs); + + ui->chooseSubstitutionCombo->addItems(families); + QList<int> sizes = db.standardSizes(); + foreach(int i, sizes) + ui->pointSizeCombo->addItem(QString::number(i)); + + ui->doubleClickIntervalSpinBox->setValue(QApplication::doubleClickInterval()); + ui->cursorFlashTimeSpinBox->setValue(QApplication::cursorFlashTime()); + ui->wheelScrollLinesSpinBox->setValue(QApplication::wheelScrollLines()); + // ############# + // resolveLinksCheckBox->setChecked(qt_resolve_symlinks); + + ui->effectsCheckBox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); + ui->effectsFrame->setEnabled(ui->effectsCheckBox->isChecked()); + + if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)) + ui->menuEffectCombo->setCurrentIndex(2); + else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) + ui->menuEffectCombo->setCurrentIndex(1); + + if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)) + ui->comboEffectCombo->setCurrentIndex(1); + + if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) + ui->toolTipEffectCombo->setCurrentIndex(2); + else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) + ui->toolTipEffectCombo->setCurrentIndex(1); + + if (QApplication::isEffectEnabled(Qt::UI_AnimateToolBox)) + ui->toolBoxEffectCombo->setCurrentIndex(1); + + QSize globalStrut = QApplication::globalStrut(); + ui->strutWidthSpinBox->setValue(globalStrut.width()); + ui->strutHeightSpinBox->setValue(globalStrut.height()); + + // find the default family + QStringList::Iterator sit = families.begin(); + int i = 0, possible = -1; + while (sit != families.end()) { + if (*sit == QApplication::font().family()) + break; + if ((*sit).contains(QApplication::font().family())) + possible = i; + + i++; + sit++; + } + if (sit == families.end()) + i = possible; + if (i == -1) // no clue about the current font + i = 0; + + ui->fontFamilyCombo->setCurrentIndex(i); + + QStringList styles = db.styles(ui->fontFamilyCombo->currentText()); + ui->fontStyleCombo->addItems(styles); + + QString stylestring = db.styleString(QApplication::font()); + sit = styles.begin(); + i = 0; + possible = -1; + while (sit != styles.end()) { + if (*sit == stylestring) + break; + if ((*sit).contains(stylestring)) + possible = i; + + i++; + sit++; + } + if (sit == styles.end()) + i = possible; + if (i == -1) // no clue about the current font + i = 0; + ui->fontStyleCombo->setCurrentIndex(i); + + i = 0; + for (int psize = QApplication::font().pointSize(); i < ui->pointSizeCombo->count(); ++i) { + const int sz = ui->pointSizeCombo->itemText(i).toInt(); + if (sz == psize) { + ui->pointSizeCombo->setCurrentIndex(i); + break; + } else if(sz > psize) { + ui->pointSizeCombo->insertItem(i, QString::number(psize)); + ui->pointSizeCombo->setCurrentIndex(i); + break; + } + } + + QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText()); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); + + ui->rtlExtensionsCheckBox->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)); +#else + ui->inputStyleCombo->hide(); + ui->inputStyleComboLabel->hide(); +#endif + +#if defined(Q_WS_X11) && !defined(QT_NO_XIM) + QStringList inputMethodCombo = QInputContextFactory::keys(); + int inputMethodComboIndex = -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); + if (im.contains(QLatin1String("imsw"))) { + inputMethodCombo.removeAt(i); + if (inputMethodComboIndex > i) + --inputMethodComboIndex; + } else if (im == defaultInputMethod) { + inputMethodComboIndex = i; + } + } + if (inputMethodComboIndex == -1 && !inputMethodCombo.isEmpty()) + inputMethodComboIndex = 0; + ui->inputMethodCombo->addItems(inputMethodCombo); + ui->inputMethodCombo->setCurrentIndex(inputMethodComboIndex); +#else + ui->inputMethodCombo->hide(); + ui->inputMethodComboLabel->hide(); +#endif + + ui->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); +#ifdef HAVE_PHONON + ui->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)); + g_free(versionString); + 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)) { + 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 + 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); + gst_object_unref (sink); + } + } + } + g_list_free(factoryList); + } +#else + ui->phononTab->setEnabled(false); + ui->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); +#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); +#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); +#endif + ui->videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); + ui->videomodeCombo->setItemData(ui->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)); + + settings.endGroup(); // Qt + + ui->helpView->setText(tr(appearance_text)); + + setModified(false); + updateStyleLayout(); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +#ifdef Q_WS_X11 +extern void qt_x11_apply_settings_in_all_apps(); +#endif + +void MainWindow::fileSave() +{ + if (! modified) { + statusBar()->showMessage(tr("No changes to be saved."), 2000); + return; + } + + statusBar()->showMessage(tr("Saving changes...")); + + { + QSettings settings(QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("Qt")); + QFontDatabase db; + QFont font = db.font(ui->fontFamilyCombo->currentText(), + ui->fontStyleCombo->currentText(), + ui->pointSizeCombo->currentText().toInt()); + + QStringList actcg, inactcg, discg; + bool overrideDesktopSettings = (ui->guiStyleCombo->currentText() != desktopThemeName); + if (overrideDesktopSettings) { + int i; + for (i = 0; i < QPalette::NColorRoles; i++) + actcg << editPalette.color(QPalette::Active, + QPalette::ColorRole(i)).name(); + for (i = 0; i < QPalette::NColorRoles; i++) + inactcg << editPalette.color(QPalette::Inactive, + QPalette::ColorRole(i)).name(); + for (i = 0; i < QPalette::NColorRoles; i++) + discg << editPalette.color(QPalette::Disabled, + QPalette::ColorRole(i)).name(); + } + + settings.setValue(QLatin1String("font"), font.toString()); + settings.setValue(QLatin1String("Palette/active"), actcg); + settings.setValue(QLatin1String("Palette/inactive"), inactcg); + 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("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()); + + QSize strut(ui->strutWidthSpinBox->value(), ui->strutHeightSpinBox->value()); + settings.setValue(QLatin1String("globalStrut/width"), strut.width()); + settings.setValue(QLatin1String("globalStrut/height"), strut.height()); + + settings.setValue(QLatin1String("useRtlExtensions"), ui->rtlExtensionsCheckBox->isChecked()); + +#ifdef Q_WS_X11 + QString style = ui->inputStyleCombo->currentText(); + QString str = QLatin1String("On The Spot"); + if (style == tr("Over The Spot")) + str = QLatin1String("Over The Spot"); + else if (style == tr("Off The Spot")) + str = QLatin1String("Off The Spot"); + else if (style == tr("Root")) + str = QLatin1String("Root"); + settings.setValue(QLatin1String("XIMInputStyle"), str); +#endif +#if defined(Q_WS_X11) && !defined(QT_NO_XIM) + settings.setValue(QLatin1String("DefaultInputMethod"), ui->inputMethodCombo->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())); + + QStringList effects; + if (ui->effectsCheckBox->isChecked()) { + effects << QLatin1String("general"); + + switch (ui->menuEffectCombo->currentIndex()) { + case 1: effects << QLatin1String("animatemenu"); break; + case 2: effects << QLatin1String("fademenu"); break; + } + + switch (ui->comboEffectCombo->currentIndex()) { + case 1: effects << QLatin1String("animatecombo"); break; + } + + switch (ui->toolTipEffectCombo->currentIndex()) { + case 1: effects << QLatin1String("animatetooltip"); break; + case 2: effects << QLatin1String("fadetooltip"); break; + } + + switch (ui->toolBoxEffectCombo->currentIndex()) { + case 1: effects << QLatin1String("animatetoolbox"); break; + } + } else + effects << QLatin1String("none"); + settings.setValue(QLatin1String("GUIEffects"), effects); + + QStringList familysubs = QFont::substitutions(); + QStringList::Iterator fit = familysubs.begin(); + settings.beginGroup(QLatin1String("Font Substitutions")); + while (fit != familysubs.end()) { + QStringList subs = QFont::substitutes(*fit); + settings.setValue(*fit, subs); + fit++; + } + settings.endGroup(); // Font Substitutions + settings.endGroup(); // Qt + } + +#if defined(Q_WS_X11) + qt_x11_apply_settings_in_all_apps(); +#endif // Q_WS_X11 + + setModified(false); + statusBar()->showMessage(tr("Saved changes.")); +} + +void MainWindow::fileExit() +{ + qApp->closeAllWindows(); +} + +void MainWindow::setModified(bool m) +{ + if (modified == m) + return; + + modified = m; + ui->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); + + editPalette = temp; + setPreviewPalette(editPalette); + updateColorButtons(); + + setModified(true); +} + +void MainWindow::setPreviewPalette(const QPalette &pal) +{ + QPalette::ColorGroup colorGroup = groupFromIndex(ui->paletteCombo->currentIndex()); + + 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)); + } + } + + ui->previewFrame->setPreviewPalette(previewPalette); +} + +void MainWindow::updateColorButtons() +{ + ui->buttonMainColor->setColor(editPalette.color(QPalette::Active, QPalette::Button)); + ui->buttonWindowColor->setColor(editPalette.color(QPalette::Active, QPalette::Window)); +} + +void MainWindow::tunePalette() +{ + bool ok; + QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette, + backgroundRole(), this); + if (!ok) + return; + + editPalette = pal; + setPreviewPalette(editPalette); + setModified(true); +} + +void MainWindow::paletteSelected(int) +{ + setPreviewPalette(editPalette); +} + +void MainWindow::updateStyleLayout() +{ + QString currentStyle = ui->guiStyleCombo->currentText(); + bool autoStyle = (currentStyle == desktopThemeName); + ui->previewFrame->setPreviewVisible(!autoStyle); + ui->buildPaletteGroup->setEnabled(currentStyle.toLower() != QLatin1String("gtk") && !autoStyle); +} + +void MainWindow::styleSelected(const QString &stylename) +{ + QStyle *style = 0; + if (stylename == desktopThemeName) { + setModified(true); + } else { + style = QStyleFactory::create(stylename); + if (!style) + return; + setStyleHelper(ui->previewFrame, style); + delete previewstyle; + previewstyle = style; + setModified(true); + } + 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); + buildFont(); +} + +void MainWindow::buildFont() +{ + QFontDatabase db; + QFont font = db.font(ui->fontFamilyCombo->currentText(), + ui->fontStyleCombo->currentText(), + ui->pointSizeCombo->currentText().toInt()); + ui->sampleLineEdit->setFont(font); + setModified(true); +} + +void MainWindow::substituteSelected(const QString &family) +{ + QStringList subs = QFont::substitutes(family); + ui->substitutionsListBox->clear(); + ui->substitutionsListBox->insertItems(0, subs); +} + +void MainWindow::removeSubstitute() +{ + if (!ui->substitutionsListBox->currentItem()) + 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); + 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); + 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); + setModified(true); +} + +void MainWindow::downSubstitute() +{ + if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() >= ui->substitutionsListBox->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); + setModified(true); +} + +void MainWindow::upSubstitute() +{ + if (!ui->substitutionsListBox->currentItem() || ui->substitutionsListBox->currentRow() < 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); + setModified(true); +} + +void MainWindow::removeFontpath() +{ + if (!ui->fontpathListBox->currentItem()) + 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); + setModified(true); +} + +void MainWindow::addFontpath() +{ + if (ui->fontPathLineEdit->text().isEmpty()) + return; + + if (!ui->fontpathListBox->currentItem()) { + fontpaths.append(ui->fontPathLineEdit->text()); + ui->fontpathListBox->clear(); + ui->fontpathListBox->insertItems(0, 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); + setModified(true); +} + +void MainWindow::downFontpath() +{ + if (!ui->fontpathListBox->currentItem() + || ui->fontpathListBox->currentRow() >= (ui->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); + setModified(true); +} + +void MainWindow::upFontpath() +{ + if (!ui->fontpathListBox->currentItem() || ui->fontpathListBox->currentRow() < 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); + setModified(true); +} + +void MainWindow::browseFontpath() +{ + QString dirname = QFileDialog::getExistingDirectory(this, tr("Select a Directory")); + if (dirname.isNull()) + return; + + ui->fontPathLineEdit->setText(dirname); +} + +void MainWindow::somethingModified() +{ + setModified(true); +} + +void MainWindow::helpAbout() +{ + QMessageBox box(this); + box.setText(tr("<h3>%1</h3>" + "<br/>Version %2" + "<br/><br/>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).") + .arg(tr("Qt Configuration")).arg(QLatin1String(QT_VERSION_STR))); + box.setWindowTitle(tr("Qt Configuration")); + box.setIcon(QMessageBox::NoIcon); + box.exec(); +} + +void MainWindow::helpAboutQt() +{ + QMessageBox::aboutQt(this, tr("Qt Configuration")); +} + +void MainWindow::pageChanged(int pageNumber) +{ + QWidget *page = ui->mainTabWidget->widget(pageNumber); + 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)); +} + +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 + qApp->processEvents(); + fileSave(); + + // fall through intended + case QMessageBox::No: // don't save + e->accept(); + break; + + case QMessageBox::Cancel: // cancel + e->ignore(); + break; + + default: break; + } + } else + e->accept(); +} + +QT_END_NAMESPACE diff --git a/src/qtconfig/mainwindow.h b/src/qtconfig/mainwindow.h new file mode 100644 index 000000000..6f4c8a52e --- /dev/null +++ b/src/qtconfig/mainwindow.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 MAINWINDOW_H +#define MAINWINDOW_H + +#include <QtGui/QMainWindow> + +QT_BEGIN_NAMESPACE + +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + ~MainWindow(); + + void closeEvent(QCloseEvent *); + +public slots: + virtual void buildPalette(); + virtual void buildFont(); + virtual void tunePalette(); + virtual void paletteSelected(int); + virtual void styleSelected(const QString &); + virtual void familySelected(const QString &); + virtual void substituteSelected(const QString &); + virtual void removeSubstitute(); + virtual void addSubstitute(); + virtual void downSubstitute(); + virtual void upSubstitute(); + virtual void removeFontpath(); + virtual void addFontpath(); + virtual void downFontpath(); + virtual void upFontpath(); + virtual void browseFontpath(); + virtual void fileSave(); + virtual void fileExit(); + virtual void somethingModified(); + virtual void helpAbout(); + virtual void helpAboutQt(); + virtual void pageChanged(int); + + +private: + 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; + QStringList fontpaths; + bool modified; +}; + +QT_END_NAMESPACE + +#endif // MAINWINDOW_H diff --git a/src/qtconfig/mainwindow.ui b/src/qtconfig/mainwindow.ui new file mode 100644 index 000000000..d906800fe --- /dev/null +++ b/src/qtconfig/mainwindow.ui @@ -0,0 +1,1388 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2011 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$ +** +*********************************************************************</comment> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>716</height> + </rect> + </property> + <property name="windowTitle"> + <string>Qt Configuration</string> + </property> + <widget class="QWidget" name="widget"> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>8</number> + </property> + <item row="0" column="0"> + <widget class="QTextEdit" name="helpView"> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QTabWidget" name="mainTabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="appearanceTab"> + <attribute name="title"> + <string>Appearance</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QGroupBox" name="guiStyleGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>GUI Style</string> + </property> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QLabel" name="guiStyleLabel"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Select GUI &Style:</string> + </property> + <property name="buddy"> + <cstring>guiStyleCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="guiStyleCombo"/> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="previewGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="paletteLabel"> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="paletteCombo"> + <item> + <property name="text"> + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="PreviewFrame" name="previewFrame" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>410</width> + <height>260</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="buildPaletteGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Build Palette</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QWidget" name="colorConfig" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelMainColor"> + <property name="text"> + <string>&Button Background:</string> + </property> + <property name="buddy"> + <cstring>buttonMainColor</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonMainColor" native="true"/> + </item> + <item> + <widget class="QLabel" name="labelWindowColor"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="text"> + <string>Window Back&ground:</string> + </property> + <property name="alignment"> + <set>Qt::AlignVCenter</set> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="buddy"> + <cstring>buttonWindowColor</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonWindowColor" native="true"/> + </item> + <item> + <spacer name="spacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="tunePaletteButton"> + <property name="text"> + <string>&Tune Palette...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="kdeNoteLabel"> + <property name="text"> + <string>Please use the KDE Control Center to set the palette.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="fontsTab"> + <attribute name="title"> + <string>Fonts</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="defaultFontGroup"> + <property name="title"> + <string>Default Font</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="1"> + <widget class="QComboBox" name="fontStyleCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="fontFamilyCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="pointSizeCombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="fontStyleLabel"> + <property name="text"> + <string>&Style:</string> + </property> + <property name="buddy"> + <cstring>fontStyleCombo</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="pointSizeLabel"> + <property name="text"> + <string>&Point Size:</string> + </property> + <property name="buddy"> + <cstring>pointSizeCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="fontFamilyLabel"> + <property name="text"> + <string>F&amily:</string> + </property> + <property name="buddy"> + <cstring>fontFamilyCombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QLineEdit" name="sampleLineEdit"> + <property name="text"> + <string>Sample Text</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="fontSubstitutionGroup"> + <property name="title"> + <string>Font Substitution</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="familySubstitutionLabel"> + <property name="text"> + <string>S&elect or Enter a Family:</string> + </property> + <property name="buddy"> + <cstring>familySubstitutionCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="familySubstitutionCombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line1"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="substitutionsLabel"> + <property name="text"> + <string>Current Substitutions:</string> + </property> + </widget> + </item> + <item> + <widget class="QListWidget" name="substitutionsListBox"/> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="upSubstitutionButton"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="downSubstitutionButton"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="removeSubstitutionButton"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line2"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="chooseSubstitutionLabel"> + <property name="text"> + <string>Select s&ubstitute Family:</string> + </property> + <property name="buddy"> + <cstring>chooseSubstitutionCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="chooseSubstitutionCombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="addSubstitutionButton"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="interfaceTab"> + <attribute name="title"> + <string>Interface</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="feelSettingsGroup"> + <property name="title"> + <string>Feel Settings</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="1"> + <widget class="QSpinBox" name="doubleClickIntervalSpinBox"> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>10</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="doubleClickIntervalLabel"> + <property name="text"> + <string>&Double Click Interval:</string> + </property> + <property name="buddy"> + <cstring>doubleClickIntervalSpinBox</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="cursorFlashTimeSpinBox"> + <property name="specialValueText"> + <string>No blinking</string> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>9</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="cursorFlashTimeLabel"> + <property name="text"> + <string>&Cursor Flash Time:</string> + </property> + <property name="buddy"> + <cstring>cursorFlashTimeSpinBox</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="wheelScrollLinesSpinBox"> + <property name="suffix"> + <string> lines</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="wheelScrollLinesLabel"> + <property name="text"> + <string>Wheel &Scroll Lines:</string> + </property> + <property name="buddy"> + <cstring>wheelScrollLinesSpinBox</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="resolveLinksCheckBox"> + <property name="text"> + <string>Resolve symlinks in URLs</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="guiEffectsGroup"> + <property name="title"> + <string>GUI Effects</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QCheckBox" name="effectsCheckBox"> + <property name="text"> + <string>&Enable</string> + </property> + <property name="shortcut"> + <string>Alt+E</string> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="effectsFrame"> + <layout class="QGridLayout"> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="menuEffectLabel"> + <property name="text"> + <string>&Menu Effect:</string> + </property> + <property name="buddy"> + <cstring>menuEffectCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="comboEffectLabel"> + <property name="text"> + <string>C&omboBox Effect:</string> + </property> + <property name="buddy"> + <cstring>comboEffectCombo</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="toolTipEffectLabel"> + <property name="text"> + <string>&ToolTip Effect:</string> + </property> + <property name="buddy"> + <cstring>toolTipEffectCombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="toolBoxEffectLabel"> + <property name="text"> + <string>Tool&Box Effect:</string> + </property> + <property name="buddy"> + <cstring>toolBoxEffectCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="menuEffectCombo"> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="comboEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="toolTipEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="toolBoxEffectCombo"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="globalStrutGroup"> + <property name="title"> + <string>Global Strut</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="strutWidthLabel"> + <property name="text"> + <string>Minimum &Width:</string> + </property> + <property name="buddy"> + <cstring>strutWidthSpinBox</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="strutHeightLabel"> + <property name="text"> + <string>Minimum Hei&ght:</string> + </property> + <property name="buddy"> + <cstring>strutHeightSpinBox</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="strutWidthSpinBox"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="strutHeightSpinBox"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QCheckBox" name="rtlExtensionsCheckBox"> + <property name="text"> + <string>Enhanced support for languages written right-to-left</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="inputStyleLabel"> + <property name="text"> + <string>XIM Input Style:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputStyleCombo"> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>On The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Over The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Off The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Root</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="inputMethodLabel"> + <property name="text"> + <string>Default Input Method:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputMethodCombo"> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="printerTab"> + <attribute name="title"> + <string>Printer</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QCheckBox" name="fontEmbeddingCheckBox"> + <property name="text"> + <string>Enable Font embedding</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="fontPathsGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Font Paths</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="0"> + <widget class="QPushButton" name="upFontpathButton"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="removeFontpathButton"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="downFontpathButton"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QListWidget" name="fontpathListBox"/> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="2" column="0"> + <spacer> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="addFontPathButton"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="browseFontPathButton"> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="browseFontPathLabel"> + <property name="text"> + <string>Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list.</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QLineEdit" name="fontPathLineEdit"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="phononTab"> + <attribute name="title"> + <string>Phonon</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="aboutPhononGroup"> + <property name="title"> + <string>About Phonon</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="phononVersionBuddyLabel"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="phononVersionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="phononWebsiteBuddyLabel"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="phononWebsiteLabel"> + <property name="text"> + <string><a href="http://phonon.kde.org">http://phonon.kde.org/</a></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="aboutGStreamerGroup"> + <property name="title"> + <string>About GStreamer</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="gstVersionBuddyLabel"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="gstVersionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="gstWebsiteBuddyLabel"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="gstWebsiteLabel"> + <property name="text"> + <string><a href="http://gstreamer.freedesktop.org/">http://gstreamer.freedesktop.org/</a></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gstBackendGroup"> + <property name="title"> + <string>GStreamer backend settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="audiosinkLabel"> + <property name="text"> + <string>Preferred audio sink:</string> + </property> + <property name="buddy"> + <cstring>audiosinkCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="audiosinkCombo"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="videomodeLabel"> + <property name="text"> + <string>Preferred render method:</string> + </property> + <property name="buddy"> + <cstring>videomodeCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="videomodeCombo"/> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="gstBackendNoteLabel"> + <property name="text"> + <string><!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></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>2</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="phononLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="mainMenu"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>19</height> + </rect> + </property> + <widget class="QMenu" name="fileMenu"> + <property name="geometry"> + <rect> + <x>203</x> + <y>114</y> + <width>161</width> + <height>110</height> + </rect> + </property> + <property name="title"> + <string>&File</string> + </property> + <addaction name="fileSaveAction"/> + <addaction name="separator"/> + <addaction name="fileExitAction"/> + </widget> + <widget class="QMenu" name="saveMenu"> + <property name="geometry"> + <rect> + <x>543</x> + <y>98</y> + <width>161</width> + <height>106</height> + </rect> + </property> + <property name="title"> + <string>&Help</string> + </property> + <addaction name="helpAboutAction"/> + <addaction name="helpAboutQtAction"/> + </widget> + <addaction name="fileMenu"/> + <addaction name="separator"/> + <addaction name="saveMenu"/> + </widget> + <action name="fileSaveAction"> + <property name="text"> + <string>&Save</string> + </property> + <property name="iconText"> + <string>Save</string> + </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> + <action name="fileExitAction"> + <property name="text"> + <string>E&xit</string> + </property> + <property name="iconText"> + <string>Exit</string> + </property> + <property name="shortcut"> + <string>Ctrl+Q</string> + </property> + </action> + <action name="helpAboutAction"> + <property name="text"> + <string>&About</string> + </property> + <property name="iconText"> + <string>About</string> + </property> + <property name="shortcut"> + <string/> + </property> + </action> + <action name="helpAboutQtAction"> + <property name="text"> + <string>About &Qt</string> + </property> + <property name="iconText"> + <string>About Qt</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>ColorButton</class> + <extends></extends> + <header>colorbutton.h</header> + </customwidget> + <customwidget> + <class>PreviewFrame</class> + <extends></extends> + <header>previewframe.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>helpView</tabstop> + <tabstop>mainTabWidget</tabstop> + <tabstop>guiStyleCombo</tabstop> + <tabstop>tunePaletteButton</tabstop> + <tabstop>paletteCombo</tabstop> + <tabstop>fontFamilyCombo</tabstop> + <tabstop>fontStyleCombo</tabstop> + <tabstop>pointSizeCombo</tabstop> + <tabstop>sampleLineEdit</tabstop> + <tabstop>familySubstitutionCombo</tabstop> + <tabstop>substitutionsListBox</tabstop> + <tabstop>upSubstitutionButton</tabstop> + <tabstop>downSubstitutionButton</tabstop> + <tabstop>removeSubstitutionButton</tabstop> + <tabstop>chooseSubstitutionCombo</tabstop> + <tabstop>addSubstitutionButton</tabstop> + <tabstop>doubleClickIntervalSpinBox</tabstop> + <tabstop>cursorFlashTimeSpinBox</tabstop> + <tabstop>wheelScrollLinesSpinBox</tabstop> + <tabstop>resolveLinksCheckBox</tabstop> + <tabstop>effectsCheckBox</tabstop> + <tabstop>menuEffectCombo</tabstop> + <tabstop>comboEffectCombo</tabstop> + <tabstop>toolTipEffectCombo</tabstop> + <tabstop>toolBoxEffectCombo</tabstop> + <tabstop>strutWidthSpinBox</tabstop> + <tabstop>strutHeightSpinBox</tabstop> + <tabstop>rtlExtensionsCheckBox</tabstop> + <tabstop>inputStyleCombo</tabstop> + <tabstop>inputMethodCombo</tabstop> + <tabstop>fontEmbeddingCheckBox</tabstop> + <tabstop>fontpathListBox</tabstop> + <tabstop>upFontpathButton</tabstop> + <tabstop>downFontpathButton</tabstop> + <tabstop>removeFontpathButton</tabstop> + <tabstop>fontPathLineEdit</tabstop> + <tabstop>browseFontPathButton</tabstop> + <tabstop>addFontPathButton</tabstop> + <tabstop>audiosinkCombo</tabstop> + <tabstop>videomodeCombo</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>effectsCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>effectsFrame</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>417</x> + <y>257</y> + </hint> + <hint type="destinationlabel"> + <x>578</x> + <y>379</y> + </hint> + </hints> + </connection> + <connection> + <sender>fontEmbeddingCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>fontPathsGroup</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>449</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>447</x> + <y>94</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/qtconfig/paletteeditoradvanced.cpp b/src/qtconfig/paletteeditoradvanced.cpp new file mode 100644 index 000000000..4797ead93 --- /dev/null +++ b/src/qtconfig/paletteeditoradvanced.cpp @@ -0,0 +1,401 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "ui_paletteeditoradvanced.h" +#include "paletteeditoradvanced.h" +#include "colorbutton.h" + +QT_BEGIN_NAMESPACE + +PaletteEditorAdvanced::PaletteEditorAdvanced(QWidget *parent) + : QDialog(parent), ui(new Ui::PaletteEditorAdvanced), 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.")); + 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(); +} + +PaletteEditorAdvanced::~PaletteEditorAdvanced() +{ + delete ui; +} + +void PaletteEditorAdvanced::onToggleBuildInactive(bool v) +{ + if (selectedPalette == 1) { + ui->groupCentral->setDisabled(v); + ui->groupEffect->setDisabled(v); + } + + if (v) { + build(QPalette::Inactive); + updateColorButtons(); + } +} + +void PaletteEditorAdvanced::onToggleBuildDisabled(bool v) +{ + if (selectedPalette == 2) { + ui->groupCentral->setDisabled(v); + ui->groupEffect->setDisabled(v); + } + + if (v) { + build(QPalette::Disabled); + updateColorButtons(); + } +} + +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); + } + 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); + } + + 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); + } + + updateColorButtons(); +} + +void PaletteEditorAdvanced::onToggleBuildEffects(bool on) +{ + if (on) { + for (int i = 0; i < QPalette::NColorGroups; i++) + buildEffect(QPalette::ColorGroup(i)); + } +} + +QPalette::ColorGroup PaletteEditorAdvanced::groupFromIndex(int item) +{ + switch (item) { + case 0: + default: + return QPalette::Active; + case 1: + return QPalette::Inactive; + case 2: + return QPalette::Disabled; + } +} + +QPalette::ColorRole PaletteEditorAdvanced::centralFromIndex(int item) +{ + switch (item) { + case 0: + return QPalette::Window; + case 1: + return QPalette::WindowText; + case 2: + return QPalette::Base; + case 3: + return QPalette::AlternateBase; + 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; + default: + return QPalette::NoRole; + } +} + +QPalette::ColorRole PaletteEditorAdvanced::effectFromIndex(int item) +{ + switch (item) { + case 0: + return QPalette::Light; + case 1: + return QPalette::Midlight; + case 2: + return QPalette::Mid; + case 3: + return QPalette::Dark; + case 4: + return QPalette::Shadow; + default: + return QPalette::NoRole; + } +} + +void PaletteEditorAdvanced::onCentral(int item) +{ + QColor c = editPalette.color(groupFromIndex(selectedPalette), centralFromIndex(item)); + buttonCentral->setColor(c); +} + +void PaletteEditorAdvanced::onEffect(int item) +{ + QColor c = editPalette.color(groupFromIndex(selectedPalette), effectFromIndex(item)); + buttonEffect->setColor(c); +} + +QPalette PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup, + const QPalette &basePalette) +{ + QPalette result(basePalette); + + if (colorGroup == QPalette::Active) { + QPalette calculatedPalette(basePalette.color(colorGroup, QPalette::Button), + basePalette.color(colorGroup, QPalette::Window)); + + 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); + + 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); + } + + return result; +} + +void PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup) +{ + editPalette = buildEffect(colorGroup, editPalette); + updateColorButtons(); +} + +void PaletteEditorAdvanced::build(QPalette::ColorGroup colorGroup) +{ + 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))); + + 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); + } + + if (ui->checkBuildEffect->isChecked()) + buildEffect(colorGroup); + else + updateColorButtons(); + } +} + +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()))); +} + +void PaletteEditorAdvanced::setPal(const QPalette &pal) +{ + editPalette = pal; + updateColorButtons(); +} + +QPalette PaletteEditorAdvanced::pal() const +{ + return editPalette; +} + +void PaletteEditorAdvanced::setupBackgroundRole(QPalette::ColorRole role) +{ + int initRole = 0; + + switch (role) { + case QPalette::Window: + initRole = 0; + break; + case QPalette::WindowText: + initRole = 1; + break; + case QPalette::Base: + initRole = 2; + break; + case QPalette::AlternateBase: + initRole = 3; + break; + case QPalette::ToolTipBase: + initRole = 4; + break; + case QPalette::ToolTipText: + initRole = 5; + break; + case QPalette::Text: + initRole = 6; + break; + case QPalette::Button: + initRole = 7; + break; + case QPalette::ButtonText: + initRole = 8; + break; + case QPalette::BrightText: + initRole = 9; + break; + case QPalette::Highlight: + initRole = 10; + break; + case QPalette::HighlightedText: + initRole = 11; + break; + case QPalette::Link: + initRole = 12; + break; + case QPalette::LinkVisited: + initRole = 13; + break; + default: + initRole = -1; + break; + } + + if (initRole != -1) + ui->comboCentral->setCurrentIndex(initRole); +} + +QPalette PaletteEditorAdvanced::getPalette(bool *ok, const QPalette &init, + QPalette::ColorRole backgroundRole, QWidget *parent) +{ + PaletteEditorAdvanced *dlg = new PaletteEditorAdvanced(parent); + dlg->setupBackgroundRole(backgroundRole); + + if (init != QPalette()) + dlg->setPal(init); + int resultCode = dlg->exec(); + + QPalette result = init; + if (resultCode == QDialog::Accepted) + result = dlg->pal(); + + if (ok) + *ok = resultCode; + + delete dlg; + return result; +} + +QT_END_NAMESPACE diff --git a/src/qtconfig/paletteeditoradvanced.h b/src/qtconfig/paletteeditoradvanced.h new file mode 100644 index 000000000..4f6167670 --- /dev/null +++ b/src/qtconfig/paletteeditoradvanced.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 PALETTEEDITORADVANCED_H +#define PALETTEEDITORADVANCED_H + +#include <QtGui/QDialog> + +QT_BEGIN_NAMESPACE + +namespace Ui { + class PaletteEditorAdvanced; +} + +class ColorButton; + +class PaletteEditorAdvanced : public QDialog +{ + Q_OBJECT +public: + PaletteEditorAdvanced(QWidget *parent = 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); + +protected slots: + void paletteSelected(int); + + void onCentral(int); + void onEffect(int); + + void onChooseCentralColor(); + void onChooseEffectColor(); + + void onToggleBuildEffects(bool); + void onToggleBuildInactive(bool); + void onToggleBuildDisabled(bool); + +protected: + void buildEffect(QPalette::ColorGroup); + void build(QPalette::ColorGroup); + +private: + void updateColorButtons(); + void setupBackgroundRole(QPalette::ColorRole); + + QPalette pal() const; + void setPal(const QPalette &); + + static QPalette::ColorGroup groupFromIndex(int); + static QPalette::ColorRole centralFromIndex(int); + static QPalette::ColorRole effectFromIndex(int); + QPalette editPalette; + + Ui::PaletteEditorAdvanced *ui; + + int selectedPalette; + ColorButton *buttonCentral; + ColorButton *buttonEffect; +}; + +QT_END_NAMESPACE + +#endif // PALETTEEDITORADVANCED_H diff --git a/src/qtconfig/paletteeditoradvanced.ui b/src/qtconfig/paletteeditoradvanced.ui new file mode 100644 index 000000000..0b4ae6613 --- /dev/null +++ b/src/qtconfig/paletteeditoradvanced.ui @@ -0,0 +1,416 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2011 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$ +** +*********************************************************************</comment> + <class>PaletteEditorAdvanced</class> + <widget class="QDialog" name="PaletteEditorAdvanced"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>239</width> + <height>344</height> + </rect> + </property> + <property name="windowTitle"> + <string>Tune Palette</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="paletteComboLabel"> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="paletteCombo"> + <item> + <property name="text"> + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="autoGroupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Auto</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="checkBuildInactive"> + <property name="text"> + <string>Build inactive palette from active</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBuildDisabled"> + <property name="text"> + <string>Build disabled palette from active</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupCentral"> + <property name="title"> + <string>Central color &roles</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QComboBox" name="comboCentral"> + <property name="toolTip"> + <string>Choose central color role</string> + </property> + <property name="whatsThis"> + <string><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></string> + </property> + <item> + <property name="text"> + <string>Window</string> + </property> + </item> + <item> + <property name="text"> + <string>WindowText</string> + </property> + </item> + <item> + <property name="text"> + <string>Base</string> + </property> + </item> + <item> + <property name="text"> + <string>AlternateBase</string> + </property> + </item> + <item> + <property name="text"> + <string>ToolTipBase</string> + </property> + </item> + <item> + <property name="text"> + <string>ToolTipText</string> + </property> + </item> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <item> + <property name="text"> + <string>Button</string> + </property> + </item> + <item> + <property name="text"> + <string>ButtonText</string> + </property> + </item> + <item> + <property name="text"> + <string>BrightText</string> + </property> + </item> + <item> + <property name="text"> + <string>Highlight</string> + </property> + </item> + <item> + <property name="text"> + <string>HighlightedText</string> + </property> + </item> + <item> + <property name="text"> + <string>Link</string> + </property> + </item> + <item> + <property name="text"> + <string>LinkVisited</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="layoutCentral"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelCentral"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Select Color:</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupEffect"> + <property name="title"> + <string>3-D shadow &effects</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QCheckBox" name="checkBuildEffect"> + <property name="toolTip"> + <string>Generate shadings</string> + </property> + <property name="whatsThis"> + <string>Check to let 3D-effect colors be calculated from button-color.</string> + </property> + <property name="text"> + <string>Build &from button color</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboEffect"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Choose 3D-effect color role</string> + </property> + <property name="whatsThis"> + <string><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></string> + </property> + <item> + <property name="text"> + <string>Light</string> + </property> + </item> + <item> + <property name="text"> + <string>Midlight</string> + </property> + </item> + <item> + <property name="text"> + <string>Mid</string> + </property> + </item> + <item> + <property name="text"> + <string>Dark</string> + </property> + </item> + <item> + <property name="text"> + <string>Shadow</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="layoutEffect"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelEffect"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Select Co&lor:</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PaletteEditorAdvanced</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>238</x> + <y>384</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PaletteEditorAdvanced</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>306</x> + <y>390</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>checkBuildEffect</sender> + <signal>toggled(bool)</signal> + <receiver>comboEffect</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>82</x> + <y>262</y> + </hint> + <hint type="destinationlabel"> + <x>190</x> + <y>262</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/qtconfig/previewframe.cpp b/src/qtconfig/previewframe.cpp new file mode 100644 index 000000000..c6df89950 --- /dev/null +++ b/src/qtconfig/previewframe.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "previewframe.h" +#include "previewwidget.h" + +#include <QBoxLayout> +#include <QPainter> +#include <QMdiSubWindow> + +QT_BEGIN_NAMESPACE + +PreviewFrame::PreviewFrame(QWidget *parent) + : QFrame(parent) +{ + setMinimumSize(200, 200); + setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + setLineWidth(1); + + QVBoxLayout *vbox = new QVBoxLayout(this); + vbox->setMargin(0); + previewWidget = new PreviewWidget; + workspace = new Workspace(this); + vbox->addWidget(workspace); + previewWidget->setAutoFillBackground(true); +} + +void PreviewFrame::setPreviewPalette(QPalette pal) +{ + previewWidget->setPalette(pal); +} + +QString PreviewFrame::previewText() const +{ + return m_previewWindowText; +} + +void PreviewFrame::setPreviewVisible(bool visible) +{ + previewWidget->parentWidget()->setVisible(visible); + if (visible) + m_previewWindowText = QLatin1String("The moose in the noose\nate the goose who was loose."); + else + m_previewWindowText = tr("Desktop settings will only take effect after an application restart."); + workspace->viewport()->update(); +} + +Workspace::Workspace(PreviewFrame *parent) + : QMdiArea(parent) +{ + previewFrame = parent; + PreviewWidget *previewWidget = previewFrame->widget(); + QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); + frame->move(10, 10); + frame->show(); +} + +void Workspace::paintEvent(QPaintEvent *) +{ + 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()); +} + +QT_END_NAMESPACE diff --git a/src/qtconfig/previewframe.h b/src/qtconfig/previewframe.h new file mode 100644 index 000000000..5cb0d59c1 --- /dev/null +++ b/src/qtconfig/previewframe.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 PREVIEWFRAME_H +#define PREVIEWFRAME_H + +#include <QMdiArea> + +QT_BEGIN_NAMESPACE + +class PreviewFrame; +class Workspace : public QMdiArea +{ + Q_OBJECT + +public: + Workspace(PreviewFrame *parent = 0); + ~Workspace() {} + +protected: + void paintEvent(QPaintEvent *); +private: + PreviewFrame *previewFrame; +}; + +class PreviewWidget; +class PreviewFrame : public QFrame +{ + Q_OBJECT + +public: + PreviewFrame(QWidget *parent = 0); + void setPreviewPalette(QPalette); + void setPreviewVisible(bool val); + QString previewText() const; + PreviewWidget *widget() const { return previewWidget; } +private: + Workspace *workspace; + PreviewWidget *previewWidget; + QString m_previewWindowText; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/qtconfig/previewwidget.cpp b/src/qtconfig/previewwidget.cpp new file mode 100644 index 000000000..66ebb92b6 --- /dev/null +++ b/src/qtconfig/previewwidget.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 "previewwidget.h" +#include "ui_previewwidget.h" +#include <QtEvents> + +QT_BEGIN_NAMESPACE + +PreviewWidget::PreviewWidget(QWidget *parent) + : QWidget(parent), ui(new Ui::PreviewWidget) +{ + ui->setupUi(this); + + // install event filter on child widgets + QList<QWidget *> l = findChildren<QWidget *>(); + foreach(QWidget *w, l) { + w->installEventFilter(this); + w->setFocusPolicy(Qt::NoFocus); + } +} + +PreviewWidget::~PreviewWidget() +{ + delete ui; +} + +bool PreviewWidget::eventFilter(QObject *, QEvent *e) +{ + switch (e->type()) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::Enter: + case QEvent::Leave: + return true; // ignore; + default: + break; + } + return false; +} + +void PreviewWidget::closeEvent(QCloseEvent *e) +{ + e->ignore(); +} + +QT_END_NAMESPACE diff --git a/src/qtconfig/previewwidget.h b/src/qtconfig/previewwidget.h new file mode 100644 index 000000000..d39fd7540 --- /dev/null +++ b/src/qtconfig/previewwidget.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 PREVIEWWIDGET_H +#define PREVIEWWIDGET_H + +#include <QtGui/QWidget> + +QT_BEGIN_NAMESPACE + +namespace Ui { + class PreviewWidget; +} + + +class PreviewWidget : public QWidget +{ + Q_OBJECT + +public: + PreviewWidget(QWidget *parent = 0); + ~PreviewWidget(); + + bool eventFilter(QObject *, QEvent *); +private: + void closeEvent(QCloseEvent *); + Ui::PreviewWidget *ui; +}; + +QT_END_NAMESPACE + +#endif // PREVIEWWIDGET_H diff --git a/src/qtconfig/previewwidget.ui b/src/qtconfig/previewwidget.ui new file mode 100644 index 000000000..fac4b6c34 --- /dev/null +++ b/src/qtconfig/previewwidget.ui @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2011 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$ +** +*********************************************************************</comment> + <class>PreviewWidget</class> + <widget class="QWidget" name="PreviewWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>398</width> + <height>282</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Preview Window</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="GroupBox1"> + <property name="title"> + <string>GroupBox</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="RadioButton1"> + <property name="text"> + <string>RadioButton1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton2"> + <property name="text"> + <string>RadioButton2</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton3"> + <property name="text"> + <string>RadioButton3</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox2"> + <property name="title"> + <string>GroupBox2</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QCheckBox" name="CheckBox1"> + <property name="text"> + <string>CheckBox1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="CheckBox2"> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QProgressBar" name="ProgressBar1"> + <property name="value"> + <number>50</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLineEdit" name="LineEdit1"> + <property name="text"> + <string>LineEdit</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="ComboBox1"> + <item> + <property name="text"> + <string>ComboBox</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QSpinBox" name="SpinBox1"/> + </item> + <item> + <widget class="QPushButton" name="PushButton1"> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollBar" name="ScrollBar1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="Slider1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="textView"> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>55</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="html"> + <string><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></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="Spacer2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/qtconfig/qtconfig.pro b/src/qtconfig/qtconfig.pro new file mode 100644 index 000000000..cb06e5a99 --- /dev/null +++ b/src/qtconfig/qtconfig.pro @@ -0,0 +1,28 @@ +TEMPLATE = app +CONFIG += qt warn_on x11 +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} +LANGUAGE = C++ + +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 +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 + +FORMS = mainwindow.ui paletteeditoradvanced.ui previewwidget.ui +RESOURCES = qtconfig.qrc + +PROJECTNAME = Qt Configuration +TARGET = qtconfig +DESTDIR = ../../bin + +target.path=$$[QT_INSTALL_BINS] +INSTALLS += target +INCLUDEPATH += . +DBFILE = qtconfig.db diff --git a/src/qtconfig/qtconfig.qrc b/src/qtconfig/qtconfig.qrc new file mode 100644 index 000000000..cd6656727 --- /dev/null +++ b/src/qtconfig/qtconfig.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/trolltech/qtconfig/"> + <file>images/appicon.png</file> +</qresource> +</RCC> |