diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /tools/qconfig | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'tools/qconfig')
-rw-r--r-- | tools/qconfig/LICENSE.GPL | 280 | ||||
-rw-r--r-- | tools/qconfig/main.cpp | 733 | ||||
-rw-r--r-- | tools/qconfig/main.h | 86 | ||||
-rw-r--r-- | tools/qconfig/qconfig.pro | 7 |
4 files changed, 1106 insertions, 0 deletions
diff --git a/tools/qconfig/LICENSE.GPL b/tools/qconfig/LICENSE.GPL new file mode 100644 index 000000000..65cb2ad07 --- /dev/null +++ b/tools/qconfig/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 retquired to print an announcement.) + +These retquirements 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 retquired 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/qconfig/main.cpp b/tools/qconfig/main.cpp new file mode 100644 index 000000000..001fa81f7 --- /dev/null +++ b/tools/qconfig/main.cpp @@ -0,0 +1,733 @@ +/********************************************************************** +** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt/Embedded. +** +** 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 TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing retquirements 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 TQt Commercial licenses may use this file in +** accordance with the TQt 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 "main.h" +#include <qapplication.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qlistview.h> +#include <qhbox.h> +#include <qlabel.h> +#include <qmessagebox.h> +#include <qpopupmenu.h> +#include <qmenubar.h> +#include <qtoolbutton.h> +#include <qstatusbar.h> +#include <qsplitter.h> +#include <qregexp.h> +#if defined(Q_OS_WIN32) +#include <direct.h> +#else +#include <unistd.h> +#endif +#include <stdlib.h> + + +/* XPM */ +static const char * const logo_xpm[] = { +/* width height ncolors chars_per_pixel */ +"50 50 17 1", +/* colors */ +" c #000000", +". c #495808", +"X c #2A3304", +"o c #242B04", +"O c #030401", +"+ c #9EC011", +"@ c #93B310", +"# c #748E0C", +"$ c #A2C511", +"% c #8BA90E", +"& c #99BA10", +"* c #060701", +"= c #181D02", +"- c #212804", +"; c #61770A", +": c #0B0D01", +"/ c None", +/* pixels */ +"/$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$+++$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$@;.o=::=o.;@$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$+#X* **X#+$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$#oO* O **o#+$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$&.* OO O*.&$$$$$$$$$$$$$", +"$$$$$$$$$$$$@XOO * OO X&$$$$$$$$$$$$", +"$$$$$$$$$$$@XO OO O **:::OOO OOO X@$$$$$$$$$$$", +"$$$$$$$$$$&XO O-;#@++@%.oOO X&$$$$$$$$$$", +"$$$$$$$$$$.O : *-#+$$$$$$$$+#- : O O*.$$$$$$$$$$", +"$$$$$$$$$#*OO O*.&$$$$$$$$$$$$+.OOOO **#$$$$$$$$$", +"$$$$$$$$+-OO O *;$$$$$$$$$$$&$$$$;* o+$$$$$$$$", +"$$$$$$$$#O* O .+$$$$$$$$$$@X;$$$+.O *#$$$$$$$$", +"$$$$$$$$X* -&$$$$$$$$$$@- :;$$$&- OX$$$$$$$$", +"$$$$$$$@*O *O#$$$$$$$$$$@oOO**;$$$# O*%$$$$$$$", +"$$$$$$$; -+$$$$$$$$$@o O OO ;+$$-O *;$$$$$$$", +"$$$$$$$. ;$$$$$$$$$@-OO OO X&$$;O .$$$$$$$", +"$$$$$$$o *#$$$$$$$$@o O O O-@$$$#O *o$$$$$$$", +"$$$$$$+= *@$$$$$$$@o* OO -@$$$$&: =$$$$$$$", +"$$$$$$+: :+$$$$$$@- *-@$$$$$$: :+$$$$$$", +"$$$$$$+: :+$$$$$@o* O *-@$$$$$$: :+$$$$$$", +"$$$$$$$= :@$$$$@o*OOO -@$$$$@: =+$$$$$$", +"$$$$$$$- O%$$$@o* O O O O-@$$$#* OX$$$$$$$", +"$$$$$$$. O *O;$$&o O*O* *O -@$$; O.$$$$$$$", +"$$$$$$$;* Oo+$$;O*O:OO-- Oo@+= *;$$$$$$$", +"$$$$$$$@* O O#$$$;*OOOo@@-O Oo;O* **@$$$$$$$", +"$$$$$$$$X* OOO-+$$$;O o@$$@- O O OX$$$$$$$$", +"$$$$$$$$#* * O.$$$$;X@$$$$@-O O O#$$$$$$$$", +"$$$$$$$$+oO O OO.+$$+&$$$$$$@-O o+$$$$$$$$", +"$$$$$$$$$#* **.&$$$$$$$$$$@o OO:#$$$$$$$$$", +"$$$$$$$$$+. O* O-#+$$$$$$$$+;O OOO:@$$$$$$$$$", +"$$$$$$$$$$&X *O -;#@++@#;=O O -@$$$$$$$$", +"$$$$$$$$$$$&X O O*O::::O OO Oo@$$$$$$$", +"$$$$$$$$$$$$@XOO OO O*X+$$$$$$", +"$$$$$$$$$$$$$&.* ** O :: *:#$$$$$$$", +"$$$$$$$$$$$$$$$#o*OO O Oo#@-OOO=#$$$$$$$$", +"$$$$$$$$$$$$$$$$+#X:* * O**X#+$$@-*:#$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$%;.o=::=o.#@$$$$$$@X#$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$+++$$$$$$$$$$$+$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", +"/$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/", +}; + + +#define FIXED_LAYOUT + +static const char*back_xpm[]={ +"16 16 5 1", +"# c #000000", +"a c #ffffff", +"c c #808080", +"b c #c0c0c0", +". c None", +"................", +".......#........", +"......##........", +".....#a#........", +"....#aa########.", +"...#aabaaaaaaa#.", +"..#aabbbbbbbbb#.", +"...#abbbbbbbbb#.", +"...c#ab########.", +"....c#a#ccccccc.", +".....c##c.......", +"......c#c.......", +".......cc.......", +"........c.......", +"................", +"......................"}; + +static const char*forward_xpm[]={ +"16 16 5 1", +"# c #000000", +"a c #ffffff", +"c c #808080", +"b c #c0c0c0", +". c None", +"................", +"................", +".........#......", +".........##.....", +".........#a#....", +"..########aa#...", +"..#aaaaaaabaa#..", +"..#bbbbbbbbbaa#.", +"..#bbbbbbbbba#..", +"..########ba#c..", +"..ccccccc#a#c...", +"........c##c....", +"........c#c.....", +"........cc......", +"........c.......", +"................", +"................"}; + +class ChoiceItem : public TQCheckListItem { +public: + TQString id; + ChoiceItem(const TQString& i, TQListViewItem* parent) : + TQCheckListItem(parent, + i.mid(6), // strip "QT_NO_" as we reverse the logic + CheckBox), + id(i) + { + setOpen(TRUE); + label = text(0); + avl = TRUE; + } + + // We reverse the logic + void setDefined(bool y) { setOn(!y); } + bool isDefined() const { return !isOn(); } + + void setAvailable(bool y) + { + if ( avl != y ) { + avl = y; + repaint(); + } + } + bool isAvailable() const { return avl; } + + virtual void setOn(bool y) + { + TQCheckListItem::setOn(y); + setOpen(y); +/* + for (TQListViewItem* i=firstChild(); i; i = i->nextSibling() ) { + ChoiceItem* ci = (ChoiceItem*)i; // all are ChoiceItem + if ( ci->isSelectable() != y ) { + ci->setSelectable(y); + listView()->repaintItem(ci); + } + } +*/ + } + + void paintBranches( TQPainter * p, const TQColorGroup & cg, + int w, int y, int h) + { + TQListViewItem::paintBranches(p,cg,w,y,h); + } + + void paintCell( TQPainter * p, const TQColorGroup & cg, + int column, int width, int align ) + { + if ( !isSelectable() || !isAvailable() ) { + TQColorGroup c = cg; + c.setColor(TQColorGroup::Text, lightGray); + TQCheckListItem::paintCell(p,c,column,width,align); + } else { + TQCheckListItem::paintCell(p,cg,column,width,align); + } + } + + void setInfo(const TQString& l, const TQString& d) + { + label = l; + doc = d; + setText(0,label); + } + + TQString label; + + TQString info() const + { + return "<h2>"+label+"</h2>"+doc; + } + +private: + TQString doc; + bool avl; +}; + +Main::Main() +{ + setIcon( (const char**)logo_xpm ); +#ifdef FIXED_LAYOUT + TQHBox* horizontal = new TQHBox(this); +#else + TQSplitter* horizontal = new TQSplitter(this); +#endif + + lv = new TQListView(horizontal); + lv->setSorting(-1); + lv->setRootIsDecorated(TRUE); + lv->addColumn("ID"); + + info = new Info(horizontal); + info->setBackgroundMode(PaletteBase); + info->setMargin(10); + info->setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken); + info->setAlignment(AlignTop); + + connect(info, SIGNAL(idClicked(const TQString&)), + this, SLOT(selectId(const TQString&))); + +#ifdef FIXED_LAYOUT + horizontal->setStretchFactor(info,2); +#endif + + connect(lv, SIGNAL(pressed(TQListViewItem*)), + this, SLOT(updateAvailability(TQListViewItem*))); + connect(lv, SIGNAL(selectionChanged(TQListViewItem*)), + this, SLOT(showInfo(TQListViewItem*))); + + setCentralWidget(horizontal); + + TQToolBar* tb = new TQToolBar( this, "browser controls" ); + tb->setLabel( "Browser Controls" ); + (void)new TQToolButton( TQPixmap(back_xpm), "Back", TQString::null, + info, SLOT(back()), tb, "back" ); + (void)new TQToolButton( TQPixmap(forward_xpm), "Forward", TQString::null, + info, SLOT(forward()), tb, "forward" ); + + TQPopupMenu* file = new TQPopupMenu( menuBar() ); + file->insertItem( "&Open", this, SLOT(open()), CTRL+Key_O ); + file->insertItem( "&Save", this, SLOT(save()), CTRL+Key_S ); + file->insertSeparator(); + file->insertItem( "&Test all", this, SLOT(testAll()), CTRL+Key_T ); + file->insertSeparator(); + file->insertItem( "E&xit", qApp, SLOT(tquit()), CTRL+Key_Q ); + + menuBar()->insertItem( "&File",file ); + + menuBar()->insertSeparator(); + + TQPopupMenu *help = new TQPopupMenu( menuBar() ); + help->insertItem( "&About", this, SLOT(about()) ); + help->insertItem( "About &TQt", this, SLOT(aboutTQt()) ); + + menuBar()->insertItem( "&Help", help ); + + statusBar()->message( "Ready" ); +} + +void Main::open() +{ +} + +void Main::save() +{ +} + +void Main::testAll() +{ + TQString qtdir = getenv("QTDIR"); + chdir((qtdir+"/src").ascii()); + TQString c; + for (TQStringList::ConstIterator it = choices.begin(); it != choices.end(); ++it) + { + c += "Feature: "; + c += *it; + c += "\n"; + + c += "Section: "; + c += section[*it]; + c += "\n"; + + c += "Retquires: "; + c += dependencies[*it].join(" "); + c += "\n"; + + c += "Name: "; + c += label[*it]; + c += "\n"; + + c += "SeeAlso: ???\n"; + + c += "\n"; + } + TQFile f("features.txt"); + f.open(IO_WriteOnly); + f.writeBlock(c.ascii(),c.length()); + f.close(); + // system("./feature_size_calculator"); + +#if 0 + system("mv ../include/qconfig.h ../include/qconfig.h-orig"); + for (TQStringList::ConstIterator it = choices.begin(); it != choices.end(); ++it) + { + TQString choice = *it; + TQFile f("../include/qconfig.h"); + f.open(IO_WriteOnly); + TQCString s = "#define "; + s += choice.latin1(); + s += "\n"; + f.writeBlock(s,s.length()); + f.close(); + int err = system("make"); + if ( err != 0 ) + break; + } + system("mv ../include/qconfig.h-orig ../include/qconfig.h"); +#endif +} + + +// ##### should be in TQMap? +template <class K, class D> +TQValueList<K> keys(TQMap<K,D> map) +{ + TQValueList<K> result; + for (Q_TYPENAME TQMap<K,D>::ConstIterator it = map.begin(); it!=map.end(); ++it) + result.append(it.key()); + return result; +} + +void Main::loadFeatures(const TQString& filename) +{ + TQFile file(filename); + if ( !file.open(IO_ReadOnly) ) { + TQMessageBox::warning(this,"Warning", + "Cannot open file " + filename); + return; + } + TQTextStream s(&file); + TQRegExp qt_no_xxx("QT_NO_[A-Z_0-9]*"); + TQStringList sections; + +#if 1 + TQString line = s.readLine(); + TQString feature, lab, sec; + TQStringList deps, seealso; + TQMap<TQString,TQStringList> sectioncontents; + while (!s.atEnd()) { + if ( line.length() <= 1 ) { + if ( !feature.isEmpty() ) { + dependencies[feature] = deps; + for (TQStringList::ConstIterator it = deps.begin(); it!=deps.end(); ++it) + rdependencies[*it].append(feature); + label[feature] = lab; + links[feature] = seealso; + section[feature] = sec; + sectioncontents[sec].append(feature); + choices.append(feature); + } else { + qDebug("Unparsed text"); + } + + feature = lab = sec = TQString::null; + deps.clear(); seealso.clear(); + line = s.readLine(); + continue; + } + + TQString nextline = s.readLine(); + while ( nextline[0] == ' ' ) { + line += nextline; + nextline = s.readLine(); + } + + int colon = line.find(':'); + if ( colon < 0 ) { + qDebug("Cannot parse: %s",line.ascii()); + } else { + TQString tag = line.left(colon); + TQString value = line.mid(colon+1).stripWhiteSpace(); + if ( tag == "Feature" ) + feature = value; + else if ( tag == "Retquires" ) + deps = TQStringList::split(TQChar(' '),value); + else if ( tag == "Name" ) + lab = value; + else if ( tag == "Section" ) + sec = value; + else if ( tag == "SeeAlso" ) + seealso = TQStringList::split(TQChar(' '),value); + } + + line = nextline; + } + sections = keys(sectioncontents); + +#else + TQString sec; + TQString lab; + TQString doc; + bool on = FALSE; + bool docmode = FALSE; + TQStringList deps; + + do { + TQString line = s.readLine(); + line.replace(TQRegExp("# *define"),"#define"); + + TQStringList token = TQStringList::split(TQChar(' '),line); + if ( on ) { + if ( docmode ) { + if ( token[0] == "*/" ) + docmode = FALSE; + else if ( lab.isEmpty() ) + lab = line.stripWhiteSpace(); + else + doc += line.simplifyWhiteSpace() + "\n"; + } else if ( token[0] == "//#define" || token[0] == "#define" ) { + dependencies[token[1]] = deps; + for (TQStringList::ConstIterator it = deps.begin(); it!=deps.end(); ++it) + rdependencies[*it].append(token[1]); + section[token[1]] = sec; + documentation[token[1]] = doc; + label[token[1]] = lab; + choices.append(token[1]); + doc = ""; + lab = ""; + } else if ( token[0] == "/*!" ) { + docmode = TRUE; + } else if ( token[0] == "//" ) { + token.remove(token.begin()); + sec = token.join(" "); + sections.append(sec); + } else if ( token[0] == "#if" ) { + Q_ASSERT(deps.isEmpty()); + for (int i=1; i<(int)token.count(); i++) { + if ( token[i][0] == 'd' ) { + int index; + int len; + index = qt_no_xxx.match(token[i],0,&len); + if ( index >= 0 ) { + TQString d = token[i].mid(index,len); + deps.append(d); + } + } + } + } else if ( token[0] == "#endif" ) { + deps.clear(); + } else if ( token[0].isEmpty() ) { + } else { + qDebug("Cannot parse: %s",token.join(" ").ascii()); + } + } else if ( token[0] == "#include" ) { + on = TRUE; + } + } while (!s.atEnd()); +#endif + + lv->clear(); + sections.sort(); + // ##### TQListView default sort order is reverse of insertion order + for (TQStringList::Iterator se = sections.fromLast(); se != sections.end(); --se) { + sectionitem[*se] = new TQListViewItem(lv,*se); + } + for (TQStringList::Iterator ch = choices.begin(); ch != choices.end(); ++ch) { + createItem(*ch); + } + +#ifdef FIXED_LAYOUT + lv->setFixedWidth(lv->sizeHint().width()); +#endif +} + +void Main::createItem(const TQString& ch) +{ + if ( !item[ch] ) { + TQStringList deps = dependencies[ch]; + TQString sec = section[ch]; + TQListViewItem* parent = 0; + for (TQStringList::Iterator dp = deps.begin(); dp != deps.end(); ++dp) { + TQString dsec = section[*dp]; + if ( dsec.isEmpty() ) + qDebug("No section for %s",(*dp).latin1()); + if ( !parent && dsec == sec ) { + createItem(*dp); + parent = item[*dp]; + } + } + if ( !parent ) + parent = sectionitem[section[ch]]; + ChoiceItem* ci = new ChoiceItem(ch,parent); + item[ch] = ci; + if ( !label[ch].isEmpty() ) + ci->setInfo(label[ch],documentation[ch]); + } +} + +void Main::loadConfig(const TQString& filename) +{ + TQFile file(filename); + if ( !file.open(IO_ReadOnly) ) { + TQMessageBox::warning(this,"Warning", + "Cannot open file " + filename); + return; + } + TQTextStream s(&file); + TQRegExp qt_no_xxx("QT_NO_[A-Z_0-9]*"); + + for (TQStringList::Iterator ch = choices.begin(); ch != choices.end(); ++ch) { + item[*ch]->setDefined(FALSE); + } + do { + TQString line = s.readLine(); + TQStringList token = TQStringList::split(TQChar(' '),line); + if ( token[0] == "#define" ) { + ChoiceItem* i = item[token[1]]; + if ( i ) + i->setDefined(TRUE); + else + qDebug("The item %s is not used by qfeatures.h", token[1].latin1()); + } + } while (!s.atEnd()); +} + +void Main::updateAvailability(TQListViewItem* i) +{ + if ( !i || !i->parent() ) { + // section. do nothing for now + } else { + ChoiceItem* choice = (ChoiceItem*)i; + TQStringList deps = rdependencies[choice->id]; + for (TQStringList::ConstIterator it = deps.begin(); + it != deps.end(); ++it) + { + ChoiceItem* d = item[*it]; + TQStringList ddeps = dependencies[d->id]; + bool av = TRUE; + for (TQStringList::ConstIterator dit = ddeps.begin(); + av && dit != ddeps.end(); ++dit) + { + ChoiceItem* dd = item[*dit]; + if ( dd ) { + if ( dd->isDefined() || !dd->isAvailable() ) + av = FALSE; + } else + qDebug("%s ???",(*dit).latin1()); + } + if ( d->isAvailable() != av ) { + d->setAvailable(av); + updateAvailability(d); + } + } +qDebug("%s: %d",choice->id.latin1(),choice->isAvailable()); + } +} + +void Main::showInfo(TQListViewItem* i) +{ + if ( !i ) + return; + if ( !i->parent() ) { + // section. do nothing for now + } else { + ChoiceItem* choice = (ChoiceItem*)i; + TQString i = choice->info(); + TQStringList deps = dependencies[choice->id]; + if ( !deps.isEmpty() ) { + i += "<h3>Retquires:</h3><ul>"; + for (TQStringList::ConstIterator it = deps.begin(); + it != deps.end(); ++it) + { + ChoiceItem* d = item[*it]; + if ( d ) { + bool got = d->isAvailable() && !d->isDefined(); + i += "<li>"; + if ( !got ) i += "<font color=red>"; + i += "<a href=id://"+d->id+">"+d->label+"</a>"; + if ( !got ) i += "</font>"; + } + } + i += "</ul>"; + } + TQStringList rdeps = rdependencies[choice->id]; + if ( !rdeps.isEmpty() ) { + i += "<h3>Retquired for:</h3><ul>"; + for (TQStringList::ConstIterator it = rdeps.begin(); + it != rdeps.end(); ++it) + { + ChoiceItem* d = item[*it]; + if ( d ) + i += "<li><a href=id://"+d->id+">"+d->label+"</a>"; + } + i += "</ul>"; + } + info->setText(i); + } +} + +void Main::selectId(const TQString& id) +{ + TQListViewItem* it = item[id]; + if ( it ) { + lv->setSelected(it,TRUE); + lv->ensureItemVisible(it); + } +} + +Info::Info( TQWidget* parent, const char* name ) : + TQTextBrowser(parent, name) +{ +} + +void Info::setSource(const TQString& name) +{ + if ( name.left(5) == "id://" ) { + emit idClicked(name.mid(5,name.length()-6)); // skip trailing "/" too + } else { + TQTextBrowser::setSource(name); + } +} + +void Main::about() +{ + TQMessageBox::about(this, "About qconfig", + "<p><b><font size=+2>TQt/Embedded build configuration</font></b></p>" + "<p></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>" + ); +} + +void Main::aboutTQt() +{ + TQMessageBox::aboutTQt( this, tr("qconfig") ); +} + +int main(int argc, char** argv) +{ + TQApplication app(argc,argv); + Main m; + TQString qtdir = getenv("QTDIR"); + TQString qfeatures = qtdir + "/src/tools/qfeatures.txt"; + //TQString qfeatures = qtdir + "/include/qfeatures.h"; + TQString qconfig = qtdir + "/include/qconfig.h"; + for (int i=1; i<argc; i++) { + TQString arg = argv[i]; + if ( arg == "-f" && i+i<argc ) { + qfeatures = argv[++i]; + } else { + qconfig = argv[i]; + } + } + m.loadFeatures(qfeatures); + m.loadConfig(qconfig); + m.resize(m.sizeHint()+TQSize(500,300)); + app.setMainWidget(&m); + m.show(); + return app.exec(); +} diff --git a/tools/qconfig/main.h b/tools/qconfig/main.h new file mode 100644 index 000000000..c23e59910 --- /dev/null +++ b/tools/qconfig/main.h @@ -0,0 +1,86 @@ +/********************************************************************** +** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt/Embedded. +** +** 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 TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing retquirements 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 TQt Commercial licenses may use this file in +** accordance with the TQt 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 <qmainwindow.h> +#include <qmap.h> +#include <qstringlist.h> +#include <qtextbrowser.h> + +class ChoiceItem; +class TQListViewItem; +class TQListView; +class TQLabel; + +class Info : public TQTextBrowser { + Q_OBJECT +public: + Info( TQWidget* parent, const char* name=0 ); + +signals: + void idClicked(const TQString& name); + +public slots: + void setSource(const TQString& name); +}; + +class Main : public TQMainWindow { + Q_OBJECT +public: + Main(); + void loadFeatures(const TQString& filename); + void loadConfig(const TQString& filename); + +private: + void createItem(const TQString& ch); + TQMap<TQString,TQString> label; + TQMap<TQString,TQString> documentation; + TQMap<TQString,TQStringList> links; + TQMap<TQString,TQStringList> dependencies; + TQMap<TQString,TQStringList> rdependencies; + TQMap<TQString,TQString> section; + TQMap<TQString,ChoiceItem*> item; + TQMap<TQString,TQListViewItem*> sectionitem; + TQStringList choices; + TQListView* lv; + TQTextBrowser* info; + +private slots: + void updateAvailability(TQListViewItem* i); + void showInfo(TQListViewItem* i); + void selectId(const TQString&); + void open(); + void save(); + void testAll(); + void about(); + void aboutTQt(); +}; diff --git a/tools/qconfig/qconfig.pro b/tools/qconfig/qconfig.pro new file mode 100644 index 000000000..bc0527329 --- /dev/null +++ b/tools/qconfig/qconfig.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +CONFIG += qt warn_on release +HEADERS = main.h +SOURCES = main.cpp +INTERFACES = +TARGET = qconfig +REQUIRES=full-config nocrosscompiler |