diff options
Diffstat (limited to 'tools/qtconfig')
-rw-r--r-- | tools/qtconfig/LICENSE.GPL | 280 | ||||
-rw-r--r-- | tools/qtconfig/colorbutton.cpp | 177 | ||||
-rw-r--r-- | tools/qtconfig/colorbutton.h | 82 | ||||
-rw-r--r-- | tools/qtconfig/images/appicon.png | bin | 0 -> 714 bytes | |||
-rw-r--r-- | tools/qtconfig/main.cpp | 45 | ||||
-rw-r--r-- | tools/qtconfig/mainwindow.cpp | 1142 | ||||
-rw-r--r-- | tools/qtconfig/mainwindow.h | 104 | ||||
-rw-r--r-- | tools/qtconfig/mainwindowbase.ui | 1846 | ||||
-rw-r--r-- | tools/qtconfig/paletteeditoradvanced.cpp | 615 | ||||
-rw-r--r-- | tools/qtconfig/paletteeditoradvanced.h | 98 | ||||
-rw-r--r-- | tools/qtconfig/paletteeditoradvancedbase.ui | 682 | ||||
-rw-r--r-- | tools/qtconfig/previewframe.cpp | 63 | ||||
-rw-r--r-- | tools/qtconfig/previewframe.h | 67 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.cpp | 75 | ||||
-rw-r--r-- | tools/qtconfig/previewwidget.h | 50 | ||||
-rw-r--r-- | tools/qtconfig/previewwidgetbase.ui | 311 | ||||
-rw-r--r-- | tools/qtconfig/qtconfig.pro | 18 |
17 files changed, 5655 insertions, 0 deletions
diff --git a/tools/qtconfig/LICENSE.GPL b/tools/qtconfig/LICENSE.GPL new file mode 100644 index 0000000..3221c03 --- /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 Steet, 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..1e678f2 --- /dev/null +++ b/tools/qtconfig/colorbutton.cpp @@ -0,0 +1,177 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "colorbutton.h" + +#include <qapplication.h> +#include <qcolordialog.h> +#include <qpainter.h> +#include <qdragobject.h> +#include <qstyle.h> + + +ColorButton::ColorButton(QWidget *parent, const char *name) + : QButton(parent, name), mousepressed(FALSE) +{ + setAcceptDrops(TRUE); + col = black; + connect(this, SIGNAL(clicked()), SLOT(changeColor())); +} + + +ColorButton::ColorButton(const QColor &c, QWidget *parent, const char *name) + : QButton(parent, name) +{ + 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) +{ + style().drawPrimitive(QStyle::PE_ButtonBevel, p, rect(), colorGroup(), + isDown() ? QStyle::Style_Down : QStyle::Style_Raised); + drawButtonLabel(p); + + if (hasFocus()) + style().drawPrimitive(QStyle::PE_FocusRect, p, + style().subRect(QStyle::SR_PushButtonFocusRect, this), + colorGroup(), QStyle::Style_Default); +} + + +void ColorButton::drawButtonLabel(QPainter *p) +{ + QColor pen = (isEnabled() ? + (hasFocus() ? palette().active().buttonText() : + palette().inactive().buttonText()) + : palette().disabled().buttonText()); + p->setPen( pen ); + p->setBrush(col); + p->drawRect(width() / 4, height() / 4, width() / 2, height() / 2); +} + + +void ColorButton::dragEnterEvent(QDragEnterEvent *e) +{ + if (! QColorDrag::canDecode(e)) { + e->ignore(); + return; + } +} + + +void ColorButton::dragMoveEvent(QDragMoveEvent *e) +{ + if (! QColorDrag::canDecode(e)) { + e->ignore(); + return; + } + + e->accept(); +} + + +void ColorButton::dropEvent(QDropEvent *e) +{ + if (! QColorDrag::canDecode(e)) { + e->ignore(); + return; + } + + QColor c; + QColorDrag::decode(e, c); + setColor(c); + emit colorChanged(color()); +} + + +void ColorButton::mousePressEvent(QMouseEvent *e) +{ + presspos = e->pos(); + mousepressed = TRUE; + QButton::mousePressEvent(e); +} + + +void ColorButton::mouseReleaseEvent(QMouseEvent *e) +{ + mousepressed = FALSE; + QButton::mouseReleaseEvent(e); +} + + +void ColorButton::mouseMoveEvent(QMouseEvent *e) +{ + if (! mousepressed) + return; + + if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { + mousepressed = FALSE; + setDown(FALSE); + + QColorDrag *cd = new QColorDrag(color(), this); + cd->dragCopy(); + } +} diff --git a/tools/qtconfig/colorbutton.h b/tools/qtconfig/colorbutton.h new file mode 100644 index 0000000..4f370d0 --- /dev/null +++ b/tools/qtconfig/colorbutton.h @@ -0,0 +1,82 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef COLORBUTTON_H +#define COLORBUTTON_H + +#include <qbutton.h> + + +class ColorButton : public QButton +{ + Q_OBJECT + +public: + ColorButton(QWidget *, const char * = 0); + ColorButton(const QColor &, QWidget *, const char * = 0); + + 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 drawButton(QPainter *); + void drawButtonLabel(QPainter *); + + +private slots: + void changeColor(); + + +private: + QColor col; + QPoint presspos; + bool mousepressed; +}; + + +#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..0cb2b68 --- /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..980e64c --- /dev/null +++ b/tools/qtconfig/main.cpp @@ -0,0 +1,45 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "mainwindow.h" +#include <qapplication.h> + + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + MainWindow mw; + app.setMainWidget(&mw); + mw.show(); + return app.exec(); +} diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp new file mode 100644 index 0000000..c9f81ff --- /dev/null +++ b/tools/qtconfig/mainwindow.cpp @@ -0,0 +1,1142 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "mainwindow.h" +#include "colorbutton.h" +#include "previewframe.h" +#include "paletteeditoradvanced.h" + +#include <qlabel.h> +#include <qapplication.h> +#include <qcombobox.h> +#include <qstylefactory.h> +#include <qinputcontextfactory.h> +#include <qobjectlist.h> +#include <qfontdatabase.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qfiledialog.h> +#include <qaction.h> +#include <qstatusbar.h> +#include <qsettings.h> +#include <qmessagebox.h> +#include <qtextview.h> +#include <qstyle.h> + +#include <stdlib.h> + + +// from qapplication.cpp and qapplication_x11.cpp - These are NOT for +// external use ignore them +extern bool Q_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 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 *libpath_text = +"<p><b><font size+=2>Library Paths</font></b></p>" +"<hr>" +"<p>Use this tab to select additional directories where Qt should search " +"for component plugins." +"<p>These directories should be the base directory of where your plugins " +"are stored. For example, if you wish to store GUI Style plugins in " +"$HOME/plugins/styles and Qt Designer plugins in $HOME/plugins/designer, " +"you would add $HOME/plugins to your Library Path. <p>Notes:" +"<ul><li>The Qt Configuration program does <i>not</i> support environment " +"variables, so you must give full path names, for example " +"<tt>/home/brad/myplugins</tt> not <tt>$HOME/myplugins</tt>" +"<li> Qt automatically " +"searches in the directory where you installed Qt for component plugins. " +"Removing that path is not possible.</ul>"; + +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 *about_text = +"<p><b><font size=+2>Qt Configuration</font></b></p>" +"<p>A graphical configuration tool for programs using Qt</p>" +"<p>Version 1.0</p>" +"<p>Copyright (C) 2001-2008 Trolltech ASA. All rights reserved.</p>" +"<p></p>" +"<p>This program is licensed to you under the terms of the GNU General " +"Public License Version 2 as published by the Free Software Foundation. This " +"gives you legal permission to copy, distribute and/or modify this software " +"under certain conditions. For details, see the file 'LICENSE.GPL' that came with " +"this software distribution. If you did not get the file, send email to " +"info@trolltech.com.</p>\n\n<p>The program is provided AS IS with NO WARRANTY " +"OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS " +"FOR A PARTICULAR PURPOSE.</p>"; + + +static QColorGroup::ColorRole centralFromItem( int item ) +{ + switch( item ) { + case 0: return QColorGroup::Background; + case 1: return QColorGroup::Foreground; + 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) +{ + w->unsetPalette(); + w->setStyle(s); + + const QObjectList *children = w->children(); + if (! children) + return; + + QPtrListIterator<QObject> childit(*children); + QObject *child; + while ((child = childit.current()) != 0) { + ++childit; + + if (child->isWidgetType()) + setStyleHelper((QWidget *) child, s); + } +} + + +MainWindow::MainWindow() + : MainWindowBase(0, "main window"), + editPalette(palette()), previewPalette(palette()), previewstyle(0) +{ + modified = TRUE; + + QStringList gstyles = QStyleFactory::keys(); + gstyles.sort(); + gstylecombo->insertStringList(gstyles); + + QSettings settings; + QString currentstyle = settings.readEntry("/qt/style"); + if (currentstyle.isNull()) + currentstyle = QApplication::style().className(); + { + int s = 0; + QStringList::Iterator git = gstyles.begin(); + while (git != gstyles.end()) { + if (*git == currentstyle) + break; + s++; + git++; + } + + if (s < gstylecombo->count()) { + gstylecombo->setCurrentItem(s); + } else { + // no predefined style, try to find the closest match + // class names usually contain the name of the style, so we + // iterate over the items in the combobox, and use the one whose + // name is contained in the classname of the style + s = 0; + git = gstyles.begin(); + while (git != gstyles.end()) { + if (currentstyle.contains(*git)) + break; + s++; + git++; + } + + if (s < gstylecombo->count()) { + gstylecombo->setCurrentItem(s); + } else { + // we give up + gstylecombo->insertItem("Unknown"); + gstylecombo->setCurrentItem(gstylecombo->count() - 1); + } + } + } + + buttonMainColor->setColor(palette().color(QPalette::Active, + QColorGroup::Button)); + buttonMainColor2->setColor(palette().color(QPalette::Active, + QColorGroup::Background)); + + 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); + QValueList<int> sizes = db.standardSizes(); + QValueList<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(UI_General)); + effectbase->setEnabled(effectcheckbox->isChecked()); + + if (QApplication::isEffectEnabled(UI_FadeMenu)) + menueffect->setCurrentItem(2); + else if (QApplication::isEffectEnabled(UI_AnimateMenu)) + menueffect->setCurrentItem(1); + + if (QApplication::isEffectEnabled(UI_AnimateCombo)) + comboeffect->setCurrentItem(1); + + if (QApplication::isEffectEnabled(UI_FadeTooltip)) + tooltipeffect->setCurrentItem(2); + else if (QApplication::isEffectEnabled(UI_AnimateTooltip)) + tooltipeffect->setCurrentItem(1); + + if ( QApplication::isEffectEnabled( UI_AnimateToolBox ) ) + toolboxeffect->setCurrentItem( 1 ); + + QSize globalStrut = QApplication::globalStrut(); + strutwidth->setValue(globalStrut.width()); + strutheight->setValue(globalStrut.height()); + + libpathlistbox->clear(); + libpathlistbox->insertStringList(QApplication::libraryPaths()); + + // 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; + while (i < psizecombo->count()) { + if (psizecombo->text(i) == QString::number(QApplication::font().pointSize())) { + psizecombo->setCurrentItem(i); + break; + } + + i++; + } + + QStringList subs = QFont::substitutes(familysubcombo->currentText()); + sublistbox->clear(); + sublistbox->insertStringList(subs); + + rtlExtensions->setChecked( settings.readBoolEntry( "/qt/useRtlExtensions", FALSE ) ); + +#if defined(Q_WS_X11) + inputStyle->setCurrentText( settings.readEntry( "/qt/XIMInputStyle", trUtf8( "On The Spot" ) ) ); +#else + inputStyle->hide(); + inputStyleLabel->hide(); +#endif + +#if defined(Q_WS_X11) && !defined(QT_NO_IM_EXTENSIONS) + /* + This code makes it possible to set up default input method. + + The list of identifier names of input method which can be used + is acquired using QInputContextFactory::keys(). And it is + translated to display name and set to inputMethodCombo which + displays the list of input method. + */ + inputMethodIdentifiers = QInputContextFactory::keys(); + QStringList imDispNames; + { + // input method switcher should named with "imsw-" prefix to + // prevent to be listed in ordinary input method list. + QStringList::Iterator imIt = inputMethodIdentifiers.begin(); + while (imIt != inputMethodIdentifiers.end()) { + if ((*imIt).find("imsw-") == 0) + imIt = inputMethodIdentifiers.remove(imIt); + else + imIt++; + } + // we should not sort the list + //inputMethodIdentifiers.sort(); + for (imIt = inputMethodIdentifiers.begin(); + imIt != inputMethodIdentifiers.end(); + imIt++) { + QString dispName = QInputContextFactory::displayName(*imIt); + if (dispName.isNull() || dispName.isEmpty()) + dispName = *imIt; + imDispNames << dispName; + } + } + //inputMethodCombo->insertStringList(inputMethodIdentifiers); + inputMethodCombo->insertStringList(imDispNames); + + /* + input method set up as a default in the past is chosen. + If nothing is set up, default input method in the platform is chosen. + */ + // default input method is XIM in X11. + QString currentIM = settings.readEntry("/qt/DefaultInputMethod", "xim"); + { + int index = inputMethodIdentifiers.findIndex(currentIM); + // set up Selected input method. + if (0 <= index && index < inputMethodIdentifiers.count()) { + inputMethodCombo->setCurrentItem(index); + } else { + // Give up. this part is executed when specified IM is not + // installed. + QString dispName = tr("Unknown Input Method") + " (" + currentIM + ")"; + inputMethodCombo->insertItem(dispName); + inputMethodCombo->setCurrentItem(inputMethodCombo->count() - 1); + inputMethodIdentifiers << currentIM; + } + } +#else + inputMethodCombo->hide(); + inputMethodLabel->hide(); +#endif + + fontembeddingcheckbox->setChecked( settings.readBoolEntry("/qt/embedFonts", TRUE) ); + fontpaths = settings.readListEntry("/qt/fontPath", ':'); + fontpathlistbox->insertStringList(fontpaths); + + setModified(FALSE); +} + + +MainWindow::~MainWindow() +{ +} + + +void MainWindow::fileSave() +{ + if (! modified) { + statusBar()->message("No changes to be saved.", 2000); + return; + } + + statusBar()->message("Saving changes..."); + + { + QSettings settings; + QFontDatabase db; + QFont font = db.font(familycombo->currentText(), + stylecombo->currentText(), + psizecombo->currentText().toInt()); + QStringList actcg, inactcg, discg; + + 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.writeEntry("/qt/font", font.toString()); + settings.writeEntry("/qt/Palette/active", actcg); + settings.writeEntry("/qt/Palette/inactive", inactcg); + settings.writeEntry("/qt/Palette/disabled", discg); + + QStringList libpath = QApplication::libraryPaths(); + QString libpathkey = + QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); + settings.writeEntry(libpathkey, libpath, ':'); + settings.writeEntry("/qt/fontPath", fontpaths, ':'); + settings.writeEntry("/qt/embedFonts", fontembeddingcheckbox->isChecked() ); + settings.writeEntry("/qt/style", gstylecombo->currentText()); + settings.writeEntry("/qt/doubleClickInterval", + dcispin->value()); + settings.writeEntry("/qt/cursorFlashTime", cfispin->value() == 9 ? 0 : cfispin->value() ); + settings.writeEntry("/qt/wheelScrollLines", wslspin->value()); + settings.writeEntry("/qt/resolveSymlinks", resolvelinks->isChecked()); + + QStringList strut; + strut << QString::number(strutwidth->value()); + strut << QString::number(strutheight->value()); + settings.writeEntry("/qt/globalStrut", strut); + + settings.writeEntry("/qt/useRtlExtensions", rtlExtensions->isChecked() ); + +#ifdef Q_WS_X11 + QString style = inputStyle->currentText(); + QString str = "On The Spot"; + if ( style == trUtf8( "Over The Spot" ) ) + str = "Over The Spot"; + else if ( style == trUtf8( "Off The Spot" ) ) + str = "Off The Spot"; + else if ( style == trUtf8( "Root" ) ) + str = "Root"; + settings.writeEntry( "/qt/XIMInputStyle", inputStyle->currentText() ); + +#if !defined(QT_NO_IM_EXTENSIONS) + QString imSwitcher = settings.readEntry("/qt/DefaultInputMethodSwitcher", "imsw-multi"); + settings.writeEntry("/qt/DefaultInputMethodSwitcher", imSwitcher); + int imIndex = inputMethodCombo->currentItem(); + settings.writeEntry("/qt/DefaultInputMethod", inputMethodIdentifiers[imIndex]); +#endif +#endif + + QStringList effects; + if (effectcheckbox->isChecked()) { + effects << "general"; + + switch (menueffect->currentItem()) { + case 1: effects << "animatemenu"; break; + case 2: effects << "fademenu"; break; + } + + switch (comboeffect->currentItem()) { + case 1: effects << "animatecombo"; break; + } + + switch (tooltipeffect->currentItem()) { + case 1: effects << "animatetooltip"; break; + case 2: effects << "fadetooltip"; break; + } + + switch ( toolboxeffect->currentItem() ) { + case 1: effects << "animatetoolbox"; break; + } + } else + effects << "none"; + settings.writeEntry("/qt/GUIEffects", effects); + + QStringList familysubs = QFont::substitutions(); + QStringList::Iterator fit = familysubs.begin(); + while (fit != familysubs.end()) { + QStringList subs = QFont::substitutes(*fit); + settings.writeEntry("/qt/Font Substitutions/" + *fit, subs); + fit++; + } + } + +#if defined(Q_WS_X11) + QApplication::x11_apply_settings(); +#endif // Q_WS_X11 + + setModified(FALSE); + statusBar()->message("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::Background ) ); + + 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 = 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, darkGray ); + cg.setColor( QColorGroup::Foreground, darkGray ); + cg.setColor( QColorGroup::Text, darkGray ); + cg.setColor( QColorGroup::HighlightedText, 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 = 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::Background )); +} + + +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::styleSelected(const QString &stylename) +{ + QStyle *style = QStyleFactory::create(stylename); + if (! style) + return; + + setStyleHelper(previewFrame, style); + delete previewstyle; + previewstyle = style; + + setModified(TRUE); +} + + +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()); + QStringList::Iterator it = subs.at(item); + QString fam = *it; + subs.remove(it); + it = subs.at(item); + subs.insert(++it, 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()); + QStringList::Iterator it = subs.at(item); + QString fam = *it; + subs.remove(it); + it = subs.at(item - 1); + subs.insert(it, fam); + sublistbox->clear(); + sublistbox->insertStringList(subs); + sublistbox->setCurrentItem(item - 1); + QFont::removeSubstitution(familysubcombo->currentText()); + QFont::insertSubstitutions(familysubcombo->currentText(), subs); + setModified(TRUE); +} + + +void MainWindow::removeLibpath() +{ + if (libpathlistbox->currentItem() < 0 || + uint(libpathlistbox->currentItem()) > libpathlistbox->count()) + return; + + int item = libpathlistbox->currentItem(); + QStringList paths = QApplication::libraryPaths(); + paths.remove(paths.at(libpathlistbox->currentItem())); + libpathlistbox->clear(); + libpathlistbox->insertStringList(paths); + if (uint(item) > libpathlistbox->count()) + item = int(libpathlistbox->count()) - 1; + libpathlistbox->setCurrentItem(item); + QApplication::setLibraryPaths(paths); + setModified(TRUE); +} + + +void MainWindow::addLibpath() +{ + if (libpathlineedit->text().isEmpty()) + return; + + if (libpathlistbox->currentItem() < 0 || + uint(libpathlistbox->currentItem()) > libpathlistbox->count()) { + QStringList paths = QApplication::libraryPaths(); + paths.append(libpathlineedit->text()); + libpathlistbox->clear(); + libpathlistbox->insertStringList(paths); + QApplication::setLibraryPaths(paths); + setModified(TRUE); + + return; + } + + int item = libpathlistbox->currentItem(); + QStringList paths =QApplication::libraryPaths(); + paths.insert(++paths.at(libpathlistbox->currentItem()), + libpathlineedit->text()); + libpathlistbox->clear(); + libpathlistbox->insertStringList(paths); + libpathlistbox->setCurrentItem(item); + QApplication::setLibraryPaths(paths); + setModified(TRUE); +} + + +void MainWindow::downLibpath() +{ + if (libpathlistbox->currentItem() < 0 || + uint(libpathlistbox->currentItem()) >= libpathlistbox->count() - 1) + return; + + int item = libpathlistbox->currentItem(); + QStringList paths = QApplication::libraryPaths(); + QStringList::Iterator it = paths.at(item); + QString fam = *it; + paths.remove(it); + it = paths.at(item); + paths.insert(++it, fam); + libpathlistbox->clear(); + libpathlistbox->insertStringList(paths); + libpathlistbox->setCurrentItem(item + 1); + QApplication::setLibraryPaths(paths); + setModified(TRUE); +} + + +void MainWindow::upLibpath() +{ + if (libpathlistbox->currentItem() < 1) + return; + + int item = libpathlistbox->currentItem(); + QStringList paths = QApplication::libraryPaths(); + QStringList::Iterator it = paths.at(item); + QString fam = *it; + paths.remove(it); + it = paths.at(item - 1); + paths.insert(it, fam); + libpathlistbox->clear(); + libpathlistbox->insertStringList(paths); + libpathlistbox->setCurrentItem(item - 1); + QApplication::setLibraryPaths(paths); + setModified(TRUE); +} + + +void MainWindow::browseLibpath() +{ + QString dirname = QFileDialog::getExistingDirectory(QString::null, this, 0, + tr("Select a Directory")); + if (dirname.isNull()) + return; + + libpathlineedit->setText(dirname); +} + + +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(++fontpaths.at(fontpathlistbox->currentItem()), + 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(); + QStringList::Iterator it = fontpaths.at(item); + QString fam = *it; + fontpaths.remove(it); + it = fontpaths.at(item); + fontpaths.insert(++it, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item + 1); + setModified(TRUE); +} + + +void MainWindow::upFontpath() +{ + if (fontpathlistbox->currentItem() < 1) + return; + + int item = fontpathlistbox->currentItem(); + QStringList::Iterator it = fontpaths.at(item); + QString fam = *it; + fontpaths.remove(it); + it = fontpaths.at(item - 1); + fontpaths.insert(it, fam); + fontpathlistbox->clear(); + fontpathlistbox->insertStringList(fontpaths); + fontpathlistbox->setCurrentItem(item - 1); + setModified(TRUE); +} + + +void MainWindow::browseFontpath() +{ + QString dirname = QFileDialog::getExistingDirectory(QString::null, this, 0, + tr("Select a Directory")); + if (dirname.isNull()) + return; + + fontpathlineedit->setText(dirname); +} + + +void MainWindow::somethingModified() +{ + setModified(TRUE); +} + + +void MainWindow::helpAbout() +{ + QMessageBox::about(this, tr("Qt Configuration"), + tr(about_text)); +} + + +void MainWindow::helpAboutQt() +{ + QMessageBox::aboutQt(this, tr("Qt Configuration")); +} + + +void MainWindow::pageChanged(QWidget *page) +{ + if (page == tab) + helpview->setText(tr(appearance_text)); + else if (page == tab_2) + helpview->setText(tr(font_text)); + else if (page == tab_3) + helpview->setText(tr(interface_text)); + else if (page == tab_4) + helpview->setText(tr(libpath_text)); + else if (page == tab_5) + helpview->setText(tr(printer_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(); +} diff --git a/tools/qtconfig/mainwindow.h b/tools/qtconfig/mainwindow.h new file mode 100644 index 0000000..056edbb --- /dev/null +++ b/tools/qtconfig/mainwindow.h @@ -0,0 +1,104 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "mainwindowbase.h" + + +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 removeLibpath(); + virtual void addLibpath(); + virtual void downLibpath(); + virtual void upLibpath(); + virtual void browseLibpath(); + 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 setPreviewPalette(const QPalette &); + + void setModified(bool); + + QPalette editPalette, previewPalette; + QStyle *previewstyle; + QStringList fontpaths; + QStringList inputMethodIdentifiers; + bool modified; +}; + + +#endif // MAINWINDOW_H diff --git a/tools/qtconfig/mainwindowbase.ui b/tools/qtconfig/mainwindowbase.ui new file mode 100644 index 0000000..0cf65df --- /dev/null +++ b/tools/qtconfig/mainwindowbase.ui @@ -0,0 +1,1846 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>MainWindowBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="QMainWindow"> + <property name="name"> + <cstring>MainWindowBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>700</width> + <height>600</height> + </rect> + </property> + <property name="caption"> + <string>Qt Configuration</string> + </property> + <property name="icon"> + <pixmap>appicon.png</pixmap> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QTextView"> + <property name="name"> + <cstring>helpview</cstring> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string><p align=center><b>Documentation</b></p> +<p>This QTextView will display a brief explanation about the current page, so that the user isn't confused about the settings he/she is twiddling.</p></string> + </property> + </widget> + <widget class="QTabWidget"> + <property name="name"> + <cstring>TabWidget3</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Appearance</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>4</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox40</cstring> + </property> + <property name="title"> + <string>GUI Style</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>gstylebuddy</cstring> + </property> + <property name="text"> + <string>Select GUI &Style:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>gstylecombo</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>gstylecombo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupAutoPalette</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Build Palette</string> + </property> + <property name="alignment"> + <set>AlignAuto</set> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelMainColor</cstring> + </property> + <property name="text"> + <string>&3-D Effects:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>buttonMainColor</cstring> + </property> + </widget> + <widget class="ColorButton"> + <property name="name"> + <cstring>buttonMainColor</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelMainColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <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="margin"> + <number>0</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="text"> + <string>Back&ground:</string> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + <property name="buddy" stdset="0"> + <cstring>buttonMainColor2</cstring> + </property> + </widget> + <widget class="ColorButton"> + <property name="name"> + <cstring>buttonMainColor2</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>70</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>btnAdvanced</cstring> + </property> + <property name="text"> + <string>&Tune Palette...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox126</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Preview</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>paletteCombo</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <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> + <property name="name"> + <cstring>paletteCombo</cstring> + </property> + </widget> + <widget class="PreviewFrame" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>previewFrame</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>410</width> + <height>260</height> + </size> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Fonts</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>Default Font</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>stylecombo</cstring> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>familycombo</cstring> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <property name="name"> + <cstring>psizecombo</cstring> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>stylebuddy</cstring> + </property> + <property name="text"> + <string>&Style:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>stylecombo</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>psizebuddy</cstring> + </property> + <property name="text"> + <string>&Point Size:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>psizecombo</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>familybuddy</cstring> + </property> + <property name="text"> + <string>F&amily:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>familycombo</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>samplelineedit</cstring> + </property> + <property name="text"> + <string>Sample Text</string> + </property> + <property name="alignment"> + <set>AlignHCenter</set> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Font Substitution</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>famsubbuddy</cstring> + </property> + <property name="text"> + <string>S&elect or Enter a Family:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>familysubcombo</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>familysubcombo</cstring> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="text"> + <string>Current Substitutions:</string> + </property> + </widget> + <widget class="QListBox"> + <property name="name"> + <cstring>sublistbox</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>Up</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton3</cstring> + </property> + <property name="text"> + <string>Down</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton4</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>choosebuddy</cstring> + </property> + <property name="text"> + <string>Select s&ubstitute Family:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>choosesubcombo</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>choosesubcombo</cstring> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>Add</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Interface</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox4</cstring> + </property> + <property name="title"> + <string>Feel Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QSpinBox" row="0" column="1"> + <property name="name"> + <cstring>dcispin</cstring> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="maxValue"> + <number>10000</number> + </property> + <property name="minValue"> + <number>10</number> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>dcibuddy</cstring> + </property> + <property name="text"> + <string>&Double Click Interval:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>dcispin</cstring> + </property> + </widget> + <widget class="QSpinBox" row="1" column="1"> + <property name="name"> + <cstring>cfispin</cstring> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="maxValue"> + <number>10000</number> + </property> + <property name="minValue"> + <number>9</number> + </property> + <property name="specialValueText"> + <string>No blinking</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>cfibuddy</cstring> + </property> + <property name="text"> + <string>&Cursor Flash Time:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>cfispin</cstring> + </property> + </widget> + <widget class="QSpinBox" row="2" column="1"> + <property name="name"> + <cstring>wslspin</cstring> + </property> + <property name="suffix"> + <string> lines</string> + </property> + <property name="maxValue"> + <number>20</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>wslbuddy</cstring> + </property> + <property name="text"> + <string>Wheel &Scroll Lines:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>wslspin</cstring> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>resolvelinks</cstring> + </property> + <property name="text"> + <string>Resolve symlinks in URLs</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>GUI Effects</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>effectcheckbox</cstring> + </property> + <property name="text"> + <string>&Enable</string> + </property> + <property name="accel"> + <string>Alt+E</string> + </property> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>effectbase</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>meffectbuddy</cstring> + </property> + <property name="text"> + <string>&Menu Effect:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>menueffect</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>ceffectbuddy</cstring> + </property> + <property name="text"> + <string>C&omboBox Effect:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comboeffect</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>teffectbuddy</cstring> + </property> + <property name="text"> + <string>&ToolTip Effect:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tooltipeffect</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>beffectbuddy</cstring> + </property> + <property name="text"> + <string>Tool&Box Effect:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>toolboxeffect</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <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> + <property name="name"> + <cstring>menueffect</cstring> + </property> + <property name="currentItem"> + <number>0</number> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <property name="name"> + <cstring>comboeffect</cstring> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <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> + <property name="name"> + <cstring>tooltipeffect</cstring> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>Disable</string> + </property> + </item> + <item> + <property name="text"> + <string>Animate</string> + </property> + </item> + <property name="name"> + <cstring>toolboxeffect</cstring> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox5</cstring> + </property> + <property name="title"> + <string>Global Strut</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>swbuddy</cstring> + </property> + <property name="text"> + <string>Minimum &Width:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>strutwidth</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>shbuddy</cstring> + </property> + <property name="text"> + <string>Minimum Hei&ght:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>strutheight</cstring> + </property> + </widget> + <widget class="QSpinBox" row="0" column="1"> + <property name="name"> + <cstring>strutwidth</cstring> + </property> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maxValue"> + <number>1000</number> + </property> + </widget> + <widget class="QSpinBox" row="1" column="1"> + <property name="name"> + <cstring>strutheight</cstring> + </property> + <property name="suffix"> + <string> pixels</string> + </property> + <property name="maxValue"> + <number>1000</number> + </property> + </widget> + </grid> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>rtlExtensions</cstring> + </property> + <property name="text"> + <string>Enhanced support for languages written right-to-left</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>inputStyleLabel</cstring> + </property> + <property name="text"> + <string>XIM Input Style:</string> + </property> + </widget> + <widget class="QComboBox"> + <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> + <property name="name"> + <cstring>inputStyle</cstring> + </property> + <property name="currentItem"> + <number>0</number> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>inputMethodLabel</cstring> + </property> + <property name="text"> + <string>Default Input Method:</string> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>inputMethodCombo</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Library Paths</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>4</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox39</cstring> + </property> + <property name="title"> + <string>Library Paths</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout68</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QListBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>libpathlistbox</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>PushButton8</cstring> + </property> + <property name="text"> + <string>Down</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="2"> + <property name="name"> + <cstring>PushButton9</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>PushButton7</cstring> + </property> + <property name="text"> + <string>Up</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout71</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <spacer row="2" column="0"> + <property name="name"> + <cstring>Spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>TextLabel15</cstring> + </property> + <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> + <widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>libpathlineedit</cstring> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>PushButton5</cstring> + </property> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>PushButton6</cstring> + </property> + <property name="text"> + <string>Add</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Printer</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fontembeddingcheckbox</cstring> + </property> + <property name="text"> + <string>Enable Font embedding</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox10</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Font Paths</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>8</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout9</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>PushButton11</cstring> + </property> + <property name="text"> + <string>Up</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="2"> + <property name="name"> + <cstring>PushButton13</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="QListBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>fontpathlistbox</cstring> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>PushButton12</cstring> + </property> + <property name="text"> + <string>Down</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout10</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>4</number> + </property> + <spacer row="2" column="0"> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>TextLabel15_2</cstring> + </property> + <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> + <widget class="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>PushButton15</cstring> + </property> + <property name="text"> + <string>Add</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>fontpathlineedit</cstring> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>PushButton14</cstring> + </property> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + </vbox> + </widget> + </widget> + </hbox> +</widget> +<menubar> + <property name="name"> + <cstring>menubar</cstring> + </property> + <item text="&File" name="PopupMenu"> + <action name="fileSaveAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Help" name="PopupMenu_2"> + <action name="helpAboutAction"/> + <action name="helpAboutQtAction"/> + </item> +</menubar> +<toolbars> +</toolbars> +<customwidgets> + <customwidget> + <class>ColorButton</class> + <header location="local">colorbutton.h</header> + <sizehint> + <width>40</width> + <height>25</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>clicked()</signal> + <signal>colorChanged(const QColor &)</signal> + <signal>changed()</signal> + <property type="Color">color</property> + <property type="Pixmap">pixmap</property> + <property type="Bool">scale</property> + </customwidget> + <customwidget> + <class>PreviewFrame</class> + <header location="local">previewframe.h</header> + <sizehint> + <width>200</width> + <height>200</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image1</pixmap> + </customwidget> +</customwidgets> +<actions> + <action> + <property name="name"> + <cstring>fileSaveAction</cstring> + </property> + <property name="iconSet"> + <iconset></iconset> + </property> + <property name="text"> + <string>Save</string> + </property> + <property name="menuText"> + <string>&Save</string> + </property> + <property name="accel"> + <string>Ctrl+S</string> + </property> + </action> + <action> + <property name="name"> + <cstring>fileExitAction</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutAction</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="menuText"> + <string>&About</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutQtAction</cstring> + </property> + <property name="text"> + <string>About Qt</string> + </property> + <property name="menuText"> + <string>About &Qt</string> + </property> + </action> +</actions> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data> + </image> + <image name="image1"> + <data format="XPM.GZ" length="857">789c6d92cd4ec3300c80ef7d8a68b94da8dbba51a9423c02882312e210c7f95d3a241807847877eca4e93a84d54af9fcd5899374b316cf4f0f62bd693eceea1cb4d05ebd8b357e8ee3d7cbebfd77b3ea3a41cfae17bbd54db36a85168f6f27c3634563b9dfedb7db2da3acd8778cb1607f5bd0331ed4411f142330f65db5a1e0301444c64157d41507cd980a6a53d67515cbc723a3c66a6dc5624dc532d5a9a0b5058f8cd6566cdb56aaeba05436a0f43210a4826294369c31c63a4404002f55362c02e50d2f8001207a2f6531d4d131e729128227a32643152ed14ce86c4a09168605440ac031a57031b404091f3d861872d16c6ca9a01d87885cb430b9c29cac8b90122e0c7205094b4dd374b3a16d70056f15fc1f6323d8bc550757b3510680d3fc5e75e0f2b72e00f2212cbb464701d45d449796060199318490079775e8dc4b660e980c9dad9f1dd2f10428b7d02a991d9f58001ec0747374dbf24fa8c9fcff87fcdc35bf3990fd9c</data> + </image> +</images> +<connections> + <connection> + <sender>fontpathlineedit</sender> + <signal>returnPressed()</signal> + <receiver>MainWindowBase</receiver> + <slot>addFontpath()</slot> + </connection> + <connection> + <sender>PushButton15</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>addFontpath()</slot> + </connection> + <connection> + <sender>PushButton6</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>addLibpath()</slot> + </connection> + <connection> + <sender>libpathlineedit</sender> + <signal>returnPressed()</signal> + <receiver>MainWindowBase</receiver> + <slot>addLibpath()</slot> + </connection> + <connection> + <sender>PushButton1</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>addSubstitute()</slot> + </connection> + <connection> + <sender>PushButton14</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>browseFontpath()</slot> + </connection> + <connection> + <sender>PushButton5</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>browseLibpath()</slot> + </connection> + <connection> + <sender>stylecombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>buildFont()</slot> + </connection> + <connection> + <sender>psizecombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>buildFont()</slot> + </connection> + <connection> + <sender>PushButton12</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>downFontpath()</slot> + </connection> + <connection> + <sender>PushButton8</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>downLibpath()</slot> + </connection> + <connection> + <sender>PushButton3</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>downSubstitute()</slot> + </connection> + <connection> + <sender>familycombo</sender> + <signal>activated(const QString&)</signal> + <receiver>MainWindowBase</receiver> + <slot>familySelected(const QString&)</slot> + </connection> + <connection> + <sender>fileExitAction</sender> + <signal>activated()</signal> + <receiver>MainWindowBase</receiver> + <slot>fileExit()</slot> + </connection> + <connection> + <sender>fileSaveAction</sender> + <signal>activated()</signal> + <receiver>MainWindowBase</receiver> + <slot>fileSave()</slot> + </connection> + <connection> + <sender>helpAboutAction</sender> + <signal>activated()</signal> + <receiver>MainWindowBase</receiver> + <slot>helpAbout()</slot> + </connection> + <connection> + <sender>helpAboutQtAction</sender> + <signal>activated()</signal> + <receiver>MainWindowBase</receiver> + <slot>helpAboutQt()</slot> + </connection> + <connection> + <sender>TabWidget3</sender> + <signal>currentChanged(QWidget*)</signal> + <receiver>MainWindowBase</receiver> + <slot>pageChanged(QWidget*)</slot> + </connection> + <connection> + <sender>paletteCombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>paletteSelected(int)</slot> + </connection> + <connection> + <sender>PushButton13</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>removeFontpath()</slot> + </connection> + <connection> + <sender>PushButton9</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>removeLibpath()</slot> + </connection> + <connection> + <sender>PushButton4</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>removeSubstitute()</slot> + </connection> + <connection> + <sender>effectcheckbox</sender> + <signal>toggled(bool)</signal> + <receiver>effectbase</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>fontembeddingcheckbox</sender> + <signal>toggled(bool)</signal> + <receiver>GroupBox10</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>toolboxeffect</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>dcispin</sender> + <signal>valueChanged(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>cfispin</sender> + <signal>valueChanged(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>wslspin</sender> + <signal>valueChanged(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>menueffect</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>comboeffect</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>tooltipeffect</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>strutwidth</sender> + <signal>valueChanged(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>strutheight</sender> + <signal>valueChanged(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>effectcheckbox</sender> + <signal>toggled(bool)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>resolvelinks</sender> + <signal>toggled(bool)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>fontembeddingcheckbox</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>rtlExtensions</sender> + <signal>toggled(bool)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>inputStyle</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>inputMethodCombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindowBase</receiver> + <slot>somethingModified()</slot> + </connection> + <connection> + <sender>gstylecombo</sender> + <signal>activated(const QString&)</signal> + <receiver>MainWindowBase</receiver> + <slot>styleSelected(const QString&)</slot> + </connection> + <connection> + <sender>familysubcombo</sender> + <signal>activated(const QString&)</signal> + <receiver>MainWindowBase</receiver> + <slot>substituteSelected(const QString&)</slot> + </connection> + <connection> + <sender>btnAdvanced</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>tunePalette()</slot> + </connection> + <connection> + <sender>PushButton11</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>upFontpath()</slot> + </connection> + <connection> + <sender>PushButton7</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>upLibpath()</slot> + </connection> + <connection> + <sender>PushButton2</sender> + <signal>clicked()</signal> + <receiver>MainWindowBase</receiver> + <slot>upSubstitute()</slot> + </connection> +</connections> +<tabstops> + <tabstop>helpview</tabstop> + <tabstop>TabWidget3</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>libpathlineedit</tabstop> + <tabstop>PushButton5</tabstop> + <tabstop>PushButton6</tabstop> + <tabstop>PushButton7</tabstop> + <tabstop>PushButton8</tabstop> + <tabstop>PushButton9</tabstop> + <tabstop>sublistbox</tabstop> + <tabstop>libpathlistbox</tabstop> +</tabstops> +<slots> + <slot access="protected">init()</slot> + <slot access="protected">destroy()</slot> + <slot>addFontpath()</slot> + <slot>addLibpath()</slot> + <slot>addSubstitute()</slot> + <slot>browseFontpath()</slot> + <slot>browseLibpath()</slot> + <slot>buildFont()</slot> + <slot>buildPalette()</slot> + <slot>downFontpath()</slot> + <slot>downLibpath()</slot> + <slot>downSubstitute()</slot> + <slot>familySelected( const QString & )</slot> + <slot>fileExit()</slot> + <slot>fileSave()</slot> + <slot>helpAbout()</slot> + <slot>helpAboutQt()</slot> + <slot>new_slot()</slot> + <slot>pageChanged( QWidget * )</slot> + <slot>paletteSelected( int )</slot> + <slot>removeFontpath()</slot> + <slot>removeLibpath()</slot> + <slot>removeSubstitute()</slot> + <slot>somethingModified()</slot> + <slot>styleSelected( const QString & )</slot> + <slot>substituteSelected( const QString & )</slot> + <slot>tunePalette()</slot> + <slot>upFontpath()</slot> + <slot>upLibpath()</slot> + <slot>upSubstitute()</slot> +</slots> +<pixmapinproject/> +<layoutdefaults spacing="4" margin="8"/> +<includehints> + <includehint>colorbutton.h</includehint> + <includehint>colorbutton.h</includehint> + <includehint>previewframe.h</includehint> +</includehints> +</UI> diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp new file mode 100644 index 0000000..3944970 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -0,0 +1,615 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "paletteeditoradvanced.h" +#include "colorbutton.h" + +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qapplication.h> +#include <qpushbutton.h> +#include <qlistbox.h> +#include <qpainter.h> +#include <qgroupbox.h> + +/*! + Class used by PaletteEditor for bold combobox items +*/ + +class BoldListBoxText : public QListBoxText +{ +public: + BoldListBoxText( QString text, QListBox* lb = 0 ); + +protected: + virtual void paint( QPainter* ); +}; + +BoldListBoxText::BoldListBoxText( QString text, QListBox* lb ) + : QListBoxText( lb ) +{ + setText( text ); +} + +void BoldListBoxText::paint( QPainter* painter ) +{ + QFont f = painter->font(); + f.setBold( TRUE ); + painter->setFont( f ); + + QListBoxText::paint( painter ); +} + +PaletteEditorAdvanced::PaletteEditorAdvanced( QWidget * parent, + const char * name, bool modal, WFlags f ) + : PaletteEditorAdvancedBase( parent, name, modal, f ), selectedPalette(0) +{ + 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::Background; + case 1: + return QColorGroup::Foreground; + 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; + case 9: + return QColorGroup::Link; + case 10: + return QColorGroup::LinkVisited; + 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 = 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, darkGray ); + cg.setColor( QColorGroup::Foreground, darkGray ); + cg.setColor( QColorGroup::Text, darkGray ); + cg.setColor( QColorGroup::HighlightedText, 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 = 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( BackgroundMode mode ) +{ + int initRole = 0; + + switch( mode ) { + case PaletteBackground: + initRole = 0; + break; + case PaletteForeground: + initRole = 1; + break; + case PaletteButton: + initRole = 2; + break; + case PaletteBase: + initRole = 3; + break; + case PaletteText: + initRole = 4; + break; + case PaletteBrightText: + initRole = 5; + break; + case PaletteButtonText: + initRole = 6; + break; + case PaletteHighlight: + initRole = 7; + break; + case PaletteHighlightedText: + initRole = 8; + break; + case PaletteLight: + initRole = 9; + break; + case PaletteMidlight: + initRole = 10; + break; + case PaletteDark: + initRole = 11; + break; + case PaletteMid: + initRole = 12; + break; + case PaletteShadow: + initRole = 13; + break; + default: + initRole = -1; + break; + } + + if ( initRole <= -1 ) return; + + if (initRole > 8 ) { + comboEffect->setCurrentItem( initRole - 9 ); + if ( comboEffect->listBox() ) { + QString text = comboEffect->currentText(); + comboEffect->listBox()->changeItem( new BoldListBoxText( text ), initRole - 9 ); + } + } + else { + comboCentral->setCurrentItem( initRole ); + if ( comboCentral->listBox() ) { + QString text = comboCentral->currentText(); + comboCentral->listBox()->changeItem( new BoldListBoxText( text ), initRole ); + } + } +} + +QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init, + 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; +} diff --git a/tools/qtconfig/paletteeditoradvanced.h b/tools/qtconfig/paletteeditoradvanced.h new file mode 100644 index 0000000..aca4632 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvanced.h @@ -0,0 +1,98 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef PALETTEEDITORADVANCED_H +#define PALETTEEDITORADVANCED_H + +#include "paletteeditoradvancedbase.h" + +class PaletteEditorAdvanced : public PaletteEditorAdvancedBase +{ + Q_OBJECT +public: + PaletteEditorAdvanced( QWidget * parent=0, const char * name=0, + bool modal=FALSE, WFlags f=0 ); + ~PaletteEditorAdvanced(); + + static QPalette getPalette( bool *ok, const QPalette &pal, BackgroundMode mode = 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( BackgroundMode ); + + QPalette pal() const; + void setPal( const QPalette& ); + + QColorGroup::ColorRole centralFromItem( int ); + QColorGroup::ColorRole effectFromItem( int ); + QPalette editPalette; + QPalette previewPalette; + + int selectedPalette; +}; + +#endif diff --git a/tools/qtconfig/paletteeditoradvancedbase.ui b/tools/qtconfig/paletteeditoradvancedbase.ui new file mode 100644 index 0000000..61f97b5 --- /dev/null +++ b/tools/qtconfig/paletteeditoradvancedbase.ui @@ -0,0 +1,682 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>PaletteEditorAdvancedBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Designer. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="QDialog"> + <property name="name"> + <cstring>PaletteEditorAdvancedBase</cstring> + </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="caption"> + <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> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="frameShape"> + <enum>MShape</enum> + </property> + <property name="frameShadow"> + <enum>MShadow</enum> + </property> + <property name="text"> + <string>Select &Palette:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>paletteCombo</cstring> + </property> + </widget> + <widget class="QComboBox"> + <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> + <property name="name"> + <cstring>paletteCombo</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>4</vsizetype> + </sizepolicy> + </property> + <property name="title"> + <string>Auto</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkBuildInactive</cstring> + </property> + <property name="text"> + <string>Build inactive palette from active.</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkBuildDisabled</cstring> + </property> + <property name="text"> + <string>Build disabled palette from active.</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupCentral</cstring> + </property> + <property name="title"> + <string>Central color &roles</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Background</string> + </property> + </item> + <item> + <property name="text"> + <string>Foreground</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>HighlightText</string> + </property> + </item> + <item> + <property name="text"> + <string>Link</string> + </property> + </item> + <item> + <property name="text"> + <string>LinkVisited</string> + </property> + </item> + <property name="name"> + <cstring>comboCentral</cstring> + </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>Background - general background color.</li> <li>Foreground - 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 forground color used with Base. Usually this is the same as the Foreground, in what case it must provide good contrast both with Background and Base. </li> <li>Button - general button background color, where buttons need a background different from Background, 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 Foreground and contrasts well with e.g. black. </li> </ul> </p></string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout32_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal_Spacing1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>labelCentral</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + </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> + <widget class="ColorButton"> + <property name="name"> + <cstring>buttonCentral</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>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> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupEffect</cstring> + </property> + <property name="title"> + <string>3-D shadow &effects</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout32_3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkBuildEffect</cstring> + </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> + <widget class="QComboBox"> + <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> + <property name="name"> + <cstring>comboEffect</cstring> + </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> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout31_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal_Spacing3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>labelEffect</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + </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> + <widget class="ColorButton"> + <property name="name"> + <cstring>buttonEffect</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>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> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal_Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </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> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </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> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>ColorButton</class> + <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> + <signal>clicked()</signal> + <signal>colorChanged(const QColor &)</signal> + <signal>changed()</signal> + <property type="Color">color</property> + <property type="Pixmap">pixmap</property> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>paletteCombo</sender> + <signal>activated(int)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>paletteSelected(int)</slot> + </connection> + <connection> + <sender>comboCentral</sender> + <signal>activated(int)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onCentral(int)</slot> + </connection> + <connection> + <sender>buttonCentral</sender> + <signal>clicked()</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onChooseCentralColor()</slot> + </connection> + <connection> + <sender>buttonEffect</sender> + <signal>clicked()</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onChooseEffectColor()</slot> + </connection> + <connection> + <sender>comboEffect</sender> + <signal>activated(int)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onEffect(int)</slot> + </connection> + <connection> + <sender>checkBuildEffect</sender> + <signal>toggled(bool)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onToggleBuildEffects(bool)</slot> + </connection> + <connection> + <sender>checkBuildEffect</sender> + <signal>toggled(bool)</signal> + <receiver>comboEffect</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>checkBuildEffect</sender> + <signal>toggled(bool)</signal> + <receiver>buttonEffect</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>checkBuildInactive</sender> + <signal>toggled(bool)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onToggleBuildInactive(bool)</slot> + </connection> + <connection> + <sender>checkBuildDisabled</sender> + <signal>toggled(bool)</signal> + <receiver>PaletteEditorAdvancedBase</receiver> + <slot>onToggleBuildDisabled(bool)</slot> + </connection> + <slot access="protected" language="C++" returnType="void">init()</slot> + <slot access="protected" language="C++" returnType="void">destroy()</slot> + <slot access="protected" language="C++" returnType="void">onCentral(int)</slot> + <slot access="protected" language="C++" returnType="void">onChooseCentralColor()</slot> + <slot access="protected" language="C++" returnType="void">onChooseEffectColor()</slot> + <slot access="protected" language="C++" returnType="void">onEffect(int)</slot> + <slot access="protected" language="C++" returnType="void">onToggleBuildDisabled(bool)</slot> + <slot access="protected" language="C++" returnType="void">onToggleBuildEffects(bool)</slot> + <slot access="protected" language="C++" returnType="void">onToggleBuildInactive(bool)</slot> + <slot access="protected" language="C++" returnType="void">paletteSelected(int)</slot> +</connections> +<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> +</UI> diff --git a/tools/qtconfig/previewframe.cpp b/tools/qtconfig/previewframe.cpp new file mode 100644 index 0000000..a16b566 --- /dev/null +++ b/tools/qtconfig/previewframe.cpp @@ -0,0 +1,63 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "previewframe.h" + +#include <qvbox.h> +#include <qpainter.h> + +PreviewFrame::PreviewFrame( QWidget *parent, const char *name ) + : QVBox( parent, name ) +{ + setMinimumSize(200, 200); + setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + setLineWidth(1); + + Workspace * w = new Workspace( this ); + w->setEraseColor(colorGroup().dark()); + previewWidget = new PreviewWidget( w ); + previewWidget->move( 10, 10 ); +} + +void PreviewFrame::setPreviewPalette(QPalette pal) +{ + previewWidget->setPalette(pal); +} + +void Workspace::paintEvent( QPaintEvent* ) +{ + QPainter p ( this ); + p.setPen( QPen( white ) ); + p.drawText ( 0, height() / 2, width(), height(), AlignHCenter, + "The moose in the noose\nate the goose who was loose." ); +} diff --git a/tools/qtconfig/previewframe.h b/tools/qtconfig/previewframe.h new file mode 100644 index 0000000..f2281a7 --- /dev/null +++ b/tools/qtconfig/previewframe.h @@ -0,0 +1,67 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef PREVIEWFRAME_H +#define PREVIEWFRAME_H + +#include "previewwidget.h" + +#include <qvbox.h> +#include <qworkspace.h> + +class Workspace : public QWorkspace +{ + Q_OBJECT + +public: + Workspace( QWidget* parent = 0, const char* name = 0 ) + : QWorkspace( parent, name ) {} + ~Workspace() {} + +protected: + void paintEvent( QPaintEvent* ); +}; + +class PreviewFrame : public QVBox +{ + Q_OBJECT + +public: + PreviewFrame( QWidget *parent = 0, const char *name = 0 ); + void setPreviewPalette(QPalette); + +private: + PreviewWidget *previewWidget; +}; + +#endif diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp new file mode 100644 index 0000000..cd88a29 --- /dev/null +++ b/tools/qtconfig/previewwidget.cpp @@ -0,0 +1,75 @@ +/********************************************************************** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "previewwidget.h" + +#include <qobjectlist.h> + +PreviewWidget::PreviewWidget( QWidget *parent, const char *name ) + : PreviewWidgetBase( parent, name ) +{ + // install event filter on child widgets + QObjectList *l = queryList("QWidget"); + QObjectListIt it(*l); + QObject * obj; + while ((obj = it.current()) != 0) { + ++it; + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(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; +} diff --git a/tools/qtconfig/previewwidget.h b/tools/qtconfig/previewwidget.h new file mode 100644 index 0000000..ca7e5bd --- /dev/null +++ b/tools/qtconfig/previewwidget.h @@ -0,0 +1,50 @@ +/********************************************************************** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef PREVIEWWIDGET_H +#define PREVIEWWIDGET_H + +#include "previewwidgetbase.h" + +class PreviewWidget : public PreviewWidgetBase +{ + Q_OBJECT + +public: + PreviewWidget( QWidget *parent = 0, const char *name = 0 ); + + void closeEvent(QCloseEvent *); + bool eventFilter(QObject *, QEvent *); +}; + +#endif diff --git a/tools/qtconfig/previewwidgetbase.ui b/tools/qtconfig/previewwidgetbase.ui new file mode 100644 index 0000000..a03df6b --- /dev/null +++ b/tools/qtconfig/previewwidgetbase.ui @@ -0,0 +1,311 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>PreviewWidgetBase</class> +<comment>********************************************************************* +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of Qt Configuration. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free Qt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with +** the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +*********************************************************************</comment> +<widget class="QWidget"> + <property name="name"> + <cstring>PreviewWidgetBase</cstring> + </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> + </sizepolicy> + </property> + <property name="caption"> + <string>Preview Window</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout17</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>ButtonGroup</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton1</cstring> + </property> + <property name="text"> + <string>RadioButton1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton2</cstring> + </property> + <property name="text"> + <string>RadioButton2</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>RadioButton3</cstring> + </property> + <property name="text"> + <string>RadioButton3</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>ButtonGroup2</cstring> + </property> + <property name="title"> + <string>ButtonGroup2</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>CheckBox1</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>CheckBox2</cstring> + </property> + <property name="text"> + <string>CheckBox2</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QProgressBar"> + <property name="name"> + <cstring>ProgressBar1</cstring> + </property> + <property name="progress"> + <number>50</number> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit1</cstring> + </property> + <property name="text"> + <string>LineEdit</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>ComboBox</string> + </property> + </item> + <property name="name"> + <cstring>ComboBox1</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QSpinBox"> + <property name="name"> + <cstring>SpinBox1</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QScrollBar"> + <property name="name"> + <cstring>ScrollBar1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>Slider1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QTextView"> + <property name="name"> + <cstring>textView</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string><p> +<a href="http://www.trolltech.com">http://www.trolltech.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p></string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <slot access="protected" language="C++" returnType="void">init()</slot> + <slot access="protected" language="C++" returnType="void">destroy()</slot> +</connections> +</UI> diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro new file mode 100644 index 0000000..aaef136 --- /dev/null +++ b/tools/qtconfig/qtconfig.pro @@ -0,0 +1,18 @@ +TEMPLATE = app +CONFIG += qt warn_on +LANGUAGE = C++ + +SOURCES += colorbutton.cpp main.cpp previewframe.cpp previewwidget.cpp mainwindow.cpp paletteeditoradvanced.cpp +HEADERS += colorbutton.h previewframe.h previewwidget.h mainwindow.h paletteeditoradvanced.h +FORMS = mainwindowbase.ui paletteeditoradvancedbase.ui previewwidgetbase.ui +IMAGES = images/appicon.png + +PROJECTNAME = Qt Configuration +TARGET = qtconfig +DESTDIR = ../../bin + +target.path=$$bins.path +INSTALLS += target +INCLUDEPATH += . +DBFILE = qtconfig.db +REQUIRES=full-config nocrosscompiler !win32* |