From 54d6270593430ea50bd8ec54e7155a6a745eab4c Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 12 Aug 2016 22:19:28 +0000 Subject: [PATCH] add back qtconfig I'll find use for it when I implement antialiasing and image conversions options, maybe something else Signed-off-by: Ivailo Monev --- src/tools/CMakeLists.txt | 1 + src/tools/qtconfig/CMakeLists.txt | 62 ++ src/tools/qtconfig/colorbutton.cpp | 209 +++++ src/tools/qtconfig/colorbutton.h | 90 ++ src/tools/qtconfig/images/qtconfig.png | Bin 0 -> 2238 bytes src/tools/qtconfig/main.cpp | 71 ++ src/tools/qtconfig/mainwindow.cpp | 873 ++++++++++++++++++ src/tools/qtconfig/mainwindow.h | 109 +++ src/tools/qtconfig/mainwindow.ui | 1221 ++++++++++++++++++++++++++ src/tools/qtconfig/paletteeditoradvanced.cpp | 403 +++++++++ src/tools/qtconfig/paletteeditoradvanced.h | 106 +++ src/tools/qtconfig/paletteeditoradvanced.ui | 416 +++++++++ src/tools/qtconfig/previewframe.cpp | 107 +++ src/tools/qtconfig/previewframe.h | 83 ++ src/tools/qtconfig/previewwidget.cpp | 91 ++ src/tools/qtconfig/previewwidget.h | 70 ++ src/tools/qtconfig/previewwidget.ui | 252 ++++++ src/tools/qtconfig/qtconfig.desktop.cmake | 9 + src/tools/qtconfig/qtconfig.qrc | 5 + 19 files changed, 4178 insertions(+) create mode 100644 src/tools/qtconfig/CMakeLists.txt create mode 100644 src/tools/qtconfig/colorbutton.cpp create mode 100644 src/tools/qtconfig/colorbutton.h create mode 100644 src/tools/qtconfig/images/qtconfig.png create mode 100644 src/tools/qtconfig/main.cpp create mode 100644 src/tools/qtconfig/mainwindow.cpp create mode 100644 src/tools/qtconfig/mainwindow.h create mode 100644 src/tools/qtconfig/mainwindow.ui create mode 100644 src/tools/qtconfig/paletteeditoradvanced.cpp create mode 100644 src/tools/qtconfig/paletteeditoradvanced.h create mode 100644 src/tools/qtconfig/paletteeditoradvanced.ui create mode 100644 src/tools/qtconfig/previewframe.cpp create mode 100644 src/tools/qtconfig/previewframe.h create mode 100644 src/tools/qtconfig/previewwidget.cpp create mode 100644 src/tools/qtconfig/previewwidget.h create mode 100644 src/tools/qtconfig/previewwidget.ui create mode 100644 src/tools/qtconfig/qtconfig.desktop.cmake create mode 100644 src/tools/qtconfig/qtconfig.qrc diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 9e7f94939..aecc41202 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -18,5 +18,6 @@ if(NOT KATIE_BOOTSTRAP) add_subdirectory(qhelpgenerator) add_subdirectory(qcollectiongenerator) add_subdirectory(qscript) + add_subdirectory(qtconfig) add_subdirectory(designer) endif() diff --git a/src/tools/qtconfig/CMakeLists.txt b/src/tools/qtconfig/CMakeLists.txt new file mode 100644 index 000000000..2a273d1b7 --- /dev/null +++ b/src/tools/qtconfig/CMakeLists.txt @@ -0,0 +1,62 @@ +# add_definitions() +set(EXTRA_QTCONFIG_LIBS KtCore KtGui) + +include_directories( + ${CMAKE_BINARY_DIR}/include + ${CMAKE_BINARY_DIR}/privateinclude + ${CMAKE_BINARY_DIR}/include/QtCore + ${CMAKE_BINARY_DIR}/privateinclude/QtCore + ${CMAKE_BINARY_DIR}/include/QtGui + ${CMAKE_BINARY_DIR}/privateinclude/QtGui +) + +set(QTCONFIG_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/colorbutton.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/previewframe.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.ui + ${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.ui + ${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.ui + ${CMAKE_CURRENT_SOURCE_DIR}/qtconfig.qrc +) + +set(QTCONFIG_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/colorbutton.h + ${CMAKE_CURRENT_SOURCE_DIR}/previewframe.h + ${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.h + ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h + ${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.h +) + +katie_resources(${QTCONFIG_SOURCES} ${QTCONFIG_HEADERS}) +katie_setup_flags() +katie_setup_paths() + +add_executable(qtconfig + WIN32 # TODO: MACOSX_BUNDLE + ${QTCONFIG_SOURCES} ${QTCONFIG_HEADERS} +) +target_link_libraries(qtconfig ${EXTRA_QTCONFIG_LIBS}) + +install( + TARGETS qtconfig + EXPORT KatieBinaryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} + RUNTIME DESTINATION ${QT_BINARIES_PATH} + COMPONENT Devel +) + +if(NOT KATIE_PLATFORM MATCHES "(win32|wince|mac)") + install( + PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/qtconfig.desktop + DESTINATION ${APPLICATIONS_INSTALL_PATH} + COMPONENT Devel + ) + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/qdbusviewer.png + DESTINATION ${PIXMAPS_INSTALL_PATH} + COMPONENT Devel + ) +endif() diff --git a/src/tools/qtconfig/colorbutton.cpp b/src/tools/qtconfig/colorbutton.cpp new file mode 100644 index 000000000..fb34d5966 --- /dev/null +++ b/src/tools/qtconfig/colorbutton.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "colorbutton.h" + +#include +#include +#include +#include +#include +#include +#include + +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(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); +} + +#include "moc_colorbutton.h" + +QT_END_NAMESPACE diff --git a/src/tools/qtconfig/colorbutton.h b/src/tools/qtconfig/colorbutton.h new file mode 100644 index 000000000..cfd2dad42 --- /dev/null +++ b/src/tools/qtconfig/colorbutton.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COLORBUTTON_H +#define COLORBUTTON_H + +#include + +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/tools/qtconfig/images/qtconfig.png b/src/tools/qtconfig/images/qtconfig.png new file mode 100644 index 0000000000000000000000000000000000000000..00931777875ac206566aa26a1b02989ece8a7acb GIT binary patch literal 2238 zcmV;v2toIWP)R8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H12s=qcK~!jg&02eKRMj2+?(W^aH=AsBNkRw&SRnEaQ4DWEWu!o` z!(*)4PK%|T)|xVuYOT{h+5$3`$v9X?Tj|*8s6$7Gsg5|*Qke)UBtm#r5=e+V^4ySw zymt4#?>YTrht!*Mx8&X|==ay&-*?XW{k}bqd(Q7%j#7$L2$n@k0el<4vQQ2`zGPn3 zgkYE#eLfBx2O=d%pCXecO(nIuMyqt49IDz;*Oaos+X&81NU$v81Mnh%tpHG5nuR%~ zS>QakZcvd4NyN-PMJ6qpLM~_;{oK&WN5^*5T}pH87NipL27pZfFm{4~ zBoQ+Q6q&TC3b~+bv_{uy<+1Ix=SJK(Y=i{MB8vf30pK_e*sw7lVqh3u;S#z=X*_1e z70GN@6;iLMw8qfs$49r$&+~wcCxE$v1xl zL;P(I%qhG)2cMtIA8NM~^398W7`T12_zoj2|GuUY+~_ip?ajy7>o$KzT^L#>3d1wpKz{|LjKX#F>SzHbfg**q6N{NoQSTv5*5 zcx=wo7F%ajL-Euix1j)VDI^{<5p7cO{jv=V*B-lqy=Pwl0)3dbEED@HkD}uJ7c6BK z6s{WV6$rjA_sC5l6Z0Yrry2_Dz|R2yViFtd%Cbq=wf9B5`rco0 z=1(<)_L$m>iX-I^co7-?z_8+SEo4f;6o%7GnXz#IcrS;9DluG^KWyuRf}%^k3a9`Q z!;8!D&{7h~EkselG=@`cgaClo$3c==E?dZP>OLi0%@Lp9gK&U7$J-4pAUV7wg%y$| z*!PGVI2OWj044S*BoD{g*8yOcY#z?<&9JRw7!(%LG{N9`mNtLuJc+R4~L~ILOA$tH#WWe1ol4j_ATo)-Z+al&g=li|Mp!RfE8r!${7;Jrx47P}HSaG!YdP7CIEgKY9+b=vV)hb(?QiYE zy_@GVWxAy{R5c$+i-=T6TQ;8eahN$O5* zL;wfi&B`|!?#cPP@ZCAjVn!a@V@{!|gt;M3s}M26gUD172R=K(oL9nP9+ppe6s3g^ zjo6POllO<((tgpi;QkN{V&L&zkEgq706=fI-v8VXy`nzG +#include +#include +#include + +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(); +} + +#include "qrc_qtconfig.cpp" diff --git a/src/tools/qtconfig/mainwindow.cpp b/src/tools/qtconfig/mainwindow.cpp new file mode 100644 index 000000000..726db97dc --- /dev/null +++ b/src/tools/qtconfig/mainwindow.cpp @@ -0,0 +1,873 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include "colorbutton.h" +#include "previewframe.h" +#include "paletteeditoradvanced.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef Q_WS_X11 +#include +#endif + +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", +"

Appearance

" +"
" +"

Use this tab to customize the appearance of your Qt applications.

" +"

You can select the default GUI Style from the drop down list and " +"customize the colors.

" +"

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.)

" +"

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." +"

The Preview Window shows what the selected Style and colors look " +"like."); + +static const char *font_text = QT_TRANSLATE_NOOP("MainWindow", +"

Fonts

" +"
" +"

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.

" +"

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." +"

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", +"

Interface

" +"
" +"

Use this tab to customize the feel of your Qt applications.

" +"

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.

" +"

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

" +"

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", +"

Printer

" +"
" +"

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." +"

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."); + +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->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/qtconfig.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())); + +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE) + ui->colorConfig->hide(); + else + ui->kdeNoteLabel->hide(); +#else + ui->colorConfig->hide(); + ui->kdeNoteLabel->hide(); +#endif + + 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 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->inputStyleLabel->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->inputMethodLabel->hide(); +#endif + + ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true) + .toBool()); + fontpaths = settings.value(QLatin1String("fontPath")).toStringList(); + ui->fontpathListBox->insertItems(0, fontpaths); + + 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 + + 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("

%1

" + "
Version %2" + "

Copyright (C) 2015 The Qt Company Ltd.") + .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)); +} + +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(); +} + +#include "moc_mainwindow.h" + +QT_END_NAMESPACE diff --git a/src/tools/qtconfig/mainwindow.h b/src/tools/qtconfig/mainwindow.h new file mode 100644 index 000000000..84eb8ecec --- /dev/null +++ b/src/tools/qtconfig/mainwindow.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +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/tools/qtconfig/mainwindow.ui b/src/tools/qtconfig/mainwindow.ui new file mode 100644 index 000000000..e80ce01b9 --- /dev/null +++ b/src/tools/qtconfig/mainwindow.ui @@ -0,0 +1,1221 @@ + + + ********************************************************************* +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +********************************************************************* + MainWindow + + + + 0 + 0 + 815 + 716 + + + + Qt Configuration + + + + + 8 + + + + + + 200 + 0 + + + + true + + + + + + + 0 + + + + Appearance + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + GUI Style + + + + 4 + + + 8 + + + + + + 0 + 0 + + + + Select GUI &Style: + + + guiStyleCombo + + + + + + + + + + + + + + 0 + 0 + + + + Preview + + + + + + Select &Palette: + + + paletteCombo + + + + + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + + + + + + 0 + 0 + + + + + 410 + 260 + + + + + + + + + + + + 0 + 0 + + + + + 400 + 0 + + + + Build Palette + + + + + + + 0 + + + + + &Button Background: + + + buttonMainColor + + + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + 1 + + + 0 + + + Window Back&ground: + + + Qt::AlignVCenter + + + 0 + + + buttonWindowColor + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 70 + 20 + + + + + + + + &Tune Palette... + + + + + + + + + + Please use the KDE Control Center to set the palette. + + + + + + + + + + + Fonts + + + + + + Default Font + + + + 8 + + + 4 + + + + + true + + + false + + + + + + + true + + + false + + + + + + + true + + + true + + + false + + + + + + + &Style: + + + fontStyleCombo + + + + + + + &Point Size: + + + pointSizeCombo + + + + + + + F&amily: + + + fontFamilyCombo + + + + + + + Sample Text + + + Qt::AlignHCenter + + + + + + + + + + Font Substitution + + + + 4 + + + 8 + + + + + 4 + + + 0 + + + + + S&elect or Enter a Family: + + + familySubstitutionCombo + + + + + + + true + + + true + + + false + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + + Current Substitutions: + + + + + + + + + + 4 + + + 0 + + + + + Up + + + + + + + Down + + + + + + + Remove + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + Qt::Horizontal + + + + + + + 4 + + + 0 + + + + + Select s&ubstitute Family: + + + chooseSubstitutionCombo + + + + + + + true + + + false + + + + + + + Add + + + + + + + + + + + + + Interface + + + + + + Feel Settings + + + + 8 + + + 4 + + + + + ms + + + 10 + + + 10000 + + + + + + + &Double Click Interval: + + + doubleClickIntervalSpinBox + + + + + + + No blinking + + + ms + + + 9 + + + 10000 + + + + + + + &Cursor Flash Time: + + + cursorFlashTimeSpinBox + + + + + + + lines + + + 1 + + + 20 + + + + + + + Wheel &Scroll Lines: + + + wheelScrollLinesSpinBox + + + + + + + Resolve symlinks in URLs + + + + + + + + + + GUI Effects + + + + 4 + + + 8 + + + + + &Enable + + + Alt+E + + + + + + + + 4 + + + + + &Menu Effect: + + + menuEffectCombo + + + + + + + C&omboBox Effect: + + + comboEffectCombo + + + + + + + &ToolTip Effect: + + + toolTipEffectCombo + + + + + + + Tool&Box Effect: + + + toolBoxEffectCombo + + + + + + + 0 + + + true + + + + Disable + + + + + Animate + + + + + Fade + + + + + + + + + Disable + + + + + Animate + + + + + + + + + Disable + + + + + Animate + + + + + Fade + + + + + + + + + Disable + + + + + Animate + + + + + + + + + + + + + + Global Strut + + + + 8 + + + 4 + + + + + Minimum &Width: + + + strutWidthSpinBox + + + + + + + Minimum Hei&ght: + + + strutHeightSpinBox + + + + + + + pixels + + + 1000 + + + + + + + pixels + + + 1000 + + + + + + + + + + Enhanced support for languages written right-to-left + + + + + + + XIM Input Style: + + + + + + + 0 + + + + On The Spot + + + + + Over The Spot + + + + + Off The Spot + + + + + Root + + + + + + + + Default Input Method: + + + + + + + -1 + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + Printer + + + + + + Enable Font embedding + + + true + + + + + + + + 0 + 0 + + + + Font Paths + + + + 4 + + + 8 + + + + + 0 + + + 4 + + + + + Up + + + + + + + Remove + + + + + + + Down + + + + + + + + + + + + 0 + + + 4 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + Add + + + + + + + Browse... + + + + + + + Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 815 + 20 + + + + + + 203 + 114 + 121 + 110 + + + + &File + + + + + + + + + 543 + 98 + 121 + 106 + + + + &Help + + + + + + + + + + + &Save + + + Save + + + Ctrl+S + + + + + E&xit + + + Exit + + + Ctrl+Q + + + + + &About + + + About + + + + + + + + About &Qt + + + About Qt + + + + + + ColorButton + +
colorbutton.h
+
+ + PreviewFrame + +
previewframe.h
+
+
+ + helpView + mainTabWidget + guiStyleCombo + tunePaletteButton + paletteCombo + fontFamilyCombo + fontStyleCombo + pointSizeCombo + sampleLineEdit + familySubstitutionCombo + substitutionsListBox + upSubstitutionButton + downSubstitutionButton + removeSubstitutionButton + chooseSubstitutionCombo + addSubstitutionButton + doubleClickIntervalSpinBox + cursorFlashTimeSpinBox + wheelScrollLinesSpinBox + resolveLinksCheckBox + effectsCheckBox + menuEffectCombo + comboEffectCombo + toolTipEffectCombo + toolBoxEffectCombo + strutWidthSpinBox + strutHeightSpinBox + rtlExtensionsCheckBox + inputStyleCombo + inputMethodCombo + fontEmbeddingCheckBox + fontpathListBox + upFontpathButton + downFontpathButton + removeFontpathButton + fontPathLineEdit + browseFontPathButton + addFontPathButton + + + + + effectsCheckBox + toggled(bool) + effectsFrame + setEnabled(bool) + + + 417 + 257 + + + 578 + 379 + + + + + fontEmbeddingCheckBox + toggled(bool) + fontPathsGroup + setEnabled(bool) + + + 449 + 69 + + + 447 + 94 + + + + +
diff --git a/src/tools/qtconfig/paletteeditoradvanced.cpp b/src/tools/qtconfig/paletteeditoradvanced.cpp new file mode 100644 index 000000000..e385d3ccb --- /dev/null +++ b/src/tools/qtconfig/paletteeditoradvanced.cpp @@ -0,0 +1,403 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $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; +} + +#include "moc_paletteeditoradvanced.h" + +QT_END_NAMESPACE diff --git a/src/tools/qtconfig/paletteeditoradvanced.h b/src/tools/qtconfig/paletteeditoradvanced.h new file mode 100644 index 000000000..0c55a2612 --- /dev/null +++ b/src/tools/qtconfig/paletteeditoradvanced.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PALETTEEDITORADVANCED_H +#define PALETTEEDITORADVANCED_H + +#include + +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/tools/qtconfig/paletteeditoradvanced.ui b/src/tools/qtconfig/paletteeditoradvanced.ui new file mode 100644 index 000000000..6e275a62f --- /dev/null +++ b/src/tools/qtconfig/paletteeditoradvanced.ui @@ -0,0 +1,416 @@ + + + ********************************************************************* +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +********************************************************************* + PaletteEditorAdvanced + + + + 0 + 0 + 239 + 344 + + + + Tune Palette + + + + + + + + Select &Palette: + + + paletteCombo + + + + + + + + Active Palette + + + + + Inactive Palette + + + + + Disabled Palette + + + + + + + + + + + 0 + 0 + + + + Auto + + + + + + Build inactive palette from active + + + true + + + + + + + Build disabled palette from active + + + true + + + + + + + + + + Central color &roles + + + + + + Choose central color role + + + <b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p> + + + + Window + + + + + WindowText + + + + + Base + + + + + AlternateBase + + + + + ToolTipBase + + + + + ToolTipText + + + + + Text + + + + + Button + + + + + ButtonText + + + + + BrightText + + + + + Highlight + + + + + HighlightedText + + + + + Link + + + + + LinkVisited + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + &Select Color: + + + + + + + + + + + + 3-D shadow &effects + + + + + + + + Generate shadings + + + Check to let 3D-effect colors be calculated from button-color. + + + Build &from button color + + + true + + + + + + + false + + + Choose 3D-effect color role + + + <b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul> + + + + Light + + + + + Midlight + + + + + Mid + + + + + Dark + + + + + Shadow + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Select Co&lor: + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + PaletteEditorAdvanced + accept() + + + 238 + 384 + + + 157 + 274 + + + + + buttonBox + rejected() + PaletteEditorAdvanced + reject() + + + 306 + 390 + + + 286 + 274 + + + + + checkBuildEffect + toggled(bool) + comboEffect + setDisabled(bool) + + + 82 + 262 + + + 190 + 262 + + + + + diff --git a/src/tools/qtconfig/previewframe.cpp b/src/tools/qtconfig/previewframe.cpp new file mode 100644 index 000000000..d110ca6b3 --- /dev/null +++ b/src/tools/qtconfig/previewframe.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewframe.h" +#include "previewwidget.h" + +#include +#include +#include +#include + +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()); +} + +#include "moc_previewframe.h" + +QT_END_NAMESPACE diff --git a/src/tools/qtconfig/previewframe.h b/src/tools/qtconfig/previewframe.h new file mode 100644 index 000000000..9aa9e3dca --- /dev/null +++ b/src/tools/qtconfig/previewframe.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWFRAME_H +#define PREVIEWFRAME_H + +#include + +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/tools/qtconfig/previewwidget.cpp b/src/tools/qtconfig/previewwidget.cpp new file mode 100644 index 000000000..0a08b1c8f --- /dev/null +++ b/src/tools/qtconfig/previewwidget.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewwidget.h" +#include "ui_previewwidget.h" +#include + +QT_BEGIN_NAMESPACE + +PreviewWidget::PreviewWidget(QWidget *parent) + : QWidget(parent), ui(new Ui::PreviewWidget) +{ + ui->setupUi(this); + + // install event filter on child widgets + QList l = findChildren(); + 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(); +} + +#include "moc_previewwidget.h" + +QT_END_NAMESPACE diff --git a/src/tools/qtconfig/previewwidget.h b/src/tools/qtconfig/previewwidget.h new file mode 100644 index 000000000..31abbb842 --- /dev/null +++ b/src/tools/qtconfig/previewwidget.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWWIDGET_H +#define PREVIEWWIDGET_H + +#include + +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/tools/qtconfig/previewwidget.ui b/src/tools/qtconfig/previewwidget.ui new file mode 100644 index 000000000..2c90b6411 --- /dev/null +++ b/src/tools/qtconfig/previewwidget.ui @@ -0,0 +1,252 @@ + + + ********************************************************************* +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** $QT_END_LICENSE$ +** +********************************************************************* + PreviewWidget + + + + 0 + 0 + 398 + 282 + + + + + 0 + 0 + + + + Preview Window + + + + + + + + 6 + + + 0 + + + + + GroupBox + + + + 6 + + + 11 + + + + + RadioButton1 + + + true + + + + + + + RadioButton2 + + + + + + + RadioButton3 + + + + + + + + + + GroupBox2 + + + + 6 + + + 11 + + + + + CheckBox1 + + + true + + + + + + + CheckBox2 + + + + + + + + + + 50 + + + + + + + + + 6 + + + 0 + + + + + LineEdit + + + + + + + + ComboBox + + + + + + + + 6 + + + 0 + + + + + + + + PushButton + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + + 32767 + 55 + + + + true + + + <p><a href="http://qt.nokia.com">http://qt.nokia.com</a></p> +<p><a href="http://www.kde.org">http://www.kde.org</a></p> + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 0 + + + + + + + + + diff --git a/src/tools/qtconfig/qtconfig.desktop.cmake b/src/tools/qtconfig/qtconfig.desktop.cmake new file mode 100644 index 000000000..a883b8374 --- /dev/null +++ b/src/tools/qtconfig/qtconfig.desktop.cmake @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Katie Config +Comment=Configure Katie behavior, styles, fonts +Exec=@QT_BINARIES_PATH@/qtconfig +Icon=@PIXMAPS_INSTALL_PATH@/qtconfig.png +Terminal=false +Encoding=UTF-8 +Type=Application +Categories=Qt;Settings; diff --git a/src/tools/qtconfig/qtconfig.qrc b/src/tools/qtconfig/qtconfig.qrc new file mode 100644 index 000000000..40da425d0 --- /dev/null +++ b/src/tools/qtconfig/qtconfig.qrc @@ -0,0 +1,5 @@ + + + images/qtconfig.png + + -- 2.11.0