diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-03-23 09:18:55 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:18:55 (GMT) |
commit | e5fcad302d86d316390c6b0f62759a067313e8a9 (patch) | |
tree | c2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tools/qtconfig | |
download | Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2 |
Long live Qt 4.5!
Diffstat (limited to 'tools/qtconfig')
25 files changed, 5960 insertions, 0 deletions
diff --git a/tools/qtconfig/LICENSE.GPL b/tools/qtconfig/LICENSE.GPL new file mode 100644 index 0000000..b6e1c33 --- /dev/null +++ b/tools/qtconfig/LICENSE.GPL @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/tools/qtconfig/colorbutton.cpp b/tools/qtconfig/colorbutton.cpp new file mode 100644 index 0000000..d700507 --- /dev/null +++ b/tools/qtconfig/colorbutton.cpp @@ -0,0 +1,206 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "colorbutton.h" + +#include <QApplication> +#include <QtEvents> +#include <QColorDialog> +#include <QPainter> +#include <QMimeData> +#include <QStyle> +#include <QStyleOption> + +QT_BEGIN_NAMESPACE + +ColorButton::ColorButton(QWidget *parent) + : QAbstractButton(parent), mousepressed(false) +{ + setAcceptDrops(true); + col = Qt::black; + connect(this, SIGNAL(clicked()), SLOT(changeColor())); +} + + +ColorButton::ColorButton(const QColor &c, QWidget *parent) + : QAbstractButton(parent) +{ + setAcceptDrops(true); + col = c; + connect(this, SIGNAL(clicked()), SLOT(changeColor())); +} + + +void ColorButton::setColor(const QColor &c) +{ + col = c; + update(); +} + + +void ColorButton::changeColor() +{ + QColor c = QColorDialog::getColor(col, qApp->activeWindow()); + + if (c.isValid()) { + setColor(c); + emit colorChanged(color()); + } +} + + +QSize ColorButton::sizeHint() const +{ + return QSize(40, 25); +} + + +QSize ColorButton::minimumSizeHint() const +{ + return QSize(40, 25); +} + + +void ColorButton::drawButton(QPainter *p) +{ + QStyleOptionButton buttonOptions; + buttonOptions.init(this); + buttonOptions.features = QStyleOptionButton::None; + buttonOptions.rect = rect(); + buttonOptions.palette = palette(); + buttonOptions.state = (isDown() ? QStyle::State_Sunken : QStyle::State_Raised); + style()->drawPrimitive(QStyle::PE_PanelButtonBevel, &buttonOptions, p, this); + + p->save(); + drawButtonLabel(p); + p->restore(); + + QStyleOptionFocusRect frectOptions; + frectOptions.init(this); + frectOptions.rect = style()->subElementRect(QStyle::SE_PushButtonFocusRect, &buttonOptions, this); + if (hasFocus()) + style()->drawPrimitive(QStyle::PE_FrameFocusRect, &frectOptions, p, this); +} + + +void ColorButton::drawButtonLabel(QPainter *p) +{ + QPalette::ColorGroup cg = + (isEnabled() ? (hasFocus() ? QPalette::Active : QPalette::Inactive) : QPalette::Disabled); + + p->setPen(palette().color(cg, QPalette::ButtonText)); + p->setBrush(col); + p->drawRect(width() / 4, height() / 4, width() / 2 - 1, height() / 2 - 1); +} + + +void ColorButton::dragEnterEvent(QDragEnterEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } +} + + +void ColorButton::dragMoveEvent(QDragMoveEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } + + e->accept(); +} + + +void ColorButton::dropEvent(QDropEvent *e) +{ + if (!e->mimeData()->hasColor()) { + e->ignore(); + return; + } + + QColor c = qvariant_cast<QColor>(e->mimeData()->colorData()); + setColor(c); + emit colorChanged(color()); +} + + +void ColorButton::mousePressEvent(QMouseEvent *e) +{ + presspos = e->pos(); + mousepressed = true; + QAbstractButton::mousePressEvent(e); +} + + +void ColorButton::mouseReleaseEvent(QMouseEvent *e) +{ + mousepressed = false; + QAbstractButton::mouseReleaseEvent(e); +} + + +void ColorButton::mouseMoveEvent(QMouseEvent *e) +{ + if (! mousepressed) + return; + + if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { + mousepressed = false; + setDown(false); + + QDrag *drag = new QDrag(this); + QMimeData *data = new QMimeData; + data->setColorData(color()); + drag->setMimeData(data); + drag->start(Qt::CopyAction); + } +} + +void ColorButton::paintEvent(QPaintEvent *) +{ + QPainter p(this); + drawButton(&p); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/colorbutton.h b/tools/qtconfig/colorbutton.h new file mode 100644 index 0000000..01f6760 --- /dev/null +++ b/tools/qtconfig/colorbutton.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COLORBUTTON_H +#define COLORBUTTON_H + +#include <QAbstractButton> + +QT_BEGIN_NAMESPACE + +class ColorButton : public QAbstractButton +{ + Q_OBJECT + +public: + ColorButton(QWidget *); + ColorButton(const QColor &, QWidget *); + + const QColor &color() const { return col; } + + void setColor(const QColor &); + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void dragEnterEvent(QDragEnterEvent *); + void dragMoveEvent(QDragMoveEvent *); + void dropEvent(QDropEvent *); + +signals: + void colorChanged(const QColor &); + +protected: + void paintEvent(QPaintEvent *); + void drawButton(QPainter *); + void drawButtonLabel(QPainter *); + +private slots: + void changeColor(); + + +private: + QColor col; + QPoint presspos; + bool mousepressed; +}; + +QT_END_NAMESPACE + +#endif // COLORBUTTON_H diff --git a/tools/qtconfig/images/appicon.png b/tools/qtconfig/images/appicon.png Binary files differnew file mode 100644 index 0000000..0093177 --- /dev/null +++ b/tools/qtconfig/images/appicon.png diff --git a/tools/qtconfig/main.cpp b/tools/qtconfig/main.cpp new file mode 100644 index 0000000..e6b7630 --- /dev/null +++ b/tools/qtconfig/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ui_previewwidgetbase.h" +#include "mainwindow.h" +#include <QApplication> + +QT_USE_NAMESPACE + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(qtconfig); + + QApplication app(argc, argv); + MainWindow mw; + mw.show(); + return app.exec(); +} diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp new file mode 100644 index 0000000..498a6b6 --- /dev/null +++ b/tools/qtconfig/mainwindow.cpp @@ -0,0 +1,1073 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include "colorbutton.h" +#include "previewframe.h" +#include "paletteeditoradvanced.h" + +#include <QLabel> +#include <QApplication> +#include <QComboBox> +#include <QStyleFactory> +#include <QFontDatabase> +#include <QLineEdit> +#include <QSpinBox> +#include <QCheckBox> +#include <QFileDialog> +#include <QAction> +#include <QStatusBar> +#include <QSettings> +#include <QMessageBox> +#include <QStyle> +#include <QtEvents> +#include <Q3ValueList> +#include <QInputContext> +#include <QInputContextFactory> +#include <QtDebug> + +#include <stdlib.h> + +#ifndef QT_NO_GSTREAMER +#include <gst/gst.h> +#include <phonon/phononnamespace.h> +#endif + +#include <QtGui/private/qt_x11_p.h> + +QT_BEGIN_NAMESPACE + +// from qapplication.cpp and qapplication_x11.cpp - These are NOT for +// external use ignore them +// extern bool Q_CORE_EXPORT qt_resolve_symlinks; + +static const char *appearance_text = +"<p><b><font size+=2>Appearance</font></b></p>" +"<hr>" +"<p>Use this tab to customize the appearance of your Qt applications.</p>" +"<p>You can select the default GUI Style from the drop down list and " +"customize the colors.</p>" +"<p>Any GUI Style plugins in your plugin path will automatically be added " +"to the list of built-in Qt styles. (See the Library Paths tab for " +"information on adding new plugin paths.)</p>" +"<p>When you choose 3-D Effects and Window Background colors, the Qt " +"Configuration program will automatically generate a palette for you. " +"To customize colors further, press the Tune Palette button to open " +"the advanced palette editor." +"<p>The Preview Window shows what the selected Style and colors look " +"like."; + +static const char *font_text = +"<p><b><font size+=2>Fonts</font></b></p>" +"<hr>" +"<p>Use this tab to select the default font for your Qt applications. " +"The selected font is shown (initially as 'Sample Text') in the line " +"edit below the Family, " +"Style and Point Size drop down lists.</p>" +"<p>Qt has a powerful font substitution feature that allows you to " +"specify a list of substitute fonts. Substitute fonts are used " +"when a font cannot be loaded, or if the specified font doesn't have " +"a particular character." +"<p>For example, if you select the font Lucida, which doesn't have Korean " +"characters, but need to show some Korean text using the Mincho font family " +"you can do so by adding Mincho to the list. Once Mincho is added, any " +"Korean characters that are not found in the Lucida font will be taken " +"from the Mincho font. Because the font substitutions are " +"lists, you can also select multiple families, such as Song Ti (for " +"use with Chinese text)."; + +static const char *interface_text = +"<p><b><font size+=2>Interface</font></b></p>" +"<hr>" +"<p>Use this tab to customize the feel of your Qt applications.</p>" +"<p>If the Resolve Symlinks checkbox is checked Qt will follow symlinks " +"when handling URLs. For example, in the file dialog, if this setting is turned " +"on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory " +"will cause the file dialog to change to /var/tmp. With this setting turned " +"off, symlinks are not resolved or followed.</p>" +"<p>The Global Strut setting is useful for people who require a " +"minimum size for all widgets (e.g. when using a touch panel or for users " +"who are visually impaired). Leaving the Global Strut width and height " +"at 0 will disable the Global Strut feature</p>" +"<p>XIM (Extended Input Methods) are used for entering characters in " +"languages that have large character sets, for example, Chinese and " +"Japanese."; +// ### What does the 'Enhanced support for languages written R2L do? + +static const char *printer_text = +"<p><b><font size+=2>Printer</font></b></p>" +"<hr>" +"<p>Use this tab to configure the way Qt generates output for the printer." +"You can specify if Qt should try to embed fonts into its generated output." +"If you enable font embedding, the resulting postscript will be more " +"portable and will more accurately reflect the " +"visual output on the screen; however the resulting postscript file " +"size will be bigger." +"<p>When using font embedding you can select additional directories where " +"Qt should search for embeddable font files. By default, the X " +"server font path is used."; + +static const char *phonon_text = +"<p><b><font size+=2>Phonon</font></b></p>" +"<hr>" +"<p>Use this tab to configure the Phonon GStreamer multimedia backend. " +"<p>It is reccommended to leave all settings on \"Auto\" to let " +"Phonon determine your settings automatically."; + +static QColorGroup::ColorRole centralFromItem( int item ) +{ + switch( item ) { + case 0: return QColorGroup::Window; + case 1: return QColorGroup::WindowText; + case 2: return QColorGroup::Button; + case 3: return QColorGroup::Base; + case 4: return QColorGroup::Text; + case 5: return QColorGroup::BrightText; + case 6: return QColorGroup::ButtonText; + case 7: return QColorGroup::Highlight; + case 8: return QColorGroup::HighlightedText; + default: return QColorGroup::NColorRoles; + } +} + + +static QColorGroup::ColorRole effectFromItem( int item ) +{ + switch( item ) { + case 0: return QColorGroup::Light; + case 1: return QColorGroup::Midlight; + case 2: return QColorGroup::Mid; + case 3: return QColorGroup::Dark; + case 4: return QColorGroup::Shadow; + default: return QColorGroup::NColorRoles; + } +} + + +static void setStyleHelper(QWidget *w, QStyle *s) +{ + const QObjectList children = w->children(); + 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() + : MainWindowBase(0, "main window"), + editPalette(palette()), previewPalette(palette()), previewstyle(0) +{ + modified = true; + desktopThemeName = tr("Desktop Settings (Default)"); + QStringList gstyles = QStyleFactory::keys(); + gstyles.sort(); + gstylecombo->addItem(desktopThemeName); + gstylecombo->setItemData(gstylecombo->findText(desktopThemeName), + tr("Choose style and palette based on your desktop settings."), Qt::ToolTipRole); + gstylecombo->insertStringList(gstyles); + + QSettings settings(QLatin1String("Trolltech")); + settings.beginGroup(QLatin1String("Qt")); + + QString currentstyle = settings.value(QLatin1String("style")).toString(); + if (currentstyle.isEmpty()) { + gstylecombo->setCurrentItem(gstylecombo->findText(desktopThemeName)); + currentstyle = QLatin1String(QApplication::style()->name()); + } else { + int index = gstylecombo->findText(currentstyle, Qt::MatchFixedString); + if (index != -1) { + gstylecombo->setCurrentItem(index); + } else { // we give up + gstylecombo->insertItem(QLatin1String("Unknown")); + gstylecombo->setCurrentItem(gstylecombo->count() - 1); + } + } + buttonMainColor->setColor(palette().color(QPalette::Active, + QColorGroup::Button)); + buttonMainColor2->setColor(palette().color(QPalette::Active, + QColorGroup::Window)); + connect(buttonMainColor, SIGNAL(colorChanged(QColor)), + this, SLOT(buildPalette())); + connect(buttonMainColor2, SIGNAL(colorChanged(QColor)), + this, SLOT(buildPalette())); + + if (X11->desktopEnvironment == DE_KDE) + colorConfig->hide(); + else + labelKDENote->hide(); + + QFontDatabase db; + QStringList families = db.families(); + familycombo->insertStringList(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(); + familysubcombo->insertStringList(fs); + + choosesubcombo->insertStringList(families); + Q3ValueList<int> sizes = db.standardSizes(); + Q3ValueList<int>::Iterator it = sizes.begin(); + while (it != sizes.end()) + psizecombo->insertItem(QString::number(*it++)); + + dcispin->setValue(QApplication::doubleClickInterval()); + cfispin->setValue(QApplication::cursorFlashTime()); + wslspin->setValue(QApplication::wheelScrollLines()); + // ############# +// resolvelinks->setChecked(qt_resolve_symlinks); + + effectcheckbox->setChecked(QApplication::isEffectEnabled(Qt::UI_General)); + effectbase->setEnabled(effectcheckbox->isChecked()); + + if (QApplication::isEffectEnabled(Qt::UI_FadeMenu)) + menueffect->setCurrentItem(2); + else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu)) + menueffect->setCurrentItem(1); + + if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)) + comboeffect->setCurrentItem(1); + + if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)) + tooltipeffect->setCurrentItem(2); + else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip)) + tooltipeffect->setCurrentItem(1); + + if ( QApplication::isEffectEnabled( Qt::UI_AnimateToolBox ) ) + toolboxeffect->setCurrentItem( 1 ); + + QSize globalStrut = QApplication::globalStrut(); + strutwidth->setValue(globalStrut.width()); + strutheight->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; + + familycombo->setCurrentItem(i); + + QStringList styles = db.styles(familycombo->currentText()); + stylecombo->insertStringList(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; + stylecombo->setCurrentItem(i); + + i = 0; + for (int psize = QApplication::font().pointSize(); i < psizecombo->count(); ++i) { + const int sz = psizecombo->text(i).toInt(); + if (sz == psize) { + psizecombo->setCurrentItem(i); + break; + } else if(sz > psize) { + psizecombo->insertItem(i, QString::number(psize)); + psizecombo->setCurrentItem(i); + break; + } + } + + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + + rtlExtensions->setChecked(settings.value(QLatin1String("useRtlExtensions"), false).toBool()); + +#ifdef Q_WS_X11 + inputStyle->setCurrentText(settings.value(QLatin1String("XIMInputStyle"), trUtf8("On The Spot")).toString()); +#else + inputStyle->hide(); + inputStyleLabel->hide(); +#endif + +#if defined(Q_WS_X11) && !defined(QT_NO_XIM) + QStringList inputMethods = QInputContextFactory::keys(); + int inputMethodIndex = -1; + QString defaultInputMethod = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString(); + for (int i = inputMethods.size()-1; i >= 0; --i) { + const QString &im = inputMethods.at(i); + if (im.contains(QLatin1String("imsw"))) { + inputMethods.removeAt(i); + if (inputMethodIndex > i) + --inputMethodIndex; + } else if (im == defaultInputMethod) { + inputMethodIndex = i; + } + } + if (inputMethodIndex == -1 && !inputMethods.isEmpty()) + inputMethodIndex = 0; + inputMethod->addItems(inputMethods); + inputMethod->setCurrentIndex(inputMethodIndex); +#else + inputMethod->hide(); + inputMethodLabel->hide(); +#endif + + fontembeddingcheckbox->setChecked(settings.value(QLatin1String("embedFonts"), true).toBool()); + fontpaths = settings.value(QLatin1String("fontPath")).toStringList(); + fontpathlistbox->insertStringList(fontpaths); + + audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + audiosinkCombo->setItemData(audiosinkCombo->findText(tr("Auto (default)")), + tr("Choose audio output automatically."), Qt::ToolTipRole); + audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink")); + audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")), + tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole); +#ifndef QT_NO_GSTREAMER + phononVersionLabel->setText(QLatin1String(Phonon::phononVersion())); + if (gst_init_check(0, 0, 0)) { + gchar *versionString = gst_version_string(); + gstversionLabel->setText(QLatin1String(versionString)); + g_free(versionString); + GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); + QString name, klass, description; + for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { + GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data); + klass = QLatin1String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature))); + if (klass == QLatin1String("Sink/Audio")) { + name = QLatin1String(GST_PLUGIN_FEATURE_NAME(feature)); + if (name == QLatin1String("sfsink")) + continue; //useless to output audio to file when you cannot set the file path + else if (name == QLatin1String("autoaudiosink")) + continue; //This is used implicitly from the auto setting + GstElement *sink = gst_element_factory_make (qPrintable(name), NULL); + if (sink) { + description = QLatin1String(gst_element_factory_get_description (GST_ELEMENT_FACTORY(feature))); + audiosinkCombo->addItem(name, name); + audiosinkCombo->setItemData(audiosinkCombo->findText(name), description, Qt::ToolTipRole); + gst_object_unref (sink); + } + } + } + g_list_free(factoryList); + } +#else + tab4->setEnabled(false); + phononLabel->setText(tr("Phonon GStreamer backend not available.")); +#endif + + videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("Auto (default)")), tr("Choose render method automatically"), Qt::ToolTipRole); +#ifdef Q_WS_X11 + videomodeCombo->addItem(tr("X11"), QLatin1String("X11")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("X11")), tr("Use X11 Overlays"), Qt::ToolTipRole); +#endif +#ifndef QT_NO_OPENGL + videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if avaiable"), Qt::ToolTipRole); +#endif + videomodeCombo->addItem(tr("Software"), QLatin1String("Software")); + videomodeCombo->setItemData(videomodeCombo->findText(tr("Software")), tr("Use simple software rendering"), Qt::ToolTipRole); + + QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); + QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); + audiosinkCombo->setCurrentItem(audiosinkCombo->findData(audioSink)); + videomodeCombo->setCurrentItem(videomodeCombo->findData(videoMode)); + + settings.endGroup(); // Qt + + helpview->setText(tr(appearance_text)); + + setModified(false); + updateStyleLayout(); +} + + +MainWindow::~MainWindow() +{ +} + +#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(familycombo->currentText(), + stylecombo->currentText(), + psizecombo->currentText().toInt()); + + QStringList actcg, inactcg, discg; + bool overrideDesktopSettings = (gstylecombo->currentText() != desktopThemeName); + if (overrideDesktopSettings) { + int i; + for (i = 0; i < QColorGroup::NColorRoles; i++) + actcg << editPalette.color(QPalette::Active, + (QColorGroup::ColorRole) i).name(); + for (i = 0; i < QColorGroup::NColorRoles; i++) + inactcg << editPalette.color(QPalette::Inactive, + (QColorGroup::ColorRole) i).name(); + for (i = 0; i < QColorGroup::NColorRoles; i++) + discg << editPalette.color(QPalette::Disabled, + (QColorGroup::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"), fontembeddingcheckbox->isChecked()); + settings.setValue(QLatin1String("style"), overrideDesktopSettings ? gstylecombo->currentText() : QString()); + + settings.setValue(QLatin1String("doubleClickInterval"), dcispin->value()); + settings.setValue(QLatin1String("cursorFlashTime"), cfispin->value() == 9 ? 0 : cfispin->value() ); + settings.setValue(QLatin1String("wheelScrollLines"), wslspin->value()); + settings.setValue(QLatin1String("resolveSymlinks"), resolvelinks->isChecked()); + + QSize strut(strutwidth->value(), strutheight->value()); + settings.setValue(QLatin1String("globalStrut/width"), strut.width()); + settings.setValue(QLatin1String("globalStrut/height"), strut.height()); + + settings.setValue(QLatin1String("useRtlExtensions"), rtlExtensions->isChecked()); + +#ifdef Q_WS_X11 + QString style = inputStyle->currentText(); + QString str = QLatin1String("On The Spot"); + if ( style == trUtf8( "Over The Spot" ) ) + str = QLatin1String("Over The Spot"); + else if ( style == trUtf8( "Off The Spot" ) ) + str = QLatin1String("Off The Spot"); + else if ( style == trUtf8( "Root" ) ) + str = QLatin1String("Root"); + settings.setValue( QLatin1String("XIMInputStyle"), str ); +#endif +#if defined(Q_WS_X11) && !defined(QT_NO_XIM) + settings.setValue(QLatin1String("DefaultInputMethod"), inputMethod->currentText()); +#endif + + QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString(); + QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString(); + settings.setValue(QLatin1String("audiosink"), audiosinkCombo->itemData(audiosinkCombo->currentIndex())); + settings.setValue(QLatin1String("videomode"), videomodeCombo->itemData(videomodeCombo->currentIndex())); + + QStringList effects; + if (effectcheckbox->isChecked()) { + effects << QLatin1String("general"); + + switch (menueffect->currentItem()) { + case 1: effects << QLatin1String("animatemenu"); break; + case 2: effects << QLatin1String("fademenu"); break; + } + + switch (comboeffect->currentItem()) { + case 1: effects << QLatin1String("animatecombo"); break; + } + + switch (tooltipeffect->currentItem()) { + case 1: effects << QLatin1String("animatetooltip"); break; + case 2: effects << QLatin1String("fadetooltip"); break; + } + + switch ( toolboxeffect->currentItem() ) { + 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(QLatin1String("Saved changes.")); +} + + +void MainWindow::fileExit() +{ + qApp->closeAllWindows(); +} + + +void MainWindow::setModified(bool m) +{ + if (modified == m) + return; + + modified = m; + fileSaveAction->setEnabled(m); +} + + +void MainWindow::buildPalette() +{ + int i; + QColorGroup cg; + QColor btn = buttonMainColor->color(); + QColor back = buttonMainColor2->color(); + QPalette automake( btn, back ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) ); + + editPalette.setActive( cg ); + buildActiveEffect(); + + cg = editPalette.inactive(); + + QPalette temp( editPalette.active().color( QColorGroup::Button ), + editPalette.active().color( QColorGroup::Window ) ); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) ); + + editPalette.setInactive( cg ); + buildInactiveEffect(); + + cg = editPalette.disabled(); + + for (i = 0; i<9; i++) + cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) ); + + editPalette.setDisabled( cg ); + buildDisabledEffect(); + + updateColorButtons(); + + setModified(true); +} + + +void MainWindow::buildActiveEffect() +{ + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); + + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateColorButtons(); +} + + +void MainWindow::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + buildInactiveEffect(); +} + + +void MainWindow::buildInactiveEffect() +{ + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + + +void MainWindow::buildDisabled() +{ + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); + cg.setColor( QColorGroup::WindowText, Qt::darkGray ); + cg.setColor( QColorGroup::Text, Qt::darkGray ); + cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); +} + + +void MainWindow::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + + +void MainWindow::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (paletteCombo->currentItem()) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; + } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); + + previewFrame->setPreviewPalette(previewPalette); +} + + +void MainWindow::updateColorButtons() +{ + buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button )); + buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Window )); +} + + +void MainWindow::tunePalette() +{ + bool ok; + QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette, + backgroundMode(), this); + if (! ok) + return; + + editPalette = pal; + setPreviewPalette(editPalette); + setModified(true); +} + + +void MainWindow::paletteSelected(int) +{ + setPreviewPalette(editPalette); +} + +void MainWindow::updateStyleLayout() +{ + QString currentStyle = gstylecombo->currentText(); + bool autoStyle = (currentStyle == desktopThemeName); + previewFrame->setPreviewVisible(!autoStyle); + groupAutoPalette->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(previewFrame, style); + delete previewstyle; + previewstyle = style; + setModified(true); + } + updateStyleLayout(); +} + + +void MainWindow::familySelected(const QString &family) +{ + QFontDatabase db; + QStringList styles = db.styles(family); + stylecombo->clear(); + stylecombo->insertStringList(styles); + familysubcombo->insertItem(family); + buildFont(); +} + + +void MainWindow::buildFont() +{ + QFontDatabase db; + QFont font = db.font(familycombo->currentText(), + stylecombo->currentText(), + psizecombo->currentText().toInt()); + samplelineedit->setFont(font); + setModified(true); +} + + +void MainWindow::substituteSelected(const QString &family) +{ + QStringList subs = QFont::substitutes(family); + sublistbox->clear(); + sublistbox->insertStringList(subs); +} + + +void MainWindow::removeSubstitute() +{ + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) > sublistbox->count()) + return; + + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + subs.remove(subs.at(sublistbox->currentItem())); + sublistbox->clear(); + sublistbox->insertStringList(subs); + if (uint(item) > sublistbox->count()) + item = int(sublistbox->count()) - 1; + sublistbox->setCurrentItem(item); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); + setModified(true); +} + + +void MainWindow::addSubstitute() +{ + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) > sublistbox->count()) { + QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + setModified(true); + return; + } + + int item = sublistbox->currentItem(); + QFont::insertSubstitution(familysubcombo->currentText(), choosesubcombo->currentText()); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item); + setModified(true); +} + + +void MainWindow::downSubstitute() +{ + if (sublistbox->currentItem() < 0 || + uint(sublistbox->currentItem()) >= sublistbox->count()) + return; + + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + QString fam = subs.at(item); + subs.removeAt(item); + subs.insert(item+1, fam); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item + 1); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); + setModified(true); +} + + +void MainWindow::upSubstitute() +{ + if (sublistbox->currentItem() < 1) + return; + + int item = sublistbox->currentItem(); + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + QString fam = subs.at(item); + subs.removeAt(item); + subs.insert(item-1, fam); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item - 1); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); + setModified(true); +} + + +void MainWindow::removeFontpath() +{ + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) + return; + + int item = fontpathlistbox->currentItem(); + fontpaths.remove(fontpaths.at(fontpathlistbox->currentItem())); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + if (uint(item) > fontpathlistbox->count()) + item = int(fontpathlistbox->count()) - 1; + fontpathlistbox->setCurrentItem(item); + setModified(true); +} + + +void MainWindow::addFontpath() +{ + if (fontpathlineedit->text().isEmpty()) + return; + + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) { + fontpaths.append(fontpathlineedit->text()); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + setModified(true); + + return; + } + + int item = fontpathlistbox->currentItem(); + fontpaths.insert(fontpathlistbox->currentItem()+1, + fontpathlineedit->text()); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item); + setModified(true); +} + + +void MainWindow::downFontpath() +{ + if (fontpathlistbox->currentItem() < 0 || + uint(fontpathlistbox->currentItem()) >= fontpathlistbox->count() - 1) + return; + + int item = fontpathlistbox->currentItem(); + QString fam = fontpaths.at(item); + fontpaths.removeAt(item); + fontpaths.insert(item+1, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item + 1); + setModified(true); +} + + +void MainWindow::upFontpath() +{ + if (fontpathlistbox->currentItem() < 1) + return; + + int item = fontpathlistbox->currentItem(); + QString fam = fontpaths.at(item); + fontpaths.removeAt(item); + fontpaths.insert(item-1, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item - 1); + setModified(true); +} + + +void MainWindow::browseFontpath() +{ + QString dirname = QFileDialog::getExistingDirectory(QString(), this, 0, + tr("Select a Directory")); + if (dirname.isNull()) + return; + + fontpathlineedit->setText(dirname); +} + + +void MainWindow::somethingModified() +{ + setModified(true); +} + + +void MainWindow::helpAbout() +{ + QMessageBox box(this); + box.setText(tr("<h3>%1</h3>" + "<br/>Version %2" +#if QT_EDITION == QT_EDITION_OPENSOURCE + " Open Source Edition</center><p>" + "This version of Qt Configuration is part of the Qt Open Source Edition, for use " + "in the development of Open Source applications. " + "Qt is a comprehensive C++ framework for cross-platform application " + "development.<br/><br/>" + "You need a commercial Qt license for development of proprietary (closed " + "source) applications. Please see <tt>http://qtsoftware.com/company/model" + ".html</tt> for an overview of Qt licensing." +#else + "</center><p>This program is licensed to you under the terms of the " + "Qt Commercial License Agreement. For details, see the file LICENSE " + "that came with this software distribution." +#endif + "<br/><br/>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." + "<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND," + " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" + " PARTICULAR PURPOSE.<br/> ") + .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(QWidget *page) +{ + if (page == tab) + helpview->setText(tr(interface_text)); + else if (page == tab1) + helpview->setText(tr(appearance_text)); + else if (page == tab2) + helpview->setText(tr(font_text)); + else if (page == tab3) + helpview->setText(tr(printer_text)); + else if (page == tab4) + helpview->setText(tr(phonon_text)); +} + + +void MainWindow::closeEvent(QCloseEvent *e) +{ + if (modified) { + switch(QMessageBox::warning(this, tr("Save Changes"), + tr("Save changes to settings?"), + tr("&Yes"), tr("&No"), tr("&Cancel"), 0, 2)) { + case 0: // save + qApp->processEvents(); + fileSave(); + + // fall through intended + case 1: // don't save + e->accept(); + break; + + case 2: // cancel + e->ignore(); + break; + + default: break; + } + } else + e->accept(); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/mainwindow.h b/tools/qtconfig/mainwindow.h new file mode 100644 index 0000000..ac16232 --- /dev/null +++ b/tools/qtconfig/mainwindow.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "mainwindowbase.h" + +QT_BEGIN_NAMESPACE + +class MainWindow : public MainWindowBase +{ + 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(QWidget *); + + +private: + void buildActive(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); + + void updateColorButtons(); + void updateFontSample(); + void updateStyleLayout(); + + void setPreviewPalette(const QPalette &); + + void setModified(bool); + + QString desktopThemeName; + QPalette editPalette, previewPalette; + QStyle *previewstyle; + QStringList fontpaths; + bool modified; +}; + +QT_END_NAMESPACE + +#endif // MAINWINDOW_H diff --git a/tools/qtconfig/mainwindowbase.cpp b/tools/qtconfig/mainwindowbase.cpp new file mode 100644 index 0000000..9f90479 --- /dev/null +++ b/tools/qtconfig/mainwindowbase.cpp @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindowbase.h" +#include "colorbutton.h" +#include "previewframe.h" + +#include <QVariant> +#include <QImage> +#include <QPixmap> + +QT_BEGIN_NAMESPACE + +/* + * Constructs a MainWindowBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + */ +MainWindowBase::MainWindowBase(QWidget* parent, const char* name, Qt::WindowFlags fl) + : Q3MainWindow(parent, name, fl) +{ + setupUi(this); + + (void)statusBar(); + + // signals and slots connections + connect(fontpathlineedit, SIGNAL(returnPressed()), this, SLOT(addFontpath())); + connect(PushButton15, SIGNAL(clicked()), this, SLOT(addFontpath())); + connect(PushButton1, SIGNAL(clicked()), this, SLOT(addSubstitute())); + connect(PushButton14, SIGNAL(clicked()), this, SLOT(browseFontpath())); + connect(stylecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); + connect(psizecombo, SIGNAL(activated(int)), this, SLOT(buildFont())); + connect(PushButton12, SIGNAL(clicked()), this, SLOT(downFontpath())); + connect(PushButton3, SIGNAL(clicked()), this, SLOT(downSubstitute())); + connect(familycombo, SIGNAL(activated(QString)), this, SLOT(familySelected(QString))); + connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); + connect(fileSaveAction, SIGNAL(activated()), this, SLOT(fileSave())); + connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); + connect(helpAboutQtAction, SIGNAL(activated()), this, SLOT(helpAboutQt())); + connect(TabWidget3, SIGNAL(currentChanged(QWidget*)), this, SLOT(pageChanged(QWidget*))); + connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); + connect(PushButton13, SIGNAL(clicked()), this, SLOT(removeFontpath())); + connect(PushButton4, SIGNAL(clicked()), this, SLOT(removeSubstitute())); + connect(effectcheckbox, SIGNAL(toggled(bool)), effectbase, SLOT(setEnabled(bool))); + connect(fontembeddingcheckbox, SIGNAL(toggled(bool)), GroupBox10, SLOT(setEnabled(bool))); + connect(toolboxeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(dcispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(cfispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(wslspin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(menueffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(comboeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(audiosinkCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(videomodeCombo, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(tooltipeffect, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(strutwidth, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(strutheight, SIGNAL(valueChanged(int)), this, SLOT(somethingModified())); + connect(effectcheckbox, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(resolvelinks, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(fontembeddingcheckbox, SIGNAL(clicked()), this, SLOT(somethingModified())); + connect(rtlExtensions, SIGNAL(toggled(bool)), this, SLOT(somethingModified())); + connect(inputStyle, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(inputMethod, SIGNAL(activated(int)), this, SLOT(somethingModified())); + connect(gstylecombo, SIGNAL(activated(QString)), this, SLOT(styleSelected(QString))); + connect(familysubcombo, SIGNAL(activated(QString)), this, SLOT(substituteSelected(QString))); + connect(btnAdvanced, SIGNAL(clicked()), this, SLOT(tunePalette())); + connect(PushButton11, SIGNAL(clicked()), this, SLOT(upFontpath())); + connect(PushButton2, SIGNAL(clicked()), this, SLOT(upSubstitute())); + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +MainWindowBase::~MainWindowBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void MainWindowBase::languageChange() +{ + retranslateUi(this); +} + +void MainWindowBase::init() +{ +} + +void MainWindowBase::destroy() +{ +} + +void MainWindowBase::addFontpath() +{ + qWarning("MainWindowBase::addFontpath(): Not implemented yet"); +} + +void MainWindowBase::addSubstitute() +{ + qWarning("MainWindowBase::addSubstitute(): Not implemented yet"); +} + +void MainWindowBase::browseFontpath() +{ + qWarning("MainWindowBase::browseFontpath(): Not implemented yet"); +} + +void MainWindowBase::buildFont() +{ + qWarning("MainWindowBase::buildFont(): Not implemented yet"); +} + +void MainWindowBase::buildPalette() +{ + qWarning("MainWindowBase::buildPalette(): Not implemented yet"); +} + +void MainWindowBase::downFontpath() +{ + qWarning("MainWindowBase::downFontpath(): Not implemented yet"); +} + +void MainWindowBase::downSubstitute() +{ + qWarning("MainWindowBase::downSubstitute(): Not implemented yet"); +} + +void MainWindowBase::familySelected( const QString &) +{ + qWarning("MainWindowBase::familySelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::fileExit() +{ + qWarning("MainWindowBase::fileExit(): Not implemented yet"); +} + +void MainWindowBase::fileSave() +{ + qWarning("MainWindowBase::fileSave(): Not implemented yet"); +} + +void MainWindowBase::helpAbout() +{ + qWarning("MainWindowBase::helpAbout(): Not implemented yet"); +} + +void MainWindowBase::helpAboutQt() +{ + qWarning("MainWindowBase::helpAboutQt(): Not implemented yet"); +} + +void MainWindowBase::new_slot() +{ + qWarning("MainWindowBase::new_slot(): Not implemented yet"); +} + +void MainWindowBase::pageChanged( QWidget *) +{ + qWarning("MainWindowBase::pageChanged( QWidget *): Not implemented yet"); +} + +void MainWindowBase::paletteSelected(int) +{ + qWarning("MainWindowBase::paletteSelected(int): Not implemented yet"); +} + +void MainWindowBase::removeFontpath() +{ + qWarning("MainWindowBase::removeFontpath(): Not implemented yet"); +} + +void MainWindowBase::removeSubstitute() +{ + qWarning("MainWindowBase::removeSubstitute(): Not implemented yet"); +} + +void MainWindowBase::somethingModified() +{ + qWarning("MainWindowBase::somethingModified(): Not implemented yet"); +} + +void MainWindowBase::styleSelected( const QString &) +{ + qWarning("MainWindowBase::styleSelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::substituteSelected( const QString &) +{ + qWarning("MainWindowBase::substituteSelected( const QString &): Not implemented yet"); +} + +void MainWindowBase::tunePalette() +{ + qWarning("MainWindowBase::tunePalette(): Not implemented yet"); +} + +void MainWindowBase::upFontpath() +{ + qWarning("MainWindowBase::upFontpath(): Not implemented yet"); +} + +void MainWindowBase::upSubstitute() +{ + qWarning("MainWindowBase::upSubstitute(): Not implemented yet"); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/mainwindowbase.h b/tools/qtconfig/mainwindowbase.h new file mode 100644 index 0000000..f54b433 --- /dev/null +++ b/tools/qtconfig/mainwindowbase.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOWBASE_H +#define MAINWINDOWBASE_H + +#include "ui_mainwindowbase.h" +#include <QVariant> + +QT_BEGIN_NAMESPACE + +class ColorButton; +class PreviewFrame; + +class MainWindowBase : public Q3MainWindow, public Ui::MainWindowBase +{ + Q_OBJECT + +public: + MainWindowBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::Window); + ~MainWindowBase(); + +public slots: + virtual void addFontpath(); + virtual void addSubstitute(); + virtual void browseFontpath(); + virtual void buildFont(); + virtual void buildPalette(); + virtual void downFontpath(); + virtual void downSubstitute(); + virtual void familySelected( const QString & ); + virtual void fileExit(); + virtual void fileSave(); + virtual void helpAbout(); + virtual void helpAboutQt(); + virtual void new_slot(); + virtual void pageChanged( QWidget * ); + virtual void paletteSelected( int ); + virtual void removeFontpath(); + virtual void removeSubstitute(); + virtual void somethingModified(); + virtual void styleSelected( const QString & ); + virtual void substituteSelected( const QString & ); + virtual void tunePalette(); + virtual void upFontpath(); + virtual void upSubstitute(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); +}; + +QT_END_NAMESPACE + +#endif // MAINWINDOWBASE_H diff --git a/tools/qtconfig/mainwindowbase.ui b/tools/qtconfig/mainwindowbase.ui new file mode 100644 index 0000000..747ca28 --- /dev/null +++ b/tools/qtconfig/mainwindowbase.ui @@ -0,0 +1,1384 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <class>MainWindowBase</class> + <widget class="Q3MainWindow" name="MainWindowBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>716</height> + </rect> + </property> + <property name="windowTitle"> + <string>Qt Configuration</string> + </property> + <widget class="QWidget" name="widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>26</y> + <width>815</width> + <height>690</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>8</number> + </property> + <item row="0" column="0"> + <widget class="QTextEdit" name="helpview"> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QTabWidget" name="TabWidget3"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab1"> + <attribute name="title"> + <string>Appearance</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QGroupBox" name="GroupBox40"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>GUI Style</string> + </property> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QLabel" name="gstylebuddy"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Select GUI &Style:</string> + </property> + <property name="buddy"> + <cstring>gstylecombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="gstylecombo"/> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="groupPreview"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel1"> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="paletteCombo"> + <item> + <property name="text"> + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text"> + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="PreviewFrame" name="previewFrame" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>410</width> + <height>260</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupAutoPalette"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Build Palette</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QWidget" name="colorConfig" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="labelMainColor"> + <property name="text"> + <string>&3-D Effects:</string> + </property> + <property name="buddy"> + <cstring>buttonMainColor</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonMainColor" native="true"/> + </item> + <item> + <widget class="QLabel" name="labelMainColor2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="text"> + <string>Window Back&ground:</string> + </property> + <property name="alignment"> + <set>Qt::AlignVCenter</set> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="buddy"> + <cstring>buttonMainColor2</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonMainColor2" native="true"/> + </item> + <item> + <spacer name="spacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="btnAdvanced"> + <property name="text"> + <string>&Tune Palette...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="labelKDENote"> + <property name="text"> + <string>Please use the KDE Control Center to set the palette.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab2"> + <attribute name="title"> + <string>Fonts</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="GroupBox1"> + <property name="title"> + <string>Default Font</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="1"> + <widget class="QComboBox" name="stylecombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="familycombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="psizecombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="stylebuddy"> + <property name="text"> + <string>&Style:</string> + </property> + <property name="buddy"> + <cstring>stylecombo</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="psizebuddy"> + <property name="text"> + <string>&Point Size:</string> + </property> + <property name="buddy"> + <cstring>psizecombo</cstring> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="familybuddy"> + <property name="text"> + <string>F&amily:</string> + </property> + <property name="buddy"> + <cstring>familycombo</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QLineEdit" name="samplelineedit"> + <property name="text"> + <string>Sample Text</string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox2"> + <property name="title"> + <string>Font Substitution</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="famsubbuddy"> + <property name="text"> + <string>S&elect or Enter a Family:</string> + </property> + <property name="buddy"> + <cstring>familysubcombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="familysubcombo"> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line1"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="TextLabel5"> + <property name="text"> + <string>Current Substitutions:</string> + </property> + </widget> + </item> + <item> + <widget class="Q3ListBox" name="sublistbox"/> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="PushButton2"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="PushButton3"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="PushButton4"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Line" name="Line2"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="choosebuddy"> + <property name="text"> + <string>Select s&ubstitute Family:</string> + </property> + <property name="buddy"> + <cstring>choosesubcombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="choosesubcombo"> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="PushButton1"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Interface</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QGroupBox" name="GroupBox4"> + <property name="title"> + <string>Feel Settings</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="1"> + <widget class="QSpinBox" name="dcispin"> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>10</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="dcibuddy"> + <property name="text"> + <string>&Double Click Interval:</string> + </property> + <property name="buddy"> + <cstring>dcispin</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="cfispin"> + <property name="specialValueText"> + <string>No blinking</string> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="minimum"> + <number>9</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="cfibuddy"> + <property name="text"> + <string>&Cursor Flash Time:</string> + </property> + <property name="buddy"> + <cstring>cfispin</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="wslspin"> + <property name="suffix"> + <string> lines</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="wslbuddy"> + <property name="text"> + <string>Wheel &Scroll Lines:</string> + </property> + <property name="buddy"> + <cstring>wslspin</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="resolvelinks"> + <property name="text"> + <string>Resolve symlinks in URLs</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox3"> + <property name="title"> + <string>GUI Effects</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <widget class="QCheckBox" name="effectcheckbox"> + <property name="text"> + <string>&Enable</string> + </property> + <property name="shortcut"> + <string>Alt+E</string> + </property> + </widget> + </item> + <item> + <widget class="Q3Frame" name="effectbase"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="meffectbuddy"> + <property name="text"> + <string>&Menu Effect:</string> + </property> + <property name="buddy"> + <cstring>menueffect</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="ceffectbuddy"> + <property name="text"> + <string>C&omboBox Effect:</string> + </property> + <property name="buddy"> + <cstring>comboeffect</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="teffectbuddy"> + <property name="text"> + <string>&ToolTip Effect:</string> + </property> + <property name="buddy"> + <cstring>tooltipeffect</cstring> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="beffectbuddy"> + <property name="text"> + <string>Tool&Box Effect:</string> + </property> + <property name="buddy"> + <cstring>toolboxeffect</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="menueffect"> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="comboeffect"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="tooltipeffect"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="toolboxeffect"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox5"> + <property name="title"> + <string>Global Strut</string> + </property> + <layout class="QGridLayout"> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="swbuddy"> + <property name="text"> + <string>Minimum &Width:</string> + </property> + <property name="buddy"> + <cstring>strutwidth</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="shbuddy"> + <property name="text"> + <string>Minimum Hei&ght:</string> + </property> + <property name="buddy"> + <cstring>strutheight</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="strutwidth"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="strutheight"> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QCheckBox" name="rtlExtensions"> + <property name="text"> + <string>Enhanced support for languages written right-to-left</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="inputStyleLabel"> + <property name="text"> + <string>XIM Input Style:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputStyle"> + <property name="currentIndex"> + <number>0</number> + </property> + <item> + <property name="text"> + <string>On The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Over The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Off The Spot</string> + </property> + </item> + <item> + <property name="text"> + <string>Root</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QLabel" name="inputMethodLabel"> + <property name="text"> + <string>Default Input Method:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="inputMethod"> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab3"> + <attribute name="title"> + <string>Printer</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QCheckBox" name="fontembeddingcheckbox"> + <property name="text"> + <string>Enable Font embedding</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="GroupBox10"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Font Paths</string> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>4</number> + </property> + <property name="margin"> + <number>8</number> + </property> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="1" column="0"> + <widget class="QPushButton" name="PushButton11"> + <property name="text"> + <string>Up</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="PushButton13"> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="PushButton12"> + <property name="text"> + <string>Down</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="Q3ListBox" name="fontpathlistbox"/> + </item> + </layout> + </item> + <item> + <layout class="QGridLayout"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <item row="2" column="0"> + <spacer> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="PushButton15"> + <property name="text"> + <string>Add</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="PushButton14"> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="TextLabel15_2"> + <property name="text"> + <string>Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list.</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QLineEdit" name="fontpathlineedit"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab4"> + <attribute name="title"> + <string>Phonon</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>About Phonon</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="phononVersionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="gstversionLabel_3"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>About GStreamer</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Current Version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="gstversionLabel"> + <property name="text"> + <string>Not available</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Website:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="gstversionLabel_2"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>GStreamer backend settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Preferred audio sink:</string> + </property> + <property name="buddy"> + <cstring>audiosinkCombo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="audiosinkCombo"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Preferred render method:</string> + </property> + <property name="buddy"> + <cstring>videomodeCombo</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="videomodeCombo"/> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>2</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QLabel" name="phononLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>815</width> + <height>26</height> + </rect> + </property> + <widget class="QMenu" name="PopupMenu"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>123</width> + <height>92</height> + </rect> + </property> + <property name="title"> + <string>&File</string> + </property> + <action name=""/> + <action name=""/> + <action name=""/> + <addaction name="fileSaveAction"/> + <addaction name="separator"/> + <addaction name="fileExitAction"/> + </widget> + <widget class="QMenu" name="PopupMenu_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>123</width> + <height>90</height> + </rect> + </property> + <property name="title"> + <string>&Help</string> + </property> + <addaction name="helpAboutAction"/> + <addaction name="helpAboutQtAction"/> + </widget> + <action name=""/> + <action name=""/> + <action name=""/> + <addaction name="PopupMenu"/> + <addaction name="separator"/> + <addaction name="PopupMenu_2"/> + </widget> + <action name="fileSaveAction"> + <property name="text"> + <string>&Save</string> + </property> + <property name="iconText"> + <string>Save</string> + </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> + <action name="fileExitAction"> + <property name="text"> + <string>E&xit</string> + </property> + <property name="iconText"> + <string>Exit</string> + </property> + <property name="shortcut"> + <string/> + </property> + </action> + <action name="helpAboutAction"> + <property name="text"> + <string>&About</string> + </property> + <property name="iconText"> + <string>About</string> + </property> + <property name="shortcut"> + <string/> + </property> + </action> + <action name="helpAboutQtAction"> + <property name="text"> + <string>About &Qt</string> + </property> + <property name="iconText"> + <string>About Qt</string> + </property> + </action> + </widget> + <customwidgets> + <customwidget> + <class>Q3Frame</class> + <extends>QFrame</extends> + <header>Qt3Support/Q3Frame</header> + <container>1</container> + </customwidget> + <customwidget> + <class>Q3MainWindow</class> + <extends>QWidget</extends> + <header>q3mainwindow.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>Q3ListBox</class> + <extends>Q3Frame</extends> + <header>q3listbox.h</header> + </customwidget> + <customwidget> + <class>ColorButton</class> + <extends></extends> + <header>colorbutton.h</header> + </customwidget> + <customwidget> + <class>PreviewFrame</class> + <extends></extends> + <header>previewframe.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>helpview</tabstop> + <tabstop>familycombo</tabstop> + <tabstop>stylecombo</tabstop> + <tabstop>psizecombo</tabstop> + <tabstop>samplelineedit</tabstop> + <tabstop>familysubcombo</tabstop> + <tabstop>PushButton2</tabstop> + <tabstop>PushButton3</tabstop> + <tabstop>PushButton4</tabstop> + <tabstop>choosesubcombo</tabstop> + <tabstop>PushButton1</tabstop> + <tabstop>dcispin</tabstop> + <tabstop>cfispin</tabstop> + <tabstop>wslspin</tabstop> + <tabstop>effectcheckbox</tabstop> + <tabstop>menueffect</tabstop> + <tabstop>comboeffect</tabstop> + <tabstop>tooltipeffect</tabstop> + <tabstop>strutwidth</tabstop> + <tabstop>strutheight</tabstop> + <tabstop>sublistbox</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp new file mode 100644 index 0000000..d9bafeb --- /dev/null +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -0,0 +1,591 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "paletteeditoradvanced.h" +#include "colorbutton.h" + +#include <QCheckBox> +#include <QComboBox> +#include <QApplication> +#include <QPushButton> +#include <QPainter> +#include <QGroupBox> + +QT_BEGIN_NAMESPACE + +PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent, + const char * name, bool modal, Qt::WindowFlags f ) + : PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0) +{ + // work around buggy ui file + comboEffect->setEnabled(false); + buttonEffect->setEnabled(false); + onToggleBuildEffects(true); + + editPalette = QApplication::palette(); + setPreviewPalette( editPalette ); +} + +PaletteEditorAdvanced::~PaletteEditorAdvanced() +{ +} + +void PaletteEditorAdvanced::onToggleBuildInactive( bool v ) +{ + if (selectedPalette == 1) { + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); + } + + if (v) { + buildInactive(); + updateColorButtons(); + } +} + +void PaletteEditorAdvanced::onToggleBuildDisabled( bool v ) +{ + if (selectedPalette == 2) { + groupCentral->setDisabled(v); + groupEffect->setDisabled(v); + } + + if (v) { + buildDisabled(); + updateColorButtons(); + } +} + +void PaletteEditorAdvanced::paletteSelected(int p) +{ + selectedPalette = p; + + if(p == 1) { // inactive + groupCentral->setDisabled(checkBuildInactive->isChecked()); + groupEffect->setDisabled(checkBuildInactive->isChecked()); + } + else if (p == 2) { // disabled + groupCentral->setDisabled(checkBuildDisabled->isChecked()); + groupEffect->setDisabled(checkBuildDisabled->isChecked()); + } + else { + groupCentral->setEnabled(true); + groupEffect->setEnabled(true); + } + updateColorButtons(); +} + +void PaletteEditorAdvanced::onChooseCentralColor() +{ + switch(selectedPalette) { + case 0: + default: + mapToActiveCentralRole( buttonCentral->color() ); + break; + case 1: + mapToInactiveCentralRole( buttonCentral->color() ); + break; + case 2: + mapToDisabledCentralRole( buttonCentral->color() ); + break; + } + updateColorButtons(); +} + +void PaletteEditorAdvanced::onChooseEffectColor() +{ + switch(selectedPalette) { + case 0: + default: + mapToActiveEffectRole( buttonEffect->color() ); + break; + case 1: + mapToInactiveEffectRole( buttonEffect->color() ); + break; + case 2: + mapToDisabledEffectRole( buttonEffect->color() ); + break; + } + updateColorButtons(); +} + +void PaletteEditorAdvanced::onToggleBuildEffects( bool on ) +{ + if (!on) return; + buildActiveEffect(); + buildInactiveEffect(); + buildDisabledEffect(); +} + +QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item ) +{ + switch( item ) { + case 0: + return QColorGroup::Window; + case 1: + return QColorGroup::WindowText; + case 2: + return QColorGroup::Button; + case 3: + return QColorGroup::Base; + case 4: + return QColorGroup::Text; + case 5: + return QColorGroup::BrightText; + case 6: + return QColorGroup::ButtonText; + case 7: + return QColorGroup::Highlight; + case 8: + return QColorGroup::HighlightedText; + default: + return QColorGroup::NColorRoles; + } +} + +QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item ) +{ + switch( item ) { + case 0: + return QColorGroup::Light; + case 1: + return QColorGroup::Midlight; + case 2: + return QColorGroup::Mid; + case 3: + return QColorGroup::Dark; + case 4: + return QColorGroup::Shadow; + default: + return QColorGroup::NColorRoles; + } +} + +void PaletteEditorAdvanced::onCentral( int item ) +{ + QColor c; + + switch(selectedPalette) { + case 0: + default: + c = editPalette.active().color( centralFromItem(item) ); + break; + case 1: + c = editPalette.inactive().color( centralFromItem(item) ); + break; + case 2: + c = editPalette.disabled().color( centralFromItem(item) ); + break; + } + + buttonCentral->setColor(c); +} + +void PaletteEditorAdvanced::onEffect( int item ) +{ + QColor c; + switch(selectedPalette) { + case 0: + default: + c = editPalette.active().color( effectFromItem(item) ); + break; + case 1: + editPalette.inactive().color( effectFromItem(item) ); + break; + case 2: + editPalette.disabled().color( effectFromItem(item) ); + break; + } + buttonEffect->setColor(c); +} + +void PaletteEditorAdvanced::mapToActiveCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.active(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setActive( cg ); + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToActiveEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.active(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setActive( cg ); + + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.active(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setActive( cg ); + + + buildActiveEffect(); + if(checkBuildInactive->isChecked()) + buildInactive(); + if(checkBuildDisabled->isChecked()) + buildDisabled(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.inactive(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setInactive( cg ); + + buildInactiveEffect(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactiveEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.inactive(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.inactive(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + editPalette.setInactive( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( centralFromItem(comboCentral->currentItem()), c ); + editPalette.setDisabled( cg ); + + buildDisabledEffect(); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledEffectRole( const QColor& c ) +{ + QColorGroup cg = editPalette.disabled(); + cg.setColor( effectFromItem(comboEffect->currentItem()), c ); + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::mapToDisabledPixmapRole( const QPixmap& pm ) +{ + QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem()); + QColorGroup cg = editPalette.disabled(); + if ( !pm.isNull() ) + cg.setBrush( role, QBrush( cg.color( role ), pm ) ); + else + cg.setBrush( role, QBrush( cg.color( role ) ) ); + + editPalette.setDisabled( cg ); + + setPreviewPalette( editPalette ); +} + +void PaletteEditorAdvanced::buildActiveEffect() +{ + QColorGroup cg = editPalette.active(); + QColor btn = cg.color( QColorGroup::Button ); + + QPalette temp( btn, btn ); + + for (int i = 0; i<5; i++) + cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) ); + + editPalette.setActive( cg ); + setPreviewPalette( editPalette ); + + updateColorButtons(); +} + +void PaletteEditorAdvanced::buildInactive() +{ + editPalette.setInactive( editPalette.active() ); + if ( checkBuildEffect->isChecked() ) + buildInactiveEffect(); + else { + setPreviewPalette( editPalette ); + updateColorButtons(); + } + +} + +void PaletteEditorAdvanced::buildInactiveEffect() +{ + QColorGroup cg = editPalette.inactive(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setInactive( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + +void PaletteEditorAdvanced::buildDisabled() +{ + QColorGroup cg = editPalette.active(); + cg.setColor( QColorGroup::ButtonText, Qt::darkGray ); + cg.setColor( QColorGroup::WindowText, Qt::darkGray ); + cg.setColor( QColorGroup::Text, Qt::darkGray ); + cg.setColor( QColorGroup::HighlightedText, Qt::darkGray ); + editPalette.setDisabled( cg ); + + if ( checkBuildEffect->isChecked() ) + buildDisabledEffect(); + else { + setPreviewPalette( editPalette ); + updateColorButtons(); + } +} + +void PaletteEditorAdvanced::buildDisabledEffect() +{ + QColorGroup cg = editPalette.disabled(); + + QColor light, midlight, mid, dark, shadow; + QColor btn = cg.color( QColorGroup::Button ); + + light = btn.light(150); + midlight = btn.light(115); + mid = btn.dark(150); + dark = btn.dark(); + shadow = Qt::black; + + cg.setColor( QColorGroup::Light, light ); + cg.setColor( QColorGroup::Midlight, midlight ); + cg.setColor( QColorGroup::Mid, mid ); + cg.setColor( QColorGroup::Dark, dark ); + cg.setColor( QColorGroup::Shadow, shadow ); + + editPalette.setDisabled( cg ); + setPreviewPalette( editPalette ); + updateColorButtons(); +} + +void PaletteEditorAdvanced::setPreviewPalette( const QPalette& pal ) +{ + QColorGroup cg; + + switch (selectedPalette) { + case 0: + default: + cg = pal.active(); + break; + case 1: + cg = pal.inactive(); + break; + case 2: + cg = pal.disabled(); + break; + } + previewPalette.setActive( cg ); + previewPalette.setInactive( cg ); + previewPalette.setDisabled( cg ); +} + +void PaletteEditorAdvanced::updateColorButtons() +{ + QColor central, effect; + switch (selectedPalette) { + case 0: + default: + central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) ); + break; + case 1: + central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) ); + break; + case 2: + central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) ); + effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) ); + break; + } + + buttonCentral->setColor(central); + buttonEffect->setColor(effect); +} + +void PaletteEditorAdvanced::setPal( const QPalette& pal ) +{ + editPalette = pal; + setPreviewPalette( pal ); + updateColorButtons(); +} + +QPalette PaletteEditorAdvanced::pal() const +{ + return editPalette; +} + +void PaletteEditorAdvanced::setupBackgroundMode( Qt::BackgroundMode mode ) +{ + int initRole = 0; + + switch( mode ) { + case Qt::PaletteBackground: + initRole = 0; + break; + case Qt::PaletteForeground: + initRole = 1; + break; + case Qt::PaletteButton: + initRole = 2; + break; + case Qt::PaletteBase: + initRole = 3; + break; + case Qt::PaletteText: + initRole = 4; + break; + case Qt::PaletteBrightText: + initRole = 5; + break; + case Qt::PaletteButtonText: + initRole = 6; + break; + case Qt::PaletteHighlight: + initRole = 7; + break; + case Qt::PaletteHighlightedText: + initRole = 8; + break; + case Qt::PaletteLight: + initRole = 9; + break; + case Qt::PaletteMidlight: + initRole = 10; + break; + case Qt::PaletteDark: + initRole = 11; + break; + case Qt::PaletteMid: + initRole = 12; + break; + case Qt::PaletteShadow: + initRole = 13; + break; + default: + initRole = -1; + break; + } + + if ( initRole <= -1 ) return; + + if (initRole > 8 ) { + comboEffect->setCurrentItem( initRole - 9 ); + } + else { + comboCentral->setCurrentItem( initRole ); + } +} + +QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init, + Qt::BackgroundMode mode, QWidget* parent, + const char* name ) +{ + PaletteEditorAdvanced* dlg = new PaletteEditorAdvanced( parent, name, true ); + dlg->setupBackgroundMode( mode ); + + if ( init != QPalette() ) + dlg->setPal( init ); + int resultCode = dlg->exec(); + + QPalette result = init; + if ( resultCode == QDialog::Accepted ) { + if ( ok ) + *ok = true; + result = dlg->pal(); + } else { + if ( ok ) + *ok = false; + } + delete dlg; + return result; +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/paletteeditoradvanced.h b/tools/qtconfig/paletteeditoradvanced.h new file mode 100644 index 0000000..7dc80db --- /dev/null +++ b/tools/qtconfig/paletteeditoradvanced.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PALETTEEDITORADVANCED_H +#define PALETTEEDITORADVANCED_H + +#include "paletteeditoradvancedbase.h" + +QT_BEGIN_NAMESPACE + +class PaletteEditorAdvanced : public PaletteEditorAdvancedBase +{ + Q_OBJECT +public: + PaletteEditorAdvanced( QWidget * parent=0, const char * name=0, + bool modal=false, Qt::WindowFlags f=0 ); + ~PaletteEditorAdvanced(); + + static QPalette getPalette( bool *ok, const QPalette &pal, Qt::BackgroundMode mode = Qt::PaletteBackground, + QWidget* parent = 0, const char* name = 0 ); + +protected slots: + void paletteSelected(int); + + void onCentral( int ); + void onEffect( int ); + + void onChooseCentralColor(); + void onChooseEffectColor(); + + void onToggleBuildEffects( bool ); + void onToggleBuildInactive( bool ); + void onToggleBuildDisabled( bool ); + +protected: + void mapToActiveCentralRole( const QColor& ); + void mapToActiveEffectRole( const QColor& ); + void mapToActivePixmapRole( const QPixmap& ); + void mapToInactiveCentralRole( const QColor& ); + void mapToInactiveEffectRole( const QColor& ); + void mapToInactivePixmapRole( const QPixmap& ); + void mapToDisabledCentralRole( const QColor& ); + void mapToDisabledEffectRole( const QColor& ); + void mapToDisabledPixmapRole( const QPixmap& ); + + + void buildPalette(); + void buildActiveEffect(); + void buildInactive(); + void buildInactiveEffect(); + void buildDisabled(); + void buildDisabledEffect(); + +private: + void setPreviewPalette( const QPalette& ); + void updateColorButtons(); + void setupBackgroundMode( Qt::BackgroundMode ); + + QPalette pal() const; + void setPal( const QPalette& ); + + QColorGroup::ColorRole centralFromItem( int ); + QColorGroup::ColorRole effectFromItem( int ); + QPalette editPalette; + QPalette previewPalette; + + int selectedPalette; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qtconfig/paletteeditoradvancedbase.cpp b/tools/qtconfig/paletteeditoradvancedbase.cpp new file mode 100644 index 0000000..4e107a2 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "paletteeditoradvancedbase.h" +#include "colorbutton.h" + +#include <QVariant> + +QT_BEGIN_NAMESPACE + +/* + * Constructs a PaletteEditorAdvancedBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * true to construct a modal dialog. + */ +PaletteEditorAdvancedBase::PaletteEditorAdvancedBase(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) + : QDialog(parent, name, modal, fl) +{ + setupUi(this); + + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int))); + connect(comboCentral, SIGNAL(activated(int)), this, SLOT(onCentral(int))); + connect(buttonCentral, SIGNAL(clicked()), this, SLOT(onChooseCentralColor())); + connect(buttonEffect, SIGNAL(clicked()), this, SLOT(onChooseEffectColor())); + connect(comboEffect, SIGNAL(activated(int)), this, SLOT(onEffect(int))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildEffects(bool))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), comboEffect, SLOT(setDisabled(bool))); + connect(checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool))); + connect(checkBuildInactive, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildInactive(bool))); + connect(checkBuildDisabled, SIGNAL(toggled(bool)), this, SLOT(onToggleBuildDisabled(bool))); + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +PaletteEditorAdvancedBase::~PaletteEditorAdvancedBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void PaletteEditorAdvancedBase::languageChange() +{ + retranslateUi(this); +} + +void PaletteEditorAdvancedBase::init() +{ +} + +void PaletteEditorAdvancedBase::destroy() +{ +} + +void PaletteEditorAdvancedBase::onCentral(int) +{ + qWarning("PaletteEditorAdvancedBase::onCentral(int): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onChooseCentralColor() +{ + qWarning("PaletteEditorAdvancedBase::onChooseCentralColor(): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onChooseEffectColor() +{ + qWarning("PaletteEditorAdvancedBase::onChooseEffectColor(): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onEffect(int) +{ + qWarning("PaletteEditorAdvancedBase::onEffect(int): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildDisabled(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildDisabled(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildEffects(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildEffects(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::onToggleBuildInactive(bool) +{ + qWarning("PaletteEditorAdvancedBase::onToggleBuildInactive(bool): Not implemented yet"); +} + +void PaletteEditorAdvancedBase::paletteSelected(int) +{ + qWarning("PaletteEditorAdvancedBase::paletteSelected(int): Not implemented yet"); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/paletteeditoradvancedbase.h b/tools/qtconfig/paletteeditoradvancedbase.h new file mode 100644 index 0000000..f7920d8 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PALETTEEDITORADVANCEDBASE_H +#define PALETTEEDITORADVANCEDBASE_H + +#include "ui_paletteeditoradvancedbase.h" +#include <QVariant> + +QT_BEGIN_NAMESPACE + +class ColorButton; + +class PaletteEditorAdvancedBase : public QDialog, public Ui::PaletteEditorAdvancedBase +{ + Q_OBJECT + +public: + PaletteEditorAdvancedBase(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + ~PaletteEditorAdvancedBase(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); + virtual void onCentral(int); + virtual void onChooseCentralColor(); + virtual void onChooseEffectColor(); + virtual void onEffect(int); + virtual void onToggleBuildDisabled(bool); + virtual void onToggleBuildEffects(bool); + virtual void onToggleBuildInactive(bool); + virtual void paletteSelected(int); + +}; + +QT_END_NAMESPACE + +#endif // PALETTEEDITORADVANCEDBASE_H diff --git a/tools/qtconfig/paletteeditoradvancedbase.ui b/tools/qtconfig/paletteeditoradvancedbase.ui new file mode 100644 index 0000000..465569e --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.ui @@ -0,0 +1,617 @@ +<ui version="4.0" stdsetdef="1" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>PaletteEditorAdvancedBase</class> + <widget class="QDialog" name="PaletteEditorAdvancedBase" > + <property name="objectName" > + <string notr="true" >PaletteEditorAdvancedBase</string> + </property> + <property name="enabled" > + <bool>true</bool> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>295</width> + <height>346</height> + </rect> + </property> + <property name="windowTitle" > + <string>Tune Palette</string> + </property> + <property name="sizeGripEnabled" > + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0" > + <string><b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p></string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="TextLabel1" > + <property name="objectName" > + <string notr="true" >TextLabel1</string> + </property> + <property name="text" > + <string>Select &Palette:</string> + </property> + <property name="buddy" stdset="0" > + <cstring>paletteCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="paletteCombo" > + <property name="objectName" > + <string notr="true" >paletteCombo</string> + </property> + <item> + <property name="text" > + <string>Active Palette</string> + </property> + </item> + <item> + <property name="text" > + <string>Inactive Palette</string> + </property> + </item> + <item> + <property name="text" > + <string>Disabled Palette</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="Q3ButtonGroup" name="ButtonGroup1" > + <property name="objectName" > + <string notr="true" >ButtonGroup1</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title" > + <string>Auto</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="checkBuildInactive" > + <property name="objectName" > + <string notr="true" >checkBuildInactive</string> + </property> + <property name="text" > + <string>Build inactive palette from active</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBuildDisabled" > + <property name="objectName" > + <string notr="true" >checkBuildDisabled</string> + </property> + <property name="text" > + <string>Build disabled palette from active</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="Q3GroupBox" name="groupCentral" > + <property name="objectName" > + <string notr="true" >groupCentral</string> + </property> + <property name="title" > + <string>Central color &roles</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QComboBox" name="comboCentral" > + <property name="objectName" > + <string notr="true" >comboCentral</string> + </property> + <property name="toolTip" stdset="0" > + <string>Choose central color role</string> + </property> + <property name="whatsThis" stdset="0" > + <string><b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p></string> + </property> + <item> + <property name="text" > + <string>Window</string> + </property> + </item> + <item> + <property name="text" > + <string>WindowText</string> + </property> + </item> + <item> + <property name="text" > + <string>Button</string> + </property> + </item> + <item> + <property name="text" > + <string>Base</string> + </property> + </item> + <item> + <property name="text" > + <string>Text</string> + </property> + </item> + <item> + <property name="text" > + <string>BrightText</string> + </property> + </item> + <item> + <property name="text" > + <string>ButtonText</string> + </property> + </item> + <item> + <property name="text" > + <string>Highlight</string> + </property> + </item> + <item> + <property name="text" > + <string>HighlightedText</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer name="Horizontal_Spacing1" > + <property name="sizeHint" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="sizeType" > + <enum>Expanding</enum> + </property> + <property name="orientation" > + <enum>Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelCentral" > + <property name="objectName" > + <string notr="true" >labelCentral</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text" > + <string>&Select Color:</string> + </property> + <property name="buddy" stdset="0" > + <cstring>buttonCentral</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonCentral" > + <property name="objectName" > + <string notr="true" >buttonCentral</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy" > + <enum>Qt::TabFocus</enum> + </property> + <property name="toolTip" stdset="0" > + <string>Choose a color</string> + </property> + <property name="whatsThis" stdset="0" > + <string>Choose a color for the selected central color role.</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="Q3GroupBox" name="groupEffect" > + <property name="objectName" > + <string notr="true" >groupEffect</string> + </property> + <property name="title" > + <string>3-D shadow &effects</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="checkBuildEffect" > + <property name="objectName" > + <string notr="true" >checkBuildEffect</string> + </property> + <property name="text" > + <string>Build &from button color</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="toolTip" stdset="0" > + <string>Generate shadings</string> + </property> + <property name="whatsThis" stdset="0" > + <string>Check to let 3D-effect colors be calculated from button-color.</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboEffect" > + <property name="objectName" > + <string notr="true" >comboEffect</string> + </property> + <property name="toolTip" stdset="0" > + <string>Choose 3D-effect color role</string> + </property> + <property name="whatsThis" stdset="0" > + <string><b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul></string> + </property> + <item> + <property name="text" > + <string>Light</string> + </property> + </item> + <item> + <property name="text" > + <string>Midlight</string> + </property> + </item> + <item> + <property name="text" > + <string>Mid</string> + </property> + </item> + <item> + <property name="text" > + <string>Dark</string> + </property> + </item> + <item> + <property name="text" > + <string>Shadow</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer name="Horizontal_Spacing3" > + <property name="sizeHint" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="sizeType" > + <enum>Expanding</enum> + </property> + <property name="orientation" > + <enum>Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelEffect" > + <property name="objectName" > + <string notr="true" >labelEffect</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text" > + <string>Select Co&lor:</string> + </property> + <property name="buddy" stdset="0" > + <cstring>buttonEffect</cstring> + </property> + </widget> + </item> + <item> + <widget class="ColorButton" name="buttonEffect" > + <property name="objectName" > + <string notr="true" >buttonEffect</string> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy" > + <enum>Qt::TabFocus</enum> + </property> + <property name="toolTip" stdset="0" > + <string>Choose a color</string> + </property> + <property name="whatsThis" stdset="0" > + <string>Choose a color for the selected effect color role.</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer name="Horizontal_Spacing2" > + <property name="sizeHint" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="sizeType" > + <enum>Expanding</enum> + </property> + <property name="orientation" > + <enum>Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="buttonOk" > + <property name="objectName" > + <string notr="true" >buttonOk</string> + </property> + <property name="text" > + <string>OK</string> + </property> + <property name="autoDefault" > + <bool>true</bool> + </property> + <property name="default" > + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0" > + <string>Close dialog and apply all changes.</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonCancel" > + <property name="objectName" > + <string notr="true" >buttonCancel</string> + </property> + <property name="text" > + <string>Cancel</string> + </property> + <property name="autoDefault" > + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0" > + <string>Close dialog and discard all changes.</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <customwidgets> + <customwidget> + <class>ColorButton</class> + <extends></extends> + <header location="local" >colorbutton.h</header> + <sizehint> + <width>40</width> + <height>25</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + </sizepolicy> + <pixmap>image0</pixmap> + <properties> + <property type="Color" >color</property> + <property type="Pixmap" >pixmap</property> + </properties> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> + <tabstop>paletteCombo</tabstop> + <tabstop>checkBuildInactive</tabstop> + <tabstop>checkBuildDisabled</tabstop> + <tabstop>comboCentral</tabstop> + <tabstop>buttonCentral</tabstop> + <tabstop>checkBuildEffect</tabstop> + <tabstop>comboEffect</tabstop> + <tabstop>buttonEffect</tabstop> + </tabstops> + <images> + <image name="image0" > + <data format="XPM.GZ" length="646" >789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> + </images> +</ui> diff --git a/tools/qtconfig/previewframe.cpp b/tools/qtconfig/previewframe.cpp new file mode 100644 index 0000000..5be5b1c --- /dev/null +++ b/tools/qtconfig/previewframe.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewframe.h" + +#include <QBoxLayout> +#include <QPainter> +#include <QMdiSubWindow> + +QT_BEGIN_NAMESPACE + +PreviewFrame::PreviewFrame( QWidget *parent, const char *name ) + : QFrame( parent, name ) +{ + 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, const char* name) + : QMdiArea(parent) +{ + previewFrame = parent; + PreviewWidget *previewWidget = previewFrame->widget(); + setObjectName(QLatin1String(name)); + QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window); + frame->move(10,10); + frame->show(); +} + +void Workspace::paintEvent( QPaintEvent* ) +{ + QPainter p (viewport()); + p.fillRect(rect(), palette().color(backgroundRole()).dark()); + p.setPen( QPen( Qt::white ) ); + p.drawText ( 0, height() / 2, width(), height(), Qt::AlignHCenter, previewFrame->previewText()); +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/previewframe.h b/tools/qtconfig/previewframe.h new file mode 100644 index 0000000..ce98ffe --- /dev/null +++ b/tools/qtconfig/previewframe.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWFRAME_H +#define PREVIEWFRAME_H + +#include "previewwidget.h" + +#include <QMdiArea> + +QT_BEGIN_NAMESPACE + +class PreviewFrame; +class Workspace : public QMdiArea +{ + Q_OBJECT + +public: + Workspace( PreviewFrame* parent = 0, const char* name = 0 ); + ~Workspace() {} + +protected: + void paintEvent( QPaintEvent* ); +private: + PreviewFrame *previewFrame; +}; + +class PreviewFrame : public QFrame +{ + Q_OBJECT + +public: + PreviewFrame( QWidget *parent = 0, const char *name = 0 ); + void setPreviewPalette(QPalette); + void setPreviewVisible(bool val); + QString previewText() const; + PreviewWidget *widget() const { return previewWidget; } +private: + Workspace *workspace; + PreviewWidget *previewWidget; + QString m_previewWindowText; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp new file mode 100644 index 0000000..00b1738 --- /dev/null +++ b/tools/qtconfig/previewwidget.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewwidget.h" +#include <QtEvents> + +QT_BEGIN_NAMESPACE + +PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) + : PreviewWidgetBase( parent, name ) +{ + // install event filter on child widgets + QObjectList l = queryList("QWidget"); + for (int i = 0; i < l.size(); ++i) { + QObject * obj = l.at(i); + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus); + } +} + + +void PreviewWidget::closeEvent(QCloseEvent *e) +{ + e->ignore(); +} + + +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; +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidget.h b/tools/qtconfig/previewwidget.h new file mode 100644 index 0000000..c29eb20 --- /dev/null +++ b/tools/qtconfig/previewwidget.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWWIDGET_H +#define PREVIEWWIDGET_H + +#include "previewwidgetbase.h" + +QT_BEGIN_NAMESPACE + +class PreviewWidget : public PreviewWidgetBase +{ + Q_OBJECT + +public: + PreviewWidget( QWidget *parent = 0, const char *name = 0 ); + + void closeEvent(QCloseEvent *); + bool eventFilter(QObject *, QEvent *); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qtconfig/previewwidgetbase.cpp b/tools/qtconfig/previewwidgetbase.cpp new file mode 100644 index 0000000..56e9294 --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "previewwidgetbase.h" + +#include <QVariant> + +QT_BEGIN_NAMESPACE + +/* + * Constructs a PreviewWidgetBase as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +PreviewWidgetBase::PreviewWidgetBase(QWidget* parent, const char* name, Qt::WindowFlags fl) + : QWidget(parent, name, fl) +{ + setupUi(this); + + + // signals and slots connections + init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +PreviewWidgetBase::~PreviewWidgetBase() +{ + destroy(); + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void PreviewWidgetBase::languageChange() +{ + retranslateUi(this); +} + +void PreviewWidgetBase::init() +{ +} + +void PreviewWidgetBase::destroy() +{ +} + +QT_END_NAMESPACE diff --git a/tools/qtconfig/previewwidgetbase.h b/tools/qtconfig/previewwidgetbase.h new file mode 100644 index 0000000..aa510cd --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PREVIEWWIDGETBASE_H +#define PREVIEWWIDGETBASE_H + +#include "ui_previewwidgetbase.h" +#include <QVariant> + +QT_BEGIN_NAMESPACE + +class PreviewWidgetBase : public QWidget, public Ui::PreviewWidgetBase +{ + Q_OBJECT + +public: + PreviewWidgetBase(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0); + ~PreviewWidgetBase(); + +protected slots: + virtual void languageChange(); + + virtual void init(); + virtual void destroy(); + +}; + +QT_END_NAMESPACE + +#endif // PREVIEWWIDGETBASE_H diff --git a/tools/qtconfig/previewwidgetbase.ui b/tools/qtconfig/previewwidgetbase.ui new file mode 100644 index 0000000..2c4e05d --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.ui @@ -0,0 +1,340 @@ +<ui version="4.0" stdsetdef="1" > + <author></author> + <comment>********************************************************************* +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +*********************************************************************</comment> + <exportmacro></exportmacro> + <class>PreviewWidgetBase</class> + <widget class="QWidget" name="PreviewWidgetBase" > + <property name="objectName" > + <string notr="true" >PreviewWidgetBase</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>378</width> + <height>236</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle" > + <string>Preview Window</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="Q3ButtonGroup" name="ButtonGroup1" > + <property name="objectName" > + <string notr="true" >ButtonGroup1</string> + </property> + <property name="title" > + <string>ButtonGroup</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QRadioButton" name="RadioButton1" > + <property name="objectName" > + <string notr="true" >RadioButton1</string> + </property> + <property name="text" > + <string>RadioButton1</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton2" > + <property name="objectName" > + <string notr="true" >RadioButton2</string> + </property> + <property name="text" > + <string>RadioButton2</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="RadioButton3" > + <property name="objectName" > + <string notr="true" >RadioButton3</string> + </property> + <property name="text" > + <string>RadioButton3</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="Q3ButtonGroup" name="ButtonGroup2" > + <property name="objectName" > + <string notr="true" >ButtonGroup2</string> + </property> + <property name="title" > + <string>ButtonGroup2</string> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>11</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="CheckBox1" > + <property name="objectName" > + <string notr="true" >CheckBox1</string> + </property> + <property name="text" > + <string>CheckBox1</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="CheckBox2" > + <property name="objectName" > + <string notr="true" >CheckBox2</string> + </property> + <property name="text" > + <string>CheckBox2</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QProgressBar" name="ProgressBar1" > + <property name="objectName" > + <string notr="true" >ProgressBar1</string> + </property> + <property name="value" > + <number>50</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLineEdit" name="LineEdit1" > + <property name="objectName" > + <string notr="true" >LineEdit1</string> + </property> + <property name="text" > + <string>LineEdit</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="ComboBox1" > + <property name="objectName" > + <string notr="true" >ComboBox1</string> + </property> + <item> + <property name="text" > + <string>ComboBox</string> + </property> + </item> + </widget> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QSpinBox" name="SpinBox1" > + <property name="objectName" > + <string notr="true" >SpinBox1</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="PushButton1" > + <property name="objectName" > + <string notr="true" >PushButton1</string> + </property> + <property name="text" > + <string>PushButton</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollBar" name="ScrollBar1" > + <property name="objectName" > + <string notr="true" >ScrollBar1</string> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="Slider1" > + <property name="objectName" > + <string notr="true" >Slider1</string> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="textView" > + <property name="objectName" > + <string notr="true" >textView</string> + </property> + <property name="maximumSize" > + <size> + <width>32767</width> + <height>50</height> + </size> + </property> + <property name="readOnly" > + <bool>true</bool> + </property> + <property name="text" > + <string><p> +<a href="http://qtsoftware.com">http://qtsoftware.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="Spacer2" > + <property name="sizeHint" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="sizeType" > + <enum>Expanding</enum> + </property> + <property name="orientation" > + <enum>Vertical</enum> + </property> + </spacer> + </item> + </layout> + </widget> + <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> +</ui> diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro new file mode 100644 index 0000000..8ab3f03 --- /dev/null +++ b/tools/qtconfig/qtconfig.pro @@ -0,0 +1,28 @@ +TEMPLATE = app +CONFIG += qt warn_on x11 +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} +LANGUAGE = C++ +QT += qt3support + +contains(QT_CONFIG, gstreamer):LIBS += $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 +contains(QT_CONFIG, gstreamer):QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER +contains(QT_CONFIG, gstreamer):QT += phonon +SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp \ + mainwindowbase.cpp paletteeditoradvancedbase.cpp previewwidgetbase.cpp +HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h \ + mainwindowbase.h paletteeditoradvancedbase.h previewwidgetbase.h + +FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui +RESOURCES = qtconfig.qrc + +PROJECTNAME = Qt Configuration +TARGET = qtconfig +DESTDIR = ../../bin + +target.path=$$[QT_INSTALL_BINS] +INSTALLS += target +INCLUDEPATH += . +DBFILE = qtconfig.db diff --git a/tools/qtconfig/qtconfig.qrc b/tools/qtconfig/qtconfig.qrc new file mode 100644 index 0000000..cd66567 --- /dev/null +++ b/tools/qtconfig/qtconfig.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/trolltech/qtconfig/"> + <file>images/appicon.png</file> +</qresource> +</RCC> diff --git a/tools/qtconfig/translations/translations.pro b/tools/qtconfig/translations/translations.pro new file mode 100644 index 0000000..fbbdb2bba2 --- /dev/null +++ b/tools/qtconfig/translations/translations.pro @@ -0,0 +1,13 @@ +# Include those manually as they do not contain any directory specification + +SOURCES += ../colorbutton.cpp ../main.cpp ../previewframe.cpp ../previewwidget.cpp ../mainwindow.cpp ../paletteeditoradvanced.cpp \ + ../mainwindowbase.cpp ../paletteeditoradvancedbase.cpp ../previewwidgetbase.cpp +HEADERS += ../colorbutton.h ../previewframe.h ../previewwidget.h ../mainwindow.h ../paletteeditoradvanced.h \ + ../mainwindowbase.h ../paletteeditoradvancedbase.h ../previewwidgetbase.h + +FORMS = ../mainwindowbase.ui ../paletteeditoradvancedbase.ui ../previewwidgetbase.ui + +TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/qtconfig_pl.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qtconfig_untranslated.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_CN.ts \ + $$[QT_INSTALL_TRANSLATIONS]/qtconfig_zh_TW.ts |