1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/aboutdialog.cpp Tue Jun 06 14:58:11 2006 +0000
1.3 @@ -0,0 +1,208 @@
1.4 +#include <qmime.h>
1.5 +#include <q3process.h>
1.6 +//Added by qt3to4:
1.7 +#include <Q3VBoxLayout>
1.8 +#include <Q3Frame>
1.9 +
1.10 +#include "aboutdialog.h"
1.11 +#include "version.h"
1.12 +#include "settings.h"
1.13 +#include "mainwindow.h"
1.14 +
1.15 +
1.16 +extern Main *mainWindow;
1.17 +extern Settings settings;
1.18 +extern QString iconPath;
1.19 +
1.20 +AboutDialog::AboutDialog( QWidget *parent, const char *name)
1.21 + : QDialog( parent, name)
1.22 +{
1.23 +
1.24 + mainLayout=new QVBoxLayout( this, 10);
1.25 +
1.26 + tabs=new QTabWidget (this);
1.27 + credits=new AboutTextBrowser (tabs,"credits");
1.28 +
1.29 + credits->setText (
1.30 + "<center><img src=\""+iconPath+"vym-128x128.png\"></center>"
1.31 + "<h3><center>VYM - View Your Mind </h3>"
1.32 + "<p align=\"center\"> A tool to put the things you have got in your mind into a map.</p>"
1.33 + "<p align=\"center\"> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</p>"
1.34 + "<p align=\"center\"> Version " __VYM_VERSION" - " __BUILD_DATE"</p>"
1.35 + "<ul>"
1.36 + "<li> Contact</li>"
1.37 + "<ul>"
1.38 + "<li> vym homepage:<br> <a href=\"http://www.InSilmaril.de/vym\">"
1.39 + "http://www.InSilmaril.de/vym</a></li>"
1.40 + "<li> Project homepage on Sourceforge:<br> <a href=\"http://sourceforge.net/projects/vym/\">"
1.41 + "http://sourceforge.net/projects/vym/</a></li>"
1.42 + "<li> Mailinglists are also on Sourceforge:"
1.43 + "<ul>"
1.44 + "<li>Please ask general questions about vym on "
1.45 + "<a href=\"mailto:vym-forum@lists.sourceforge.net\">vym-forum</a></li>"
1.46 + "<li>Subscribe/Unsubscribe and archives can be found <a href=\"https://sourceforge.net/mail/?group_id=127802\">here</a></li>"
1.47 + "</ul>"
1.48 + "</ul>"
1.49 + "<li> Credits "
1.50 + "<ul>"
1.51 + "<li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a> for <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
1.52 + "<li>Jakob Hilmer for image drag and drop, "About vym" window patch </li>"
1.53 + "<li>Thomas Schraitle for the stylesheet used for XHTML-export </li>"
1.54 + "<li>Debianization by Christoph Thielecke and Steffen Joeris</li>"
1.55 + "<li>Clemens Kraus for HTML-export "
1.56 + "<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
1.57 + "<li>Ken Wimer and Olaf Hering for Mac support</li>"
1.58 + "</ul>"
1.59 + "</li>");
1.60 + credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
1.61 + tabs->addTab (credits,"Credits");
1.62 +
1.63 + license=new AboutTextBrowser (tabs,"license");
1.64 + //license->setTextFormat (PlainText);
1.65 + license->setText (
1.66 + "<h3>VYM - View Your Mind</h3>"
1.67 + "<p>Copyright (C) 2004-2005 Uwe Drechsel</p>"
1.68 +
1.69 + "<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>"
1.70 +
1.71 + "<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License below for more details.</p>"
1.72 +
1.73 + "<p>In addition, as a special exception, Uwe Drechsel gives permission to link the code of this program with the QT libraries from trolltech.com (or with modified versions of QT that use the same license as QT), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than QT. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.</p> "
1.74 +
1.75 + "<p>Uwe Drechsel can be contacted at <a href=\"mailto:vym@insilmaril.de\">vym@insilmaril.de</a></p>"
1.76 +
1.77 + "<hr>"
1.78 +
1.79 + "<p align=\"center\">GNU GENERAL PUBLIC LICENSE<br>"
1.80 +"Version 2, June 1991</p>"
1.81 +
1.82 +"<p align=\"center\">Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
1.83 +
1.84 +"<p align=\"center\"> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p>"
1.85 +
1.86 +"<p align=\"center\">Preamble</p>"
1.87 +
1.88 +"<p>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.</p>"
1.89 +
1.90 +"<p>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.</p>"
1.91 +
1.92 +"<p> 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.</p>"
1.93 +
1.94 +"<p> 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.</p>"
1.95 +
1.96 +"<p> 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.</p>"
1.97 +
1.98 +"<p> 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.</p>"
1.99 +
1.100 +"<p> 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.</p>"
1.101 +
1.102 +"<p> The precise terms and conditions for copying, distribution and modification follow.</p>"
1.103 +
1.104 +"<p align=\"center\"> GNU GENERAL PUBLIC LICENSE</p>"
1.105 +"<p align=\"center\"> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</p>"
1.106 +
1.107 +"<p> 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\".</p>"
1.108 +
1.109 +"<p>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.</p>"
1.110 +
1.111 +"<p> 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.</p>"
1.112 +
1.113 +"<p>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.</p>"
1.114 +
1.115 +"<p> 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:"
1.116 +"<ol type=\"a\">"
1.117 + "<li> You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.</li>"
1.118 +
1.119 + "<li> 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.</li>"
1.120 +
1.121 + "<li> 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.)</li>"
1.122 +"</ol>"
1.123 +"</p>"
1.124 +
1.125 +"<p>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.</p>"
1.126 +
1.127 +"<p>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.</p>"
1.128 +
1.129 +"<p>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.</p>"
1.130 +
1.131 +"<p> 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:" "<ol type=\"a\">"
1.132 +
1.133 +" <li> 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,</li>"
1.134 +
1.135 +" <li> 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,</li>"
1.136 +
1.137 +" <li> 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.)</li>"
1.138 +"</ol></p>"
1.139 +
1.140 +"<p>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.</p>"
1.141 +
1.142 +"<p>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.</p>"
1.143 +
1.144 +"<p> 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.</p>"
1.145 +
1.146 +"<p> 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.</p>"
1.147 +
1.148 +"<p> 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.</p>"
1.149 +
1.150 +"<p> 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.</p>"
1.151 +
1.152 +"<p>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.</p>"
1.153 +
1.154 +"<p>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.</p>"
1.155 +
1.156 +"<p>This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</p>"
1.157 +
1.158 +"<p> 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.</p>"
1.159 +
1.160 +"<p> 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.</p>"
1.161 +
1.162 +"<p>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.</p>"
1.163 +
1.164 +"<p> 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.</p>"
1.165 +
1.166 +"<p align=\"center\">NO WARRANTY</p>"
1.167 +
1.168 +"<p> 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.</p>"
1.169 +
1.170 +"<p> 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.</p>"
1.171 +
1.172 +"<p align=\"center\">END OF TERMS AND CONDITIONS</p>"
1.173 +
1.174 + );
1.175 + credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
1.176 + tabs->addTab (license,"License");
1.177 +
1.178 + mainLayout->addWidget (tabs);
1.179 + tabs->showPage (credits);
1.180 +
1.181 + okbutton =new QPushButton (this,"okbutton");
1.182 + okbutton->setText (tr("Ok"));
1.183 + okbutton->setMaximumSize (QSize (50,30));
1.184 + okbutton->setAutoDefault (true);
1.185 + mainLayout->addWidget( okbutton);
1.186 +
1.187 + connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
1.188 +}
1.189 +
1.190 +AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
1.191 + : Q3TextBrowser(parent, name)
1.192 +{
1.193 +
1.194 +}
1.195 +
1.196 +void AboutTextBrowser::setSource(const QString &name)
1.197 +{
1.198 + Q3MimeSourceFactory *factory = Q3MimeSourceFactory::defaultFactory();
1.199 + const QMimeSource *data = factory->data(name);
1.200 + if (data) {
1.201 + Q3TextBrowser::setSource(name);
1.202 + } else {
1.203 + Q3Process *proc = new Q3Process( this );
1.204 + proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
1.205 + proc->addArgument( name);
1.206 +
1.207 + if ( !proc->start() )
1.208 + if (mainWindow->settingsURL() )
1.209 + setSource(name);
1.210 + }
1.211 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/aboutdialog.h Tue Jun 06 14:58:11 2006 +0000
2.3 @@ -0,0 +1,41 @@
2.4 +#ifndef ABOUTDIALOG_H
2.5 +#define ABOUTDIALOG_H
2.6 +
2.7 +#include <qtabwidget.h>
2.8 +#include <q3textbrowser.h>
2.9 +#include <qlayout.h>
2.10 +#include <qdialog.h>
2.11 +#include <qpushbutton.h>
2.12 +#include <qstring.h>
2.13 +
2.14 +class AboutTextBrowser;
2.15 +/////////////////////////////////////////////////////////////////////////////
2.16 +class AboutDialog :public QDialog
2.17 +{
2.18 + Q_OBJECT
2.19 +
2.20 +public:
2.21 + AboutDialog(QWidget* parent = 0, const char* name = 0);
2.22 +
2.23 +private:
2.24 + QTabWidget *tabs;
2.25 + AboutTextBrowser *credits;
2.26 + AboutTextBrowser *license;
2.27 +
2.28 + QLayout *mainLayout;
2.29 + QLayout *topLayout;
2.30 + QLayout *bottomLayout;
2.31 + QPushButton *okbutton;
2.32 +
2.33 +};
2.34 +
2.35 +class AboutTextBrowser : public Q3TextBrowser
2.36 +{
2.37 + Q_OBJECT;
2.38 + public:
2.39 + AboutTextBrowser(QWidget *parent, const char *name = 0);
2.40 + public slots:
2.41 + void setSource(const QString &name);
2.42 +};
2.43 +
2.44 +#endif
3.1 --- a/branchobj.cpp Sun Jan 30 12:58:47 2005 +0000
3.2 +++ b/branchobj.cpp Tue Jun 06 14:58:11 2006 +0000
3.3 @@ -24,13 +24,14 @@
3.4 depth=-1;
3.5 }
3.6
3.7 -BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c)
3.8 +BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c)
3.9 {
3.10 // cout << "Const BranchObj (c) called from MapCenterObj (c)\n";
3.11 + parObj=NULL;
3.12 canvas=c;
3.13 }
3.14
3.15 -BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
3.16 +BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
3.17 {
3.18 // cout << "Const BranchObj (c,p)\n";
3.19 canvas=c;
3.20 @@ -47,16 +48,18 @@
3.21
3.22 BranchObj::~BranchObj ()
3.23 {
3.24 - //cout << "Destr BranchObj\n";
3.25 +// cout << "Destr BranchObj of "<<this<<endl;
3.26 // Check, if this branch was the last child to be deleted
3.27 // If so, unset the scrolled flags
3.28
3.29 BranchObj *po=(BranchObj*)(parObj);
3.30 + BranchObj *bo;
3.31 if (po)
3.32 {
3.33 - BranchObj *bo=((BranchObj*)(parObj))->getLastBranch();
3.34 + bo=((BranchObj*)(parObj))->getLastBranch();
3.35 if (!bo) po->unScroll();
3.36 }
3.37 + clear();
3.38 }
3.39
3.40 bool BranchObj::operator< ( const BranchObj & other )
3.41 @@ -69,7 +72,7 @@
3.42 return angle == other.angle;
3.43 }
3.44
3.45 -int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j)
3.46 +int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
3.47 {
3.48 // Make sure PtrList::find works
3.49 if (i==j) return 0;
3.50 @@ -82,17 +85,15 @@
3.51
3.52 void BranchObj::init ()
3.53 {
3.54 - branch.setAutoDelete (true);
3.55 + branch.setAutoDelete (false);
3.56 floatimage.setAutoDelete (true);
3.57 + xlink.setAutoDelete (false);
3.58
3.59 - absPos=getRandPos();
3.60 - absPos+=parObj->getChildPos();
3.61 -
3.62 - // TODO This should be done in TextObj later
3.63 - QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
3.64 -// font.setPointSize(12);
3.65 - heading->setFont(font );
3.66 -// heading->setText(QObject::tr("new branch"));
3.67 + if (parObj)
3.68 + {
3.69 + absPos=getRandPos();
3.70 + absPos+=parObj->getChildPos();
3.71 + }
3.72
3.73 lastSelectedBranch=-1;
3.74
3.75 @@ -101,8 +102,8 @@
3.76 scrolled=false;
3.77 tmpUnscrolled=false;
3.78
3.79 - url="";
3.80 - vymLink="";
3.81 + includeImagesVer=false;
3.82 + includeImagesHor=false;
3.83 }
3.84
3.85 void BranchObj::copy (BranchObj* other)
3.86 @@ -125,9 +126,6 @@
3.87 tmpUnscrolled=other->tmpUnscrolled;
3.88 setVisibility (other->visible);
3.89
3.90 - url=other->url;
3.91 - vymLink=other->vymLink;
3.92 -
3.93 angle=other->angle;
3.94
3.95 positionBBox();
3.96 @@ -135,8 +133,17 @@
3.97
3.98 void BranchObj::clear()
3.99 {
3.100 - branch.clear();
3.101 floatimage.clear();
3.102 + while (!xlink.isEmpty())
3.103 + deleteXLink (xlink.first() );
3.104 +
3.105 + BranchObj *bo;
3.106 + while (!branch.isEmpty())
3.107 + {
3.108 + bo=branch.first();
3.109 + branch.removeFirst();
3.110 + delete (bo);
3.111 + }
3.112 }
3.113
3.114 int BranchObj::getNum()
3.115 @@ -149,7 +156,12 @@
3.116
3.117 int BranchObj::getNum(BranchObj *bo)
3.118 {
3.119 - return branch.findRef (bo);
3.120 + // keep current pointer in branch,
3.121 + // otherwise save might fail
3.122 + int cur=branch.at();
3.123 + int ind=branch.findRef (bo);
3.124 + branch.at(cur);
3.125 + return ind;
3.126 }
3.127
3.128 int BranchObj::getFloatImageNum(FloatImageObj *fio)
3.129 @@ -167,6 +179,11 @@
3.130 return floatimage.count();
3.131 }
3.132
3.133 +int BranchObj::countXLinks()
3.134 +{
3.135 + return xlink.count();
3.136 +}
3.137 +
3.138 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
3.139 {
3.140 // Temporary link to lmo
3.141 @@ -181,19 +198,10 @@
3.142 // ignore mapcenter and mainbranch
3.143 if (lmo->getDepth()<2) off=0;
3.144 if (off==0)
3.145 - {
3.146 link2ParPos=false;
3.147 - parObj=o;
3.148 - }
3.149 else
3.150 - {
3.151 link2ParPos=true;
3.152 - if (off>0)
3.153 - parObj=o->getParObj();
3.154 - else
3.155 - parObj=o->getParObj();
3.156 - parObj=o;
3.157 - }
3.158 + parObj=o;
3.159
3.160 depth=parObj->getDepth()+1;
3.161
3.162 @@ -254,6 +262,7 @@
3.163 parObjTmpBuf=NULL;
3.164 depth=parObj->getDepth()+1;
3.165 setLinkStyle (getDefLinkStyle() );
3.166 + updateLink();
3.167 }
3.168 }
3.169
3.170 @@ -350,6 +359,7 @@
3.171 standardFlags->setVisibility(v);
3.172 LinkableMapObj::setVisibility (v);
3.173
3.174 + // Only change childs, if I am not scrolled
3.175 if (!scrolled && (depth < toDepth))
3.176 {
3.177 // Now go recursivly through all childs
3.178 @@ -359,9 +369,11 @@
3.179 FloatImageObj *fio;
3.180 for (fio=floatimage.first(); fio; fio=floatimage.next())
3.181 fio->setVisibility (v);
3.182 + XLinkObj* xlo;
3.183 + for (xlo=xlink.first(); xlo;xlo=xlink.next() )
3.184 + xlo->setVisibility ();
3.185 }
3.186 } // depth <= toDepth
3.187 - move (absPos.x(), absPos.y() );
3.188 requestReposition();
3.189 }
3.190
3.191 @@ -376,25 +388,21 @@
3.192 // Overloaded from LinkableMapObj
3.193 // BranchObj can use color of heading
3.194
3.195 - if (mapEditor->getLinkColorHint()==HeadingColor)
3.196 - LinkableMapObj::setLinkColor (heading->getColor() );
3.197 - else
3.198 - LinkableMapObj::setLinkColor ();
3.199 + if (mapEditor)
3.200 + if (mapEditor->getLinkColorHint()==HeadingColor)
3.201 + LinkableMapObj::setLinkColor (heading->getColor() );
3.202 + else
3.203 + LinkableMapObj::setLinkColor ();
3.204 }
3.205
3.206 -void BranchObj::setColor (QColor col, bool colorChilds)
3.207 +void BranchObj::setColorChilds (QColor col)
3.208 {
3.209 - heading->setColor(col);
3.210 - setLinkColor();
3.211 - if (colorChilds)
3.212 - {
3.213 - BranchObj *bo;
3.214 - for (bo=branch.first(); bo; bo=branch.next() )
3.215 - bo->setColor(col,colorChilds);
3.216 - }
3.217 + OrnamentedObj::setColor (col);
3.218 + BranchObj *bo;
3.219 + for (bo=branch.first(); bo; bo=branch.next() )
3.220 + bo->setColorChilds(col);
3.221 }
3.222
3.223 -
3.224 BranchObj* BranchObj::first()
3.225 {
3.226 itLast=NULL;
3.227 @@ -521,10 +529,20 @@
3.228 itLast=it;
3.229 }
3.230
3.231 +void BranchObj::positionContents()
3.232 +{
3.233 + FloatImageObj *fio;
3.234 + for (fio=floatimage.first(); fio; fio=floatimage.next() )
3.235 + fio->reposition();
3.236 + OrnamentedObj::positionContents();
3.237 +}
3.238
3.239 void BranchObj::move (double x, double y)
3.240 {
3.241 OrnamentedObj::move (x,y);
3.242 + FloatImageObj *fio;
3.243 + for (fio=floatimage.first(); fio; fio=floatimage.next() )
3.244 + fio->reposition();
3.245 positionBBox();
3.246 }
3.247
3.248 @@ -536,12 +554,12 @@
3.249 void BranchObj::moveBy (double x, double y)
3.250 {
3.251 OrnamentedObj::moveBy (x,y);
3.252 - positionBBox();
3.253 BranchObj* b;
3.254 for (b=branch.first(); b;b=branch.next() )
3.255 b->moveBy (x,y);
3.256 + positionBBox();
3.257 }
3.258 -
3.259 +
3.260 void BranchObj::moveBy (QPoint p)
3.261 {
3.262 moveBy (p.x(), p.y());
3.263 @@ -550,30 +568,25 @@
3.264
3.265 void BranchObj::positionBBox()
3.266 {
3.267 -
3.268 - heading->positionBBox();
3.269 - systemFlags->positionBBox();
3.270 - standardFlags->positionBBox();
3.271 - // It seems that setting x,y also affects width,height
3.272 - int w_old=bbox.width();
3.273 - int h_old=bbox.height();
3.274 - bbox.setX (absPos.x() );
3.275 - bbox.setY (absPos.y() );
3.276 - bbox.setWidth(w_old);
3.277 - bbox.setHeight(h_old);
3.278 -
3.279 -
3.280 + QPoint ap=getAbsPos();
3.281 + bbox.moveTopLeft (ap);
3.282 + positionContents();
3.283 setSelBox();
3.284
3.285 // set the frame
3.286 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
3.287 +
3.288 + // Update links to other branches
3.289 + XLinkObj *xlo;
3.290 + for (xlo=xlink.first(); xlo; xlo=xlink.next() )
3.291 + xlo->updateXLink();
3.292 }
3.293
3.294 void BranchObj::calcBBoxSize()
3.295 {
3.296 QSize heading_r=heading->getSize();
3.297 - int heading_w=static_cast <int> (heading_r.width() );
3.298 - int heading_h=static_cast <int> (heading_r.height() );
3.299 + int heading_w=(int) heading_r.width() ;
3.300 + int heading_h=(int) heading_r.height() ;
3.301 QSize sysflags_r=systemFlags->getSize();
3.302 int sysflags_h=sysflags_r.height();
3.303 int sysflags_w=sysflags_r.width();
3.304 @@ -589,11 +602,73 @@
3.305 h=max (sysflags_h,stanflags_h);
3.306 h=max (h,heading_h);
3.307
3.308 + // Save the dimension of flags and heading
3.309 + ornamentsBBox.setSize ( QSize(w,h));
3.310 +
3.311 + // clickBox includes Flags and Heading
3.312 + clickBox.setSize (ornamentsBBox.size() );
3.313 +
3.314 + // Floatimages
3.315 + QPoint rp;
3.316 + FloatImageObj *foi;
3.317 +
3.318 + topPad=botPad=leftPad=rightPad=0;
3.319 + if (includeImagesVer || includeImagesHor)
3.320 + {
3.321 + if (countFloatImages()>0)
3.322 + {
3.323 + for (foi=floatimage.first(); foi; foi=floatimage.next() )
3.324 + {
3.325 + rp=foi->getRelPos();
3.326 + if (includeImagesVer)
3.327 + {
3.328 + if (rp.y() < 0)
3.329 + topPad=max (topPad,-rp.y()-h);
3.330 + if (rp.y()+foi->height() > 0)
3.331 + botPad=max (botPad,rp.y()+foi->height());
3.332 + }
3.333 + if (includeImagesHor)
3.334 + {
3.335 + if (orientation==OrientRightOfCenter)
3.336 + {
3.337 + if (-rp.x()-w > 0)
3.338 + leftPad=max (leftPad,-rp.x()-w);
3.339 + if (rp.x()+foi->width() > 0)
3.340 + rightPad=max (rightPad,rp.x()+foi->width());
3.341 + } else
3.342 + {
3.343 + if (rp.x()< 0)
3.344 + leftPad=max (leftPad,-rp.x());
3.345 + if (rp.x()+foi->width() > w)
3.346 + rightPad=max (rightPad,rp.x()+foi->width()-w);
3.347 + }
3.348 + }
3.349 + }
3.350 + }
3.351 + h+=topPad+botPad;
3.352 + w+=leftPad+rightPad;
3.353 + }
3.354 +
3.355 + // Frame thickness
3.356 w+=frame->getBorder();
3.357 h+=frame->getBorder();
3.358 +
3.359 + // Finally set size
3.360 bbox.setSize (QSize (w,h));
3.361 }
3.362
3.363 +void BranchObj::setDockPos()
3.364 +{
3.365 + if (getOrientation()==OrientLeftOfCenter )
3.366 + {
3.367 + childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
3.368 + parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
3.369 + } else
3.370 + {
3.371 + childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
3.372 + parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
3.373 + }
3.374 +}
3.375 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
3.376 {
3.377 // Search branches
3.378 @@ -606,89 +681,67 @@
3.379 }
3.380
3.381 // Search myself
3.382 - if (inBBox (p) && (this != excludeLMO) && isVisibleObj() )
3.383 + if (inBox (p) && (this != excludeLMO) && isVisibleObj() )
3.384 return this;
3.385
3.386 // Search float images
3.387 FloatImageObj *foi;
3.388 for (foi=floatimage.first(); foi; foi=floatimage.next() )
3.389 - if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
3.390 + if (foi->inBox(p) &&
3.391 + (foi != excludeLMO) &&
3.392 + foi->getParObj()!= excludeLMO &&
3.393 + foi->isVisibleObj()
3.394 + ) return foi;
3.395
3.396 return NULL;
3.397 }
3.398
3.399 void BranchObj::setHeading(QString s)
3.400 {
3.401 - // Adjusting font size
3.402 - QFont font=heading->getFont();
3.403 - if (depth==0)
3.404 - font.setPointSize(16);
3.405 - else
3.406 - if (depth>1)
3.407 - font.setPointSize(10);
3.408 - else
3.409 - font.setPointSize(12);
3.410 - heading->setFont(font);
3.411 heading->setText(s); // set new heading
3.412 calcBBoxSize(); // recalculate bbox
3.413 positionBBox(); // rearrange contents
3.414 requestReposition();
3.415 }
3.416
3.417 -void BranchObj::setURL(QString s)
3.418 +void BranchObj::setHideTmp (HideTmpMode mode)
3.419 {
3.420 - url=s;
3.421 - if (!url.isEmpty())
3.422 - systemFlags->activate("url");
3.423 - else
3.424 - systemFlags->deactivate("url");
3.425 - calcBBoxSize(); // recalculate bbox
3.426 - positionBBox(); // rearrange contents
3.427 - forceReposition();
3.428 + if (mode==HideExport && hasHiddenExportParent(this))
3.429 + {
3.430 + setVisibility (false);
3.431 + hidden=true;
3.432 + }else
3.433 + {
3.434 + if (hasScrolledParent(this))
3.435 + setVisibility (false);
3.436 + else
3.437 + setVisibility (true);
3.438 + hidden=false;
3.439 + }
3.440 +
3.441 + BranchObj *bo;
3.442 + for (bo=branch.first(); bo; bo=branch.next() )
3.443 + bo->setHideTmp (mode);
3.444 }
3.445
3.446 -QString BranchObj::getURL()
3.447 +bool BranchObj::hasHiddenExportParent(BranchObj *start)
3.448 {
3.449 - return url;
3.450 -}
3.451 + // Calls parents recursivly to
3.452 + // find out, if we are temp. hidden
3.453
3.454 -void BranchObj::setVymLink(QString s)
3.455 -{
3.456 - if (!s.isEmpty())
3.457 - {
3.458 - // We need the relative (from loading)
3.459 - // or absolute path (from User event)
3.460 - // and build the absolute path.
3.461 - // Note: If we have relative, use path of
3.462 - // current map to build absolute path
3.463 - QDir d(s);
3.464 - if (!d.path().startsWith ("/"))
3.465 - {
3.466 - QString p=mapEditor->getDestPath();
3.467 - int i=p.findRev("/",-1);
3.468 - d.setPath(p.left(i)+"/"+s);
3.469 - d.convertToAbs();
3.470 - }
3.471 - vymLink=d.path();
3.472 - systemFlags->activate("vymLink");
3.473 - }
3.474 - else
3.475 - {
3.476 - systemFlags->deactivate("vymLink");
3.477 - vymLink="";
3.478 - }
3.479 - calcBBoxSize(); // recalculate bbox
3.480 - positionBBox(); // rearrange contents
3.481 - forceReposition();
3.482 -}
3.483 + if (hideExport) return true;
3.484
3.485 -QString BranchObj::getVymLink()
3.486 -{
3.487 - return vymLink;
3.488 + BranchObj* bo=(BranchObj*)(parObj);
3.489 + if (bo)
3.490 + return bo->hasHiddenExportParent(start);
3.491 + else
3.492 + return false;
3.493 }
3.494
3.495 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
3.496 {
3.497 + if (hidden) return "";
3.498 +
3.499 QString s,a;
3.500 QString scrolledAttr;
3.501 if (scrolled)
3.502 @@ -696,21 +749,6 @@
3.503 else
3.504 scrolledAttr="";
3.505
3.506 - QString posAttr;
3.507 - if (depth<2) posAttr=
3.508 - attribut("absPosX",QString().setNum(absPos.x(),10)) +
3.509 - attribut("absPosY",QString().setNum(absPos.y(),10));
3.510 - else
3.511 - posAttr="";
3.512 -
3.513 - QString urlAttr;
3.514 - if (!url.isEmpty())
3.515 - urlAttr=attribut ("url",url);
3.516 -
3.517 - QString vymLinkAttr;
3.518 - if (!vymLink.isEmpty())
3.519 - vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
3.520 -
3.521 QString frameAttr;
3.522 if (frame->getFrameType()!=NoFrame)
3.523 frameAttr=attribut ("frameType",frame->getFrameTypeName());
3.524 @@ -730,11 +768,24 @@
3.525 } else
3.526 areaAttr="";
3.527
3.528 - s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr);
3.529 + // Providing an ID for a branch makes export to XHTML easier
3.530 + QString idAttr;
3.531 + if (countXLinks()>0)
3.532 + idAttr=attribut ("id",getSelectString());
3.533 + else
3.534 + idAttr="";
3.535 +
3.536 + s=beginElement ("branch"
3.537 + +getOrnAttr()
3.538 + +scrolledAttr
3.539 + +frameAttr
3.540 + +areaAttr
3.541 + +idAttr
3.542 + +getIncludeImageAttr() );
3.543 incIndent();
3.544
3.545 // save heading
3.546 - s=s+valueElement("heading", getHeading(),
3.547 + s+=valueElement("heading", getHeading(),
3.548 attribut ("textColor",QColor(heading->getColor()).name()));
3.549
3.550 // save names of flags set
3.551 @@ -748,17 +799,120 @@
3.552 BranchObj *bo;
3.553 for (bo=branch.first(); bo; bo=branch.next() )
3.554 s+=bo->saveToDir(tmpdir,prefix,offset);
3.555 - decIndent();
3.556
3.557 // Save FloatImages
3.558 FloatImageObj *fio;
3.559 for (fio=floatimage.first(); fio; fio=floatimage.next() )
3.560 - s+=fio->saveToDir (tmpdir,prefix);
3.561 + s+=fio->saveToDir (tmpdir,prefix,offset);
3.562
3.563 + // Save XLinks
3.564 + XLinkObj *xlo;
3.565 + //FIXME exponential increase in xlinks...
3.566 + QString ol; // old link
3.567 + QString cl; // current link
3.568 + for (xlo=xlink.first(); xlo; xlo=xlink.next() )
3.569 + {
3.570 + cl=xlo->saveToDir();
3.571 + if (cl!=ol)
3.572 + {
3.573 + s+=cl;
3.574 + ol=cl;
3.575 + } else
3.576 + {
3.577 + qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
3.578 + }
3.579 + }
3.580 +
3.581 + decIndent();
3.582 s+=endElement ("branch");
3.583 return s;
3.584 }
3.585
3.586 +void BranchObj::addXLink (XLinkObj *xlo)
3.587 +{
3.588 + xlink.append (xlo);
3.589 +
3.590 +}
3.591 +
3.592 +void BranchObj::removeXLinkRef (XLinkObj *xlo)
3.593 +{
3.594 + xlink.remove (xlo);
3.595 +}
3.596 +
3.597 +void BranchObj::deleteXLink(XLinkObj *xlo)
3.598 +{
3.599 + xlo->deactivate();
3.600 + if (!xlo->isUsed()) delete (xlo);
3.601 +}
3.602 +
3.603 +void BranchObj::deleteXLinkAt (int i)
3.604 +{
3.605 + XLinkObj *xlo=xlink.at(i);
3.606 + xlo->deactivate();
3.607 + if (!xlo->isUsed()) delete(xlo);
3.608 +}
3.609 +
3.610 +XLinkObj* BranchObj::XLinkAt (int i)
3.611 +{
3.612 + return xlink.at(i);
3.613 +}
3.614 +
3.615 +int BranchObj::countXLink()
3.616 +{
3.617 + return xlink.count();
3.618 +}
3.619 +
3.620 +
3.621 +BranchObj* BranchObj::XLinkTargetAt (int i)
3.622 +{
3.623 + if (xlink.at(i))
3.624 + return xlink.at(i)->otherBranch (this);
3.625 + else
3.626 + return NULL;
3.627 +}
3.628 +
3.629 +void BranchObj::setIncludeImagesVer(bool b)
3.630 +{
3.631 + includeImagesVer=b;
3.632 + calcBBoxSize();
3.633 + positionBBox();
3.634 + requestReposition();
3.635 + //FIXME undo needed
3.636 +}
3.637 +
3.638 +bool BranchObj::getIncludeImagesVer()
3.639 +{
3.640 + return includeImagesVer;
3.641 +}
3.642 +
3.643 +void BranchObj::setIncludeImagesHor(bool b)
3.644 +{
3.645 + includeImagesHor=b;
3.646 + calcBBoxSize();
3.647 + positionBBox();
3.648 + requestReposition();
3.649 + //FIXME undo needed
3.650 +}
3.651 +
3.652 +bool BranchObj::getIncludeImagesHor()
3.653 +{
3.654 + return includeImagesHor;
3.655 +}
3.656 +
3.657 +QString BranchObj::getIncludeImageAttr()
3.658 +{
3.659 + QString a;
3.660 + if (includeImagesVer)
3.661 + a=attribut ("incImgV","true");
3.662 + else
3.663 + a=attribut ("incImgV","false");
3.664 + if (includeImagesHor)
3.665 + a+=attribut ("incImgH","true");
3.666 + else
3.667 + a+=attribut ("incImgH","false");
3.668 + return a;
3.669 +}
3.670 +
3.671 LinkableMapObj* BranchObj::addFloatImage ()
3.672 {
3.673 FloatImageObj *newfi=new FloatImageObj (canvas,this);
3.674 @@ -767,8 +921,11 @@
3.675 newfi->setVisibility (false);
3.676 else
3.677 newfi->setVisibility(visible);
3.678 + calcBBoxSize();
3.679 + positionBBox();
3.680 requestReposition();
3.681 return newfi;
3.682 + //FIXME undo needed
3.683 }
3.684
3.685 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
3.686 @@ -780,8 +937,11 @@
3.687 newfi->setVisibility (false);
3.688 else
3.689 newfi->setVisibility(visible);
3.690 + calcBBoxSize();
3.691 + positionBBox();
3.692 requestReposition();
3.693 return newfi;
3.694 + // FIMXE undo needed
3.695 }
3.696
3.697 FloatImageObj* BranchObj::getFirstFloatImage ()
3.698 @@ -802,7 +962,10 @@
3.699 void BranchObj::removeFloatImage (FloatImageObj *fio)
3.700 {
3.701 floatimage.remove (fio);
3.702 + calcBBoxSize();
3.703 + positionBBox();
3.704 requestReposition();
3.705 + // FIMXE undo needed
3.706 }
3.707
3.708 void BranchObj::savePosInAngle ()
3.709 @@ -817,19 +980,40 @@
3.710 }
3.711 }
3.712
3.713 +void BranchObj::setDefAttr (BranchModification mod)
3.714 +{
3.715 + int fontsize;
3.716 + switch (depth)
3.717 + {
3.718 + case 0: fontsize=16; break;
3.719 + case 1: fontsize=12; break;
3.720 + default: fontsize=10; break;
3.721 + }
3.722 +
3.723 + setLinkColor ();
3.724 + setLinkStyle(getDefLinkStyle());
3.725 + QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
3.726 + font.setPointSize(fontsize);
3.727 + heading->setFont(font );
3.728 +
3.729 + if (mod==NewBranch)
3.730 + setColor (((BranchObj*)(parObj))->getColor());
3.731 +
3.732 + calcBBoxSize();
3.733 +}
3.734 +
3.735 BranchObj* BranchObj::addBranch()
3.736 {
3.737 BranchObj* newbo=new BranchObj(canvas,this);
3.738 branch.append (newbo);
3.739 newbo->setParObj(this);
3.740 - newbo->setColor(getColor(),false);
3.741 - newbo->setLinkColor();
3.742 + newbo->setDefAttr(NewBranch);
3.743 newbo->setHeading ("new");
3.744 - newbo->setLinkStyle (newbo->getDefLinkStyle());
3.745 if (scrolled)
3.746 newbo->setVisibility (false);
3.747 else
3.748 newbo->setVisibility(visible);
3.749 + newbo->updateLink();
3.750 requestReposition();
3.751 return newbo;
3.752 }
3.753 @@ -840,16 +1024,27 @@
3.754 branch.append (newbo);
3.755 newbo->copy(bo);
3.756 newbo->setParObj(this);
3.757 - newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth
3.758 - newbo->setLinkStyle (newbo->getDefLinkStyle());
3.759 + newbo->setDefAttr(MovedBranch);
3.760 if (scrolled)
3.761 newbo->setVisibility (false);
3.762 else
3.763 newbo->setVisibility(bo->visible);
3.764 + newbo->updateLink();
3.765 requestReposition();
3.766 return newbo;
3.767 }
3.768
3.769 +BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
3.770 +{
3.771 + branch.append (bo);
3.772 + bo->setParObj (this);
3.773 + bo->depth=depth+1;
3.774 + bo->setDefAttr(MovedBranch);
3.775 + if (scrolled) tmpUnscroll();
3.776 + setLastSelectedBranch (bo);
3.777 + return bo;
3.778 +}
3.779 +
3.780 BranchObj* BranchObj::insertBranch(int pos)
3.781 {
3.782 savePosInAngle();
3.783 @@ -870,11 +1065,56 @@
3.784 return newbo;
3.785 }
3.786
3.787 +BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
3.788 +{
3.789 + savePosInAngle();
3.790 + // Add new bo and resort branches
3.791 + bo->angle=pos-0.5;
3.792 + branch.append (bo);
3.793 + bo->setParObj (this);
3.794 + bo->depth=depth+1;
3.795 + bo->setDefAttr (MovedBranch);
3.796 + if (scrolled) tmpUnscroll();
3.797 + setLastSelectedBranch (bo);
3.798 + branch.sort();
3.799 + return bo;
3.800 +}
3.801 +
3.802 +void BranchObj::removeBranchHere(BranchObj* borem)
3.803 +{
3.804 + // This removes the branch bo from list, but
3.805 + // inserts its childs at the place of bo
3.806 + BranchObj *bo;
3.807 + bo=borem->getLastBranch();
3.808 + int pos=borem->getNum();
3.809 + while (bo)
3.810 + {
3.811 + bo->moveBranchTo (this,pos+1);
3.812 + bo=borem->getLastBranch();
3.813 + }
3.814 + removeBranch (borem);
3.815 +}
3.816 +
3.817 +void BranchObj::removeChilds()
3.818 +{
3.819 + clear();
3.820 +}
3.821 +
3.822 void BranchObj::removeBranch(BranchObj* bo)
3.823 {
3.824 // if bo is not in branch remove returns false, we
3.825 // don't care...
3.826 - branch.remove (bo);
3.827 +
3.828 + if (branch.remove (bo))
3.829 + delete (bo);
3.830 + else
3.831 + qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
3.832 + requestReposition();
3.833 +}
3.834 +
3.835 +void BranchObj::removeBranchPtr(BranchObj* bo)
3.836 +{
3.837 + branch.remove (bo);
3.838 requestReposition();
3.839 }
3.840
3.841 @@ -908,6 +1148,15 @@
3.842 return branch.at(i);
3.843 }
3.844
3.845 +bool BranchObj::canMoveBranchUp()
3.846 +{
3.847 + if (!parObj) return false;
3.848 + BranchObj* par=(BranchObj*)parObj;
3.849 + if (this==par->getFirstBranch())
3.850 + return false;
3.851 + else
3.852 + return true;
3.853 +}
3.854
3.855 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
3.856 {
3.857 @@ -923,6 +1172,16 @@
3.858 return branch.at(i);
3.859 }
3.860
3.861 +bool BranchObj::canMoveBranchDown()
3.862 +{
3.863 + if (!parObj) return false;
3.864 + BranchObj* par=(BranchObj*)parObj;
3.865 + if (this==par->getLastBranch())
3.866 + return false;
3.867 + else
3.868 + return true;
3.869 +}
3.870 +
3.871 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
3.872 {
3.873 savePosInAngle();
3.874 @@ -939,29 +1198,63 @@
3.875 return branch.at(i);
3.876 }
3.877
3.878 +BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
3.879 +{
3.880 + // Find current parent and
3.881 + // remove pointer to myself there
3.882 + if (!dst) return NULL;
3.883 + BranchObj *par=(BranchObj*)(parObj);
3.884 + if (par)
3.885 + par->removeBranchPtr (this);
3.886 + else
3.887 + return NULL;
3.888 +
3.889 + // Create new pointer to myself at dst
3.890 + if (pos<0||dst->getDepth()==0)
3.891 + {
3.892 + // links myself as last branch at dst
3.893 + dst->addBranchPtr (this);
3.894 + updateLink();
3.895 + return this;
3.896 + } else
3.897 + {
3.898 + // inserts me at pos in parent of dst
3.899 + if (par)
3.900 + {
3.901 + BranchObj *bo=dst->insertBranchPtr (this,pos);
3.902 + bo->setDefAttr(MovedBranch);
3.903 + updateLink();
3.904 + return bo;
3.905 +
3.906 + } else
3.907 + return NULL;
3.908 + }
3.909 +}
3.910 +
3.911 void BranchObj::alignRelativeTo (QPoint ref)
3.912 {
3.913 -/* FIXME testing
3.914 - if (!getHeading().isEmpty())
3.915 - cout << "BO::alignRelTo "<<getHeading()<<endl;
3.916 - else
3.917 - cout << "BO::alignRelTo ???"<<endl;
3.918 - cout << " d="<<depth<<endl;
3.919 -*/
3.920 int th = bboxTotal.height();
3.921 +// TODO testing
3.922 +/*
3.923 + cout << "BO::alignRelTo "<<getHeading()<<endl;
3.924 + cout << " d="<<depth<<
3.925 + " ref="<<ref<<
3.926 +// " bbox.topLeft="<<bboxTotal.topLeft()<<
3.927 + " absPos="<<absPos<<
3.928 +// " pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
3.929 + " hidden="<<hidden<<
3.930 + " th="<<th<<endl;
3.931 +*/
3.932
3.933 // If I am the mapcenter or a mainbranch, reposition heading
3.934 if (depth<2)
3.935 - {
3.936 - move (absPos.x(),absPos.y());
3.937 + { //FIXME ugly! optimize this move for MCO needed to initially position text in box...
3.938 if (depth==1)
3.939 - {
3.940 // Calc angle to mapCenter if I am a mainbranch
3.941 // needed for reordering the mainbranches clockwise
3.942 // around mapcenter
3.943 angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
3.944 (int)(y() - parObj->getChildPos().y() ) ) );
3.945 - }
3.946 }
3.947 else
3.948 {
3.949 @@ -970,29 +1263,25 @@
3.950 switch (orientation)
3.951 {
3.952 case OrientLeftOfCenter:
3.953 - move (ref.x()-bbox.width(), ref.y() + (th-bbox.height())/2 );
3.954 + move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
3.955 break;
3.956 case OrientRightOfCenter:
3.957 - move (ref.x(), ref.y() + (th-bbox.height())/2 );
3.958 + move (ref.x() , ref.y() + (th-bbox.height())/2 );
3.959 break;
3.960 default:
3.961 - cout <<"LMO::alignRelativeTo: oops, no orientation given...\n";
3.962 + qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
3.963 break;
3.964 }
3.965 }
3.966
3.967 - FloatImageObj *fio;
3.968 - for (fio=floatimage.first(); fio; fio=floatimage.next() )
3.969 - fio->reposition();
3.970 -
3.971 if (scrolled) return;
3.972
3.973 // Set reference point for alignment of childs
3.974 QPoint ref2;
3.975 if (orientation==OrientLeftOfCenter)
3.976 - ref2.setX(childPos.x() - linkwidth);
3.977 + ref2.setX(bbox.topLeft().x() - linkwidth);
3.978 else
3.979 - ref2.setX(childPos.x() + linkwidth);
3.980 + ref2.setX(bbox.topRight().x() + linkwidth);
3.981
3.982 if (depth==1)
3.983 ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
3.984 @@ -1003,15 +1292,18 @@
3.985 BranchObj *b;
3.986 for (b=branch.first(); b; b=branch.next() )
3.987 {
3.988 - b->alignRelativeTo (ref2);
3.989 - ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
3.990 + if (!b->isHidden())
3.991 + {
3.992 + b->alignRelativeTo (ref2);
3.993 + ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
3.994 + }
3.995 }
3.996 }
3.997
3.998
3.999 void BranchObj::reposition()
3.1000 {
3.1001 -/* FIXME testing
3.1002 +/* TODO testing only
3.1003 if (!getHeading().isEmpty())
3.1004 cout << "BO::reposition "<<getHeading()<<endl;
3.1005 else
3.1006 @@ -1023,9 +1315,13 @@
3.1007 // changes its height,
3.1008 // all upper LMOs have to change, too.
3.1009 calcBBoxSizeWithChilds();
3.1010 + updateLink(); // This update is needed if the canvas is resized
3.1011 + // due to excessive moving of a FIO
3.1012 +
3.1013 alignRelativeTo ( QPoint (absPos.x(),
3.1014 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
3.1015 branch.sort();
3.1016 + positionBBox(); // Reposition bbox and contents
3.1017 } else
3.1018 {
3.1019 // This is only important for moving branches:
3.1020 @@ -1044,11 +1340,13 @@
3.1021
3.1022 BranchObj* b;
3.1023 for (b=branch.first();b ;b=branch.next() )
3.1024 - r=addBBox(b->getTotalBBox(),r);
3.1025 + if (!b->isHidden())
3.1026 + r=addBBox(b->getTotalBBox(),r);
3.1027
3.1028 FloatImageObj* fio;
3.1029 for (fio=floatimage.first();fio ;fio=floatimage.next() )
3.1030 - r=addBBox(fio->getTotalBBox(),r);
3.1031 + if (!fio->isHidden())
3.1032 + r=addBBox(fio->getTotalBBox(),r);
3.1033
3.1034 return r;
3.1035 }
3.1036 @@ -1059,14 +1357,14 @@
3.1037 }
3.1038
3.1039 void BranchObj::calcBBoxSizeWithChilds()
3.1040 -{
3.1041 - // This is called only from reposition and
3.1042 +{
3.1043 + // This is initially called only from reposition and
3.1044 // and only for mapcenter. So it won't be
3.1045 // called more than once for a single user
3.1046 // action
3.1047
3.1048 +
3.1049 // Calculate size of LMO including all childs (to align them later)
3.1050 -
3.1051 bboxTotal.setX(bbox.x() );
3.1052 bboxTotal.setY(bbox.y() );
3.1053
3.1054 @@ -1078,6 +1376,22 @@
3.1055 return;
3.1056 }
3.1057
3.1058 + if (hidden)
3.1059 + {
3.1060 + bboxTotal.setWidth (0);
3.1061 + bboxTotal.setHeight(0);
3.1062 + if (parObj)
3.1063 + {
3.1064 + bboxTotal.setX (parObj->x());
3.1065 + bboxTotal.setY (parObj->y());
3.1066 + } else
3.1067 + {
3.1068 + bboxTotal.setX (bbox.x());
3.1069 + bboxTotal.setY (bbox.y());
3.1070 + }
3.1071 + return;
3.1072 + }
3.1073 +
3.1074 QRect r(0,0,0,0);
3.1075 QRect br;
3.1076 // Now calculate recursivly
3.1077 @@ -1087,11 +1401,14 @@
3.1078 BranchObj* b;
3.1079 for (b=branch.first();b ;b=branch.next() )
3.1080 {
3.1081 - b->calcBBoxSizeWithChilds();
3.1082 - br=b->getBBoxSizeWithChilds();
3.1083 - r.setWidth( max (br.width(), r.width() ));
3.1084 - r.setHeight(br.height() + r.height() );
3.1085 - if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
3.1086 + if (!b->isHidden())
3.1087 + {
3.1088 + b->calcBBoxSizeWithChilds();
3.1089 + br=b->getBBoxSizeWithChilds();
3.1090 + r.setWidth( max (br.width(), r.width() ));
3.1091 + r.setHeight(br.height() + r.height() );
3.1092 + if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
3.1093 + }
3.1094 }
3.1095 // Add myself and also
3.1096 // add width of link to sum if necessary
3.1097 @@ -1099,12 +1416,21 @@
3.1098 bboxTotal.setWidth (bbox.width() + r.width() );
3.1099 else
3.1100 bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
3.1101 - bboxTotal.setHeight(max (r.height(), bbox.height() ) );
3.1102 -// frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
3.1103 +
3.1104 + bboxTotal.setHeight(max (r.height(), bbox.height()));
3.1105 }
3.1106
3.1107 void BranchObj::select()
3.1108 {
3.1109 + // set Text in Editor
3.1110 + textEditor->setText(note.getNote() );
3.1111 + QString fnh=note.getFilenameHint();
3.1112 + if (fnh!="")
3.1113 + textEditor->setFilenameHint(note.getFilenameHint() );
3.1114 + else
3.1115 + textEditor->setFilenameHint(getHeading() );
3.1116 + textEditor->setFontHint (note.getFontHint() );
3.1117 +
3.1118 LinkableMapObj::select();
3.1119 // Tell parent that I am selected now:
3.1120 BranchObj* po=(BranchObj*)(parObj);
3.1121 @@ -1114,13 +1440,6 @@
3.1122 // temporary unscroll, if we have scrolled parents somewhere
3.1123 if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
3.1124
3.1125 - // set Text in Editor
3.1126 - textEditor->setText(note.getNote() );
3.1127 - textEditor->setFilename(note.getFilenameHint() );
3.1128 - textEditor->setFontHint (note.getFontHint() );
3.1129 - connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) );
3.1130 - connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) );
3.1131 -
3.1132 // Show URL and link in statusbar
3.1133 QString status;
3.1134 if (!url.isEmpty()) status+="URL: "+url+" ";
3.1135 @@ -1128,13 +1447,7 @@
3.1136 if (!status.isEmpty()) mainWindow->statusMessage (status);
3.1137
3.1138 // Update Toolbar
3.1139 - standardFlags->updateToolBar();
3.1140 -
3.1141 - // Update Browserbutton
3.1142 - if (!url.isEmpty())
3.1143 - actionEditOpenURL->setEnabled (true);
3.1144 - else
3.1145 - actionEditOpenURL->setEnabled (false);
3.1146 + standardFlags->updateToolbar();
3.1147
3.1148 // Update actions in mapeditor
3.1149 mapEditor->updateActions();
3.1150 @@ -1154,15 +1467,11 @@
3.1151 // reset temporary unscroll, if we have scrolled parents somewhere
3.1152 if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
3.1153
3.1154 - // Disconnect textEditor from this LMO
3.1155 - disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
3.1156 - disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 );
3.1157 -
3.1158 // Erase content of editor
3.1159 textEditor->setInactive();
3.1160
3.1161 // unselect all buttons in toolbar
3.1162 - standardFlagsDefault->updateToolBar();
3.1163 + standardFlagsDefault->updateToolbar();
3.1164 }
3.1165
3.1166 QString BranchObj::getSelectString()
3.1167 @@ -1170,15 +1479,12 @@
3.1168 QString s;
3.1169 if (parObj)
3.1170 {
3.1171 - if (parObj->getDepth()==0)
3.1172 + if (depth==1)
3.1173 s= "bo:" + QString("%1").arg(getNum());
3.1174 else
3.1175 s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
3.1176 } else
3.1177 - {
3.1178 s="mc:";
3.1179 - }
3.1180 -
3.1181 return s;
3.1182 }
3.1183
4.1 --- a/branchobj.h Sun Jan 30 12:58:47 2005 +0000
4.2 +++ b/branchobj.h Tue Jun 06 14:58:11 2006 +0000
4.3 @@ -4,18 +4,24 @@
4.4 #include "floatimageobj.h"
4.5 #include "linkablemapobj.h"
4.6 #include "ornamentedobj.h"
4.7 +#include "xlinkobj.h"
4.8 +//Added by qt3to4:
4.9 +#include <Q3PtrList>
4.10
4.11 -class BranchObjPtrList : public QPtrList<BranchObj>
4.12 +class BranchObjPtrList : public Q3PtrList<BranchObj>
4.13 {
4.14 - virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
4.15 + virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j);
4.16 };
4.17
4.18 +enum BranchModification {NewBranch, MovedBranch};
4.19 +enum HideTmpMode {HideNone, HideExport};
4.20 +
4.21 /////////////////////////////////////////////////////////////////////////////
4.22 class BranchObj:public OrnamentedObj {
4.23 public:
4.24 BranchObj ();
4.25 - BranchObj (QCanvas*);
4.26 - BranchObj (QCanvas*, LinkableMapObj* parent);
4.27 + BranchObj (Q3Canvas*);
4.28 + BranchObj (Q3Canvas*, LinkableMapObj* parent);
4.29 ~BranchObj ();
4.30 bool operator< ( const BranchObj & );
4.31 bool operator== ( const BranchObj & );
4.32 @@ -27,6 +33,7 @@
4.33 virtual int getFloatImageNum(FloatImageObj*);
4.34 virtual int countBranches();
4.35 virtual int countFloatImages();
4.36 + virtual int countXLinks();
4.37 virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
4.38 virtual void unsetParObjTmp(); // reuse original ParObj
4.39
4.40 @@ -40,27 +47,40 @@
4.41 virtual void setVisibility(bool,int); // set visibility
4.42 virtual void setVisibility(bool); // set vis. for w
4.43 virtual void setLinkColor(); // set the color of link
4.44 - virtual void setColor(QColor,bool); // set the color of heading
4.45 -
4.46 + virtual void setColorChilds(QColor); // set the color of heading
4.47
4.48 BranchObj* first (); // set Iterator to first LMO
4.49 BranchObj* next (); // find next LMO after given one
4.50 BranchObj* getLastIterator(); // to interrupt and resume next iteration
4.51 void setLastIterator (BranchObj*); // needed by next()
4.52
4.53 + virtual void positionContents();
4.54 virtual void move (double x,double y);
4.55 virtual void move (QPoint);
4.56 virtual void moveBy (double x,double y);
4.57 virtual void moveBy (QPoint);
4.58 virtual void positionBBox();
4.59 virtual void calcBBoxSize();
4.60 + virtual void setDockPos();
4.61 virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
4.62 virtual void setHeading (QString);
4.63 - virtual void setURL (QString);
4.64 - virtual QString getURL ();
4.65 - virtual void setVymLink (QString);
4.66 - virtual QString getVymLink ();
4.67 +
4.68 + virtual void setHideTmp (HideTmpMode);
4.69 + virtual bool hasHiddenExportParent (BranchObj*);
4.70 +
4.71 virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
4.72 + virtual void addXLink (XLinkObj*);
4.73 + virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
4.74 + virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
4.75 + virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
4.76 + virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
4.77 + virtual int countXLink ();
4.78 + virtual BranchObj* XLinkTargetAt (int);
4.79 + void setIncludeImagesVer(bool);
4.80 + bool getIncludeImagesVer();
4.81 + void setIncludeImagesHor(bool);
4.82 + bool getIncludeImagesHor();
4.83 + QString getIncludeImageAttr();
4.84 virtual LinkableMapObj* addFloatImage();
4.85 virtual LinkableMapObj* addFloatImage(FloatImageObj*);
4.86 virtual void removeFloatImage(FloatImageObj*);
4.87 @@ -68,21 +88,29 @@
4.88 virtual FloatImageObj* getLastFloatImage();
4.89 virtual FloatImageObj* getFloatImageNum(const uint &);
4.90 protected:
4.91 - virtual void savePosInAngle(); // write pos in angle for resorting
4.92 + virtual void savePosInAngle(); // write pos in angle for resorting
4.93 + virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
4.94 public:
4.95 virtual BranchObj* addBranch();
4.96 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
4.97 + virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
4.98 virtual BranchObj* insertBranch(int);
4.99 virtual BranchObj* insertBranch(BranchObj*,int);
4.100 + virtual BranchObj* insertBranchPtr (BranchObj*,int);
4.101 + virtual void removeBranchHere(BranchObj*);
4.102 + virtual void removeChilds();
4.103 virtual void removeBranch(BranchObj*);
4.104 + virtual void removeBranchPtr (BranchObj*);
4.105 virtual void setLastSelectedBranch(BranchObj*);
4.106 virtual BranchObj* getLastSelectedBranch();
4.107 virtual BranchObj* getFirstBranch();
4.108 virtual BranchObj* getLastBranch();
4.109 virtual BranchObj* getBranchNum(const uint &);
4.110 + virtual bool canMoveBranchUp();
4.111 virtual BranchObj* moveBranchUp(BranchObj*);
4.112 + virtual bool canMoveBranchDown();
4.113 virtual BranchObj* moveBranchDown(BranchObj*);
4.114 -
4.115 + virtual BranchObj* moveBranchTo (BranchObj*, int);
4.116 virtual void alignRelativeTo(const QPoint );
4.117 virtual void reposition();
4.118
4.119 @@ -97,15 +125,17 @@
4.120 protected:
4.121 static BranchObj* itLast; // iterator for first(), next()
4.122 BranchObjPtrList branch; // all child branches
4.123 - QPtrList<FloatImageObj> floatimage; // child images
4.124 + Q3PtrList<FloatImageObj> floatimage; // child images
4.125 + Q3PtrList<XLinkObj> xlink; // xlinks to other branches
4.126 public:
4.127 float angle; // used in mainbranch to reorder mainbranches
4.128 protected:
4.129 int lastSelectedBranch; // for going deeper into tree
4.130 bool scrolled; // true if all childs are scrolled and thus invisible
4.131 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
4.132 - QString url; // url to external doc
4.133 - QString vymLink; // path to another map
4.134 + bool includeImagesVer; // include floatimages in bbox vertically
4.135 + bool includeImagesHor; // include floatimages in bbox horizontally
4.136 +
4.137 };
4.138
4.139
5.1 Binary file demos/todo.vym has changed
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/exportoofiledialog.cpp Tue Jun 06 14:58:11 2006 +0000
6.3 @@ -0,0 +1,87 @@
6.4 +#include <iostream>
6.5 +
6.6 +#include "exportoofiledialog.h"
6.7 +
6.8 +ExportOOFileDialog::ExportOOFileDialog():Q3FileDialog()
6.9 +{
6.10 + init();
6.11 +}
6.12 +
6.13 +ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const char* name, bool modal):Q3FileDialog(parent, name,modal)
6.14 +{
6.15 + init();
6.16 +}
6.17 +
6.18 +QString ExportOOFileDialog::selectedConfig()
6.19 +{
6.20 + QStringList::Iterator itpath=configPaths.begin();
6.21 + QStringList::Iterator itf=filters.begin();
6.22 + while (itf != filters.end())
6.23 + {
6.24 + if (*itf==lastFilter) return *itpath;
6.25 + itpath++;
6.26 + itf++;
6.27 + }
6.28 + qWarning ("ExportOOFileDialog::selectedConfig No filter found!");
6.29 + return "";
6.30 +}
6.31 +
6.32 +void ExportOOFileDialog::newConfigPath(const QString &s)
6.33 +{
6.34 + lastFilter=s;
6.35 +}
6.36 +
6.37 +QString ExportOOFileDialog::selectedFile()
6.38 +{
6.39 + return Q3FileDialog::selectedFile();
6.40 +}
6.41 +
6.42 +
6.43 +void ExportOOFileDialog::addFilter(const QString &f)
6.44 +{
6.45 + lastFilter=f;
6.46 + filters.append (f);
6.47 + Q3FileDialog::addFilter (f);
6.48 +}
6.49 +
6.50 +void ExportOOFileDialog::init()
6.51 +{
6.52 + setMode( Q3FileDialog::AnyFile );
6.53 + QDir d;
6.54 + d.setPath ("/usr/share/vym/exports");
6.55 + scanExportConfigs(d);
6.56 + d.setPath (d.homeDirPath()+"/.vym/exports");
6.57 + scanExportConfigs(d);
6.58 + d.setPath ("exports");
6.59 + scanExportConfigs(d);
6.60 +
6.61 + connect (
6.62 + this,SIGNAL (filterSelected(const QString&)),
6.63 + this, SLOT( newConfigPath(const QString &)));
6.64 +}
6.65 +
6.66 +void ExportOOFileDialog::scanExportConfigs(QDir dir)
6.67 +{
6.68 + // Scan existing export configurations
6.69 + SimpleSettings set;
6.70 + QFile f;
6.71 + if (dir.exists())
6.72 + {
6.73 + // Traverse files
6.74 + QDir dir;
6.75 + dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
6.76 +
6.77 + QFileInfoList list = dir.entryInfoList();
6.78 + for (int i = 0; i < list.size(); ++i) {
6.79 + QFileInfo fi = list.at(i);
6.80 +
6.81 + if (fi.fileName().endsWith(".conf") )
6.82 + {
6.83 + configPaths.append (fi.absFilePath());
6.84 + set.clear();
6.85 + set.readSettings (fi.absFilePath());
6.86 + addFilter (set.readEntry("Name") + " (*.odp)");
6.87 + }
6.88 + }
6.89 + }
6.90 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/exportoofiledialog.h Tue Jun 06 14:58:11 2006 +0000
7.3 @@ -0,0 +1,32 @@
7.4 +#ifndef EXPORTOOFILEDIALOG
7.5 +#define EXPORTOOFILEDIALOG
7.6 +
7.7 +#include <q3filedialog.h>
7.8 +#include <qstringlist.h>
7.9 +
7.10 +#include "settings.h"
7.11 +
7.12 +class ExportOOFileDialog:public Q3FileDialog
7.13 +{
7.14 + Q_OBJECT
7.15 +public:
7.16 + ExportOOFileDialog();
7.17 +
7.18 + ExportOOFileDialog (QWidget * parent = 0, const char * name = 0, bool
7.19 + modal = false);
7.20 + QString selectedConfig();
7.21 + QString selectedFile();
7.22 + void addFilter(const QString &);
7.23 +
7.24 +private slots:
7.25 + void newConfigPath (const QString&f);
7.26 +
7.27 +private:
7.28 + void init();
7.29 + void scanExportConfigs(QDir );
7.30 + QStringList configPaths;
7.31 + QStringList filters;
7.32 + QString lastFilter;
7.33 +
7.34 +};
7.35 +#endif
8.1 --- a/exports.cpp Sun Jan 30 12:58:47 2005 +0000
8.2 +++ b/exports.cpp Tue Jun 06 14:58:11 2006 +0000
8.3 @@ -1,87 +1,103 @@
8.4 +#include <q3filedialog.h>
8.5 +#include <qmessagebox.h>
8.6 +#include <q3process.h>
8.7 +//Added by qt3to4:
8.8 +#include <QTextStream>
8.9 +
8.10 #include "exports.h"
8.11 +#include "file.h"
8.12 +#include "linkablemapobj.h"
8.13 +#include "misc.h"
8.14 +#include "mainwindow.h"
8.15 +#include "warningdialog.h"
8.16 +#include "xsltproc.h"
8.17
8.18 -#include "linkablemapobj.h"
8.19 +extern Main *mainWindow;
8.20 +extern QDir vymBaseDir;
8.21
8.22
8.23 -Export::Export()
8.24 +ExportBase::ExportBase()
8.25 {
8.26 indentPerDepth=" ";
8.27 + // Create tmpdir
8.28 + tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
8.29 }
8.30
8.31 -bool Export::setOutputDir(QString dirname)
8.32 +ExportBase::~ExportBase()
8.33 {
8.34 - outdir.setPath (dirname);
8.35 - if ( outdir.exists() )
8.36 - {
8.37 - // FIXME
8.38 - // ask for confirmation
8.39 - // then delete outdir
8.40 - return true;
8.41 - } else
8.42 - {
8.43 - // try to create directory
8.44 - //return outdir.mkdir (outdir.absPath());
8.45 - // FIXME
8.46 - return true;
8.47 - }
8.48 + // Remove tmpdir
8.49 + removeDir (tmpDir);
8.50 }
8.51
8.52 -void Export::setPath (const QString &p)
8.53 +void ExportBase::setDir(const QString &p)
8.54 {
8.55 - filepath=p;
8.56 + outputDir=p;
8.57 }
8.58
8.59 -void Export::setMapCenter(MapCenterObj *mc)
8.60 +void ExportBase::setFile (const QString &p)
8.61 +{
8.62 + outputFile=p;
8.63 +}
8.64 +
8.65 +void ExportBase::setMapCenter(MapCenterObj *mc)
8.66 {
8.67 mapCenter=mc;
8.68 }
8.69
8.70 -void Export::exportMap()
8.71 +void ExportBase::setCaption (const QString &s)
8.72 {
8.73 - QFile file (filepath);
8.74 - if ( !file.open( IO_WriteOnly ) )
8.75 - {
8.76 - // FIXME
8.77 - cout << "Export::exportMap couldn't open "<<filepath<<endl;
8.78 - return;
8.79 - }
8.80 - QTextStream ts( &file ); // use LANG decoding here...
8.81 -
8.82 - // Main loop over all branches
8.83 - QString s;
8.84 - QString actIndent("");
8.85 - int i;
8.86 - BranchObj *bo;
8.87 - bo=mapCenter->first();
8.88 - while (bo)
8.89 - {
8.90 - // Make indentstring
8.91 - for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
8.92 -
8.93 - // Write heading
8.94 - // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
8.95 - if (bo->getDepth()==1)
8.96 - ts << (getSectionString(bo) + bo->getHeading()+ "\n");
8.97 - else
8.98 - ts << (actIndent + " - " + bo->getHeading()+ "\n");
8.99 -
8.100 - // If necessary, write note
8.101 - if (!bo->getNote().isEmpty())
8.102 - {
8.103 - ts << ("-------------------Begin of Note-----------------\n");
8.104 - ts << (bo->getNote());
8.105 - ts << ("\n");
8.106 - ts << ("-------------------End of Note-------------------\n");
8.107 - }
8.108 -
8.109 - bo=bo->next();
8.110 - actIndent="";
8.111 - }
8.112 - file.close();
8.113 + caption=s;
8.114 }
8.115
8.116 -QString Export::getSectionString(BranchObj *bostart)
8.117 +void ExportBase::addFilter(const QString &s)
8.118 {
8.119 + filter=s;
8.120 +}
8.121 +
8.122 +bool ExportBase::execDialog()
8.123 +{
8.124 + if (mapCenter && mapCenter->getMapEditor())
8.125 + {
8.126 + Q3FileDialog *fd=new Q3FileDialog( mapCenter->getMapEditor(), caption);
8.127 + fd->addFilter (filter);
8.128 + fd->setCaption(caption);
8.129 + fd->setMode( Q3FileDialog::AnyFile );
8.130 + fd->show();
8.131 +
8.132 + if ( fd->exec() == QDialog::Accepted )
8.133 + {
8.134 + if (QFile (fd->selectedFile()).exists() )
8.135 + {
8.136 + QMessageBox mb( __VYM,
8.137 + QObject::tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()),
8.138 + QMessageBox::Warning,
8.139 + QMessageBox::Yes | QMessageBox::Default,
8.140 + QMessageBox::Cancel | QMessageBox::Escape,
8.141 + Qt::NoButton );
8.142 + mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
8.143 + mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
8.144 + ExportBase ex;
8.145 + switch( mb.exec() )
8.146 + {
8.147 + case QMessageBox::Yes:
8.148 + // save
8.149 + break;;
8.150 + case QMessageBox::Cancel:
8.151 + // return, do nothing
8.152 + return false;
8.153 + break;
8.154 + }
8.155 + }
8.156 + outputFile=fd->selectedFile();
8.157 + return true;
8.158 + }
8.159 + }
8.160 + return false;
8.161 +}
8.162 +
8.163 +QString ExportBase::getSectionString(BranchObj *bostart)
8.164 +{
8.165 + // Make prefix like "2.5.3" for "bo:2,bo:5,bo:3"
8.166 QString r;
8.167 BranchObj *bo=bostart;
8.168 int depth=bo->getDepth();
8.169 @@ -97,13 +113,24 @@
8.170 return r + " ";
8.171 }
8.172
8.173 -void Export::exportAsHTML()
8.174 +
8.175 +////////////////////////////////////////////////////////////////////////
8.176 +void ExportASCII::doExport()
8.177 {
8.178 - // FIXME just testing...
8.179 + QFile file (outputFile);
8.180 + if ( !file.open( QIODevice::WriteOnly ) )
8.181 + {
8.182 + // FIXME experimental, testing
8.183 + qWarning ("ExportBase::exportXML couldn't open "+outputFile);
8.184 + return;
8.185 + }
8.186 + QTextStream ts( &file ); // use LANG decoding here...
8.187 +
8.188 // Main loop over all branches
8.189 QString s;
8.190 QString actIndent("");
8.191 int i;
8.192 + uint j;
8.193 BranchObj *bo;
8.194 bo=mapCenter->first();
8.195 while (bo)
8.196 @@ -111,22 +138,338 @@
8.197 // Make indentstring
8.198 for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
8.199
8.200 - // Write heading
8.201 - write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
8.202 + if (bo->getDepth()==0)
8.203 + {
8.204 + ts << (bo->getHeading()+ "\n");
8.205 + for (j=0;j<bo->getHeading().length();j++) ts<<"=";
8.206 + ts << "\n";
8.207 + } else if (bo->getDepth()==1)
8.208 + ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
8.209 + else if (bo->getDepth()==2)
8.210 + ts << (actIndent + " o " + bo->getHeading()+ "\n");
8.211 + else
8.212 + ts << (actIndent + " - " + bo->getHeading()+ "\n");
8.213
8.214 // If necessary, write note
8.215 if (!bo->getNote().isEmpty())
8.216 {
8.217 - write (bo->getNote());
8.218 + s =bo->getNoteASCII();
8.219 + s=s.replace ("\n","\n"+actIndent);
8.220 + ts << (s+"\n\n");
8.221 }
8.222 -
8.223 bo=bo->next();
8.224 actIndent="";
8.225 }
8.226 + file.close();
8.227 }
8.228
8.229 -void Export::write(QString s)
8.230 +////////////////////////////////////////////////////////////////////////
8.231 +void ExportKDEBookmarks::doExport()
8.232 {
8.233 - cout << s;
8.234 + MapEditor *me=NULL;
8.235 + if (mapCenter) me=mapCenter->getMapEditor();
8.236 + if (me)
8.237 + {
8.238 + WarningDialog dia;
8.239 + dia.setCancelButton (true);
8.240 + dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
8.241 + dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
8.242 + dia.setShowAgainName("/vym/warnings/overwriteKDEBookmarks");
8.243 + if (dia.exec()==QDialog::Accepted)
8.244 + {
8.245 + me->exportXML(tmpDir.path());
8.246 +
8.247 + XSLTProc p;
8.248 + p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
8.249 + p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
8.250 + p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
8.251 + p.process();
8.252 +
8.253 + QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
8.254 + Q3Process *proc = new Q3Process( );
8.255 + proc->addArgument(ub);
8.256 +
8.257 + if ( !proc->start() )
8.258 + {
8.259 + QMessageBox::warning(0,
8.260 + QObject::tr("Warning"),
8.261 + QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
8.262 + }
8.263 +
8.264 +
8.265 + }
8.266 + }
8.267 +
8.268 }
8.269
8.270 +////////////////////////////////////////////////////////////////////////
8.271 +void ExportFirefoxBookmarks::doExport()
8.272 +{
8.273 + MapEditor *me=NULL;
8.274 + if (mapCenter) me=mapCenter->getMapEditor();
8.275 + if (me)
8.276 + {
8.277 + WarningDialog dia;
8.278 + dia.setCancelButton (true);
8.279 + dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
8.280 + dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
8.281 + dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
8.282 + if (dia.exec()==QDialog::Accepted)
8.283 + {
8.284 + me->exportXML(tmpDir.path());
8.285 +
8.286 +/*
8.287 + XSLTProc p;
8.288 + p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
8.289 + p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
8.290 + p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
8.291 + p.process();
8.292 +
8.293 + QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
8.294 + QProcess *proc = new QProcess( );
8.295 + proc->addArgument(ub);
8.296 +
8.297 + if ( !proc->start() )
8.298 + {
8.299 + QMessageBox::warning(0,
8.300 + QObject::tr("Warning"),
8.301 + QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
8.302 + }
8.303 +
8.304 +*/
8.305 +
8.306 + }
8.307 + }
8.308 +}
8.309 +
8.310 +////////////////////////////////////////////////////////////////////////
8.311 +void ExportTaskjuggler::doExport()
8.312 +{
8.313 + MapEditor *me=NULL;
8.314 + if (mapCenter) me=mapCenter->getMapEditor();
8.315 + if (me)
8.316 + {
8.317 + me->exportXML(tmpDir.path());
8.318 +
8.319 + XSLTProc p;
8.320 + p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
8.321 + p.setOutputFile (outputFile);
8.322 + p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
8.323 + p.process();
8.324 + }
8.325 +
8.326 +}
8.327 +
8.328 +////////////////////////////////////////////////////////////////////////
8.329 +void ExportLaTeX::doExport()
8.330 +{
8.331 + // Exports a map to a LaTex file.
8.332 + // This file needs to be included
8.333 + // or inported into a LaTex document
8.334 + // it will not add a preamble, or anything
8.335 + // that makes a full LaTex document.
8.336 + QFile file (outputFile);
8.337 + if ( !file.open( QIODevice::WriteOnly ) ) {
8.338 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
8.339 + mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
8.340 + return;
8.341 + }
8.342 + QTextStream ts( &file ); // use LANG decoding here...
8.343 + ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8
8.344 +
8.345 + // Main loop over all branches
8.346 + QString s;
8.347 + // QString actIndent("");
8.348 + // int i;
8.349 + BranchObj *bo;
8.350 + bo=mapCenter->first();
8.351 + while (bo) {
8.352 + if (bo->getDepth()==0);
8.353 + else if (bo->getDepth()==1) {
8.354 + ts << ("\\chapter{" + bo->getHeading()+ "}\n");
8.355 + }
8.356 + else if (bo->getDepth()==2) {
8.357 + ts << ("\\section{" + bo->getHeading()+ "}\n");
8.358 + }
8.359 + else if (bo->getDepth()==3) {
8.360 + ts << ("\\subsection{" + bo->getHeading()+ "}\n");
8.361 + }
8.362 + else if (bo->getDepth()==4) {
8.363 + ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
8.364 + }
8.365 + else {
8.366 + ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
8.367 + }
8.368 +
8.369 + // If necessary, write note
8.370 + if (!bo->getNote().isEmpty()) {
8.371 + ts << (bo->getNoteASCII());
8.372 + ts << ("\n");
8.373 + }
8.374 + bo=bo->next();
8.375 + }
8.376 + file.close();
8.377 +}
8.378 +
8.379 +////////////////////////////////////////////////////////////////////////
8.380 +ExportOO::ExportOO()
8.381 +{
8.382 + useSections=false;
8.383 +}
8.384 +
8.385 +ExportOO::~ExportOO()
8.386 +{
8.387 +}
8.388 +
8.389 +QString ExportOO::buildList (BranchObj *current)
8.390 +{
8.391 + QString r;
8.392 + BranchObj *bo;
8.393 +
8.394 + uint i=0;
8.395 + bo=current->getFirstBranch();
8.396 + if (bo)
8.397 + {
8.398 + // Start list
8.399 + r+="<text:list text:style-name=\"vym-list\">\n";
8.400 + while (bo)
8.401 + {
8.402 + r+="<text:list-item><text:p >";
8.403 + r+=quotemeta(bo->getHeading());
8.404 + // If necessary, write note
8.405 + if (!bo->getNote().isEmpty())
8.406 + r+=bo->getNoteOpenDoc();
8.407 + r+="</text:p>";
8.408 + r+=buildList (bo); // recursivly add deeper branches
8.409 + r+="</text:list-item>\n";
8.410 + i++;
8.411 + bo=current->getBranchNum(i);
8.412 + }
8.413 + r+="</text:list>\n";
8.414 + }
8.415 + return r;
8.416 +}
8.417 +
8.418 +
8.419 +void ExportOO::exportPresentation()
8.420 +{
8.421 + QString allPages;
8.422 +
8.423 + // Insert new content
8.424 + content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
8.425 + content.replace ("<!-- INSERT AUTHOR -->",quotemeta(mapCenter->getAuthor()));
8.426 +
8.427 + QString onePage;
8.428 + QString list;
8.429 +
8.430 + BranchObj *sectionBO=mapCenter->getFirstBranch();
8.431 + int i=0;
8.432 + BranchObj *pagesBO;
8.433 + int j=0;
8.434 +
8.435 + // Walk sections
8.436 + while (sectionBO)
8.437 + {
8.438 + if (useSections)
8.439 + {
8.440 + // Add page with section title
8.441 + onePage=sectionTemplate;
8.442 + onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta(sectionBO->getHeading() ) );
8.443 + allPages+=onePage;
8.444 + } else
8.445 + {
8.446 + i=-2; // only use inner loop to
8.447 + // turn mainbranches into pages
8.448 + sectionBO=mapCenter;
8.449 + }
8.450 +
8.451 + // Walk mainpages
8.452 + pagesBO=sectionBO->getFirstBranch();
8.453 + j=0;
8.454 + while (pagesBO)
8.455 + {
8.456 + // Add page with list of items
8.457 + onePage=pageTemplate;
8.458 + onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
8.459 + list=buildList (pagesBO);
8.460 + onePage.replace ("<!-- INSERT LIST -->", list);
8.461 + allPages+=onePage;
8.462 + j++;
8.463 + pagesBO=sectionBO->getBranchNum(j);
8.464 + }
8.465 + i++;
8.466 + sectionBO=mapCenter->getBranchNum(i);
8.467 + }
8.468 +
8.469 + content.replace ("<!-- INSERT PAGES -->",allPages);
8.470 +
8.471 + // Write modified content
8.472 + QFile f (contentFile);
8.473 + if ( !f.open( QIODevice::WriteOnly ) )
8.474 + {
8.475 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
8.476 + mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
8.477 + return;
8.478 + }
8.479 +
8.480 + QTextStream t( &f );
8.481 + t << content;
8.482 + f.close();
8.483 +
8.484 + // zip tmpdir to destination
8.485 + zipDir (tmpDir,outputFile);
8.486 +}
8.487 +
8.488 +bool ExportOO::setConfigFile (const QString &cf)
8.489 +{
8.490 + configFile=cf;
8.491 + int i=cf.findRev ("/");
8.492 + if (i>=0) configDir=cf.left(i);
8.493 + SimpleSettings set;
8.494 + set.readSettings(configFile);
8.495 +
8.496 + // set paths
8.497 + templateDir=configDir+"/"+set.readEntry ("Template");
8.498 +
8.499 + QDir d (templateDir);
8.500 + if (!d.exists())
8.501 + {
8.502 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Check \"%1\" in\n%2").arg("Template="+set.readEntry ("Template")).arg(configFile));
8.503 + return false;
8.504 +
8.505 + }
8.506 +
8.507 + contentTemplateFile=templateDir+"content-template.xml";
8.508 + contentFile=tmpDir.path()+"/content.xml";
8.509 + pageTemplateFile=templateDir+"page-template.xml";
8.510 + sectionTemplateFile=templateDir+"section-template.xml";
8.511 +
8.512 + if (set.readEntry("useSections").contains("yes"))
8.513 + useSections=true;
8.514 +
8.515 + // Copy template to tmpdir
8.516 + system ("cp -r "+templateDir+"* "+tmpDir.path());
8.517 +
8.518 + // Read content-template
8.519 + if (!loadStringFromDisk (contentTemplateFile,content))
8.520 + {
8.521 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(contentTemplateFile));
8.522 + return false;
8.523 + }
8.524 +
8.525 + // Read page-template
8.526 + if (!loadStringFromDisk (pageTemplateFile,pageTemplate))
8.527 + {
8.528 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(pageTemplateFile));
8.529 + return false;
8.530 + }
8.531 +
8.532 + // Read section-template
8.533 + if (useSections && !loadStringFromDisk (sectionTemplateFile,sectionTemplate))
8.534 + {
8.535 + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(sectionTemplateFile));
8.536 + return false;
8.537 + }
8.538 + return true;
8.539 +}
8.540 +
9.1 --- a/exportxhtmldialog.ui.h Sun Jan 30 12:58:47 2005 +0000
9.2 +++ b/exportxhtmldialog.ui.h Tue Jun 06 14:58:11 2006 +0000
9.3 @@ -1,3 +1,6 @@
9.4 +//Added by qt3to4:
9.5 +#include <QPixmap>
9.6 +#include <QTextStream>
9.7 /****************************************************************************
9.8 ** ui.h extension file, included from the uic-generated form implementation.
9.9 **
9.10 @@ -9,22 +12,22 @@
9.11
9.12
9.13 extern Settings settings;
9.14 +extern QDir vymBaseDir;
9.15 +extern Options options;
9.16
9.17 void ExportXHTMLDialog::init()
9.18 {
9.19 - dia=new ShowTextDialog ();
9.20 - xsltprocessor="xsltproc";
9.21 filepath="";
9.22 settingsChanged=false;
9.23 + scriptProc=new Process;
9.24 }
9.25
9.26 void ExportXHTMLDialog::readSettings()
9.27 {
9.28
9.29 - dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
9.30 + dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
9.31 lineEditDir->setText(dir);
9.32
9.33 -
9.34 if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
9.35 useImage=true;
9.36 else
9.37 @@ -63,12 +66,19 @@
9.38 showOutput=false;
9.39 outputButton->setChecked(showOutput);
9.40
9.41 - xsl=settings.readLocalEntry
9.42 - (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
9.43 + // For testing better use local styles
9.44 + if (options.isOn ("local"))
9.45 + {
9.46 + xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl";
9.47 + css=vymBaseDir.path()+"/styles/vym.css";
9.48 + } else
9.49 + {
9.50 + xsl=settings.readLocalEntry
9.51 + (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
9.52 + css=settings.readLocalEntry
9.53 + (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");
9.54 + }
9.55 lineEditXSL->setText(xsl);
9.56 -
9.57 - css=settings.readLocalEntry
9.58 - (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");
9.59 lineEditCSS->setText(css);
9.60
9.61 prescript=settings.readLocalEntry
9.62 @@ -83,17 +93,16 @@
9.63 {
9.64 QMessageBox::warning( 0, tr( "Warning" ),tr(
9.65 "The settings saved in the map "
9.66 - "would like to run scripts:\n\n") +
9.67 - prescript +" "+postscript +"\n\n"+
9.68 - tr("Please check, if you really\n"
9.69 - "want to allow this in your system!"));
9.70 + "would like to run scripts:\n\n"
9.71 + "%1\n\n"
9.72 + "Please check, if you really\n"
9.73 + "want to allow this in your system!").arg(prescript+" "+postscript));
9.74
9.75 }
9.76 }
9.77
9.78 void ExportXHTMLDialog::destroy()
9.79 {
9.80 - delete (dia);
9.81 }
9.82
9.83 void ExportXHTMLDialog::dirChanged()
9.84 @@ -106,8 +115,8 @@
9.85
9.86 void ExportXHTMLDialog::browseDirectoryPressed()
9.87 {
9.88 - QFileDialog fd( this, tr("VYM - Export HTML to directory"));
9.89 - fd.setMode (QFileDialog::DirectoryOnly);
9.90 + Q3FileDialog fd( this, tr("VYM - Export HTML to directory"));
9.91 + fd.setMode (Q3FileDialog::DirectoryOnly);
9.92 fd.setCaption(tr("VYM - Export HTML to directory"));
9.93 fd.setModal (true);
9.94 fd.show();
9.95 @@ -159,7 +168,7 @@
9.96
9.97 void ExportXHTMLDialog::browseCSSPressed()
9.98 {
9.99 - QFileDialog fd( this, tr("VYM - Path to CSS file"));
9.100 + Q3FileDialog fd( this, tr("VYM - Path to CSS file"));
9.101 fd.setModal (true);
9.102 fd.addFilter ("Cascading Stylesheet (*.css)");
9.103 fd.show();
9.104 @@ -186,9 +195,9 @@
9.105
9.106 void ExportXHTMLDialog::browseXSLPressed()
9.107 {
9.108 - QFileDialog fd( this, tr("VYM - Path to XSL file"));
9.109 + Q3FileDialog fd( this, tr("VYM - Path to XSL file"));
9.110 fd.setModal (true);
9.111 - fd.addFilter ("Extensible Styleshee Language (*.xsl)");
9.112 + fd.addFilter ("Extensible Stylesheet Language (*.xsl)");
9.113 fd.show();
9.114
9.115 if ( fd.exec() == QDialog::Accepted )
9.116 @@ -207,7 +216,7 @@
9.117
9.118 void ExportXHTMLDialog::browsePreExportButtonPressed()
9.119 {
9.120 - QFileDialog fd( this, tr("VYM - Path to pre export script"));
9.121 + Q3FileDialog fd( this, tr("VYM - Path to pre export script"));
9.122 fd.setModal (true);
9.123 fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
9.124 fd.show();
9.125 @@ -223,7 +232,7 @@
9.126
9.127 void ExportXHTMLDialog::browsePostExportButtonPressed()
9.128 {
9.129 - QFileDialog fd( this, tr("VYM - Path to post export script"));
9.130 + Q3FileDialog fd( this, tr("VYM - Path to post export script"));
9.131 fd.setModal (true);
9.132 fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
9.133 fd.show();
9.134 @@ -243,7 +252,6 @@
9.135 // (but don't save at destructor, which
9.136 // is called for "cancel", too)
9.137 settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir);
9.138 -
9.139 settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript);
9.140 settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript);
9.141
9.142 @@ -266,19 +274,25 @@
9.143 settings.writeEntry ("/vym/export/xhtml/showOutput","yes");
9.144 else
9.145 settings.writeEntry ("/vym/export/xhtml/showOutput","no");
9.146 -
9.147 - settings.setLocalEntry
9.148 - (filepath,"/vym/export/xhtml/xsl",xsl);
9.149 - settings.setLocalEntry
9.150 - (filepath,"/vym/export/xhtml/css",css);
9.151
9.152 - //FIXME add option for url image (globe flag) here
9.153 - if (true)
9.154 - {
9.155 - QPixmap pm (flag_url_xpm);
9.156 - pm.save (dir + "/flags/url.png","PNG");
9.157 + QString ipath;
9.158 + ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
9.159 + if (!options.isOn ("local"))
9.160 + {
9.161 + settings.setLocalEntry
9.162 + (filepath,"/vym/export/xhtml/xsl",xsl);
9.163 + settings.setLocalEntry
9.164 + (filepath,"/vym/export/xhtml/css",css);
9.165 }
9.166
9.167 + // Provide a smaller URL-icon to improve Layout
9.168 + QPixmap pm;
9.169 + if (!pm.load(ipath,"PNG") )
9.170 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
9.171 +
9.172 +
9.173 + if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
9.174 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
9.175 if (!saveSettingsInMap)
9.176 settings.clearLocal("/vym/export/xhtml");
9.177 else
9.178 @@ -288,12 +302,12 @@
9.179 // Copy CSS file
9.180 QFile css_src (css);
9.181 QFile css_dst (dir+"vym.css");
9.182 - if (!css_src.open ( IO_ReadOnly))
9.183 - QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!"));
9.184 + if (!css_src.open ( QIODevice::ReadOnly))
9.185 + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css));
9.186 else
9.187 {
9.188 - if (!css_dst.open( IO_WriteOnly))
9.189 - QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!"));
9.190 + if (!css_dst.open( QIODevice::WriteOnly))
9.191 + QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css"));
9.192 else
9.193 {
9.194
9.195 @@ -308,52 +322,19 @@
9.196
9.197 if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
9.198
9.199 - Process *xsltProc=new Process ();
9.200 - xsltProc->clearArguments();
9.201 - xsltProc->addArgument (xsltprocessor);
9.202 if (useImage)
9.203 - {
9.204 - xsltProc->addArgument ("--stringparam");
9.205 - xsltProc->addArgument ("imagemap");
9.206 - xsltProc->addArgument ("images/"+mapname+".png");
9.207 - }
9.208 + p.addStringParam ("imagemap","images/"+mapname+".png");
9.209 if (useTextColor)
9.210 - {
9.211 - xsltProc->addArgument ("--stringparam");
9.212 - xsltProc->addArgument ("use.textcolor");
9.213 - xsltProc->addArgument ("1");
9.214 - }
9.215 - xsltProc->addArgument ("--stringparam");
9.216 - xsltProc->addArgument ("mapname");
9.217 - xsltProc->addArgument (mapname+".vym");
9.218 + p.addStringParam ("use.textcolor","1");
9.219 + p.addStringParam ("mapname",mapname+".vym");
9.220
9.221 - xsltProc->addArgument ("--output");
9.222 - xsltProc->addArgument (dir+mapname+".html");
9.223 - xsltProc->addArgument (xsl);
9.224 - xsltProc->addArgument (dir+mapname+".xml");
9.225 - dia->append ("vym is executing: \n" + xsltProc->arguments().join(" ") );
9.226 - if (!xsltProc->start() )
9.227 - {
9.228 - QMessageBox::critical( 0, tr( "Critical Error" ),
9.229 - tr("Couldn't start ") + xsltprocessor );
9.230 - } else
9.231 - {
9.232 - xsltProc->waitFinished();
9.233 - if (!xsltProc->normalExit() )
9.234 - QMessageBox::critical( 0, tr( "Critical Error" ),
9.235 - xsltprocessor +" " +tr("didn't exit normally") +
9.236 - xsltProc->getErrout() );
9.237 - else
9.238 - if (xsltProc->exitStatus()>0) showOutput=true;
9.239 -
9.240 - }
9.241 - dia->append ("\n");
9.242 - dia->append (xsltProc->getErrout());
9.243 - dia->append (xsltProc->getStdout());
9.244 -
9.245 + p.setOutputFile (dir+mapname+".html");
9.246 + p.setInputFile (dir+mapname+".xml");
9.247 + p.setXSLFile (xsl);
9.248 + p.process();
9.249 +
9.250 if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
9.251
9.252 - if (showOutput) dia->exec();
9.253 }
9.254
9.255 void ExportXHTMLDialog::setFilePath(const QString &s)
9.256 @@ -387,26 +368,25 @@
9.257 spath.replace ("%f",fpath);
9.258 QStringList args=QStringList::split (' ',spath,false);
9.259
9.260 - Process *scriptProc=new Process ();
9.261 scriptProc->clearArguments();
9.262 scriptProc->setArguments (args);
9.263 - dia->append ("vym is executing: \n" + scriptProc->arguments().join(" ") );
9.264 + p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );
9.265 if (!scriptProc->start() )
9.266 {
9.267 QMessageBox::critical( 0, tr( "Critical Error" ),
9.268 - tr("Couldn't start ") + spath );
9.269 + tr("Could not start %1").arg(spath) );
9.270 } else
9.271 {
9.272 scriptProc->waitFinished();
9.273 if (!scriptProc->normalExit() )
9.274 QMessageBox::critical( 0, tr( "Critical Error" ),
9.275 - spath +" " +tr("didn't exit normally") +
9.276 + tr("%1 didn't exit normally").arg(spath) +
9.277 scriptProc->getErrout() );
9.278 else
9.279 if (scriptProc->exitStatus()>0) showOutput=true;
9.280
9.281 }
9.282 - dia->append ("\n");
9.283 - dia->append (scriptProc->getErrout());
9.284 - dia->append (scriptProc->getStdout());
9.285 + p.addOutput ("\n");
9.286 + p.addOutput (scriptProc->getErrout());
9.287 + p.addOutput (scriptProc->getStdout());
9.288 }
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/file.cpp Tue Jun 06 14:58:11 2006 +0000
10.3 @@ -0,0 +1,305 @@
10.4 +#include <qobject.h>
10.5 +#include <qmessagebox.h>
10.6 +//Added by qt3to4:
10.7 +#include <QPixmap>
10.8 +#include <QLabel>
10.9 +#include <QTextStream>
10.10 +#include <iostream>
10.11 +
10.12 +#include "file.h"
10.13 +#include "process.h"
10.14 +
10.15 +
10.16 +QString maskPath(QString p)
10.17 +{
10.18 + // Change " " to "\ " to enable blanks in filenames
10.19 + p=p.replace(QChar('&'),"\\&");
10.20 + return p.replace(QChar(' '),"\\ ");
10.21 +}
10.22 +
10.23 +QString convertToRel (const QString &src, const QString &dst)
10.24 +{
10.25 + QString s=src;
10.26 + QString d=dst;
10.27 + int i;
10.28 +
10.29 + if (s==d)
10.30 + {
10.31 + // Special case, we just need the name of the file,
10.32 + // not the complete path
10.33 + i=d.findRev ("/");
10.34 + d=d.right (d.length()-i-1);
10.35 + } else
10.36 + {
10.37 + // Find relative path from src to dst
10.38 +
10.39 + // Remove the first "/"
10.40 + if (s.section ("/",0,0).isEmpty())
10.41 + {
10.42 + s=s.right (s.length()-1);
10.43 + d=d.right (d.length()-1);
10.44 + }
10.45 +
10.46 + // remove identical left parts
10.47 + while (s.section("/",0,0) == d.section("/",0,0) )
10.48 + {
10.49 + i=s.find ("/");
10.50 + s=s.right (s.length()-i-1);
10.51 + d=d.right (d.length()-i-1);
10.52 + }
10.53 +
10.54 + // Now take care of paths where we have to go back first
10.55 + int srcsep=s.count("/");
10.56 + int dstsep=d.count("/");
10.57 + if (srcsep <= dstsep )
10.58 + {
10.59 + // find path to go up first and then back to dst
10.60 + i=1;
10.61 + while (i<=srcsep)
10.62 + {
10.63 + d="../"+d;
10.64 + i++;
10.65 + }
10.66 + }
10.67 + }
10.68 + return d;
10.69 +}
10.70 +
10.71 +QString makeUniqueDir (QString s)
10.72 +{
10.73 + // Create unique directory e.g. s="/tmp/vym-XXXXXX"
10.74 +
10.75 + // Convert QString to string first
10.76 + char *p;
10.77 + int bytes=s.length();
10.78 + p=(char*) malloc (bytes+1);
10.79 + int i;
10.80 + for (i=0;i<bytes;i++)
10.81 + p[i]=s.at(i).latin1();
10.82 + p[bytes]=0;
10.83 + QString r=mkdtemp (p);
10.84 + free (p);
10.85 + return r;
10.86 +}
10.87 +
10.88 +void removeDir(QDir d)
10.89 +{
10.90 + if (d.path().left(4)!="/tmp")
10.91 + {
10.92 + // This _should_ not be necessary, but proved to be useful ;-)
10.93 + qWarning ("file.cpp::removeDir should remove "+d.path()+" - aborted.");
10.94 + return;
10.95 + }
10.96 +
10.97 + // Traverse directories
10.98 + d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
10.99 + QFileInfoList list = d.entryInfoList();
10.100 + QFileInfo fi;
10.101 +
10.102 + for (int i = 0; i < list.size(); ++i)
10.103 + {
10.104 + fi=list.at(i);
10.105 + if (fi.fileName() != "." && fi.fileName() != ".." )
10.106 + {
10.107 + if ( !d.cd(fi.fileName()) )
10.108 + qWarning ("removeDir() cannot find the directory "+fi.fileName());
10.109 + else
10.110 + {
10.111 + // Recursively remove subdirs
10.112 + removeDir (d);
10.113 + d.cdUp();
10.114 + }
10.115 + }
10.116 + }
10.117 +
10.118 + // Traverse files
10.119 + d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
10.120 + list = d.entryInfoList();
10.121 +
10.122 + for (int i = 0; i < list.size(); ++i)
10.123 + {
10.124 + fi=list.at(i);
10.125 + QFile (fi.filePath()).remove();
10.126 + }
10.127 +
10.128 + if (!d.rmdir(d.path()))
10.129 + qWarning ("removeDir("+d.path()+") failed!");
10.130 +}
10.131 +
10.132 +void makeSubDirs (const QString &s)
10.133 +{
10.134 + QDir d(s);
10.135 + d.mkdir(s);
10.136 + d.mkdir ("images");
10.137 + d.mkdir ("flags");
10.138 +}
10.139 +
10.140 +ErrorCode zipDir (const QDir &zipDir, const QString &zipName)
10.141 +{
10.142 + ErrorCode err=success;
10.143 +
10.144 + // zip the temporary directory
10.145 + Process *zipProc=new Process ();
10.146 + zipProc->clearArguments();
10.147 + zipProc->setWorkingDirectory (QDir(zipDir));
10.148 + zipProc->addArgument ("zip");
10.149 + zipProc->addArgument ("-r");
10.150 + zipProc->addArgument (zipName);
10.151 + zipProc->addArgument (".");
10.152 +
10.153 + if (!zipProc->start() )
10.154 + {
10.155 + // zip could not be started
10.156 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
10.157 + QObject::tr("Couldn't start zip to compress data."));
10.158 + err=aborted;
10.159 + } else
10.160 + {
10.161 + // zip could be started
10.162 + zipProc->waitFinished();
10.163 + if (!zipProc->normalExit() )
10.164 + {
10.165 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
10.166 + QObject::tr("zip didn't exit normally")+
10.167 + "\n" + zipProc->getErrout());
10.168 + err=aborted;
10.169 + } else
10.170 + {
10.171 + if (zipProc->exitStatus()>0)
10.172 + {
10.173 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
10.174 + QString("zip exit code: %1").arg(zipProc->exitStatus() )+
10.175 + "\n" + zipProc->getErrout() );
10.176 + err=aborted;
10.177 + }
10.178 + }
10.179 + } // zip could be started
10.180 + return err;
10.181 +}
10.182 +
10.183 +ErrorCode unzipDir (const QDir &zipDir, const QString &zipName)
10.184 +{
10.185 + ErrorCode err=success;
10.186 +
10.187 + // Try to unzip file
10.188 + Process *zipProc=new Process ();
10.189 + zipProc->clearArguments();
10.190 + zipProc->setWorkingDirectory (zipDir);
10.191 + zipProc->addArgument ("unzip");
10.192 + zipProc->addArgument ("-o"); // overwrite existing files!
10.193 + zipProc->addArgument (zipName );
10.194 + zipProc->addArgument ("-d");
10.195 + zipProc->addArgument (zipDir.path());
10.196 +
10.197 + if (!zipProc->start() )
10.198 + {
10.199 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
10.200 + QObject::tr("Couldn't start unzip to decompress data."));
10.201 + err=aborted;
10.202 +
10.203 + } else
10.204 + {
10.205 + zipProc->waitFinished();
10.206 + if (!zipProc->normalExit() )
10.207 + {
10.208 + QMessageBox::critical( 0,QObject::tr( "Critical Error" ),
10.209 + QObject::tr("unzip didn't exit normally") +
10.210 + zipProc->getErrout() );
10.211 + err=aborted;
10.212 + } else
10.213 + {
10.214 + if (zipProc->exitStatus()>0)
10.215 + {
10.216 + if (zipProc->exitStatus()==9)
10.217 + // no zipped file, but maybe .xml or old version? Try again.
10.218 + err=nozip;
10.219 + else
10.220 + {
10.221 + QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
10.222 + QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
10.223 + zipProc->getErrout() );
10.224 + err=aborted;
10.225 + }
10.226 + }
10.227 + }
10.228 + }
10.229 + return err;
10.230 +}
10.231 +
10.232 +bool loadStringFromDisk (const QString &fname, QString &s)
10.233 +{
10.234 + s="";
10.235 + QFile file ( fname);
10.236 + if ( !file.open( QIODevice::ReadOnly ) ) return false;
10.237 +
10.238 + QTextStream ts( &file );
10.239 + ts.setEncoding (QTextStream::UnicodeUTF8);
10.240 + while ( !ts.atEnd() )
10.241 + s+=ts.readLine()+"\n";
10.242 + file.close();
10.243 + return true;
10.244 +}
10.245 +
10.246 +bool saveStringToDisk (const QString &fname, const QString &s)
10.247 +{
10.248 + QFile file( fname);
10.249 +
10.250 + file.setName ( fname);
10.251 + if ( !file.open( QIODevice::WriteOnly ) )
10.252 + {
10.253 + file.close();
10.254 + return false;
10.255 + }
10.256 +
10.257 + // Write it finally, and write in UTF8, no matter what
10.258 + QTextStream ts( &file );
10.259 + ts.setEncoding (QTextStream::UnicodeUTF8);
10.260 + ts << s;
10.261 + file.close();
10.262 + return true;
10.263 +}
10.264 +
10.265 +
10.266 +ImagePreview::ImagePreview (QWidget *par=0): QLabel (par)
10.267 +{
10.268 + fdia=(Q3FileDialog*)par;
10.269 +}
10.270 +
10.271 +void ImagePreview::previewUrl( const Q3Url &u )
10.272 +{
10.273 + QString path = u.path();
10.274 + QPixmap pix( path );
10.275 + if ( pix.isNull() )
10.276 + {
10.277 + // Strange: If we have fd->setMode (QFileDialog::ExistingFiles)
10.278 + // in the filedialog, then there are 3 calls to previewURL
10.279 + // for each selection. And only the first is the actual selected file
10.280 + // while the following 2 point to the directory above the current one.
10.281 + // So here's my workaround:
10.282 +
10.283 + if (fdia && fdia->selectedFiles().count()==0)
10.284 + setText( QObject::tr("This is not an image.") );
10.285 + if (fdia &&fdia->selectedFiles().count()>1)
10.286 + setText( QObject::tr("Sorry, no preview for\nmultiple selected files.") );
10.287 + }
10.288 + else
10.289 + {
10.290 + float max_w=300;
10.291 + float max_h=300;
10.292 + float r;
10.293 + if (pix.width()>max_w)
10.294 + {
10.295 + r=max_w / pix.width();
10.296 + pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
10.297 + // FIXME not a resize, but a shrink/enlarge is needed here...
10.298 + }
10.299 + if (pix.height()>max_h)
10.300 + {
10.301 + r=max_h / pix.height();
10.302 + pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
10.303 + // FIXME not a resize, but a shrink/enlarge is needed here...
10.304 + }
10.305 + setPixmap( pix );
10.306 + }
10.307 +}
10.308 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/file.h Tue Jun 06 14:58:11 2006 +0000
11.3 @@ -0,0 +1,36 @@
11.4 +#ifndef FILE_H
11.5 +#define FILE_H
11.6 +
11.7 +#include <qdir.h>
11.8 +
11.9 +enum LoadMode {NewMap,ImportAdd,ImportReplace};
11.10 +enum SaveMode {PartOfMap,CompleteMap,UndoCommand};
11.11 +enum ErrorCode {success,aborted,nozip};
11.12 +
11.13 +
11.14 +/////////////////////////////////////////////////////////////////////////////
11.15 +QString maskPath (QString );
11.16 +QString convertToRel (const QString &,const QString &);
11.17 +QString makeUniqueDir (QString);
11.18 +void removeDir(QDir);
11.19 +void makeSubDirs (const QString &);
11.20 +ErrorCode zipDir (const QDir &,const QString&);
11.21 +ErrorCode unzipDir (const QDir &,const QString&);
11.22 +bool loadStringFromDisk (const QString &, QString &);
11.23 +bool saveStringToDisk (const QString &, const QString &s);
11.24 +
11.25 +/////////////////////////////////////////////////////////////////////////////
11.26 +#include <qlabel.h>
11.27 +#include <q3filedialog.h>
11.28 +#include <qpixmap.h>
11.29 +
11.30 +class ImagePreview : public QLabel, public Q3FilePreview
11.31 +{
11.32 +public:
11.33 + ImagePreview( QWidget * );
11.34 + void previewUrl( const Q3Url & );
11.35 +protected:
11.36 + Q3FileDialog *fdia;
11.37 +};
11.38 +
11.39 +#endif
12.1 --- a/findwindow.cpp Sun Jan 30 12:58:47 2005 +0000
12.2 +++ b/findwindow.cpp Tue Jun 06 14:58:11 2006 +0000
12.3 @@ -1,21 +1,26 @@
12.4 #include <qlineedit.h>
12.5 +//Added by qt3to4:
12.6 +#include <Q3HBoxLayout>
12.7 +#include <Q3VBoxLayout>
12.8 +#include <QLabel>
12.9
12.10 #include "findwindow.h"
12.11 +#include "version.h"
12.12
12.13
12.14 -FindWindow::FindWindow(QWidget* parent, const char* name, WFlags f)
12.15 - : QGroupBox( 0, Horizontal, "Find", parent, name )
12.16 +FindWindow::FindWindow(QWidget* parent, const char* name)
12.17 + : Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name )
12.18
12.19 {
12.20 - setCaption ("VYM - Find Text");
12.21 + setCaption (__VYM " - " +tr("Find Text"));
12.22 //resize (180,130);
12.23 move (130,130);
12.24
12.25 - setMargin( 100 );
12.26 + //FIXME not avail in QT4 setMargin( 100 );
12.27
12.28 - QVBoxLayout* box = new QVBoxLayout( layout() );
12.29 + Q3VBoxLayout* box = new Q3VBoxLayout( layout() );
12.30
12.31 - QHBoxLayout *row1 = new QHBoxLayout( box );
12.32 + Q3HBoxLayout *row1 = new Q3HBoxLayout( box );
12.33 row1->setMargin( 10 );
12.34
12.35 // Create a Label
12.36 @@ -23,7 +28,7 @@
12.37 row1->addWidget( label );
12.38
12.39 // Create LineEdit (here QComboBox)
12.40 - QHBoxLayout *row2 = new QHBoxLayout( box );
12.41 + Q3HBoxLayout *row2 = new Q3HBoxLayout( box );
12.42 row2->setMargin( 10 );
12.43 findcombo = new QComboBox( true, this );
12.44 findcombo->setMinimumWidth(150);
12.45 @@ -35,7 +40,7 @@
12.46 //findcombo->insertItem( "Normal", -1 );
12.47
12.48 // Create Buttons
12.49 - QHBoxLayout *row3 = new QHBoxLayout( box );
12.50 + Q3HBoxLayout *row3 = new Q3HBoxLayout( box );
12.51 row3->setMargin( 10 );
12.52 clearbutton = new QPushButton (tr("Clear"),this);
12.53 connect ( clearbutton, SIGNAL( clicked() ),
12.54 @@ -46,7 +51,7 @@
12.55 row3->addItem(si1);
12.56
12.57 cancelbutton = new QPushButton (tr("Cancel"),this);
12.58 - cancelbutton->setAccel (Key_Escape);
12.59 + cancelbutton->setAccel (Qt::Key_Escape);
12.60 connect ( cancelbutton, SIGNAL( clicked() ),
12.61 this, SLOT( cancelPressed() ) );
12.62 row3->addWidget (cancelbutton);
13.1 --- a/findwindow.h Sun Jan 30 12:58:47 2005 +0000
13.2 +++ b/findwindow.h Tue Jun 06 14:58:11 2006 +0000
13.3 @@ -1,20 +1,20 @@
13.4 #ifndef FINDWINDOW_H
13.5 #define FINDWINDOW_H
13.6
13.7 -#include <qmainwindow.h>
13.8 +#include <q3mainwindow.h>
13.9 #include <qcombobox.h>
13.10 #include <qpushbutton.h>
13.11 -#include <qgroupbox.h>
13.12 +#include <q3groupbox.h>
13.13 #include <qlayout.h>
13.14 #include <qlabel.h>
13.15
13.16
13.17 -class FindWindow : public QGroupBox
13.18 +class FindWindow : public Q3GroupBox
13.19 {
13.20 Q_OBJECT
13.21
13.22 public:
13.23 - FindWindow (QWidget* parent=0, const char* namme=0, WFlags f=0);
13.24 + FindWindow (QWidget* parent=0, const char* namme=0);
13.25
13.26 public slots:
13.27 void popup();
13.28 @@ -27,7 +27,7 @@
13.29 void somethingChanged(); // emit to mainwindow
13.30
13.31 private:
13.32 - QGroupBox *findbox;
13.33 + Q3GroupBox *findbox;
13.34 QComboBox *findcombo;
13.35 QPushButton *clearbutton;
13.36 QPushButton *findbutton;
14.1 --- a/flagobj.cpp Sun Jan 30 12:58:47 2005 +0000
14.2 +++ b/flagobj.cpp Tue Jun 06 14:58:11 2006 +0000
14.3 @@ -1,17 +1,19 @@
14.4 #include "flagobj.h"
14.5 +//Added by qt3to4:
14.6 +#include <QPixmap>
14.7
14.8 /////////////////////////////////////////////////////////////////
14.9 // FlagObj
14.10 /////////////////////////////////////////////////////////////////
14.11 FlagObj::FlagObj()
14.12 {
14.13 -// cout << "Const FlagObj ()\n";
14.14 +// cout << "Const FlagObj ()\n";
14.15 init ();
14.16 }
14.17
14.18 -FlagObj::FlagObj(QCanvas* c):MapObj(c)
14.19 +FlagObj::FlagObj(Q3Canvas* c):MapObj(c)
14.20 {
14.21 -// cout << "Const FlagObj\n";
14.22 +// cout << "Const FlagObj canvas="<<c<<endl;
14.23 init ();
14.24 }
14.25
14.26 @@ -23,13 +25,14 @@
14.27 FlagObj::~FlagObj()
14.28 {
14.29 // cout << "Destr FlagObj " << name << "\n";
14.30 - delete (icon);
14.31 + if (icon) delete (icon);
14.32 }
14.33
14.34
14.35 void FlagObj::init ()
14.36 {
14.37 name="undefined";
14.38 + group="undefined";
14.39
14.40 icon=new ImageObj (canvas);
14.41 icon->move (absPos.x(), absPos.y() );
14.42 @@ -41,6 +44,7 @@
14.43 {
14.44 MapObj::copy(other);
14.45 name=other->name;
14.46 + group=other->group;
14.47 tooltip=other->tooltip;
14.48 state=other->state;
14.49 icon->copy(other->icon);
14.50 @@ -95,6 +99,16 @@
14.51 return name;
14.52 }
14.53
14.54 +void FlagObj::setGroup (const QString &n)
14.55 +{
14.56 + group=n;
14.57 +}
14.58 +
14.59 +const QString FlagObj::getGroup()
14.60 +{
14.61 + return group;
14.62 +}
14.63 +
14.64 void FlagObj::setToolTip(const QString &n)
14.65 {
14.66 tooltip=n;
14.67 @@ -182,8 +196,8 @@
14.68
14.69 void FlagObj::positionBBox()
14.70 {
14.71 - bbox.setX (absPos.x() );
14.72 - bbox.setY (absPos.y() );
14.73 + bbox.moveTopLeft (absPos );
14.74 + clickBox.moveTopLeft (absPos );
14.75 }
14.76
14.77 void FlagObj::calcBBoxSize()
14.78 @@ -197,5 +211,6 @@
14.79 {
14.80 bbox.setSize (QSize(0,0));
14.81 }
14.82 + clickBox.setSize (bbox.size());
14.83 }
14.84
15.1 --- a/flagobj.h Sun Jan 30 12:58:47 2005 +0000
15.2 +++ b/flagobj.h Tue Jun 06 14:58:11 2006 +0000
15.3 @@ -2,8 +2,10 @@
15.4 #define FLAGOBJ_H
15.5
15.6
15.7 -#include <qcanvas.h>
15.8 +#include <q3canvas.h>
15.9 #include <qaction.h>
15.10 +//Added by qt3to4:
15.11 +#include <QPixmap>
15.12
15.13 #include "mapobj.h"
15.14 #include "imageobj.h"
15.15 @@ -12,7 +14,7 @@
15.16 class FlagObj:public MapObj {
15.17 public:
15.18 FlagObj ();
15.19 - FlagObj (QCanvas*);
15.20 + FlagObj (Q3Canvas*);
15.21 FlagObj (FlagObj*);
15.22 ~FlagObj ();
15.23 virtual void init ();
15.24 @@ -24,6 +26,8 @@
15.25 void load (const QPixmap&);
15.26 void setName (const QString&);
15.27 const QString getName ();
15.28 + void setGroup (const QString&);
15.29 + const QString getGroup();
15.30 void setToolTip(const QString&);
15.31 const QString getToolTip();
15.32 void setButton (QAction*);
15.33 @@ -40,6 +44,7 @@
15.34
15.35 protected:
15.36 QString name;
15.37 + QString group;
15.38 QString tooltip;
15.39 bool state;
15.40 bool used;
16.1 --- a/flagrowobj.cpp Sun Jan 30 12:58:47 2005 +0000
16.2 +++ b/flagrowobj.cpp Tue Jun 06 14:58:11 2006 +0000
16.3 @@ -5,11 +5,11 @@
16.4 /////////////////////////////////////////////////////////////////
16.5 FlagRowObj::FlagRowObj()
16.6 {
16.7 - cout << "Const FlagRowObj ()\n";
16.8 +// cout << "Const FlagRowObj ()\n";
16.9 init ();
16.10 }
16.11
16.12 -FlagRowObj::FlagRowObj(QCanvas* c):MapObj(c)
16.13 +FlagRowObj::FlagRowObj(Q3Canvas* c):MapObj(c)
16.14 {
16.15 // cout << "Const FlagRowObj\n";
16.16 init ();
16.17 @@ -25,6 +25,7 @@
16.18 {
16.19 flag.setAutoDelete (true);
16.20 parentRow=NULL;
16.21 + showFlags=true;
16.22 }
16.23
16.24 void FlagRowObj::copy (FlagRowObj* other)
16.25 @@ -86,8 +87,8 @@
16.26
16.27 void FlagRowObj::positionBBox()
16.28 {
16.29 - bbox.setX (absPos.x() );
16.30 - bbox.setY (absPos.y() );
16.31 + bbox.moveTopLeft(absPos );
16.32 + clickBox.moveTopLeft(absPos );
16.33 }
16.34
16.35 void FlagRowObj::calcBBoxSize()
16.36 @@ -104,15 +105,16 @@
16.37 if (size.height() > boxsize.height() )
16.38 boxsize.setHeight(size.height() );
16.39 }
16.40 - bbox.setSize (QSize(boxsize.width(), boxsize.height() ));
16.41 + bbox.setSize (boxsize);
16.42 + clickBox.setSize (boxsize);
16.43 }
16.44
16.45 QString FlagRowObj::getFlagName (const QPoint &p)
16.46 {
16.47 - if (!inBBox (p)) return "";
16.48 + if (!inBox (p)) return "";
16.49 FlagObj *fo;
16.50 for (fo=flag.first();fo; fo=flag.next() )
16.51 - if (fo->inBBox (p)) return fo->getName();
16.52 + if (fo->inBox (p)) return fo->getName();
16.53 return "";
16.54
16.55
16.56 @@ -121,19 +123,14 @@
16.57 bool FlagRowObj::isActive (const QString &foname)
16.58 {
16.59 FlagObj *fo=findFlag (foname);
16.60 - if (parentRow)
16.61 - {
16.62 - if (fo)
16.63 - return fo->isActive();
16.64 - else
16.65 - qWarning ("FlagRowObj::isActive of "+name+" couldn't find "+foname);
16.66 -
16.67 - } else
16.68 + if (parentRow && fo)
16.69 + return fo->isActive();
16.70 + else
16.71 if (fo) return true;
16.72 return false;
16.73 }
16.74
16.75 -void FlagRowObj::toggle (const QString &foname)
16.76 +void FlagRowObj::toggle (const QString &foname, bool exclusive)
16.77 {
16.78 FlagObj *fo=findFlag (foname);
16.79 if (fo)
16.80 @@ -150,6 +147,11 @@
16.81 {
16.82 fo=addFlag (fo);
16.83 fo->activate();
16.84 + if (exclusive)
16.85 + {
16.86 + deactivateGroup (fo);
16.87 + updateToolbar();
16.88 + }
16.89 } else
16.90 qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow");
16.91 }
16.92 @@ -159,6 +161,8 @@
16.93
16.94 void FlagRowObj::activate (const QString &foname)
16.95 {
16.96 + // Note: "activate" is also called during loading of a map
16.97 + // Here we do not check for exclusive flags!
16.98 FlagObj *fo=findFlag (foname);
16.99 if (parentRow)
16.100 {
16.101 @@ -171,9 +175,11 @@
16.102 {
16.103 fo=addFlag (fo);
16.104 fo->activate();
16.105 - fo->setVisibility (visible);
16.106 + if (showFlags)
16.107 + fo->setVisibility (visible);
16.108 + else
16.109 + fo->setVisibility (false);
16.110 calcBBoxSize();
16.111 - positionBBox();
16.112 } else
16.113 qWarning ("FlagRowObj ("+name+")::activate ("+foname+") failed - could not find it in parentRow");
16.114 }
16.115 @@ -190,6 +196,7 @@
16.116 }
16.117 }
16.118
16.119 +
16.120 void FlagRowObj::deactivate (const QString &foname)
16.121 {
16.122 FlagObj *fo=findFlag (foname);
16.123 @@ -204,13 +211,27 @@
16.124 {
16.125 FlagObj *fo;
16.126 for (fo=flag.first();fo; fo=flag.next() )
16.127 - {
16.128 fo->deactivate();
16.129 - }
16.130 } else
16.131 qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
16.132 }
16.133
16.134 +void FlagRowObj::deactivateGroup (FlagObj *keepfo)
16.135 +{
16.136 + // deactivate all flags in keepof, but keep keepfo [sic!]
16.137 + if (keepfo)
16.138 + {
16.139 + QString g=keepfo->getGroup();
16.140 + if (g!="undefined")
16.141 + {
16.142 + FlagObj *fo;
16.143 + for (fo=flag.first();fo; fo=flag.next() )
16.144 + if (g==fo->getGroup() && keepfo!=fo)
16.145 + flag.remove(fo);
16.146 + }
16.147 + }
16.148 +}
16.149 +
16.150 void FlagRowObj::setEnabled (bool b)
16.151 {
16.152 // If we have no parent, we are the default FlagRowObj
16.153 @@ -223,6 +244,11 @@
16.154 }
16.155 }
16.156
16.157 +void FlagRowObj::setShowFlags (bool b)
16.158 +{
16.159 + showFlags=b;
16.160 +}
16.161 +
16.162 void FlagRowObj::resetUsedCounter()
16.163 {
16.164 FlagObj *fo;
16.165 @@ -260,26 +286,28 @@
16.166 name=n;
16.167 }
16.168
16.169 -void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
16.170 +void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
16.171 {
16.172 + //Only make toolbar for the parentrow, not each row in branches
16.173 if (!parentRow)
16.174 {
16.175 // create bar and buttons
16.176 - QToolBar* tb = new QToolBar( w);
16.177 + Q3ToolBar* tb = new Q3ToolBar( w);
16.178 tb->setLabel (n);
16.179 QAction *a;
16.180 FlagObj *fo;
16.181 for (fo=flag.first();fo; fo=flag.next() )
16.182 {
16.183 a=new QAction (
16.184 - fo->getToolTip(),
16.185 +// FIXME was in QT3: fo->getToolTip(),
16.186 fo->getPixmap(),
16.187 fo->getName(),
16.188 - 0,
16.189 - w,
16.190 - fo->getName()
16.191 +// 0,
16.192 + w
16.193 +// fo->getName()
16.194 );
16.195 a->setToggleAction(true);
16.196 +// a->setTooltip (fo->getToolTip());
16.197 // FIXME should not be enabled by default, later in updateToolbar
16.198 a->setEnabled(true);
16.199 a->addTo (tb);
16.200 @@ -288,10 +316,10 @@
16.201 w, SLOT( standardFlagChanged() ) );
16.202 }
16.203 } else
16.204 - qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows");
16.205 + qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
16.206 }
16.207
16.208 -void FlagRowObj::updateToolBar()
16.209 +void FlagRowObj::updateToolbar()
16.210 {
16.211 FlagObj *fo;
16.212 if (parentRow)
16.213 @@ -301,7 +329,7 @@
16.214 // In parentRow activate all existing (==active) flags
16.215 for (fo=flag.first();fo; fo=flag.next() )
16.216 parentRow->activate(fo->getName());
16.217 - parentRow->updateToolBar();
16.218 + parentRow->updateToolbar();
16.219 } else
16.220 {
16.221 // We are the toolbar default
17.1 --- a/flagrowobj.h Sun Jan 30 12:58:47 2005 +0000
17.2 +++ b/flagrowobj.h Tue Jun 06 14:58:11 2006 +0000
17.3 @@ -1,7 +1,9 @@
17.4 #ifndef FLAGROWOBJ_H
17.5 #define FLAGROWOBJ_H
17.6
17.7 -#include <qmainwindow.h>
17.8 +#include <q3mainwindow.h>
17.9 +//Added by qt3to4:
17.10 +#include <Q3PtrList>
17.11
17.12 #include "mapobj.h"
17.13 #include "flagobj.h"
17.14 @@ -9,7 +11,7 @@
17.15 class FlagRowObj:public QObject,public MapObj {
17.16 public:
17.17 FlagRowObj ();
17.18 - FlagRowObj (QCanvas*);
17.19 + FlagRowObj (Q3Canvas*);
17.20 ~FlagRowObj ();
17.21 virtual void init ();
17.22 virtual void copy (FlagRowObj*);
17.23 @@ -22,20 +24,23 @@
17.24 virtual void calcBBoxSize();
17.25 virtual QString getFlagName (const QPoint &p); // Find flag by position
17.26 bool isActive(const QString&);
17.27 - void toggle (const QString&);
17.28 + void toggle (const QString&,bool);
17.29 void activate(const QString&);
17.30 void deactivate(const QString&);
17.31 void deactivateAll();
17.32 + void deactivateGroup(FlagObj *);
17.33 void setEnabled (bool);
17.34 + void setShowFlags (bool);
17.35 void resetUsedCounter();
17.36 QString saveToDir (const QString &,const QString &,bool);
17.37 void setName (const QString&); // prefix for exporting flags to dir
17.38 - void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons
17.39 - void updateToolBar(); // Update Toolbar buttons
17.40 + void makeToolbar (Q3MainWindow*, const QString &); // Create Toolbar buttons
17.41 + void updateToolbar(); // Update Toolbar buttons
17.42 private:
17.43 FlagRowObj* parentRow; // look for flags in this row
17.44 FlagObj* findFlag (const QString&);
17.45 - QPtrList <FlagObj> flag;
17.46 + Q3PtrList <FlagObj> flag;
17.47 QString name;
17.48 + bool showFlags; // FloatObjects want to hide their flags
17.49 };
17.50 #endif
18.1 --- a/floatimageobj.cpp Sun Jan 30 12:58:47 2005 +0000
18.2 +++ b/floatimageobj.cpp Tue Jun 06 14:58:11 2006 +0000
18.3 @@ -1,13 +1,14 @@
18.4 #include "floatimageobj.h"
18.5 #include "branchobj.h"
18.6 -#include <math.h>
18.7 +//Added by qt3to4:
18.8 +#include <QPixmap>
18.9
18.10
18.11 /////////////////////////////////////////////////////////////////
18.12 // FloatImageObj
18.13 /////////////////////////////////////////////////////////////////
18.14
18.15 -int FloatImageObj::counter=0; // make instance
18.16 +uint FloatImageObj::saveCounter=0; // make instance
18.17
18.18
18.19 FloatImageObj::FloatImageObj ():FloatObj()
18.20 @@ -18,7 +19,7 @@
18.21 depth=-1;
18.22 }
18.23
18.24 -FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
18.25 +FloatImageObj::FloatImageObj (Q3Canvas* c):FloatObj(c)
18.26 {
18.27 // cout << "Const FloatImageObj (c) called from MapCenterObj (c)\n";
18.28 setParObj (this);
18.29 @@ -26,7 +27,7 @@
18.30 depth=-1;
18.31 }
18.32
18.33 -FloatImageObj::FloatImageObj (QCanvas* c, LinkableMapObj* p):FloatObj(c,p)
18.34 +FloatImageObj::FloatImageObj (Q3Canvas* c, OrnamentedObj* p):FloatObj(c,p)
18.35 {
18.36 // cout << "Const FloatImageObj (c,p)\n";
18.37 init();
18.38 @@ -43,18 +44,26 @@
18.39 icon=new ImageObj (canvas);
18.40 icon->move (absPos.x(), absPos.y() );
18.41 icon->setVisibility (true);
18.42 + setZ (Z_FLOATIMG);
18.43 bbox.setSize (QSize(icon->size().width(), icon->size().height()));
18.44 + clickBox.setSize (QSize(icon->size().width(), icon->size().height()));
18.45 filename="";
18.46 originalFilename="no original name available";
18.47 filetype="";
18.48 saveInMap=true;
18.49 + useRelPos=true;
18.50 +
18.51 + //Hide flags
18.52 + systemFlags->setShowFlags(false);
18.53 }
18.54
18.55 void FloatImageObj::copy (FloatImageObj* other)
18.56 {
18.57 FloatObj::copy (other);
18.58 icon->copy (other->icon);
18.59 + filetype=other->filetype;
18.60 filename=other->filename;
18.61 + originalFilename=other->originalFilename;
18.62 saveInMap=other->saveInMap;
18.63 positionBBox();
18.64 }
18.65 @@ -67,7 +76,17 @@
18.66
18.67 int FloatImageObj::z ()
18.68 {
18.69 - return lrint (icon->z());
18.70 + return qRound (icon->z());
18.71 +}
18.72 +
18.73 +void FloatImageObj::load (const QPixmap &pixmap)
18.74 +{
18.75 + icon->load(pixmap);
18.76 + bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
18.77 + clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
18.78 + positionBBox();
18.79 + filetype="PNG";
18.80 + filename="noname.png";
18.81 }
18.82
18.83 bool FloatImageObj::load (const QString &fn)
18.84 @@ -77,7 +96,8 @@
18.85 bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
18.86 positionBBox();
18.87 filename=fn;
18.88 - filetype=QPixmap::imageFormat (fn);
18.89 +//FIXME QT3 was filetype=QPixmap::imageFormat (fn);
18.90 + setOriginalFilename (fn);
18.91 return true;
18.92 } else
18.93 return false;
18.94 @@ -92,6 +112,10 @@
18.95 void FloatImageObj::setOriginalFilename(const QString & fn)
18.96 {
18.97 originalFilename=fn;
18.98 +
18.99 + // Set short name, too. Search from behind:
18.100 + int i=originalFilename.findRev("/");
18.101 + if (i>=0) originalFilename=originalFilename.remove (0,i+1);
18.102 }
18.103
18.104 QString FloatImageObj::getOriginalFilename()
18.105 @@ -101,7 +125,7 @@
18.106
18.107 void FloatImageObj::setVisibility(bool v)
18.108 {
18.109 - LinkableMapObj::setVisibility(v);
18.110 + OrnamentedObj::setVisibility(v);
18.111 if (v)
18.112 icon->setVisibility(true);
18.113 else
18.114 @@ -122,7 +146,7 @@
18.115
18.116 void FloatImageObj::positionBBox()
18.117 {
18.118 - // TODO
18.119 + clickBox=bbox;
18.120 }
18.121
18.122 void FloatImageObj::calcBBoxSize()
18.123 @@ -130,14 +154,12 @@
18.124 // TODO
18.125 }
18.126
18.127 -QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
18.128 +QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint &p)
18.129 {
18.130 - counter++;
18.131 + if (hidden) return "";
18.132
18.133 - QString posAttr=
18.134 - attribut("relPosX",QString().setNum(relPos.x(),10)) +
18.135 - attribut("relPosY",QString().setNum(relPos.y(),10));
18.136 -
18.137 + saveCounter++;
18.138 +
18.139 QString useOrientAttr;
18.140 if (useOrientation)
18.141 useOrientAttr=attribut ("useOrientation","true");
18.142 @@ -164,24 +186,27 @@
18.143 if (filetype=="GIF")
18.144 filetype="PNG";
18.145
18.146 - url="images/"+prefix+"image-" + QString().number(counter,10) + "." +filetype;
18.147 + url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype;
18.148
18.149 // And really save the image
18.150 icon->save (tmpdir + "/" + url, filetype);
18.151 +
18.152 + QString nameAttr=attribut ("orgName",originalFilename);
18.153
18.154 return singleElement ("floatimage",
18.155 - posAttr +
18.156 - useOrientAttr +
18.157 - saveInMapAttr +
18.158 - exportAttr +
18.159 - zAttr +
18.160 - attribut ("href",QString ("file:")+url)
18.161 + getOrnAttr()
18.162 + +useOrientAttr
18.163 + +saveInMapAttr
18.164 + +exportAttr
18.165 + +zAttr
18.166 + +attribut ("href",QString ("file:")+url)
18.167 + +nameAttr
18.168 );
18.169 }
18.170
18.171 void FloatImageObj::resetSaveCounter()
18.172 {
18.173 - counter=0;
18.174 + saveCounter=0;
18.175 }
18.176
18.177
19.1 --- a/floatimageobj.h Sun Jan 30 12:58:47 2005 +0000
19.2 +++ b/floatimageobj.h Tue Jun 06 14:58:11 2006 +0000
19.3 @@ -2,19 +2,22 @@
19.4 #define FLOATIMAGEOBJ_H
19.5
19.6 #include "floatobj.h"
19.7 +//Added by qt3to4:
19.8 +#include <QPixmap>
19.9
19.10 /////////////////////////////////////////////////////////////////////////////
19.11 class FloatImageObj:public FloatObj {
19.12 public:
19.13 FloatImageObj ();
19.14 - FloatImageObj (QCanvas*);
19.15 - FloatImageObj (QCanvas*, LinkableMapObj* parent);
19.16 + FloatImageObj (Q3Canvas*);
19.17 + FloatImageObj (Q3Canvas*, OrnamentedObj* parent);
19.18 ~FloatImageObj ();
19.19 virtual void init ();
19.20 virtual void copy (FloatImageObj*);
19.21 virtual void setZ (const int&);
19.22 virtual int z();
19.23
19.24 + virtual void load (const QPixmap &);
19.25 virtual bool load (const QString &);
19.26 virtual void save (const QString &, const char *);
19.27 virtual void setOriginalFilename(const QString &);
19.28 @@ -27,7 +30,7 @@
19.29 virtual QRect getTotalBBox(); // return BBox including childs
19.30 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
19.31 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
19.32 - virtual QString saveToDir(const QString &,const QString&);
19.33 + virtual QString saveToDir(const QString &,const QString&, const QPoint &);
19.34 virtual void resetSaveCounter();
19.35 virtual QString getSelectString();
19.36
19.37 @@ -35,7 +38,7 @@
19.38 protected:
19.39 ImageObj *icon;
19.40 bool saveInMap;
19.41 - static int counter; // numerate the files during saveToDir
19.42 + static uint saveCounter; // numerate the files during saveToDir
19.43 QString filetype;
19.44 QString filename;
19.45 QString originalFilename;
20.1 --- a/floatobj.cpp Sun Jan 30 12:58:47 2005 +0000
20.2 +++ b/floatobj.cpp Tue Jun 06 14:58:11 2006 +0000
20.3 @@ -6,7 +6,7 @@
20.4 // FloatObj
20.5 /////////////////////////////////////////////////////////////////
20.6
20.7 -FloatObj::FloatObj ():LinkableMapObj()
20.8 +FloatObj::FloatObj ():OrnamentedObj()
20.9 {
20.10 // cout << "Const FloatObj ()\n";
20.11 setParObj (this);
20.12 @@ -14,7 +14,7 @@
20.13 depth=-1;
20.14 }
20.15
20.16 -FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
20.17 +FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
20.18 {
20.19 // cout << "Const FloatObj (c) called from MapCenterObj (c)\n";
20.20 setParObj (this);
20.21 @@ -22,7 +22,7 @@
20.22 depth=-1;
20.23 }
20.24
20.25 -FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
20.26 +FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
20.27 {
20.28 // cout << "Const FloatObj (c,p)\n";
20.29 setParObj (p);
20.30 @@ -38,39 +38,18 @@
20.31 void FloatObj::init ()
20.32 {
20.33 setChildObj(this);
20.34 - relPos=getRandPos();
20.35 - useOrientation=true;
20.36 floatExport=true;
20.37 zPlane=Z_ICON;
20.38 + setLinkStyle (StyleParabel);
20.39 + setHideLinkUnselected(true);
20.40 }
20.41
20.42 void FloatObj::copy (FloatObj* other)
20.43 {
20.44 LinkableMapObj::copy (other);
20.45 - relPos=other->relPos;
20.46 - useOrientation=other->useOrientation;
20.47 setVisibility (other->visible);
20.48 }
20.49
20.50 -void FloatObj::setRelPos()
20.51 -{
20.52 - if (useOrientation)
20.53 - {
20.54 - if (parObj->getOrientation()==OrientLeftOfCenter)
20.55 - relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
20.56 - else
20.57 - relPos.setX (absPos.x() - parObj->x() );
20.58 - }
20.59 - else
20.60 - relPos.setX (absPos.x() - parObj->x() );
20.61 - relPos.setY (absPos.y() - parObj->y() );
20.62 -}
20.63 -
20.64 -void FloatObj::setRelPos(const QPoint &p)
20.65 -{
20.66 - relPos=p;
20.67 -}
20.68 -
20.69 void FloatObj::setZ(const int &i)
20.70 {
20.71 zPlane=i;
20.72 @@ -81,16 +60,6 @@
20.73 return zPlane;
20.74 }
20.75
20.76 -
20.77 -void FloatObj::setUseOrientation (const bool &b)
20.78 -{
20.79 - if (useOrientation!=b)
20.80 - {
20.81 - useOrientation=b;
20.82 - requestReposition();
20.83 - }
20.84 -}
20.85 -
20.86 void FloatObj::setFloatExport(const bool& b)
20.87 {
20.88 floatExport=b;
20.89 @@ -112,17 +81,15 @@
20.90 move (p.x(), p.y());
20.91 }
20.92
20.93 +void FloatObj::setDockPos()
20.94 +{
20.95 + parPos=absPos;
20.96 + childPos=absPos;
20.97 +}
20.98 +
20.99 void FloatObj::reposition()
20.100 {
20.101 - if (useOrientation)
20.102 - {
20.103 - if (parObj->getOrientation()==OrientLeftOfCenter)
20.104 - move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
20.105 - else
20.106 - move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
20.107 - }
20.108 - else
20.109 - move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
20.110 + move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
20.111 updateLink();
20.112 }
20.113
20.114 @@ -139,25 +106,11 @@
20.115 void FloatObj::select()
20.116 {
20.117 LinkableMapObj::select();
20.118 - // Temporary draw the link while FO is selected
20.119 - if (style==StyleUndef)
20.120 - {
20.121 - setLinkStyle(getDefLinkStyle());
20.122 - setLinkColor(parObj->getLinkColor());
20.123 - }
20.124 -
20.125 - // Update FloatExport switch in context menu
20.126 - if (floatExport)
20.127 - actionEditToggleFloatExport->setEnabled (true);
20.128 - else
20.129 - actionEditToggleFloatExport->setEnabled (true);
20.130 -
20.131 -
20.132 + LinkableMapObj::setLinkColor(parObj->getLinkColor());
20.133 }
20.134
20.135 void FloatObj::unselect()
20.136 {
20.137 LinkableMapObj::unselect();
20.138 - setLinkStyle (StyleUndef);
20.139 }
20.140
21.1 --- a/floatobj.h Sun Jan 30 12:58:47 2005 +0000
21.2 +++ b/floatobj.h Tue Jun 06 14:58:11 2006 +0000
21.3 @@ -1,43 +1,37 @@
21.4 #ifndef FLOATOBJ_H
21.5 #define FLOATOBJ_H
21.6
21.7 -#include "linkablemapobj.h"
21.8 +#include "ornamentedobj.h"
21.9
21.10 /////////////////////////////////////////////////////////////////////////////
21.11 -class FloatObj:public LinkableMapObj {
21.12 +class FloatObj:public OrnamentedObj {
21.13 public:
21.14 FloatObj ();
21.15 - FloatObj (QCanvas*);
21.16 - FloatObj (QCanvas*, LinkableMapObj* parent);
21.17 + FloatObj (Q3Canvas*);
21.18 + FloatObj (Q3Canvas*, LinkableMapObj* parent);
21.19 ~FloatObj ();
21.20 virtual void init ();
21.21 virtual void copy (FloatObj*);
21.22 virtual bool load (const QString&)=0;
21.23 - virtual void setRelPos(); // set relPos to current parentPos
21.24 - virtual void setRelPos(const QPoint&);
21.25 virtual void setZ(const int&); // set zPlane
21.26 virtual int z();
21.27 - virtual void setUseOrientation (const bool &);
21.28 virtual void setFloatExport (const bool &);
21.29 virtual bool getFloatExport ();
21.30
21.31 virtual void move (double,double);
21.32 virtual void move (QPoint);
21.33 -
21.34 + virtual void setDockPos();
21.35 virtual void reposition();
21.36
21.37 virtual QRect getTotalBBox(); // return BBox including childs
21.38 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
21.39
21.40 - virtual QString saveToDir(const QString &,const QString&)=0;
21.41 virtual void resetSaveCounter()=0;
21.42
21.43 virtual void select();
21.44 virtual void unselect();
21.45
21.46 protected:
21.47 - QPoint relPos;
21.48 - bool useOrientation;
21.49 bool floatExport;
21.50 int zPlane;
21.51 };
22.1 --- a/frameobj.cpp Sun Jan 30 12:58:47 2005 +0000
22.2 +++ b/frameobj.cpp Tue Jun 06 14:58:11 2006 +0000
22.3 @@ -11,7 +11,7 @@
22.4 init ();
22.5 }
22.6
22.7 -FrameObj::FrameObj(QCanvas* c) :MapObj(c)
22.8 +FrameObj::FrameObj(Q3Canvas* c) :MapObj(c)
22.9 {
22.10 // cout << "Const FrameObj\n";
22.11 init ();
22.12 @@ -117,16 +117,13 @@
22.13 break;
22.14 case Rectangle:
22.15 border=10;
22.16 - rectFrame = new QCanvasRectangle (canvas);
22.17 + rectFrame = new Q3CanvasRectangle (canvas);
22.18 rectFrame->setZ(Z_FRAME);
22.19 rectFrame->setBrush( QColor("white") );
22.20 rectFrame->setPen( QPen(QColor("black") ));
22.21 - if (visible)
22.22 - rectFrame->show();
22.23 - else
22.24 - rectFrame->hide();
22.25 break;
22.26 }
22.27 + setVisibility (visible);
22.28 }
22.29 }
22.30
22.31 @@ -141,6 +138,16 @@
22.32 void FrameObj::setVisibility (bool v)
22.33 {
22.34 MapObj::setVisibility(v);
22.35 - setFrameType (type); // changes on visibility depend on type...
22.36 + switch (type)
22.37 + {
22.38 + case NoFrame:
22.39 + break;
22.40 + case Rectangle:
22.41 + if (visible)
22.42 + rectFrame->show();
22.43 + else
22.44 + rectFrame->hide();
22.45 + break;
22.46 + }
22.47 }
22.48
23.1 --- a/frameobj.h Sun Jan 30 12:58:47 2005 +0000
23.2 +++ b/frameobj.h Tue Jun 06 14:58:11 2006 +0000
23.3 @@ -8,7 +8,7 @@
23.4 class FrameObj:public MapObj {
23.5 public:
23.6 FrameObj();
23.7 - FrameObj(QCanvas*);
23.8 + FrameObj(Q3Canvas*);
23.9 ~FrameObj();
23.10 void init();
23.11 void clear();
23.12 @@ -26,7 +26,7 @@
23.13
23.14 protected:
23.15 FrameType type;
23.16 - QCanvasRectangle* rectFrame;
23.17 + Q3CanvasRectangle* rectFrame;
23.18 int border; // distance text - frame
23.19 };
23.20 #endif
24.1 --- a/headingobj.cpp Sun Jan 30 12:58:47 2005 +0000
24.2 +++ b/headingobj.cpp Tue Jun 06 14:58:11 2006 +0000
24.3 @@ -1,4 +1,5 @@
24.4 #include "headingobj.h"
24.5 +#include <qregexp.h>
24.6
24.7 /////////////////////////////////////////////////////////////////
24.8 // HeadingObj
24.9 @@ -9,7 +10,7 @@
24.10 init ();
24.11 }
24.12
24.13 -HeadingObj::HeadingObj(QCanvas* c) :MapObj(c)
24.14 +HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
24.15 {
24.16 // cout << "Const HeadingObj\n";
24.17 init ();
24.18 @@ -26,6 +27,7 @@
24.19 textwidth=40;
24.20 color=QColor ("black");
24.21 font=QFont();
24.22 + heading="";
24.23 }
24.24
24.25 void HeadingObj::copy(HeadingObj *other)
24.26 @@ -40,13 +42,15 @@
24.27 void HeadingObj::move(double x, double y)
24.28 {
24.29 MapObj::move(x,y);
24.30 +
24.31 int h; // height of a textline
24.32 int ho; // offset of height while drawing all lines
24.33 +
24.34 if (textline.first() )
24.35 h=textline.first()->boundingRect().height();
24.36 else
24.37 h=2;
24.38 - QCanvasText *t;
24.39 + Q3CanvasText *t;
24.40 ho=0;
24.41 for (t=textline.first(); t; t=textline.next() )
24.42 {
24.43 @@ -76,7 +80,7 @@
24.44 // then no selection would be visible, thus we prevent it in ::setText()
24.45 if (!textline.isEmpty() )
24.46 {
24.47 - QCanvasText *t;
24.48 + Q3CanvasText *t;
24.49 for (t=textline.first(); t; t=textline.next() )
24.50 {
24.51 h+=t->boundingRect().height();
24.52 @@ -87,14 +91,15 @@
24.53 bbox.setSize (QSize(w,h));
24.54 }
24.55
24.56 -QCanvasText* HeadingObj::newLine(QString s)
24.57 +Q3CanvasText* HeadingObj::newLine(QString s)
24.58 {
24.59 - QCanvasText *t;
24.60 - t = new QCanvasText(canvas);
24.61 + Q3CanvasText *t;
24.62 + t = new Q3CanvasText(canvas);
24.63 t->setFont (font);
24.64 t->setColor (color);
24.65 t->setZ(Z_TEXT);
24.66 t->setText(s);
24.67 + t->setTextFlags(Qt::AlignLeft);
24.68 t->show();
24.69 return t;
24.70 }
24.71 @@ -114,15 +119,17 @@
24.72 int j=0; // index of last ws
24.73 int k=0; // index of "<br>" or similar linebreak
24.74 int br=0; // width of found break, e.g. for <br> it is 4
24.75 + QRegExp re("<br.*/>");
24.76 + re.setMinimal (true);
24.77
24.78 // set the text and wrap lines
24.79 while (s.length()>0)
24.80 {
24.81 // ok, some people wanted manual linebreaks, here we go
24.82 - k=s.find ("<br>",i,false);
24.83 + k=re.search (s,i);
24.84 if (k>=0)
24.85 {
24.86 - br=4;
24.87 + br=re.cap(0).length();
24.88 i=k;
24.89 } else
24.90 i=s.find (" ",i,false);
24.91 @@ -184,6 +191,7 @@
24.92 }
24.93 }
24.94 setVisibility (visible);
24.95 + move (absPos.x(),absPos.y());
24.96 calcBBoxSize();
24.97 }
24.98
24.99 @@ -212,7 +220,7 @@
24.100 if (color!=c)
24.101 {
24.102 color=c;
24.103 - QCanvasText *t;
24.104 + Q3CanvasText *t;
24.105 for (t=textline.first(); t; t=textline.next() )
24.106 t->setColor(c);
24.107 }
24.108 @@ -226,7 +234,7 @@
24.109 void HeadingObj::setVisibility (bool v)
24.110 {
24.111 MapObj::setVisibility(v);
24.112 - QCanvasText *t;
24.113 + Q3CanvasText *t;
24.114 for (t=textline.first(); t; t=textline.next() )
24.115 if (v)
24.116 t->show();
25.1 --- a/headingobj.h Sun Jan 30 12:58:47 2005 +0000
25.2 +++ b/headingobj.h Tue Jun 06 14:58:11 2006 +0000
25.3 @@ -2,11 +2,13 @@
25.4 #define HEADINGOBJ_H
25.5
25.6 #include "mapobj.h"
25.7 +//Added by qt3to4:
25.8 +#include <Q3PtrList>
25.9
25.10 class HeadingObj:public MapObj {
25.11 public:
25.12 HeadingObj();
25.13 - HeadingObj(QCanvas*);
25.14 + HeadingObj(Q3Canvas*);
25.15 virtual ~HeadingObj();
25.16 virtual void init();
25.17 virtual void copy(HeadingObj*);
25.18 @@ -15,7 +17,7 @@
25.19 virtual void positionBBox();
25.20 virtual void calcBBoxSize();
25.21 private:
25.22 - QCanvasText* newLine(QString); // generate new textline
25.23 + Q3CanvasText* newLine(QString); // generate new textline
25.24 public:
25.25 virtual void setText(QString);
25.26 virtual QString text();
25.27 @@ -30,7 +32,7 @@
25.28 protected:
25.29 QString heading;
25.30 uint textwidth; // width for formatting text
25.31 - QPtrList <QCanvasText> textline; // a part of e.g. the parabel
25.32 + Q3PtrList <Q3CanvasText> textline; // a part of e.g. the parabel
25.33 QColor color;
25.34 QFont font;
25.35 };
26.1 --- a/imageobj.cpp Sun Jan 30 12:58:47 2005 +0000
26.2 +++ b/imageobj.cpp Tue Jun 06 14:58:11 2006 +0000
26.3 @@ -1,10 +1,12 @@
26.4 #include "imageobj.h"
26.5 +//Added by qt3to4:
26.6 +#include <QPixmap>
26.7
26.8 /////////////////////////////////////////////////////////////////
26.9 // ImageObj
26.10 /////////////////////////////////////////////////////////////////
26.11 -ImageObj::ImageObj( QCanvas *canvas )
26.12 - : QCanvasRectangle( canvas )
26.13 +ImageObj::ImageObj( Q3Canvas *canvas )
26.14 + : Q3CanvasRectangle( canvas )
26.15 {
26.16 // cout << "Const ImageObj (canvas)\n";
26.17 setZ(Z_ICON);
26.18 @@ -39,7 +41,7 @@
26.19 {
26.20 switch (type)
26.21 {
26.22 - case undef: qWarning("undef");break;
26.23 + case undef: qWarning("Warning: ImageObj::save() type=undef");break;
26.24 case qimage: image.save (fn,format,-1);break;
26.25 case qpixmap: pixmap.save (fn,format,-1);break;
26.26 }
26.27 @@ -54,7 +56,7 @@
26.28 type=qimage;
26.29
26.30 #if !defined(Q_WS_QWS)
26.31 - pixmap.convertFromImage(image, OrderedAlphaDither);
26.32 + pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
26.33 #endif
26.34 return true;
26.35 }
26.36 @@ -78,7 +80,7 @@
26.37 {
26.38 type=qimage;
26.39 image=img;
26.40 - pixmap.convertFromImage(image, OrderedAlphaDither);
26.41 + pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
26.42 }
26.43
26.44 QPixmap ImageObj::getPixmap()
26.45 @@ -91,7 +93,7 @@
26.46 // On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
26.47 // but on other platforms, we need to use a QPixmap.
26.48 #if defined(Q_WS_QWS)
26.49 - p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
26.50 + p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
26.51 #else
26.52 p.drawPixmap( int(x()), int(y()), pixmap );
26.53 #endif
27.1 --- a/imageobj.h Sun Jan 30 12:58:47 2005 +0000
27.2 +++ b/imageobj.h Tue Jun 06 14:58:11 2006 +0000
27.3 @@ -2,17 +2,19 @@
27.4 #define IMAGEOBJ_H
27.5
27.6 #include <qimage.h>
27.7 -#include <qcanvas.h>
27.8 +#include <q3canvas.h>
27.9 #include <qpainter.h>
27.10 +//Added by qt3to4:
27.11 +#include <QPixmap>
27.12
27.13 #include "mapobj.h"
27.14
27.15 enum ImageType {qimage,qpixmap,undef};
27.16
27.17 -class ImageObj: public QCanvasRectangle
27.18 +class ImageObj: public Q3CanvasRectangle
27.19 {
27.20 public:
27.21 - ImageObj( QCanvas *canvas );
27.22 + ImageObj( Q3Canvas *canvas );
27.23 ~ImageObj();
27.24 virtual void copy (ImageObj*);
27.25 virtual void setVisibility(bool);
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/imports.cpp Tue Jun 06 14:58:11 2006 +0000
28.3 @@ -0,0 +1,115 @@
28.4 +#include <qmessagebox.h>
28.5 +//Added by qt3to4:
28.6 +#include <QTextStream>
28.7 +
28.8 +#include "file.h"
28.9 +#include "imports.h"
28.10 +#include "linkablemapobj.h"
28.11 +#include "misc.h"
28.12 +#include "mainwindow.h"
28.13 +#include "xsltproc.h"
28.14 +
28.15 +extern Main *mainWindow;
28.16 +extern QDir vymBaseDir;
28.17 +
28.18 +ImportBase::ImportBase()
28.19 +{
28.20 + // Create tmpdir
28.21 + tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
28.22 +}
28.23 +
28.24 +
28.25 +ImportBase::~ImportBase()
28.26 +{
28.27 + // Remove tmpdir
28.28 + removeDir (tmpDir);
28.29 +}
28.30 +
28.31 +void ImportBase::setDir(const QString &p)
28.32 +{
28.33 + inputDir=p;
28.34 +}
28.35 +
28.36 +void ImportBase::setFile (const QString &p)
28.37 +{
28.38 + inputFile=p;
28.39 +}
28.40 +
28.41 +void ImportBase::setMapCenter(MapCenterObj *mc)
28.42 +{
28.43 + mapCenter=mc;
28.44 +}
28.45 +
28.46 +bool ImportBase::transform()
28.47 +{
28.48 + return true;
28.49 +}
28.50 +
28.51 +QString ImportBase::getTransformedFile()
28.52 +{
28.53 + return transformedFile;
28.54 +}
28.55 +
28.56 +/////////////////////////////////////////////////
28.57 +bool ImportKDEBookmarks::transform()
28.58 +{
28.59 + transformedFile=tmpDir.path()+"/bookmarks.xml";
28.60 +
28.61 + XSLTProc p;
28.62 + p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
28.63 + p.setOutputFile (transformedFile);
28.64 + p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
28.65 + p.process();
28.66 +
28.67 + return true;
28.68 +}
28.69 +
28.70 +
28.71 +/////////////////////////////////////////////////
28.72 +bool ImportFirefoxBookmarks::transform()
28.73 +{
28.74 + transformedFile=tmpDir.path()+"/bookmarks.xml";
28.75 +
28.76 + QStringList lines;
28.77 + QFile file( inputFile );
28.78 + if ( file.open( QIODevice::ReadOnly ) )
28.79 + {
28.80 + QTextStream stream( &file );
28.81 + while ( !stream.atEnd() )
28.82 + lines += stream.readLine(); // line of text excluding '\n'
28.83 + file.close();
28.84 + }
28.85 + // FIXME
28.86 + // Generate vym from broken bookmarks above...
28.87 +
28.88 + return true;
28.89 +}
28.90 +
28.91 +
28.92 +/////////////////////////////////////////////////
28.93 +bool ImportMM::transform()
28.94 +{
28.95 + // try to unzip
28.96 + if (success==unzipDir (tmpDir, inputFile))
28.97 + {
28.98 +
28.99 + // Set short name, too. Search from behind:
28.100 + transformedFile=inputFile;
28.101 + int i=transformedFile.findRev("/");
28.102 + if (i>=0) transformedFile=transformedFile.remove (0,i+1);
28.103 + transformedFile.replace(".mmap",".xml");
28.104 + transformedFile=tmpDir.path()+"/"+transformedFile;
28.105 +
28.106 + XSLTProc p;
28.107 + p.setInputFile (tmpDir.path()+"/Document.xml");
28.108 + p.setOutputFile (transformedFile);
28.109 + p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
28.110 + p.process();
28.111 +
28.112 + cout << " xslt done"<<endl;
28.113 +
28.114 + return true;
28.115 + } else
28.116 + return false;
28.117 +
28.118 +}
29.1 --- a/linkablemapobj.cpp Sun Jan 30 12:58:47 2005 +0000
29.2 +++ b/linkablemapobj.cpp Tue Jun 06 14:58:11 2006 +0000
29.3 @@ -1,10 +1,12 @@
29.4 -//#include <math.h>
29.5 +#include <math.h>
29.6
29.7 #include "linkablemapobj.h"
29.8 #include "branchobj.h"
29.9 #include "mapeditor.h"
29.10
29.11 #include "version.h"
29.12 +//Added by qt3to4:
29.13 +#include <Q3PointArray>
29.14
29.15
29.16 /////////////////////////////////////////////////////////////////
29.17 @@ -17,7 +19,7 @@
29.18 init ();
29.19 }
29.20
29.21 -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
29.22 +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
29.23 {
29.24 // cout << "Const LinkableMapObj\n";
29.25 init ();
29.26 @@ -62,6 +64,7 @@
29.27 void LinkableMapObj::init ()
29.28 {
29.29 depth=-1;
29.30 + mapEditor=NULL;
29.31 childObj=NULL;
29.32 parObj=NULL;
29.33 parObjTmpBuf=NULL;
29.34 @@ -76,35 +79,45 @@
29.35 linkpos=LinkBottom;
29.36 segment.setAutoDelete (TRUE);
29.37 arcsegs=13;
29.38 - QPointArray pa(arcsegs*2+2);
29.39 + Q3PointArray pa(arcsegs*2+2);
29.40
29.41 - bottomline=new QCanvasLine(canvas);
29.42 + bottomline=new Q3CanvasLine(canvas);
29.43 bottomline->setPen( QPen(linkcolor, 1) );
29.44 bottomline->setZ(Z_LINK);
29.45 bottomline->show();
29.46
29.47 // Prepare showing the selection of a MapObj
29.48 - selbox = new QCanvasRectangle (canvas);
29.49 + selbox = new Q3CanvasRectangle (canvas);
29.50 selbox->setZ(Z_SELBOX);
29.51 selbox->setBrush( QColor(255,255,0) );
29.52 selbox->setPen( QPen(QColor(255,255,0) ));
29.53 selbox->hide();
29.54 selected=false;
29.55
29.56 + hideLinkUnselected=false;
29.57 +
29.58 + topPad=botPad=leftPad=rightPad=0;
29.59 +
29.60 // initialize frame
29.61 frame = new FrameObj (canvas);
29.62
29.63 repositionRequest=false;
29.64 +
29.65 + // Rel Positions
29.66 + relPos=QPoint(0,0);
29.67 + useRelPos=false;
29.68 + useOrientation=true;
29.69 }
29.70
29.71 void LinkableMapObj::copy (LinkableMapObj* other)
29.72 {
29.73 MapObj::copy(other);
29.74 bboxTotal=other->bboxTotal;
29.75 -// linkwidth=other->linkwidth;
29.76 -
29.77 setLinkStyle(other->style);
29.78 setLinkColor (other->linkcolor);
29.79 + relPos=other->relPos;
29.80 + useOrientation=other->useOrientation;
29.81 +
29.82 }
29.83
29.84 void LinkableMapObj::setChildObj(LinkableMapObj* o)
29.85 @@ -126,8 +139,57 @@
29.86 {
29.87 }
29.88
29.89 +bool LinkableMapObj::hasParObjTmp()
29.90 +{
29.91 + if (parObjTmpBuf) return true;
29.92 + return false;
29.93 +}
29.94 +
29.95 +void LinkableMapObj::setUseRelPos (const bool &b)
29.96 +{
29.97 + useRelPos=b;
29.98 +}
29.99 +
29.100 +void LinkableMapObj::setRelPos()
29.101 +{
29.102 + if (parObj)
29.103 + {
29.104 + relPos.setX (absPos.x() - parObj->getChildPos().x() );
29.105 + relPos.setY (absPos.y() - parObj->getChildPos().y() );
29.106 +
29.107 + parObj->calcBBoxSize();
29.108 + parObj->requestReposition();
29.109 + }
29.110 +}
29.111 +
29.112 +void LinkableMapObj::setRelPos(const QPoint &p)
29.113 +{
29.114 + relPos=p;
29.115 + if (parObj)
29.116 + { parObj->calcBBoxSize();
29.117 + parObj->requestReposition();
29.118 + }
29.119 +}
29.120 +
29.121 +int LinkableMapObj::getTopPad()
29.122 +{
29.123 + return topPad;
29.124 +}
29.125 +
29.126 +int LinkableMapObj::getLeftPad()
29.127 +{
29.128 + return leftPad;
29.129 +}
29.130 +
29.131 +int LinkableMapObj::getRightPad()
29.132 +{
29.133 + return rightPad;
29.134 +}
29.135 +
29.136 LinkStyle LinkableMapObj::getDefLinkStyle ()
29.137 {
29.138 + if (!mapEditor) return StyleUndef;
29.139 +
29.140 LinkStyle ls=mapEditor->getLinkStyle();
29.141 switch (ls)
29.142 {
29.143 @@ -157,6 +219,7 @@
29.144
29.145 void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
29.146 {
29.147 + //if (newstyle=style) return;
29.148 delLink();
29.149
29.150 style=newstyle;
29.151 @@ -164,14 +227,14 @@
29.152 if (childObj!=NULL && parObj != NULL)
29.153 {
29.154 int i;
29.155 - QCanvasLine* cl;
29.156 + Q3CanvasLine* cl;
29.157 switch (style)
29.158 {
29.159 case StyleUndef:
29.160 bottomline->hide();
29.161 break;
29.162 case StyleLine:
29.163 - l = new QCanvasLine(canvas);
29.164 + l = new Q3CanvasLine(canvas);
29.165 l->setPen( QPen(linkcolor, 1) );
29.166 l->setZ(Z_LINK);
29.167 if (visible)
29.168 @@ -182,7 +245,7 @@
29.169 case StyleParabel:
29.170 for (i=0;i<arcsegs;i++)
29.171 {
29.172 - cl = new QCanvasLine(canvas);
29.173 + cl = new Q3CanvasLine(canvas);
29.174 cl->setPen( QPen(linkcolor, 1) );
29.175 cl->setPoints( 0,0,i*10,100);
29.176 cl->setZ(Z_LINK);
29.177 @@ -195,7 +258,7 @@
29.178 pa0.resize (arcsegs+1);
29.179 break;
29.180 case StylePolyLine:
29.181 - p = new QCanvasPolygon(canvas);
29.182 + p = new Q3CanvasPolygon(canvas);
29.183 p->setBrush( linkcolor );
29.184 p->setZ(Z_LINK);
29.185 if (visible)
29.186 @@ -203,10 +266,9 @@
29.187 else
29.188 p->hide();
29.189 pa0.resize (3);
29.190 - // TODO
29.191 - // a bit awkward: draw the lines additionally to polygon, to avoid
29.192 + // TODO a bit awkward: draw the lines additionally to polygon, to avoid
29.193 // missing pixels, when polygon is extremly flat
29.194 - l = new QCanvasLine(canvas);
29.195 + l = new Q3CanvasLine(canvas);
29.196 l->setPen( QPen(linkcolor, 1) );
29.197 l->setZ(Z_LINK);
29.198 if (visible)
29.199 @@ -215,7 +277,7 @@
29.200 l->hide();
29.201 break;
29.202 case StylePolyParabel:
29.203 - p = new QCanvasPolygon(canvas);
29.204 + p = new Q3CanvasPolygon(canvas);
29.205 p->setBrush( linkcolor );
29.206 p->setZ(Z_LINK);
29.207 if (visible)
29.208 @@ -226,13 +288,12 @@
29.209 pa1.resize (arcsegs+1);
29.210 pa2.resize (arcsegs+1);
29.211
29.212 - // TODO
29.213 - // a bit awkward: draw the lines additionally
29.214 + // TODO a bit awkward: draw the lines additionally
29.215 // to polygon, to avoid missing pixels,
29.216 // if polygon is extremly flat
29.217 for (i=0;i<arcsegs;i++)
29.218 {
29.219 - cl = new QCanvasLine(canvas);
29.220 + cl = new Q3CanvasLine(canvas);
29.221 cl->setPen( QPen(linkcolor, 1) );
29.222 cl->setPoints( 0,0,i*10,100);
29.223 cl->setZ(Z_LINK);
29.224 @@ -246,10 +307,7 @@
29.225 default:
29.226 break;
29.227 }
29.228 - } else
29.229 - {
29.230 - cout << "Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n";
29.231 - }
29.232 + }
29.233 }
29.234
29.235 LinkStyle LinkableMapObj::getLinkStyle()
29.236 @@ -257,6 +315,18 @@
29.237 return style;
29.238 }
29.239
29.240 +void LinkableMapObj::setHideLinkUnselected(bool b)
29.241 +{
29.242 + hideLinkUnselected=b;
29.243 + setVisibility (visible);
29.244 + updateLink();
29.245 +}
29.246 +
29.247 +bool LinkableMapObj::getHideLinkUnselected()
29.248 +{
29.249 + return hideLinkUnselected;
29.250 +}
29.251 +
29.252 void LinkableMapObj::setLinkPos(LinkPos lp)
29.253 {
29.254 linkpos=lp;
29.255 @@ -272,14 +342,15 @@
29.256 {
29.257 // Overloaded in BranchObj and childs
29.258 // here only set default color
29.259 - setLinkColor (mapEditor->getDefLinkColor());
29.260 + if (mapEditor)
29.261 + setLinkColor (mapEditor->getDefLinkColor());
29.262 }
29.263
29.264 void LinkableMapObj::setLinkColor(QColor col)
29.265 {
29.266 linkcolor=col;
29.267 bottomline->setPen( QPen(linkcolor, 1) );
29.268 - QCanvasLine *cl;
29.269 + Q3CanvasLine *cl;
29.270 switch (style)
29.271 {
29.272 case StyleLine:
29.273 @@ -301,7 +372,6 @@
29.274 default:
29.275 break;
29.276 } // switch (style)
29.277 - updateLink();
29.278 }
29.279
29.280 QColor LinkableMapObj::getLinkColor()
29.281 @@ -332,32 +402,62 @@
29.282
29.283 void LinkableMapObj::setVisibility (bool v)
29.284 {
29.285 + Q3CanvasLine* cl;
29.286 MapObj::setVisibility (v);
29.287 - if (visible)
29.288 + bool visnow=visible;
29.289 +
29.290 + // We can hide the link, while object is not selected
29.291 + if (hideLinkUnselected && !selected)
29.292 + visnow=false;
29.293 +
29.294 + if (visnow)
29.295 {
29.296 bottomline->show();
29.297 - // FIXME lines and segments should be done in LMO?
29.298 - if (style==StyleLine && l)
29.299 + switch (style)
29.300 {
29.301 - l->show();
29.302 - } else
29.303 - {
29.304 - QCanvasLine* cl;
29.305 - for (cl=segment.first(); cl; cl=segment.next() )
29.306 - cl->show();
29.307 - }
29.308 + case StyleLine:
29.309 + if (l) l->show();
29.310 + break;
29.311 + case StyleParabel:
29.312 + for (cl=segment.first(); cl; cl=segment.next() )
29.313 + cl->show();
29.314 + break;
29.315 + case StylePolyLine:
29.316 + if (p) p->show();
29.317 + if (l) l->show();
29.318 + break;
29.319 + case StylePolyParabel:
29.320 + for (cl=segment.first(); cl; cl=segment.next() )
29.321 + cl->show();
29.322 + if (p) p->show();
29.323 + break;
29.324 + default:
29.325 + break;
29.326 + }
29.327 } else
29.328 {
29.329 bottomline->hide();
29.330 - if (style==StyleLine && l)
29.331 + switch (style)
29.332 {
29.333 - l->hide();
29.334 - } else
29.335 - {
29.336 - QCanvasLine* cl;
29.337 - for (cl=segment.first(); cl; cl=segment.next() )
29.338 - cl->hide();
29.339 - }
29.340 + case StyleLine:
29.341 + if (l) l->hide();
29.342 + break;
29.343 + case StyleParabel:
29.344 + for (cl=segment.first(); cl; cl=segment.next() )
29.345 + cl->hide();
29.346 + break;
29.347 + case StylePolyLine:
29.348 + if (p) p->hide();
29.349 + if (l) l->hide();
29.350 + break;
29.351 + case StylePolyParabel:
29.352 + for (cl=segment.first(); cl; cl=segment.next() )
29.353 + cl->hide();
29.354 + if (p) p->hide();
29.355 + break;
29.356 + default:
29.357 + break;
29.358 + }
29.359 }
29.360 }
29.361
29.362 @@ -370,12 +470,11 @@
29.363 //
29.364 // sets:
29.365 // orientation
29.366 - // childPos
29.367 - // parPos
29.368 - // offset
29.369 + // childPos (by calling setDockPos())
29.370 + // parPos (by calling setDockPos())
29.371 + // bottomlineY
29.372 // drawing of the link itself
29.373
29.374 -
29.375 // updateLink is called from move, but called from constructor we don't
29.376 // have parents yet...
29.377 if (style==StyleUndef) return;
29.378 @@ -387,10 +486,10 @@
29.379 switch (linkpos)
29.380 {
29.381 case LinkMiddle:
29.382 - offset=bbox.height() /2;
29.383 + bottomlineY=bbox.top()+bbox.height() /2; // draw link to middle (of frame)
29.384 break;
29.385 default :
29.386 - offset=bbox.height()-1; // draw link to bottom of bbox
29.387 + bottomlineY=bbox.bottom()-1; // draw link to bottom of box
29.388 break;
29.389 }
29.390
29.391 @@ -431,23 +530,7 @@
29.392 reposition();
29.393 }
29.394
29.395 - if (orientation==OrientLeftOfCenter )
29.396 - {
29.397 - childPos=QPoint (absPos.x(),absPos.y()+offset);
29.398 - parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
29.399 - } else
29.400 - {
29.401 - childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
29.402 - parPos=QPoint (absPos.x(),absPos.y()+offset);
29.403 - }
29.404 - /* FIXME
29.405 - cout << " LMO::updateLink absPos="<<absPos<<endl;
29.406 - cout << " LMO::updateLink childPos="<<childPos<<endl;
29.407 - cout << " LMO::updateLink parPos="<<parPos<<endl;
29.408 - cout << " LMO::updateLink offset="<<offset<<endl;
29.409 - cout << " LMO::updateLink bbox.w="<<bbox.width()<<endl;
29.410 - cout << " LMO::updateLink bbox.h="<<bbox.height()<<endl;
29.411 - */
29.412 + setDockPos();
29.413
29.414 double p1x=parPos.x(); // Link is drawn from P1 to P2
29.415 double p1y=parPos.y();
29.416 @@ -456,10 +539,10 @@
29.417 double vy=p2y - p1y;
29.418
29.419 // Draw the horizontal line below heading (from ChildPos to ParPos)
29.420 - bottomline->setPoints (lrint(childPos.x()),
29.421 - lrint(childPos.y()),
29.422 - lrint(p1x),
29.423 - lrint(p1y) );
29.424 + bottomline->setPoints (qRound(childPos.x()),
29.425 + qRound(childPos.y()),
29.426 + qRound(p1x),
29.427 + qRound(p1y) );
29.428
29.429 double a; // angle
29.430 if (vx > -0.000001 && vx < 0.000001)
29.431 @@ -467,9 +550,9 @@
29.432 else
29.433 a=atan( vy / vx );
29.434 // "turning point" for drawing polygonal links
29.435 - QPoint tp (-lrint(sin (a)*thickness_start), lrint(cos (a)*thickness_start));
29.436 + QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));
29.437
29.438 - QCanvasLine *cl;
29.439 + Q3CanvasLine *cl;
29.440
29.441 int i;
29.442
29.443 @@ -477,10 +560,10 @@
29.444 switch (style)
29.445 {
29.446 case StyleLine:
29.447 - l->setPoints( lrint (parPos.x()),
29.448 - lrint(parPos.y()),
29.449 - lrint(p2x),
29.450 - lrint(p2y) );
29.451 + l->setPoints( qRound (parPos.x()),
29.452 + qRound(parPos.y()),
29.453 + qRound(p2x),
29.454 + qRound(p2y) );
29.455 break;
29.456 case StyleParabel:
29.457 parabel (pa0, p1x,p1y,p2x,p2y);
29.458 @@ -492,15 +575,15 @@
29.459 }
29.460 break;
29.461 case StylePolyLine:
29.462 - pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
29.463 - pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
29.464 - pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
29.465 + pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
29.466 + pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
29.467 + pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
29.468 p->setPoints (pa0);
29.469 // here too, draw line to avoid missing pixels
29.470 - l->setPoints( lrint (parPos.x()),
29.471 - lrint(parPos.y()),
29.472 - lrint(p2x),
29.473 - lrint(p2y) );
29.474 + l->setPoints( qRound (parPos.x()),
29.475 + qRound(parPos.y()),
29.476 + qRound(p2x),
29.477 + qRound(p2y) );
29.478 break;
29.479 case StylePolyParabel:
29.480 parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
29.481 @@ -534,6 +617,44 @@
29.482 return parObj;
29.483 }
29.484
29.485 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
29.486 +{
29.487 + LinkableMapObj *lmo=this;
29.488 + QString part;
29.489 + QString typ;
29.490 + QString num;
29.491 + while (!s.isEmpty() )
29.492 + {
29.493 + part=s.section(",",0,0);
29.494 + typ=part.left (3);
29.495 + num=part.right(part.length() - 3);
29.496 + if (typ=="mc:")
29.497 + {
29.498 + if (depth>0)
29.499 + return false; // in a subtree there is no center
29.500 + else
29.501 + break;
29.502 + } else
29.503 + if (typ=="bo:")
29.504 + lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
29.505 + else
29.506 + if (typ=="fi:")
29.507 + lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
29.508 + if (!lmo) break;
29.509 +
29.510 + if (s.contains(","))
29.511 + s=s.right(s.length() - part.length() -1 );
29.512 + else
29.513 + break;
29.514 + }
29.515 + return lmo;
29.516 +}
29.517 +
29.518 +void LinkableMapObj::setDockPos()
29.519 +{
29.520 + cout <<"LMO::setDockPos()\n";
29.521 +}
29.522 +
29.523 QPoint LinkableMapObj::getChildPos()
29.524 {
29.525 return childPos;
29.526 @@ -546,11 +667,26 @@
29.527
29.528 QPoint LinkableMapObj::getRelPos()
29.529 {
29.530 + return relPos;
29.531 +/* FIXME not needed? relPos was moved in 1.7.10 from
29.532 + floatobj to linkablemapobj. Before we had:
29.533 +
29.534 if (!parObj) return QPoint (0,0);
29.535 return QPoint(
29.536 absPos.x() - parObj->x(),
29.537 absPos.y() - parObj->y()
29.538 );
29.539 +*/
29.540 +}
29.541 +
29.542 +
29.543 +void LinkableMapObj::setUseOrientation (const bool &b)
29.544 +{
29.545 + if (useOrientation!=b)
29.546 + {
29.547 + useOrientation=b;
29.548 + requestReposition();
29.549 + }
29.550 }
29.551
29.552 LinkOrient LinkableMapObj::getOrientation()
29.553 @@ -583,11 +719,12 @@
29.554
29.555 void LinkableMapObj::alignRelativeTo (QPoint ref)
29.556 {
29.557 + // FIXME testing, seems not to be used right now...
29.558 + cout << "LMO::alignRelTo ref="<<ref<<endl;
29.559 }
29.560
29.561 void LinkableMapObj::reposition()
29.562 {
29.563 -cout << "LMO::reposition ???"<<endl;
29.564 if (depth==0)
29.565 {
29.566 // only calculate the sizes once. If the deepest LMO changes its height,
29.567 @@ -626,14 +763,15 @@
29.568 // we want to block expensive repositioning, but just do it once at
29.569 // the end, thus check first:
29.570
29.571 - if (mapEditor->blockReposition()) return;
29.572 + if (mapEditor->isRepositionBlocked()) return;
29.573
29.574 // Pass on the request to parental objects, if this hasn't been done yet
29.575
29.576 if (parObj)
29.577 parObj->forceReposition();
29.578 else
29.579 - reposition(); }
29.580 + reposition();
29.581 +}
29.582
29.583 bool LinkableMapObj::repositionRequested()
29.584 {
29.585 @@ -643,9 +781,9 @@
29.586
29.587 void LinkableMapObj::setSelBox()
29.588 {
29.589 - selbox->setX (bbox.x() );
29.590 - selbox->setY (bbox.y() );
29.591 - selbox->setSize (bbox.width(), bbox.height() );
29.592 + selbox->setX (clickBox.x() );
29.593 + selbox->setY (clickBox.y() );
29.594 + selbox->setSize (clickBox.width(), clickBox.height() );
29.595 }
29.596
29.597 void LinkableMapObj::select()
29.598 @@ -653,6 +791,8 @@
29.599 setSelBox();
29.600 selected=true;
29.601 selbox->show();
29.602 +// FIXME not needed?
29.603 + setVisibility (visible);
29.604 }
29.605
29.606
29.607 @@ -660,9 +800,11 @@
29.608 {
29.609 selected=false;
29.610 selbox->hide();
29.611 + // Maybe we have to hide the link:
29.612 + setVisibility (visible);
29.613 }
29.614
29.615 -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
29.616 +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
29.617
29.618 {
29.619 double vx=p2x - p1x; // V=P2-P1
29.620 @@ -680,14 +822,22 @@
29.621 m=(vy / (vx*vx));
29.622 dx=vx/(arcsegs);
29.623 int i;
29.624 - ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
29.625 + ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
29.626 for (i=1;i<=arcsegs;i++)
29.627 {
29.628 pnx=p1x+dx;
29.629 pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
29.630 - ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
29.631 + ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
29.632 p1x=pnx;
29.633 p1y=pny;
29.634 }
29.635 }
29.636
29.637 +QString LinkableMapObj::getLinkAttr ()
29.638 +{
29.639 + if (hideLinkUnselected)
29.640 + return attribut ("hideLink","true");
29.641 + else
29.642 + return attribut ("hideLink","false");
29.643 +
29.644 +}
30.1 --- a/linkablemapobj.h Sun Jan 30 12:58:47 2005 +0000
30.2 +++ b/linkablemapobj.h Tue Jun 06 14:58:11 2006 +0000
30.3 @@ -5,6 +5,9 @@
30.4 #include "noteobj.h"
30.5 #include "headingobj.h"
30.6 #include "flagrowobj.h"
30.7 +//Added by qt3to4:
30.8 +#include <Q3PointArray>
30.9 +#include <Q3PtrList>
30.10
30.11 #define MAX_DEPTH 999
30.12
30.13 @@ -23,7 +26,7 @@
30.14 Q_OBJECT
30.15 public:
30.16 LinkableMapObj ();
30.17 - LinkableMapObj (QCanvas*);
30.18 + LinkableMapObj (Q3Canvas*);
30.19 LinkableMapObj (LinkableMapObj*);
30.20 ~LinkableMapObj ();
30.21 virtual void delLink();
30.22 @@ -33,9 +36,22 @@
30.23 virtual void setParObj (LinkableMapObj*);
30.24 virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
30.25 virtual void unsetParObjTmp(); // reuse original ParObj
30.26 + virtual bool hasParObjTmp();
30.27 +
30.28 + virtual void setUseRelPos (const bool&);
30.29 + virtual void setRelPos(); // set relPos to current parentPos
30.30 + virtual void setRelPos(const QPoint&);
30.31 + virtual void setUseOrientation (const bool &);
30.32 +
30.33 +
30.34 + virtual int getTopPad();
30.35 + virtual int getLeftPad();
30.36 + virtual int getRightPad();
30.37 LinkStyle getDefLinkStyle();
30.38 void setLinkStyle(LinkStyle);
30.39 LinkStyle getLinkStyle();
30.40 + void setHideLinkUnselected(bool);
30.41 + bool getHideLinkUnselected();
30.42 void setLinkPos (LinkPos);
30.43 LinkPos getLinkPos ();
30.44
30.45 @@ -51,6 +67,8 @@
30.46 // redraw link with given style
30.47 LinkableMapObj* getChildObj(); // returns pointer to fromObj
30.48 LinkableMapObj* getParObj(); // returns pointer to toObj
30.49 + virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
30.50 + virtual void setDockPos(); // sets childPos and parPos
30.51 QPoint getChildPos(); // returns pos where childs dock
30.52 QPoint getParPos(); // returns pos where parents dock
30.53 QPoint getRelPos(); // get position relative to parent (or (0,0))
30.54 @@ -75,9 +93,12 @@
30.55 virtual void select();
30.56 virtual void unselect();
30.57 virtual QString getSelectString()=0;
30.58 + virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
30.59
30.60 protected:
30.61 - void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
30.62 + void parabel(Q3PointArray &,double,double,double,double); // Create Parabel connecting two points
30.63 + QString getLinkAttr();
30.64 +
30.65 QPoint childPos;
30.66 QPoint parPos;
30.67 bool link2ParPos; // While moving around, sometimes link to parent
30.68 @@ -90,24 +111,31 @@
30.69 LinkableMapObj* childObj;
30.70 LinkableMapObj* parObj;
30.71 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
30.72 - int offset; // vertical offset of dockpos to pos
30.73 + int bottomlineY; // vertical offset of dockpos to pos
30.74
30.75 int thickness_start; // for StylePoly*
30.76 - LinkStyle style;
30.77 - LinkPos linkpos;
30.78 + LinkStyle style; // Current style
30.79 + LinkPos linkpos; // Link at bottom of object or middle of height
30.80 QColor linkcolor; // Link color
30.81 - QCanvasLine* l; // line style
30.82 - QCanvasPolygon* p; // poly styles
30.83 + Q3CanvasLine* l; // line style
30.84 + Q3CanvasPolygon* p; // poly styles
30.85 int arcsegs; // arc: number of segments
30.86 - QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
30.87 - QPointArray pa0; // For drawing of PolyParabel and PolyLine
30.88 - QPointArray pa1; // For drawing of PolyParabel
30.89 - QPointArray pa2; // For drawing of PolyParabel
30.90 - QCanvasLine* bottomline; // on bottom of BBox
30.91 + Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
30.92 + Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
30.93 + Q3PointArray pa1; // For drawing of PolyParabel
30.94 + Q3PointArray pa2; // For drawing of PolyParabel
30.95 + Q3CanvasLine* bottomline; // on bottom of BBox
30.96 bool repositionRequest; //
30.97
30.98 bool selected; // Used for marking the selection
30.99 - QCanvasRectangle* selbox;
30.100 + bool hideLinkUnselected; // to hide links if unselected
30.101 + Q3CanvasRectangle* selbox;
30.102 FrameObj *frame; // frame around object
30.103 + int topPad, botPad,
30.104 + leftPad, rightPad; // padding within bbox
30.105 +
30.106 + QPoint relPos; // position relative to childPos of parent
30.107 + bool useRelPos;
30.108 + bool useOrientation;
30.109 };
30.110 #endif
31.1 --- a/main.cpp Sun Jan 30 12:58:47 2005 +0000
31.2 +++ b/main.cpp Tue Jun 06 14:58:11 2006 +0000
31.3 @@ -1,14 +1,19 @@
31.4 #include <qapplication.h>
31.5 #include <qpixmap.h>
31.6 #include <qtranslator.h>
31.7 +#include <qdir.h>
31.8 +#include <q3ptrlist.h>
31.9 +#include <qtextcodec.h>
31.10 +#include <q3network.h>
31.11 +#include <qmime.h>
31.12 +//Added by qt3to4:
31.13 +#include <Q3PopupMenu>
31.14 +#include <Q3ActionGroup>
31.15
31.16 #include "settings.h"
31.17 #include "options.h"
31.18 #include "mainwindow.h"
31.19
31.20 -#include "icons/vym-48x48.xpm"
31.21 -#include "icons/vym-editor.xpm"
31.22 -
31.23 #include "flagrowobj.h"
31.24
31.25 // Global variables
31.26 @@ -16,14 +21,24 @@
31.27 // initialized in mainwindow
31.28
31.29 Main *mainWindow; // used in BranchObj::select()
31.30 -MapEditor *clipboardME;
31.31 +QString tmpVymDir; // All temp files go there, created in mainwindow
31.32 +QString clipboardDir; // Clipboard used in all mapEditors
31.33 +QDir vymBaseDir; // Containing all styles, scripts, images, ...
31.34 +QString iconPath; // Pointing to icons used for toolbars
31.35 +QString flagsPath; // Pointing to flags
31.36 +bool clipboardEmpty;
31.37 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
31.38 FlagRowObj *standardFlagsDefault;
31.39
31.40 +// Lists of actions
31.41 +// (QActionGroup could not be "enabled")
31.42 +Q3PtrList <QAction> actionListBranches;
31.43 +
31.44 // Actions which change sometimes
31.45 QAction *actionFileSave;
31.46 QAction *actionFilePrint;
31.47 QAction *actionEditUndo;
31.48 +QAction *actionEditRedo;
31.49 QAction *actionEditCopy;
31.50 QAction *actionEditCut;
31.51 QAction *actionEditPaste;
31.52 @@ -31,25 +46,30 @@
31.53 QAction *actionEditMoveDown;
31.54 QAction *actionEditToggleScroll;
31.55 QAction *actionEditOpenURL;
31.56 +QAction *actionEditOpenURLTab;
31.57 QAction *actionEditURL;
31.58 QAction *actionEditHeading2URL;
31.59 QAction *actionEditBugzilla2URL;
31.60 +QAction *actionEditFATE2URL;
31.61 QAction *actionEditOpenVymLink;
31.62 QAction *actionEditVymLink;
31.63 +QAction *actionEditToggleHideExport;
31.64 QAction *actionEditDeleteVymLink;
31.65 QAction *actionEditMapInfo;
31.66 QAction *actionEditHeading;
31.67 QAction *actionEditDelete;
31.68 QAction *actionEditAddBranch;
31.69 +QAction *actionEditAddBranchHere;
31.70 QAction *actionEditAddBranchAbove;
31.71 QAction *actionEditAddBranchBelow;
31.72 +QAction *actionEditRemoveBranchKeepChilds;
31.73 +QAction *actionEditRemoveChilds;
31.74 QAction *actionEditImportAdd;
31.75 QAction *actionEditImportReplace;
31.76 QAction *actionEditSaveBranch;
31.77 QAction *actionEditSelectFirst;
31.78 QAction *actionEditSelectLast;
31.79 QAction *actionEditLoadImage;
31.80 -QAction *actionEditToggleFloatExport;
31.81
31.82 QAction *actionFormatColor;
31.83 QAction *actionFormatPickColor;
31.84 @@ -59,31 +79,47 @@
31.85 QAction *actionFormatLinkColorHint;
31.86 QAction *actionFormatLinkColor;
31.87
31.88 -QActionGroup *actionGroupFormatFrameTypes;
31.89 +Q3ActionGroup *actionGroupModModes;
31.90 +QAction *actionModModeColor;
31.91 +QAction *actionModModeLink;
31.92 +QAction *actionModModeCopy;
31.93 +
31.94 +Q3ActionGroup *actionGroupFormatFrameTypes;
31.95 QAction *actionFormatFrameNone;
31.96 QAction *actionFormatFrameRectangle;
31.97
31.98 -QActionGroup *actionGroupFormatLinkStyles;
31.99 +Q3ActionGroup *actionGroupFormatLinkStyles;
31.100 +QAction *actionFormatIncludeImagesVer;
31.101 +QAction *actionFormatIncludeImagesHor;
31.102 +QAction *actionFormatHideLinkUnselected;
31.103 QAction *actionFormatLinkStyleLine;
31.104 QAction *actionFormatLinkStyleParabel;
31.105 QAction *actionFormatLinkStylePolyLine;
31.106 QAction *actionFormatLinkStylePolyParabel;
31.107
31.108 QAction *actionViewToggleNoteEditor;
31.109 +QAction *actionViewToggleHistoryWindow;
31.110
31.111 QAction *actionSettingsAutoselectHeading;
31.112 QAction *actionSettingsAutoselectText;
31.113 QAction *actionSettingsPasteNewHeading;
31.114 QAction *actionSettingsAutoedit;
31.115 QAction *actionSettingsUseDelKey;
31.116 +QAction *actionSettingsUseFlagGroups;
31.117 +QAction *actionSettingsUseHideExport;
31.118
31.119 -QPopupMenu *branchContextMenu;
31.120 -QPopupMenu *floatimageContextMenu;
31.121 -QPopupMenu *saveImageFormatMenu;
31.122 -QPopupMenu *canvasContextMenu;
31.123 -QPopupMenu *lastMapsMenu;
31.124 -QPopupMenu *exportMenu;
31.125 -QPopupMenu *exportImageFormatMenu;
31.126 +Q3PopupMenu *branchContextMenu;
31.127 +Q3PopupMenu *branchAddContextMenu;
31.128 +Q3PopupMenu *branchRemoveContextMenu;
31.129 +Q3PopupMenu *branchLinksContextMenu;
31.130 +Q3PopupMenu *branchLinksContextMenuDup;
31.131 +Q3PopupMenu *floatimageContextMenu;
31.132 +Q3PopupMenu *saveImageFormatMenu;
31.133 +Q3PopupMenu *canvasContextMenu;
31.134 +Q3PopupMenu *lastMapsMenu;
31.135 +Q3PopupMenu *importMenu;
31.136 +Q3PopupMenu *exportMenu;
31.137 +Q3PopupMenu *exportImageFormatMenu;
31.138
31.139
31.140 Settings settings;
31.141 @@ -96,19 +132,9 @@
31.142 QApplication app(argc,argv);
31.143
31.144
31.145 - // Initialize translations
31.146 - QTranslator translator (0);
31.147 - translator.load( "vym_de", "." );
31.148 - app.installTranslator( &translator );
31.149 -
31.150 - // Initializing the row of system flags
31.151 - // is done in first call to MapEditor(),
31.152 - // because we need at least one canvas first
31.153 - systemFlagsDefault=NULL;
31.154 - standardFlagsDefault=NULL;
31.155 -
31.156 // Reading and initializing options commandline options
31.157 options.add ("version", SwitchOption, "v","version");
31.158 + options.add ("local", SwitchOption, "l", "local");
31.159 options.add ("help", SwitchOption, "h", "help");
31.160 options.add ("quit", SwitchOption, "q", "quit");
31.161 options.add ("test", StringOption, "t", "test");
31.162 @@ -121,45 +147,82 @@
31.163 "http://www.InSilmaril.de/vym\n");
31.164 if (options.parse())
31.165 {
31.166 - cout << endl << options.getHelpText()<<endl;
31.167 +//FIXME QT3 cout << endl << options.getHelpText()<<endl;
31.168 return 1;
31.169 }
31.170
31.171 if (options.isOn ("version"))
31.172 {
31.173 - cout << "vym version "<<__VYM_VERSION__
31.174 + cout << "vym version "<<__VYM_VERSION
31.175 <<" (c) 2004 Uwe Drechsel - "
31.176 - <<__BUILD_DATE__<<endl;
31.177 + <<__BUILD_DATE<<endl;
31.178
31.179 return 0;
31.180 }
31.181
31.182 + // Use /usr/share/vym or /usr/local/share/vym or . ?
31.183 + // First try options
31.184 + if (options.isOn ("local"))
31.185 + {
31.186 + vymBaseDir.setPath (vymBaseDir.currentDirPath());
31.187 + } else
31.188 + // then look for environment variable
31.189 + if (getenv("VYMHOME")!=0)
31.190 + {
31.191 + vymBaseDir.setPath (getenv("VYMHOME"));
31.192 + } else
31.193 + // ok, let's find my way on my own
31.194 + {
31.195 + vymBaseDir.setPath ("/usr/share/vym");
31.196 + if (!vymBaseDir.exists())
31.197 + {
31.198 + vymBaseDir.setPath ("/usr/local/share/vym");
31.199 + if (!vymBaseDir.exists())
31.200 + vymBaseDir.setPath(vymBaseDir.currentDirPath() );
31.201 + }
31.202 + }
31.203 +
31.204 + iconPath=vymBaseDir.path()+"/icons/";
31.205 + flagsPath=vymBaseDir.path()+"/flags/";
31.206 +
31.207 if (options.isOn ("help"))
31.208 {
31.209 - cout << options.getHelpText()<<endl;
31.210 +//FIXME QT3 cout << options.getHelpText()<<endl;
31.211 return 0;
31.212 }
31.213
31.214 if (options.isOn ("test"))
31.215 {
31.216 // FIXME testing string option only
31.217 - cout << "Testing: "<<options.getArg("test")<< endl;
31.218 +//FIXME QT3 cout << "Testing: "<<options.getArg("test")<< endl;
31.219 }
31.220
31.221 +
31.222 + Q3MimeSourceFactory *factory = Q3MimeSourceFactory::defaultFactory();
31.223 + factory->setPixmap("vym-128x128", QPixmap(iconPath+"vym-128x128.png"));
31.224 + q3InitNetworkProtocols();
31.225 +
31.226 +
31.227 + // Initialize translations
31.228 + QTranslator translator (0);
31.229 + translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
31.230 + app.installTranslator( &translator );
31.231 +
31.232 + // Initializing the row of system flags
31.233 + // is done in first call to MapEditor(),
31.234 + // because we need at least one canvas first
31.235 + systemFlagsDefault=NULL;
31.236 + standardFlagsDefault=NULL;
31.237 +
31.238 // Initialize window of TextEditor
31.239 textEditor = new TextEditor();
31.240 - textEditor->setIcon (QPixmap (vym_editor_xpm));
31.241 + textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
31.242 if (textEditor->showWithMain()) textEditor->show();
31.243
31.244 - clipboardME = new MapEditor();
31.245 - clipboardME->resize (800,600);
31.246 - clipboardME->setCaption("VYM - clipboard");
31.247 - clipboardME->hide();
31.248 -
31.249 - // Initialize mainwindow after Mapeditors (because of Flags)
31.250 + // Initialize mainwindow
31.251 Main m;
31.252 //m.resize(m.sizeHint());
31.253 - m.setIcon (QPixmap (vym_logo_xpm));
31.254 + m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
31.255 m.show();
31.256 m.fileNew();
31.257 m.loadCmdLine();
32.1 --- a/mainwindow.cpp Sun Jan 30 12:58:47 2005 +0000
32.2 +++ b/mainwindow.cpp Tue Jun 06 14:58:11 2006 +0000
32.3 @@ -7,61 +7,58 @@
32.4 #include <qpainter.h>
32.5 #include <qprinter.h>
32.6 #include <qfile.h>
32.7 -#include <qfiledialog.h>
32.8 +#include <q3filedialog.h>
32.9 #include <qcolor.h>
32.10 #include <qcolordialog.h>
32.11 #include <qbitmap.h>
32.12 #include <qinputdialog.h>
32.13 +//Added by qt3to4:
32.14 +#include <Q3StrList>
32.15 +#include <QPixmap>
32.16 +#include <QCloseEvent>
32.17 +#include <QShowEvent>
32.18 +#include <QHideEvent>
32.19 +#include <Q3PopupMenu>
32.20 +#include <Q3ActionGroup>
32.21 +#include <Q3PtrList>
32.22 +//#include <qdatetime.h> // for random seed
32.23
32.24
32.25 #include <iostream>
32.26 -#include <stdlib.h>
32.27 +#include <cstdlib>
32.28 #include <typeinfo>
32.29
32.30 -#include "version.h"
32.31 -
32.32 -#include "icons/filenew.xpm"
32.33 -#include "icons/fileopen.xpm"
32.34 -#include "icons/filesave.xpm"
32.35 -#include "icons/fileprint.xpm"
32.36 -#include "icons/editundo.xpm"
32.37 -//#include "icons/editredo.xpm" // TODO
32.38 -#include "icons/editcopy.xpm"
32.39 -#include "icons/editcut.xpm"
32.40 -#include "icons/editpaste.xpm"
32.41 -#include "icons/editmoveup.xpm"
32.42 -#include "icons/editmovedown.xpm"
32.43 -#include "icons/formatcoloritem.xpm"
32.44 -#include "icons/formatcolorbranch.xpm"
32.45 -#include "icons/formatcolorpicker.xpm"
32.46 -#include "icons/viewzoomreset.xpm"
32.47 -#include "icons/viewzoomin.xpm"
32.48 -#include "icons/viewzoomout.xpm"
32.49 -#include "icons/vym-48x48.xpm"
32.50 -#include "icons/flag-note.xpm"
32.51 -#include "icons/flag-url.xpm"
32.52 -#include "icons/flag-vymlink.xpm"
32.53 -#include "icons/flag-scrolled-right.xpm"
32.54 -
32.55 +#include "aboutdialog.h"
32.56 +#include "exportoofiledialog.h"
32.57 +#include "exports.h"
32.58 +#include "exportxhtmldialog.h"
32.59 +#include "file.h"
32.60 #include "flagrowobj.h"
32.61 -#include "texteditor.h"
32.62 +#include "imports.h"
32.63 #include "mapeditor.h"
32.64 -#include "exporthtmldialog.h"
32.65 -#include "exportxhtmldialog.h"
32.66 -#include "showtextdialog.h"
32.67 +#include "misc.h"
32.68 +#include "options.h"
32.69 #include "process.h"
32.70 #include "settings.h"
32.71 -#include "options.h"
32.72 +#include "showtextdialog.h"
32.73 +#include "texteditor.h"
32.74 +#include "version.h"
32.75
32.76 extern TextEditor *textEditor;
32.77 extern Main *mainWindow;
32.78 +extern QString tmpVymDir;
32.79 +extern QString clipboardDir;
32.80 +extern bool clipboardEmpty;
32.81 extern int statusbarTime;
32.82 -extern MapEditor *clipboardME;
32.83 extern FlagRowObj* standardFlagsDefault;
32.84 +extern FlagRowObj* systemFlagsDefault;
32.85 +
32.86 +extern Q3PtrList <QAction> actionListBranches;
32.87
32.88 extern QAction* actionFileSave;
32.89 extern QAction* actionFilePrint;
32.90 extern QAction* actionEditUndo;
32.91 +extern QAction* actionEditRedo;
32.92 extern QAction *actionEditCopy;
32.93 extern QAction *actionEditCut;
32.94 extern QAction *actionEditPaste;
32.95 @@ -69,25 +66,30 @@
32.96 extern QAction *actionEditMoveDown;
32.97 extern QAction *actionEditToggleScroll;
32.98 extern QAction* actionEditOpenURL;
32.99 +extern QAction* actionEditOpenURLTab;
32.100 extern QAction* actionEditURL;
32.101 extern QAction* actionEditHeading2URL;
32.102 extern QAction* actionEditBugzilla2URL;
32.103 +extern QAction* actionEditFATE2URL;
32.104 extern QAction *actionEditOpenVymLink;
32.105 extern QAction *actionEditVymLink;
32.106 extern QAction *actionEditDeleteVymLink;
32.107 +extern QAction *actionEditToggleHideExport;
32.108 extern QAction *actionEditMapInfo;
32.109 extern QAction *actionEditHeading;
32.110 extern QAction *actionEditDelete;
32.111 extern QAction *actionEditAddBranch;
32.112 +extern QAction *actionEditAddBranchHere;
32.113 extern QAction *actionEditAddBranchAbove;
32.114 extern QAction *actionEditAddBranchBelow;
32.115 +extern QAction *actionEditRemoveBranchKeepChilds;
32.116 +extern QAction *actionEditRemoveChilds;
32.117 extern QAction *actionEditImportAdd;
32.118 extern QAction *actionEditImportReplace;
32.119 extern QAction *actionEditSaveBranch;
32.120 extern QAction *actionEditSelectFirst;
32.121 extern QAction *actionEditSelectLast;
32.122 extern QAction *actionEditLoadImage;
32.123 -extern QAction *actionEditToggleFloatExport;
32.124
32.125 extern QAction* actionFormatColor;
32.126 extern QAction* actionFormatPickColor;
32.127 @@ -96,18 +98,27 @@
32.128 extern QAction* actionFormatLinkColorHint;
32.129 extern QAction* actionFormatBackColor;
32.130 extern QAction* actionFormatLinkColor;
32.131 +extern QAction *actionFormatIncludeImagesVer;
32.132 +extern QAction *actionFormatIncludeImagesHor;
32.133
32.134 -extern QActionGroup *actionGroupFormatFrameTypes;
32.135 +extern Q3ActionGroup* actionGroupModModes;
32.136 +extern QAction* actionModModeColor;
32.137 +extern QAction* actionModModeLink;
32.138 +extern QAction* actionModModeCopy;
32.139 +
32.140 +extern Q3ActionGroup *actionGroupFormatFrameTypes;
32.141 extern QAction *actionFormatFrameNone;
32.142 extern QAction *actionFormatFrameRectangle;
32.143
32.144 -extern QActionGroup *actionGroupFormatLinkStyles;
32.145 +extern Q3ActionGroup *actionGroupFormatLinkStyles;
32.146 extern QAction *actionFormatLinkStyleLine;
32.147 extern QAction *actionFormatLinkStyleParabel;
32.148 extern QAction *actionFormatLinkStylePolyLine;
32.149 extern QAction *actionFormatLinkStylePolyParabel;
32.150 +extern QAction *actionFormatHideLinkUnselected;
32.151
32.152 extern QAction *actionViewToggleNoteEditor;
32.153 +extern QAction *actionViewToggleHistoryWindow;
32.154
32.155 extern QAction* actionSettingsAutoedit;
32.156 extern QAction* actionSettingsAutoselectHeading;
32.157 @@ -115,25 +126,31 @@
32.158 extern QAction* actionSettingsAutoselectText;
32.159 extern QAction* actionSettingsPasteNewHeading;
32.160 extern QAction* actionSettingsUseDelKey;
32.161 +extern QAction* actionSettingsUseFlagGroups;
32.162 +extern QAction* actionSettingsUseHideExport;
32.163
32.164 -extern QPopupMenu* branchContextMenu;
32.165 -extern QPopupMenu* floatimageContextMenu;
32.166 -extern QPopupMenu* saveImageFormatMenu;
32.167 -extern QPopupMenu* canvasContextMenu;
32.168 -extern QPopupMenu* lastMapsMenu;
32.169 -extern QPopupMenu* exportMenu;
32.170 -extern QPopupMenu* exportImageFormatMenu;
32.171 +extern Q3PopupMenu* branchContextMenu;
32.172 +extern Q3PopupMenu* branchAddContextMenu;
32.173 +extern Q3PopupMenu* branchRemoveContextMenu;
32.174 +extern Q3PopupMenu* branchLinksContextMenu;
32.175 +extern Q3PopupMenu* branchLinksContextMenuDup;
32.176 +extern Q3PopupMenu* floatimageContextMenu;
32.177 +extern Q3PopupMenu* saveImageFormatMenu;
32.178 +extern Q3PopupMenu* canvasContextMenu;
32.179 +extern Q3PopupMenu* lastMapsMenu;
32.180 +extern Q3PopupMenu* importMenu;
32.181 +extern Q3PopupMenu* exportMenu;
32.182 +extern Q3PopupMenu* exportImageFormatMenu;
32.183
32.184
32.185 extern Settings settings;
32.186 extern Options options;
32.187 +extern QDir vymBaseDir;
32.188 +extern QString iconPath;
32.189 +extern QString flagsPath;
32.190
32.191 -#if defined(Q_OS_LINUX)
32.192 -extern void qt_wait_for_window_manager( QWidget* w );
32.193 -#endif
32.194 -
32.195 -Main::Main(QWidget* parent, const char* name, WFlags f) :
32.196 - QMainWindow(parent,name,f)
32.197 +Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
32.198 + Q3MainWindow(parent,name,f)
32.199 {
32.200 mainWindow=this;
32.201
32.202 @@ -146,6 +163,24 @@
32.203 settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
32.204
32.205
32.206 + // Create unique temporary directory
32.207 + tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
32.208 +
32.209 + // Create direcctory for clipboard
32.210 + clipboardDir=tmpVymDir+"/clipboard";
32.211 + QDir d(clipboardDir);
32.212 + d.mkdir (clipboardDir,true);
32.213 + makeSubDirs (clipboardDir);
32.214 + clipboardEmpty=true;
32.215 +
32.216 + procBrowser=NULL;
32.217 +
32.218 + // FIXME not used currently
32.219 + // Set random seed (random used for object IDs)
32.220 + // QTime t = QTime::currentTime(); // set random seed
32.221 + // srand( t.hour()*12+t.minute()*60+t.second()*60 );
32.222 +
32.223 +
32.224 // Initialize some settings, which are platform dependant
32.225 QString p,s;
32.226
32.227 @@ -155,7 +190,7 @@
32.228 s=settings.readEntry (p,"konqueror");
32.229 #else
32.230 #if defined(Q_OS_MACX)
32.231 - s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
32.232 + s=settings.readEntry (p,"/usr/bin/open");
32.233 #else
32.234 s=settings.readEntry (p,"mozilla");
32.235 #endif
32.236 @@ -168,7 +203,7 @@
32.237 s=settings.readEntry (p,"acroread");
32.238 #else
32.239 #if defined(Q_OS_MACX)
32.240 - s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
32.241 + s=settings.readEntry (p,"/usr/bin/open");
32.242 #else
32.243 s=settings.readEntry (p,"acroread");
32.244 #endif
32.245 @@ -189,6 +224,7 @@
32.246 setupEditActions();
32.247 setupFormatActions();
32.248 setupViewActions();
32.249 + setupModeActions();
32.250 setupFlagActions();
32.251 setupSettingsActions();
32.252 setupContextMenus();
32.253 @@ -200,10 +236,6 @@
32.254
32.255 statusBar();
32.256
32.257 - // Create the default map into first tab
32.258 -// fileNew();
32.259 -// tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed");
32.260 -// currentMapEditor()->show();
32.261
32.262 // Initialize Find window
32.263 findWindow=new FindWindow(NULL,"findwindow");
32.264 @@ -212,6 +244,9 @@
32.265 connect (findWindow, SIGNAL( somethingChanged() ),
32.266 this, SLOT(editFindChanged() ) );
32.267
32.268 + // Connect TextEditor, so that we can update flags if text changes
32.269 + connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
32.270 +
32.271 updateGeometry();
32.272 }
32.273
32.274 @@ -223,29 +258,33 @@
32.275 settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
32.276 settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
32.277
32.278 - settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
32.279 - settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
32.280 + settings.writeEntry( "/vym/version/version", __VYM_VERSION );
32.281 + settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
32.282
32.283 settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
32.284 settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
32.285 settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
32.286 settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
32.287 settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
32.288 + settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
32.289 + settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
32.290
32.291 QString s;
32.292 int maps=lastMaps.count();
32.293 settings.writeEntry( "/vym/lastMaps/number",maps );
32.294 for (int i=1;i<=maps;i++)
32.295 {
32.296 - QStringList::Iterator it = lastMaps.at(i-1);
32.297 s=QString("/vym/lastMaps/map-%1").arg(i);
32.298 if (!s.isEmpty() && i<=maxLastMaps)
32.299 - settings.writeEntry (s, *it);
32.300 + settings.writeEntry (s, lastMaps.at(i-1));
32.301 }
32.302
32.303
32.304 // To make the texteditor save its settings, call the destructor
32.305 delete (textEditor);
32.306 +
32.307 + // Remove temporary directory
32.308 + removeDir (QDir(tmpVymDir));
32.309 }
32.310
32.311 void Main::loadCmdLine()
32.312 @@ -280,385 +319,622 @@
32.313 // File Actions
32.314 void Main::setupFileActions()
32.315 {
32.316 - QToolBar *tb = new QToolBar( this );
32.317 + Q3ToolBar *tb = new Q3ToolBar( this );
32.318 tb->setLabel( "File Actions" );
32.319 - QPopupMenu *menu = new QPopupMenu( this );
32.320 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.321 menuBar()->insertItem( tr( "&File" ), menu );
32.322
32.323 // Keycodes: /usr/lib64/qt3/include/qnamespace.h
32.324
32.325 QAction *a;
32.326 - a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
32.327 - connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
32.328 + a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
32.329 + a->setStatusTip ( tr( "New map","File menu" ) );
32.330 + a->setShortcut ( Qt::CTRL + Qt::Key_N );
32.331 a->addTo( tb );
32.332 a->addTo( menu );
32.333 + connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
32.334
32.335 - a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
32.336 - connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
32.337 + a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
32.338 + a->setStatusTip (tr( "Open","File menu" ) );
32.339 + a->setShortcut ( Qt::CTRL + Qt::Key_O );
32.340 a->addTo( tb );
32.341 a->addTo( menu );
32.342 + connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
32.343
32.344 - lastMapsMenu = new QPopupMenu (this);
32.345 + lastMapsMenu = new Q3PopupMenu (this);
32.346
32.347 menu->insertItem (tr("Open Recent"),lastMapsMenu );
32.348 menu->insertSeparator();
32.349
32.350 - a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
32.351 - connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
32.352 + a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
32.353 + a->setStatusTip ( tr( "Save" ));
32.354 + a->setShortcut (Qt::CTRL + Qt::Key_S );
32.355 a->addTo( tb );
32.356 a->addTo( menu );
32.357 + connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
32.358 actionFileSave=a;
32.359
32.360 - a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
32.361 + a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
32.362 + a->setStatusTip (tr( "Save &As" ) );
32.363 + a->addTo( menu );
32.364 connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
32.365 - a->addTo( menu );
32.366
32.367 menu->insertSeparator();
32.368
32.369 - a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
32.370 + importMenu = new Q3PopupMenu (this);
32.371 + menu->insertItem (tr("Import"),importMenu );
32.372 +
32.373 + a = new QAction(tr("KDE Bookmarks"), this);
32.374 + a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
32.375 + a->addTo (importMenu);
32.376 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
32.377 +
32.378 + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
32.379 + {
32.380 + a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
32.381 + a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
32.382 + a->addTo (importMenu);
32.383 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
32.384 + }
32.385 +
32.386 + a = new QAction("Mind Manager...",this);
32.387 + a->setStatusTip ( tr( "Import")+" Mind Manager" );
32.388 + a->addTo (importMenu);
32.389 + connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
32.390 +
32.391 + a = new QAction( tr( "Import Dir"+QString("...") ), this);
32.392 + a->setStatusTip (tr( "Import directory structure (experimental)" ) );
32.393 + a->addTo( importMenu);
32.394 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
32.395 - a->addTo( menu );
32.396
32.397 - exportMenu = new QPopupMenu (this);
32.398 + exportMenu = new Q3PopupMenu (this);
32.399 menu->insertItem (tr("Export"),exportMenu );
32.400
32.401 menu->insertSeparator();
32.402
32.403
32.404 - a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
32.405 - connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
32.406 + a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
32.407 + a->setStatusTip ( tr( "Print" ) );
32.408 + a->setShortcut (Qt::CTRL + Qt::Key_P );
32.409 a->addTo( tb );
32.410 a->addTo( menu );
32.411 + connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
32.412 actionFilePrint=a;
32.413
32.414 - a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
32.415 + a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
32.416 + a->setStatusTip (tr( "Close Map" ) );
32.417 + a->setShortcut (Qt::ALT + Qt::Key_C );
32.418 + a->addTo( menu );
32.419 connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
32.420 +
32.421 + a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
32.422 + a->setStatusTip ( tr( "Exit")+" "+__VYM );
32.423 + a->setShortcut (Qt::CTRL + Qt::Key_Q );
32.424 a->addTo( menu );
32.425 -
32.426 - a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
32.427 connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
32.428 - a->addTo( menu );
32.429 }
32.430
32.431
32.432 //Edit Actions
32.433 void Main::setupEditActions()
32.434 {
32.435 - QToolBar *tb = new QToolBar( this );
32.436 + Q3ToolBar *tb = new Q3ToolBar( this );
32.437 tb->setLabel( "Edit Actions" );
32.438 - QPopupMenu *menu = new QPopupMenu( this );
32.439 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.440 menuBar()->insertItem( tr( "&Edit" ), menu );
32.441
32.442 QAction *a;
32.443 - a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
32.444 + QAction *alt;
32.445 + a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
32.446 connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
32.447 + a->setStatusTip (tr( "Undo" ) );
32.448 + a->setShortcut ( Qt::CTRL + Qt::Key_Z );
32.449 a->setEnabled (false);
32.450 a->addTo( tb );
32.451 a->addTo( menu );
32.452 actionEditUndo=a;
32.453 - /*
32.454 - a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
32.455 - connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
32.456 - a->addTo( tb );
32.457 - a->addTo( menu );
32.458 - */
32.459 +
32.460 + if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
32.461 + {
32.462 + a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this);
32.463 + a->setStatusTip (tr( "Redo" ));
32.464 + a->setShortcut (Qt::CTRL + Qt::Key_Y );
32.465 + a->addTo( tb );
32.466 + a->addTo( menu );
32.467 + connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
32.468 + }
32.469 +
32.470 menu->insertSeparator();
32.471 - a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
32.472 - connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
32.473 + a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
32.474 + a->setStatusTip ( tr( "Copy" ) );
32.475 + a->setShortcut (Qt::CTRL + Qt::Key_C );
32.476 a->setEnabled (false);
32.477 a->addTo( tb );
32.478 a->addTo( menu );
32.479 + connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
32.480 actionEditCopy=a;
32.481 - a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
32.482 - connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
32.483 +
32.484 + a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
32.485 + a->setStatusTip ( tr( "Cut" ) );
32.486 + a->setShortcut (Qt::CTRL + Qt::Key_X );
32.487 a->setEnabled (false);
32.488 a->addTo( tb );
32.489 a->addTo( menu );
32.490 actionEditCut=a;
32.491 - a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
32.492 + connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
32.493 +
32.494 + a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
32.495 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
32.496 + a->setStatusTip ( tr( "Paste" ) );
32.497 + a->setShortcut ( Qt::CTRL + Qt::Key_V );
32.498 a->setEnabled (false);
32.499 a->addTo( tb );
32.500 a->addTo( menu );
32.501 actionEditPaste=a;
32.502 - a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
32.503 - connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
32.504 +
32.505 + a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
32.506 + a->setStatusTip ( tr( "Move branch up" ) );
32.507 + a->setShortcut (Qt::Key_PageUp );
32.508 a->setEnabled (false);
32.509 a->addTo( tb );
32.510 a->addTo( menu );
32.511 + connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
32.512 actionEditMoveUp=a;
32.513 - a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
32.514 +
32.515 + a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
32.516 connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
32.517 + a->setStatusTip (tr( "Move branch down" ) );
32.518 + a->setShortcut ( Qt::Key_PageDown );
32.519 a->setEnabled (false);
32.520 a->addTo( tb );
32.521 a->addTo( menu );
32.522 actionEditMoveDown=a;
32.523 +
32.524
32.525 - a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
32.526 + a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
32.527 + a->setShortcut ( Qt::Key_ScrollLock );
32.528 + a->setStatusTip (tr( "Scroll branch" ) );
32.529 connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
32.530 - a->setEnabled (false);
32.531 - a->addTo( tb );
32.532 + alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
32.533 + alt->setShortcut ( Qt::Key_S );
32.534 + alt->setStatusTip (tr( "Scroll branch" ));
32.535 + connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
32.536 + #if defined(Q_OS_MACX)
32.537 + actionEditToggleScroll=alt;
32.538 + #else
32.539 + actionEditToggleScroll=a;
32.540 + #endif
32.541 + actionEditToggleScroll->setEnabled (false);
32.542 + actionEditToggleScroll->setToggleAction(true);
32.543 + actionEditToggleScroll->addTo( tb );
32.544 + actionEditToggleScroll->addTo( menu );
32.545 + actionListBranches.append(actionEditToggleScroll);
32.546 +
32.547 + a = new QAction( tr( "Unscroll all scrolled branches" ), this);
32.548 + a->setStatusTip (tr( "Unscroll all" ));
32.549 a->addTo( menu );
32.550 - actionEditToggleScroll=a;
32.551 -
32.552 - a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
32.553 connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
32.554 - a->addTo( menu );
32.555
32.556 menu->insertSeparator();
32.557
32.558 - a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
32.559 + a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
32.560 + a->setStatusTip (tr( "Find" ) );
32.561 + a->setShortcut (Qt::CTRL + Qt::Key_F );
32.562 + a->addTo( menu );
32.563 connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
32.564 - a->addTo( menu );
32.565
32.566 menu->insertSeparator();
32.567
32.568 - a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
32.569 - connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
32.570 - a->addTo( menu );
32.571 + a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
32.572 + a->setShortcut (Qt::CTRL + Qt::Key_U );
32.573 + a->setShortcut (tr( "Open URL" ));
32.574 a->addTo( tb );
32.575 a->setEnabled (false);
32.576 + connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
32.577 actionEditOpenURL=a;
32.578
32.579 - a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
32.580 + a = new QAction( tr( "Open URL in new tab" ), this);
32.581 + a->setStatusTip (tr( "Open URL in new tab" ));
32.582 + a->setShortcut (Qt::CTRL+Qt::Key_U );
32.583 + a->setEnabled (false);
32.584 + connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
32.585 + actionEditOpenURLTab=a;
32.586 +
32.587 + a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
32.588 + a->setStatusTip ( tr( "Edit URL" ) );
32.589 + a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U );
32.590 + a->setEnabled (false);
32.591 + actionListBranches.append(a);
32.592 connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
32.593 - a->addTo( menu );
32.594 - a->setEnabled (false);
32.595 actionEditURL=a;
32.596
32.597 - a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
32.598 + a = new QAction( tr( "Use heading for URL" ), this);
32.599 + a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
32.600 + a->setEnabled (false);
32.601 + actionListBranches.append(a);
32.602 connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
32.603 - a->addTo( menu );
32.604 - a->setEnabled (false);
32.605 actionEditHeading2URL=a;
32.606
32.607 - a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
32.608 + a = new QAction(tr( "Create URL to Bugzilla" ), this);
32.609 + a->setStatusTip ( tr( "Create URL to Bugzilla" ));
32.610 + a->setEnabled (false);
32.611 + actionListBranches.append(a);
32.612 connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
32.613 - a->setEnabled (false);
32.614 actionEditBugzilla2URL=a;
32.615
32.616 - menu->insertSeparator();
32.617 + a = new QAction(tr( "Create URL to FATE" ), this);
32.618 + a->setStatusTip ( tr( "Create URL to FATE" ));
32.619 + a->setEnabled (false);
32.620 + actionListBranches.append(a);
32.621 + connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
32.622 + actionEditFATE2URL=a;
32.623
32.624 - a = new QAction( tr( "Jump to another vym map, if needed load it first" ), QPixmap(flag_vymlink_xpm), tr( "Jump to map" ), 0, this, "jumpMap" );
32.625 - connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
32.626 - a->addTo( menu );
32.627 + a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
32.628 + a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
32.629 a->addTo( tb );
32.630 a->setEnabled (false);
32.631 + connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
32.632 actionEditOpenVymLink=a;
32.633
32.634 - a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
32.635 + a = new QAction(tr( "Edit vym link"+QString("...") ), this);
32.636 + a->setEnabled (false);
32.637 + a->setStatusTip ( tr( "Edit link to another vym map" ));
32.638 connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
32.639 - a->addTo( menu );
32.640 - a->setEnabled (false);
32.641 + actionListBranches.append(a);
32.642 actionEditVymLink=a;
32.643
32.644 - a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
32.645 + a = new QAction(tr( "Delete vym link" ),this);
32.646 + a->setStatusTip ( tr( "Delete link to another vym map" ));
32.647 + a->setEnabled (false);
32.648 connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
32.649 - a->addTo( menu );
32.650 - a->setEnabled (false);
32.651 actionEditDeleteVymLink=a;
32.652
32.653 - menu->insertSeparator();
32.654 + a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
32.655 + a->setStatusTip ( tr( "Hide object in exports" ) );
32.656 + a->setShortcut (Qt::Key_H );
32.657 + a->setToggleAction(true);
32.658 + a->addTo( tb );
32.659 + a->setEnabled (false);
32.660 + connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
32.661 + actionEditToggleHideExport=a;
32.662
32.663 - a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
32.664 + a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
32.665 + a->setStatusTip ( tr( "Edit Map Info" ));
32.666 + a->setEnabled (true);
32.667 connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
32.668 - a->addTo( menu );
32.669 - a->setEnabled (true);
32.670 actionEditMapInfo=a;
32.671
32.672 menu->insertSeparator();
32.673
32.674 // Shortcuts to modify heading:
32.675 - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
32.676 + a = new QAction(tr( "Edit heading" ),this);
32.677 + a->setStatusTip ( tr( "edit Heading" ));
32.678 + a->setShortcut ( Qt::Key_Enter );
32.679 + connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
32.680 + actionListBranches.append(a);
32.681 + a = new QAction( tr( "Edit heading" ), this);
32.682 + a->setStatusTip (tr( "edit Heading" ));
32.683 + a->setShortcut (Qt::Key_Return );
32.684 + connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
32.685 + actionListBranches.append(a);
32.686 + actionEditHeading=a;
32.687 + a = new QAction( tr( "Edit heading" ),this);
32.688 + a->setStatusTip (tr( "edit Heading" ));
32.689 + a->setShortcut ( Qt::Key_F2 );
32.690 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
32.691 a->setEnabled (false);
32.692 - a->addTo ( menu );
32.693 actionEditHeading=a;
32.694 - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
32.695 - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
32.696 - //a->addTo ( menu );
32.697 + actionListBranches.append(a);
32.698
32.699 // Shortcut to delete selection
32.700 - a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
32.701 + a = new QAction( tr( "Delete Selection" ),this);
32.702 + a->setStatusTip (tr( "Delete Selection" ));
32.703 + a->setShortcut ( Qt::Key_Delete);
32.704 connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
32.705 a->setEnabled (false);
32.706 - a->addTo ( menu );
32.707 actionEditDelete=a;
32.708
32.709 // Shortcut to add branch
32.710 + alt = new QAction(tr( "Add branch as child" ), this);
32.711 + alt->setStatusTip ( tr( "Add a branch as child of selection" ));
32.712 + alt->setShortcut (Qt::Key_A);
32.713 + connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
32.714 + a = new QAction(tr( "Add branch as child" ), this);
32.715 + a->setStatusTip ( tr( "Add a branch as child of selection" ));
32.716 + a->setShortcut (Qt::Key_Insert);
32.717 + a->setEnabled (false);
32.718 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
32.719 + actionListBranches.append(a);
32.720 #if defined (Q_OS_MACX)
32.721 - a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" );
32.722 - #else
32.723 - a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
32.724 - #endif
32.725 - connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
32.726 + // In OSX show different shortcut in menues, the keys work independtly always
32.727 + actionEditAddBranch=alt;
32.728 + #else
32.729 + actionEditAddBranch=a;
32.730 + #endif
32.731 +
32.732 + // Add branch by inserting it at selection
32.733 + a = new QAction(tr( "Add branch (insert)" ), this);
32.734 + a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
32.735 + a->setShortcut (Qt::ALT + Qt::Key_Insert );
32.736 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
32.737 a->setEnabled (false);
32.738 - a->addTo ( menu );
32.739 - actionEditAddBranch=a;
32.740 + actionListBranches.append(a);
32.741 + actionEditAddBranchHere=a;
32.742 + a = new QAction(tr( "Add branch (insert)" ),this);
32.743 + a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
32.744 + a->setShortcut ( Qt::ALT + Qt::Key_A );
32.745 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
32.746 + actionListBranches.append(a);
32.747
32.748 // Add branch above
32.749 - a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
32.750 + a = new QAction(tr( "Add branch above" ), this);
32.751 + a->setStatusTip ( tr( "Add a branch above selection" ));
32.752 + a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
32.753 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
32.754 a->setEnabled (false);
32.755 - a->addTo ( menu );
32.756 + actionListBranches.append(a);
32.757 actionEditAddBranchAbove=a;
32.758 + a = new QAction(tr( "Add branch above" ), this);
32.759 + a->setStatusTip ( tr( "Add a branch above selection" ));
32.760 + a->setShortcut (Qt::SHIFT+Qt::Key_A );
32.761 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
32.762 + actionListBranches.append(a);
32.763
32.764 // Add branch below
32.765 - a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
32.766 + a = new QAction(tr( "Add branch below" ), this);
32.767 + a->setStatusTip ( tr( "Add a branch below selection" ));
32.768 + a->setShortcut (Qt::CTRL +Qt::Key_Insert );
32.769 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
32.770 a->setEnabled (false);
32.771 - a->addTo ( menu );
32.772 + actionListBranches.append(a);
32.773 actionEditAddBranchBelow=a;
32.774 + a = new QAction(tr( "Add branch below" ), this);
32.775 + a->setStatusTip ( tr( "Add a branch below selection" ));
32.776 + a->setShortcut (Qt::CTRL +Qt::Key_A );
32.777 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
32.778 + actionListBranches.append(a);
32.779
32.780 // Import at selection (adding to selection)
32.781 - a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
32.782 + a = new QAction( tr( "Add map (insert)" ),this);
32.783 + a->setStatusTip (tr( "Add map at selection" ));
32.784 connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
32.785 a->setEnabled (false);
32.786 - a->addTo ( menu );
32.787 + actionListBranches.append(a);
32.788 actionEditImportAdd=a;
32.789
32.790 // Import at selection (replacing selection)
32.791 - a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
32.792 + a = new QAction( tr( "Add map (replace)" ), this);
32.793 + a->setStatusTip (tr( "Replace selection with map" ));
32.794 connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
32.795 a->setEnabled (false);
32.796 - a->addTo ( menu );
32.797 + actionListBranches.append(a);
32.798 actionEditImportReplace=a;
32.799
32.800 // Save selection
32.801 - a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
32.802 + a = new QAction( tr( "Save selection" ), this);
32.803 + a->setStatusTip (tr( "Save selection" ));
32.804 connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
32.805 a->setEnabled (false);
32.806 - a->addTo ( menu );
32.807 + actionListBranches.append(a);
32.808 actionEditSaveBranch=a;
32.809
32.810 + // Only remove branch, not its childs
32.811 + a = new QAction(tr( "Remove only branch " ), this);
32.812 + a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
32.813 + a->setShortcut (Qt::ALT + Qt::Key_Delete );
32.814 + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
32.815 + a->setEnabled (false);
32.816 + actionListBranches.append(a);
32.817 + actionEditRemoveBranchKeepChilds=a;
32.818 +
32.819 + // Only remove childs of a branch
32.820 + a = new QAction( tr( "Remove childs" ), this);
32.821 + a->setStatusTip (tr( "Remove childs of branch" ));
32.822 + a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
32.823 + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
32.824 + a->setEnabled (false);
32.825 + actionListBranches.append(a);
32.826 + actionEditRemoveChilds=a;
32.827 +
32.828 // Shortcuts for navigating with cursor:
32.829 - a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
32.830 + a = new QAction(tr( "Select upper branch" ), this);
32.831 + a->setStatusTip ( tr( "Select upper branch" ));
32.832 + a->setShortcut (Qt::Key_Up );
32.833 connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
32.834 - a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
32.835 + a = new QAction( tr( "Select lower branch" ),this);
32.836 + a->setStatusTip (tr( "Select lower branch" ));
32.837 + a->setShortcut ( Qt::Key_Down );
32.838 connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
32.839 - a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
32.840 + a = new QAction(tr( "Select left branch" ), this);
32.841 + a->setStatusTip ( tr( "Select left branch" ));
32.842 + a->setShortcut (Qt::Key_Left );
32.843 connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
32.844 - a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
32.845 + a = new QAction( tr( "Select child branch" ), this);
32.846 + a->setStatusTip (tr( "Select right branch" ));
32.847 + a->setShortcut (Qt::Key_Right);
32.848 connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
32.849 - a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
32.850 + a = new QAction( tr( "Select first branch" ), this);
32.851 + a->setStatusTip (tr( "Select first branch" ));
32.852 + a->setShortcut (Qt::Key_Home );
32.853 a->setEnabled (false);
32.854 a->addTo ( menu );
32.855 + actionListBranches.append(a);
32.856 actionEditSelectFirst=a;
32.857 connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
32.858 - a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
32.859 + a = new QAction( tr( "Select last branch" ),this);
32.860 + a->setStatusTip (tr( "Select last branch" ));
32.861 + a->setShortcut ( Qt::Key_End );
32.862 connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
32.863 a->setEnabled (false);
32.864 a->addTo ( menu );
32.865 + actionListBranches.append(a);
32.866 actionEditSelectLast=a;
32.867
32.868 - a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
32.869 + a = new QAction( tr( "Add Image" )+QString("..."), this);
32.870 + a->setStatusTip (tr( "Add Image" ));
32.871 connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
32.872 actionEditLoadImage=a;
32.873 +
32.874 }
32.875
32.876 // Format Actions
32.877 void Main::setupFormatActions()
32.878 {
32.879 - QPopupMenu *menu = new QPopupMenu( this );
32.880 - menuBar()->insertItem( tr( "&Format" ), menu );
32.881 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.882 + menuBar()->insertItem( tr( "F&ormat" ), menu );
32.883
32.884 - QToolBar *tb = new QToolBar( this );
32.885 + Q3ToolBar *tb = new Q3ToolBar( this );
32.886 QAction *a;
32.887 QPixmap pix( 16,16);
32.888 - pix.fill (black);
32.889 - actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
32.890 - connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
32.891 - actionFormatColor->addTo( tb );
32.892 - actionFormatColor->addTo( menu );
32.893 - a= new QAction( tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ), QPixmap(formatcolorpicker_xpm), tr( "Pic&k color" ), CTRL + Key_K, this, "pickColor" );
32.894 + pix.fill (Qt::black);
32.895 + a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
32.896 + a->setStatusTip ( tr( "Set Color" ));
32.897 + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
32.898 + a->addTo( tb );
32.899 + a->addTo( menu );
32.900 + actionFormatColor=a;
32.901 + a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
32.902 + a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
32.903 + a->setShortcut (Qt::CTRL + Qt::Key_K );
32.904 connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
32.905 a->setEnabled (false);
32.906 a->addTo( tb );
32.907 a->addTo( menu );
32.908 + actionListBranches.append(a);
32.909 actionFormatPickColor=a;
32.910 - a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
32.911 +
32.912 + a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
32.913 + a->setStatusTip ( tr( "Color branch" ) );
32.914 + a->setShortcut (Qt::CTRL + Qt::Key_I);
32.915 connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
32.916 a->setEnabled (false);
32.917 a->addTo( tb );
32.918 a->addTo( menu );
32.919 + actionListBranches.append(a);
32.920 actionFormatColorBranch=a;
32.921 - a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
32.922 +
32.923 + a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
32.924 + a->setStatusTip ( tr( "Color Subtree" ));
32.925 + a->setShortcut (Qt::CTRL + Qt::Key_T);
32.926 connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
32.927 a->setEnabled (false);
32.928 a->addTo( menu );
32.929 a->addTo( tb );
32.930 + actionListBranches.append(a);
32.931 actionFormatColorSubtree=a;
32.932
32.933 menu->insertSeparator();
32.934 - actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
32.935 + actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
32.936 actionGroupFormatLinkStyles->setExclusive (true);
32.937 - a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
32.938 + a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
32.939 + a->setStatusTip (tr( "Line" ));
32.940 a->setToggleAction(true);
32.941 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
32.942 actionFormatLinkStyleLine=a;
32.943 - a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
32.944 + a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
32.945 + a->setStatusTip (tr( "Line" ));
32.946 a->setToggleAction(true);
32.947 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
32.948 actionFormatLinkStyleParabel=a;
32.949 - a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
32.950 + a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
32.951 + a->setStatusTip (tr( "PolyLine" ));
32.952 a->setToggleAction(true);
32.953 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
32.954 actionFormatLinkStylePolyLine=a;
32.955 - a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
32.956 + a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
32.957 + a->setStatusTip (tr( "PolyParabel" ) );
32.958 a->setToggleAction(true);
32.959 connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
32.960 actionFormatLinkStylePolyParabel=a;
32.961 actionGroupFormatLinkStyles->addTo (menu);
32.962
32.963 - actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
32.964 + actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
32.965 actionGroupFormatFrameTypes->setExclusive (true);
32.966 - a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
32.967 + a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
32.968 + a->setStatusTip (tr("No Frame"));
32.969 a->setToggleAction(true);
32.970 connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
32.971 actionFormatFrameNone=a;
32.972 - a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
32.973 + a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
32.974 + a->setStatusTip (tr( "Rectangle" ));
32.975 a->setToggleAction(true);
32.976 connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
32.977 actionFormatFrameRectangle=a;
32.978
32.979 + a = new QAction( tr( "Include images vertically" ), actionFormatIncludeImagesVer);
32.980 + a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
32.981 + a->setToggleAction(true);
32.982 + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
32.983 + actionFormatIncludeImagesVer=a;
32.984 +
32.985 + a = new QAction( tr( "Include images horizontally" ), actionFormatIncludeImagesHor );
32.986 + a->setStatusTip ( tr ("Include left and right position of images into branch"));
32.987 + a->setToggleAction(true);
32.988 + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
32.989 + actionFormatIncludeImagesHor=a;
32.990 +
32.991 + a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
32.992 + a->setStatusTip (tr( "Hide link" ));
32.993 + a->setToggleAction(true);
32.994 + connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
32.995 + actionFormatHideLinkUnselected=a;
32.996 +
32.997 menu->insertSeparator();
32.998 - a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
32.999 + a= new QAction( tr( "&Use color of heading for link" ), this);
32.1000 + a->setStatusTip (tr( "Use same color for links and headings" ));
32.1001 a->setToggleAction(true);
32.1002 connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
32.1003 a->addTo( menu );
32.1004 actionFormatLinkColorHint=a;
32.1005 - pix.fill (white);
32.1006 - actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
32.1007 - connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
32.1008 - actionFormatLinkColor->addTo( menu );
32.1009 - actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
32.1010 - connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
32.1011 - actionFormatBackColor->addTo( menu );
32.1012 +
32.1013 + pix.fill (Qt::white);
32.1014 + a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this );
32.1015 + a->setStatusTip (tr( "Set Link Color" ));
32.1016 + a->addTo( menu );
32.1017 + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
32.1018 + actionFormatLinkColor=a;
32.1019 +
32.1020 + a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
32.1021 + a->setStatusTip (tr( "Set Background Color" ));
32.1022 + a->addTo( menu );
32.1023 + connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
32.1024 + actionFormatBackColor=a;
32.1025 }
32.1026
32.1027 // View Actions
32.1028 void Main::setupViewActions()
32.1029 {
32.1030 - QToolBar *tb = new QToolBar( this );
32.1031 + Q3ToolBar *tb = new Q3ToolBar( this );
32.1032 tb->setLabel( "View Actions" );
32.1033 - QPopupMenu *menu = new QPopupMenu( this );
32.1034 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.1035 menuBar()->insertItem( tr( "&View" ), menu );
32.1036
32.1037 QAction *a;
32.1038 - a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
32.1039 - connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
32.1040 + a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
32.1041 + a->setStatusTip ( tr( "Zoom reset" ) );
32.1042 + a->setShortcut (Qt::CTRL + Qt::Key_0 );
32.1043 a->addTo( tb );
32.1044 a->addTo( menu );
32.1045 - a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
32.1046 - connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
32.1047 + connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
32.1048 +
32.1049 + a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
32.1050 + a->setStatusTip (tr( "Zoom in" ));
32.1051 + a->setShortcut (Qt::CTRL + Qt::Key_Plus);
32.1052 a->addTo( tb );
32.1053 a->addTo( menu );
32.1054 - a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
32.1055 - connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
32.1056 + connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
32.1057 +
32.1058 + a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
32.1059 + a->setStatusTip (tr( "Zoom out" ));
32.1060 + a->setShortcut (Qt::CTRL + Qt::Key_Minus );
32.1061 a->addTo( tb );
32.1062 a->addTo( menu );
32.1063 - a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
32.1064 - connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
32.1065 + connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
32.1066 +
32.1067 +
32.1068 + a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
32.1069 + a->setStatusTip ( tr( "Show Note Editor" ));
32.1070 + a->setShortcut ( Qt::CTRL + Qt::Key_E );
32.1071 a->setToggleAction(true);
32.1072 if (textEditor->showWithMain())
32.1073 a->setOn(true);
32.1074 @@ -666,102 +942,348 @@
32.1075 a->setOn(false);
32.1076 a->addTo( tb );
32.1077 a->addTo( menu );
32.1078 + connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
32.1079 actionViewToggleNoteEditor=a;
32.1080 - a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
32.1081 +
32.1082 + a = new QAction( tr( "Show history window" ),this );
32.1083 + a->setStatusTip ( tr( "Show history window" ));
32.1084 + a->setShortcut ( Qt::CTRL + Qt::Key_H );
32.1085 + a->setToggleAction(false);
32.1086 + a->addTo( menu );
32.1087 + connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
32.1088 + actionViewToggleHistoryWindow=a;
32.1089 +
32.1090 + a = new QAction(tr( "Next Window" ), this);
32.1091 + a->setStatusTip ( tr( "&Next Window" ) );
32.1092 + a->setShortcut (Qt::ALT + Qt::Key_N );
32.1093 + a->addTo( menu );
32.1094 connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
32.1095 +
32.1096 + a = new QAction (tr( "Previous Window" ), this );
32.1097 + a->setStatusTip (tr( "&Previous Window" ));
32.1098 + a->setShortcut (Qt::ALT + Qt::Key_P );
32.1099 a->addTo( menu );
32.1100 - a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
32.1101 connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
32.1102 - a->addTo( menu );
32.1103 +}
32.1104 +
32.1105 +// Mode Actions
32.1106 +void Main::setupModeActions()
32.1107 +{
32.1108 + //QPopupMenu *menu = new QPopupMenu( this );
32.1109 + //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
32.1110 +
32.1111 + Q3ToolBar *tb = new Q3ToolBar( this );
32.1112 + tb->setLabel( tr ("Modes when using modifiers") );
32.1113 + QAction *a;
32.1114 + actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
32.1115 + actionGroupModModes->setExclusive (true);
32.1116 + a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
32.1117 + a->setShortcut (Qt::Key_J);
32.1118 + a->setStatusTip ( tr( "Use modifier to color branches" ));
32.1119 + a->setToggleAction(true);
32.1120 + a->addTo (tb);
32.1121 + a->setOn(true);
32.1122 + actionModModeColor=a;
32.1123 +
32.1124 + a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
32.1125 + a->setShortcut( Qt::Key_K);
32.1126 + a->setStatusTip( tr( "Use modifier to copy" ));
32.1127 + a->setToggleAction(true);
32.1128 + a->addTo (tb);
32.1129 + actionModModeCopy=a;
32.1130 +
32.1131 + a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
32.1132 + a->setShortcut (Qt::Key_L);
32.1133 + a->setStatusTip( tr( "Use modifier to draw xLinks" ));
32.1134 + a->setToggleAction(true);
32.1135 + a->addTo (tb);
32.1136 + actionModModeLink=a;
32.1137 }
32.1138
32.1139 // Flag Actions
32.1140 void Main::setupFlagActions()
32.1141 {
32.1142 + // Create System Flags
32.1143 + systemFlagsDefault = new FlagRowObj ();
32.1144 + systemFlagsDefault->setVisibility (false);
32.1145 + systemFlagsDefault->setName ("systemFlagsDef");
32.1146 +
32.1147 + FlagObj *fo = new FlagObj ();
32.1148 + fo->load(QPixmap(flagsPath+"flag-note.png"));
32.1149 + fo->setName("note");
32.1150 + fo->setToolTip(tr("Note","Systemflag"));
32.1151 + systemFlagsDefault->addFlag (fo); // makes deep copy
32.1152 +
32.1153 + fo->load(QPixmap(flagsPath+"flag-url.png"));
32.1154 + fo->setName("url");
32.1155 + fo->setToolTip(tr("WWW Document (external)","Systemflag"));
32.1156 + systemFlagsDefault->addFlag (fo);
32.1157 +
32.1158 + fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
32.1159 + fo->setName("vymLink");
32.1160 + fo->setToolTip(tr("Link to another vym map","Systemflag"));
32.1161 + systemFlagsDefault->addFlag (fo);
32.1162 +
32.1163 + fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
32.1164 + fo->setName("scrolledright");
32.1165 + fo->setToolTip(tr("subtree is scrolled","Systemflag"));
32.1166 + systemFlagsDefault->addFlag (fo);
32.1167 +
32.1168 + fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
32.1169 + fo->setName("tmpUnscrolledright");
32.1170 + fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
32.1171 + systemFlagsDefault->addFlag (fo);
32.1172 +
32.1173 + fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
32.1174 + fo->setName("hideInExport");
32.1175 + fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
32.1176 + systemFlagsDefault->addFlag (fo);
32.1177 +
32.1178 + // Create Standard Flags
32.1179 + standardFlagsDefault = new FlagRowObj ();
32.1180 + standardFlagsDefault->setVisibility (false);
32.1181 + standardFlagsDefault->setName ("standardFlagsDef");
32.1182 +
32.1183 + fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
32.1184 + fo->setName ("exclamationmark");
32.1185 + fo->setGroup("standard-mark");
32.1186 + fo->setToolTip(tr("Take care!","Standardflag"));
32.1187 + standardFlagsDefault->addFlag (fo); // makes deep copy
32.1188 +
32.1189 + fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
32.1190 + fo->setName("questionmark");
32.1191 + fo->setGroup("standard-mark");
32.1192 + fo->setToolTip(tr("Really?","Standardflag"));
32.1193 + standardFlagsDefault->addFlag (fo);
32.1194 +
32.1195 + fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
32.1196 + fo->setName("hook-green");
32.1197 + fo->setGroup("standard-hook");
32.1198 + fo->setToolTip(tr("ok!","Standardflag"));
32.1199 + standardFlagsDefault->addFlag (fo);
32.1200 +
32.1201 + fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
32.1202 + fo->setName("cross-red");
32.1203 + fo->setGroup("standard-hook");
32.1204 + fo->setToolTip(tr("Not ok!","Standardflag"));
32.1205 + standardFlagsDefault->addFlag (fo);
32.1206 +
32.1207 + fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
32.1208 + fo->setName("stopsign");
32.1209 + fo->setToolTip(tr("This won't work!","Standardflag"));
32.1210 + standardFlagsDefault->addFlag (fo);
32.1211 +
32.1212 + fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
32.1213 + fo->setName("smiley-good");
32.1214 + fo->setGroup("standard-smiley");
32.1215 + fo->setToolTip(tr("Good","Standardflag"));
32.1216 + standardFlagsDefault->addFlag (fo);
32.1217 +
32.1218 + fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
32.1219 + fo->setName("smiley-sad");
32.1220 + fo->setGroup("standard-smiley");
32.1221 + fo->setToolTip(tr("Bad","Standardflag"));
32.1222 + standardFlagsDefault->addFlag (fo);
32.1223 +
32.1224 + fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
32.1225 + // Original omg.png (in KDE emoticons)
32.1226 + fo->setName("smiley-omg");
32.1227 + fo->setGroup("standard-smiley");
32.1228 + fo->setToolTip(tr("Oh no!","Standardflag"));
32.1229 + standardFlagsDefault->addFlag (fo);
32.1230 +
32.1231 + fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
32.1232 + fo->setName("clock");
32.1233 + fo->setToolTip(tr("Time critical","Standardflag"));
32.1234 + standardFlagsDefault->addFlag (fo);
32.1235 +
32.1236 + fo->load(QPixmap(flagsPath+"flag-phone.png"));
32.1237 + fo->setName("phone");
32.1238 + fo->setToolTip(tr("Call...","Standardflag"));
32.1239 + standardFlagsDefault->addFlag (fo);
32.1240 +
32.1241 + fo->load(QPixmap(flagsPath+"flag-lamp.png"));
32.1242 + fo->setName("lamp");
32.1243 + fo->setToolTip(tr("Idea!","Standardflag"));
32.1244 + standardFlagsDefault->addFlag (fo);
32.1245 +
32.1246 + fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
32.1247 + fo->setName("arrow-up");
32.1248 + fo->setGroup("standard-arrow");
32.1249 + fo->setToolTip(tr("Important","Standardflag"));
32.1250 + standardFlagsDefault->addFlag (fo);
32.1251 +
32.1252 + fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
32.1253 + fo->setName("arrow-down");
32.1254 + fo->setGroup("standard-arrow");
32.1255 + fo->setToolTip(tr("Unimportant","Standardflag"));
32.1256 + standardFlagsDefault->addFlag (fo);
32.1257 +
32.1258 + fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
32.1259 + fo->setName("2arrow-up");
32.1260 + fo->setGroup("standard-arrow");
32.1261 + fo->setToolTip(tr("Very important!","Standardflag"));
32.1262 + standardFlagsDefault->addFlag (fo);
32.1263 +
32.1264 + fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
32.1265 + fo->setName("2arrow-down");
32.1266 + fo->setGroup("standard-arrow");
32.1267 + fo->setToolTip(tr("Very unimportant!","Standardflag"));
32.1268 + standardFlagsDefault->addFlag (fo);
32.1269 +
32.1270 + fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
32.1271 + fo->setName("thumb-up");
32.1272 + fo->setGroup("standard-thumb");
32.1273 + fo->setToolTip(tr("I like this","Standardflag"));
32.1274 + standardFlagsDefault->addFlag (fo);
32.1275 +
32.1276 + fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
32.1277 + fo->setName("thumb-down");
32.1278 + fo->setGroup("standard-thumb");
32.1279 + fo->setToolTip(tr("I like this","Standardflag"));
32.1280 + fo->setToolTip(tr("I do not like this","Standardflag"));
32.1281 + standardFlagsDefault->addFlag (fo);
32.1282 +
32.1283 + fo->load(QPixmap(flagsPath+"flag-rose.png"));
32.1284 + fo->setName("rose");
32.1285 + fo->setToolTip(tr("Rose","Standardflag"));
32.1286 + standardFlagsDefault->addFlag (fo);
32.1287 +
32.1288 + fo->load(QPixmap(flagsPath+"flag-heart.png"));
32.1289 + fo->setName("heart");
32.1290 + fo->setToolTip(tr("I just love... ","Standardflag"));
32.1291 + standardFlagsDefault->addFlag (fo);
32.1292 +
32.1293 + fo->load(QPixmap(flagsPath+"flag-present.png"));
32.1294 + fo->setName("present");
32.1295 + fo->setToolTip(tr("Surprise!","Standardflag"));
32.1296 + standardFlagsDefault->addFlag (fo);
32.1297 +
32.1298 + fo->load(QPixmap(flagsPath+"flag-flash.png"));
32.1299 + fo->setName("flash");
32.1300 + fo->setToolTip(tr("Dangerous","Standardflag"));
32.1301 + standardFlagsDefault->addFlag (fo);
32.1302 +
32.1303 + fo->load(QPixmap(flagsPath+"flag-info.png"));
32.1304 + // Original: xsldbg_output.png
32.1305 + fo->setName("info");
32.1306 + fo->setToolTip(tr("Info","Standardflag"));
32.1307 + standardFlagsDefault->addFlag (fo);
32.1308 +
32.1309 + fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
32.1310 + // Original khelpcenter.png
32.1311 + fo->setName("lifebelt");
32.1312 + fo->setToolTip(tr("This will help","Standardflag"));
32.1313 + standardFlagsDefault->addFlag (fo);
32.1314 +
32.1315 + delete (fo);
32.1316 +
32.1317 standardFlagsDefault->makeToolbar(this, "Standard Flags");
32.1318 }
32.1319
32.1320 // Settings Actions
32.1321 void Main::setupSettingsActions()
32.1322 {
32.1323 - QPopupMenu *menu = new QPopupMenu( this );
32.1324 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.1325 menuBar()->insertItem( tr( "&Settings" ), menu );
32.1326
32.1327 QAction *a;
32.1328
32.1329
32.1330 - a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
32.1331 + a = new QAction( tr( "Set application to open pdf files"), this);
32.1332 + a->setStatusTip ( tr( "Set application to open pdf files"));
32.1333 connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
32.1334 a->addTo( menu );
32.1335
32.1336 - a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
32.1337 + a = new QAction( tr( "Set application to open external links"), this);
32.1338 + a->setStatusTip( tr( "Set application to open external links"));
32.1339 connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
32.1340 a->addTo( menu );
32.1341
32.1342 menu->insertSeparator();
32.1343 - a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
32.1344 + a = new QAction( tr( "Edit branch after adding it" ), this );
32.1345 + a->setStatusTip( tr( "Edit branch after adding it" ));
32.1346 a->setToggleAction(true);
32.1347 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
32.1348 a->addTo( menu );
32.1349 actionSettingsAutoedit=a;
32.1350
32.1351 - a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
32.1352 + a= new QAction( tr( "Select branch after adding it" ), this );
32.1353 + a->setStatusTip( tr( "Select branch after adding it" ));
32.1354 a->setToggleAction(true);
32.1355 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
32.1356 a->addTo( menu );
32.1357 actionSettingsAutoselectHeading=a;
32.1358
32.1359 - a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
32.1360 + a= new QAction(tr( "Select existing heading" ), this);
32.1361 + a->setStatusTip( tr( "Select heading before editing" ));
32.1362 a->setToggleAction(true);
32.1363 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
32.1364 a->addTo( menu );
32.1365 actionSettingsAutoselectText=a;
32.1366
32.1367 - a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
32.1368 + a= new QAction(tr( "pasting into new branch" ), this );
32.1369 + a->setStatusTip( tr( "Pasting into new branch" ));
32.1370 a->setToggleAction(true);
32.1371 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
32.1372 a->addTo( menu );
32.1373 actionSettingsPasteNewHeading=a;
32.1374
32.1375 - a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
32.1376 + a= new QAction( tr( "Delete key" ), this);
32.1377 + a->setStatusTip( tr( "Delete key for deleting branches" ));
32.1378 a->setToggleAction(true);
32.1379 a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
32.1380 a->addTo( menu );
32.1381 + connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
32.1382 actionSettingsUseDelKey=a;
32.1383 +
32.1384 + a= new QAction( tr( "Exclusive flags" ), this);
32.1385 + a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
32.1386 + a->setToggleAction(true);
32.1387 + a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
32.1388 + a->addTo( menu );
32.1389 + actionSettingsUseFlagGroups=a;
32.1390 +
32.1391 + a= new QAction( tr( "Use hide flags" ), this);
32.1392 + a->setStatusTip( tr( "Use hide flag during exports " ));
32.1393 + a->setToggleAction(true);
32.1394 + a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
32.1395 + a->addTo( menu );
32.1396 + actionSettingsUseHideExport=a;
32.1397 }
32.1398
32.1399 // Test Actions
32.1400 void Main::setupTestActions()
32.1401 {
32.1402 - QPopupMenu *menu = new QPopupMenu( this );
32.1403 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.1404 menuBar()->insertItem( tr( "&Test" ), menu );
32.1405
32.1406 QAction *a;
32.1407 - a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
32.1408 + a = new QAction( tr( "test flag" ), this);
32.1409 + a->setStatusTip( tr( "Call test function" ));
32.1410 connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
32.1411 a->addTo( menu );
32.1412 -
32.1413 - a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
32.1414 - connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
32.1415 - a->addTo( menu );
32.1416 }
32.1417
32.1418 // Help Actions
32.1419 void Main::setupHelpActions()
32.1420 {
32.1421 - QPopupMenu *menu = new QPopupMenu( this );
32.1422 + Q3PopupMenu *menu = new Q3PopupMenu( this );
32.1423 menuBar()->insertItem( tr( "&Help" ), menu );
32.1424
32.1425 QAction *a;
32.1426 - a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
32.1427 + a = new QAction( tr( "Open VYM Documentation (pdf) " ), this );
32.1428 + a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
32.1429 connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
32.1430 a->addTo( menu );
32.1431
32.1432 - a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
32.1433 + a = new QAction( tr( "About VYM" ), this);
32.1434 + a->setStatusTip( tr( "About VYM")+" "__VYM);
32.1435 connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
32.1436 a->addTo( menu );
32.1437
32.1438 - a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
32.1439 + a = new QAction( tr( "About QT" ), this);
32.1440 + a->setStatusTip( tr( "Information about QT toolkit" ));
32.1441 connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
32.1442 a->addTo( menu );
32.1443 }
32.1444 @@ -772,44 +1294,89 @@
32.1445 QAction*a;
32.1446
32.1447 // Context Menu for branch or mapcenter
32.1448 - branchContextMenu =new QPopupMenu (this);
32.1449 - actionEditAddBranch->addTo ( branchContextMenu );
32.1450 - actionEditAddBranchAbove->addTo ( branchContextMenu );
32.1451 - actionEditAddBranchBelow->addTo ( branchContextMenu );
32.1452 + branchContextMenu =new Q3PopupMenu (this);
32.1453 +
32.1454 + // Submenu "Add"
32.1455 + branchAddContextMenu =new Q3PopupMenu (this);
32.1456 + actionEditPaste->addTo ( branchAddContextMenu );
32.1457 + actionEditAddBranch->addTo ( branchAddContextMenu );
32.1458 + actionEditAddBranchHere->addTo ( branchAddContextMenu );
32.1459 + actionEditAddBranchAbove->addTo ( branchAddContextMenu );
32.1460 + actionEditAddBranchBelow->addTo ( branchAddContextMenu );
32.1461 + branchAddContextMenu->insertSeparator();
32.1462 + actionEditLoadImage->addTo( branchAddContextMenu );
32.1463 + branchAddContextMenu->insertSeparator();
32.1464 + actionEditImportAdd->addTo ( branchAddContextMenu );
32.1465 + actionEditImportReplace->addTo ( branchAddContextMenu );
32.1466 +
32.1467 + // Submenu "Remove"
32.1468 + branchRemoveContextMenu =new Q3PopupMenu (this);
32.1469 + actionEditCut->addTo ( branchRemoveContextMenu );
32.1470 + actionEditDelete->addTo ( branchRemoveContextMenu );
32.1471 + actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
32.1472 + actionEditRemoveChilds->addTo( branchRemoveContextMenu );
32.1473 +
32.1474 + branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
32.1475 + branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
32.1476 +
32.1477 actionEditSaveBranch->addTo( branchContextMenu );
32.1478 - branchContextMenu->insertSeparator();
32.1479 - actionEditImportAdd->addTo ( branchContextMenu );
32.1480 - actionEditImportReplace->addTo ( branchContextMenu );
32.1481 +
32.1482 branchContextMenu->insertSeparator();
32.1483 actionEditOpenURL->addTo ( branchContextMenu );
32.1484 + actionEditOpenURLTab->addTo ( branchContextMenu );
32.1485 actionEditURL->addTo ( branchContextMenu );
32.1486 actionEditHeading2URL->addTo ( branchContextMenu );
32.1487 + actionEditBugzilla2URL->addTo( branchContextMenu );
32.1488 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
32.1489 - actionEditBugzilla2URL->addTo( branchContextMenu );
32.1490 + {
32.1491 + actionEditFATE2URL->addTo( branchContextMenu );
32.1492 + }
32.1493 branchContextMenu->insertSeparator();
32.1494 actionEditOpenVymLink->addTo ( branchContextMenu );
32.1495 actionEditVymLink->addTo ( branchContextMenu );
32.1496 actionEditDeleteVymLink->addTo ( branchContextMenu );
32.1497 - branchContextMenu->insertSeparator();
32.1498 - actionEditLoadImage->addTo( branchContextMenu );
32.1499 - branchContextMenu->insertSeparator();
32.1500 - actionEditCopy->addTo( branchContextMenu );
32.1501 - actionEditCut->addTo( branchContextMenu );
32.1502 - actionEditPaste->addTo( branchContextMenu );
32.1503 +
32.1504 branchContextMenu->insertSeparator();
32.1505 actionGroupFormatFrameTypes->addTo( branchContextMenu );
32.1506
32.1507 + branchContextMenu->insertSeparator();
32.1508 + actionFormatIncludeImagesVer->addTo( branchContextMenu );
32.1509 + actionFormatIncludeImagesHor->addTo( branchContextMenu );
32.1510 + actionFormatHideLinkUnselected->addTo( branchContextMenu );
32.1511 +
32.1512 + // Context Menu for links in a branch menu
32.1513 + // This will be populated "on demand" in MapEditor::updateActions
32.1514 + branchContextMenu->insertSeparator();
32.1515 + branchLinksContextMenu =new Q3PopupMenu (this);
32.1516 + branchLinksContextMenuDup =new Q3PopupMenu (this);
32.1517 + branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
32.1518 + connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
32.1519 +
32.1520 + branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
32.1521 + connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
32.1522 +
32.1523 // Context menu for floatimage
32.1524 - floatimageContextMenu =new QPopupMenu (this);
32.1525 - saveImageFormatMenu=new QPopupMenu (this);
32.1526 - exportImageFormatMenu=new QPopupMenu (this);
32.1527 + floatimageContextMenu =new Q3PopupMenu (this);
32.1528 + saveImageFormatMenu=new Q3PopupMenu (this);
32.1529 + exportImageFormatMenu=new Q3PopupMenu (this);
32.1530
32.1531 - QStrList fmt = QImage::outputFormats();
32.1532 +/* FIXME strange error
32.1533 + foreach (QByteArray format, QImageWriter::supportedImageFormats())
32.1534 + {
32.1535 + QString text = tr("%1...").arg(QString(format).toUpper());
32.1536 + saveImageFormatMenu->insertItem( text );
32.1537 + exportImageFormatMenu->insertItem( text );
32.1538 + }
32.1539 +*/
32.1540 +
32.1541 +/* FIXME not needed any longer
32.1542 + Q3StrList fmt = QImageWriter::supportedImageFormats();
32.1543 for (const char* f = fmt.first(); f; f = fmt.next())
32.1544 {
32.1545 saveImageFormatMenu->insertItem( f );
32.1546 exportImageFormatMenu->insertItem( f );
32.1547 }
32.1548 +*/
32.1549 connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
32.1550 connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
32.1551 floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
32.1552 @@ -819,39 +1386,48 @@
32.1553 actionEditCut->addTo( floatimageContextMenu );
32.1554
32.1555 floatimageContextMenu->insertSeparator();
32.1556 - a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
32.1557 - a->setToggleAction(true);
32.1558 - connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
32.1559 - a->addTo( floatimageContextMenu);
32.1560 - actionEditToggleFloatExport=a;
32.1561 + actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
32.1562
32.1563 + exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
32.1564
32.1565 + a = new QAction( "Open Office"+QString("..."), this);
32.1566 + a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
32.1567 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
32.1568 + a->addTo (exportMenu);
32.1569
32.1570 - // Context menu for exports
32.1571 - exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
32.1572 -
32.1573 - a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
32.1574 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
32.1575 + a = new QAction( "Webpage (XHTML)...",this );
32.1576 + a->setShortcut (Qt::ALT + Qt::Key_X);
32.1577 + a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
32.1578 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
32.1579 a->addTo( exportMenu );
32.1580
32.1581 - a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" );
32.1582 + a = new QAction( "Text (ASCII)...", this);
32.1583 + a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
32.1584 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
32.1585 + a->addTo( exportMenu );
32.1586 +
32.1587 + a = new QAction( tr("KDE Bookmarks"), this);
32.1588 + a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
32.1589 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
32.1590 + a->addTo (exportMenu);
32.1591 +
32.1592 + a = new QAction( "Taskjuggler...", this );
32.1593 + a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
32.1594 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
32.1595 + a->addTo( exportMenu );
32.1596 +
32.1597 + a = new QAction( "LaTeX...", this);
32.1598 + a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
32.1599 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
32.1600 + a->addTo( exportMenu );
32.1601 +
32.1602 + a = new QAction( "XML..." , this );
32.1603 + a->setStatusTip (tr( "Export as")+" XML");
32.1604 connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
32.1605 a->addTo( exportMenu );
32.1606
32.1607 - if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
32.1608 - {
32.1609 - a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
32.1610 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
32.1611 - a->addTo( exportMenu );
32.1612 - }
32.1613 -
32.1614 - a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
32.1615 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
32.1616 - a->addTo( exportMenu );
32.1617 -
32.1618 -
32.1619 // Context menu for canvas
32.1620 - canvasContextMenu =new QPopupMenu (this);
32.1621 + canvasContextMenu =new Q3PopupMenu (this);
32.1622 actionEditMapInfo->addTo( canvasContextMenu );
32.1623 canvasContextMenu->insertSeparator();
32.1624 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
32.1625 @@ -910,7 +1486,7 @@
32.1626
32.1627 void Main::showEvent (QShowEvent * )
32.1628 {
32.1629 - if (textEditor->showWithMain()) textEditor->show();
32.1630 + if (textEditor->showWithMain()) textEditor->showNormal();
32.1631 }
32.1632
32.1633 bool Main::reallyWriteDirectory(const QString &dir)
32.1634 @@ -920,9 +1496,8 @@
32.1635 if (eList.first() =="..") eList.pop_front(); // remove "."
32.1636 if (!eList.isEmpty())
32.1637 {
32.1638 - QMessageBox mb( "VYM",
32.1639 - tr("The directory ") + dir +
32.1640 - tr(" is not empty. Do you risk to overwrite its contents?"),
32.1641 + QMessageBox mb( __VYM,
32.1642 + tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
32.1643 QMessageBox::Warning,
32.1644 QMessageBox::Yes ,
32.1645 QMessageBox::Cancel | QMessageBox::Default,
32.1646 @@ -945,9 +1520,9 @@
32.1647
32.1648 QString Main::browseDirectory (const QString &caption)
32.1649 {
32.1650 - QFileDialog fd(this,caption);
32.1651 - fd.setMode (QFileDialog::DirectoryOnly);
32.1652 - fd.setCaption("VYM - "+caption);
32.1653 + Q3FileDialog fd(this,caption);
32.1654 + fd.setMode (Q3FileDialog::DirectoryOnly);
32.1655 + fd.setCaption(__VYM " - "+caption);
32.1656 fd.show();
32.1657
32.1658 if ( fd.exec() == QDialog::Accepted )
32.1659 @@ -968,7 +1543,7 @@
32.1660 void Main::newView()
32.1661 {
32.1662 // Open a new view... have it delete when closed.
32.1663 - Main *m = new Main(0, 0, WDestructiveClose);
32.1664 + Main *m = new Main(0, 0, Qt::WDestructiveClose);
32.1665 qApp->setMainWidget(m);
32.1666 m->show();
32.1667 qApp->setMainWidget(0);
32.1668 @@ -995,18 +1570,17 @@
32.1669 void Main::fileNew()
32.1670 {
32.1671 QString fn="unnamed";
32.1672 - MapEditor* medit = new MapEditor (tabWidget, true);
32.1673 + MapEditor* medit = new MapEditor ( NULL,true);
32.1674 tabWidget->addTab (medit,fn);
32.1675 tabWidget->showPage(medit);
32.1676 medit->viewport()->setFocus();
32.1677 + // For the very first map we do not have flagrows yet...
32.1678 medit->select("mc:");
32.1679 }
32.1680
32.1681 -void Main::fileLoad(QString fn, const LoadMode &lmode)
32.1682 +ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
32.1683 {
32.1684 - // Error codes
32.1685 - enum errorCode {success,aborted};
32.1686 - errorCode err=success;
32.1687 + ErrorCode err=success;
32.1688
32.1689 // fn is usually the archive, mapfile the file after uncompressing
32.1690 QString mapfile;
32.1691 @@ -1026,15 +1600,15 @@
32.1692 if (me->getFilePath() == fn)
32.1693 {
32.1694 // Already there, ask for confirmation
32.1695 - QMessageBox mb( "VYM",
32.1696 - tr("The map ") + fn + tr ("\n is already opened."
32.1697 + QMessageBox mb( __VYM,
32.1698 + tr("The map %1\nis already opened."
32.1699 "Opening the same map in multiple editors may lead \n"
32.1700 "to confusion when finishing working with vym."
32.1701 - "Do you want to"),
32.1702 + "Do you want to").arg(fn),
32.1703 QMessageBox::Warning,
32.1704 QMessageBox::Yes | QMessageBox::Default,
32.1705 QMessageBox::Cancel | QMessageBox::Escape,
32.1706 - QMessageBox::QMessageBox::NoButton);
32.1707 + QMessageBox::NoButton);
32.1708 mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
32.1709 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
32.1710 switch( mb.exec() )
32.1711 @@ -1045,7 +1619,7 @@
32.1712 break;
32.1713 case QMessageBox::Cancel:
32.1714 // do nothing
32.1715 - return;
32.1716 + return aborted;
32.1717 break;
32.1718 }
32.1719 }
32.1720 @@ -1074,13 +1648,12 @@
32.1721 // from command line
32.1722 if (!QFile(fn).exists() )
32.1723 {
32.1724 - QMessageBox mb( "VYM",
32.1725 - tr("The map") + fn +
32.1726 - tr(" does not exist.\n Do you want to create a new one?"),
32.1727 + QMessageBox mb( __VYM,
32.1728 + tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
32.1729 QMessageBox::Question,
32.1730 QMessageBox::Yes ,
32.1731 QMessageBox::Cancel | QMessageBox::Default,
32.1732 - QMessageBox::QMessageBox::NoButton );
32.1733 + QMessageBox::NoButton );
32.1734
32.1735 mb.setButtonText( QMessageBox::Yes, tr("Create"));
32.1736 mb.setButtonText( QMessageBox::No, tr("Cancel"));
32.1737 @@ -1092,13 +1665,13 @@
32.1738 tabWidget->setTabLabel (currentMapEditor(),
32.1739 currentMapEditor()->getFileName() );
32.1740 statusBar()->message( "Created " + fn , statusbarTime );
32.1741 - return;
32.1742 + return success;
32.1743
32.1744 case QMessageBox::Cancel:
32.1745 // don't create new map
32.1746 statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
32.1747 fileCloseMap();
32.1748 - return;
32.1749 + return aborted;
32.1750 }
32.1751 }
32.1752
32.1753 @@ -1112,130 +1685,101 @@
32.1754 QString tmpMapDir=mkdtemp(tmpdir1);
32.1755
32.1756 // Try to unzip file
32.1757 - Process *zipProc=new Process ();
32.1758 - zipProc->clearArguments();
32.1759 - zipProc->setWorkingDirectory (QDir(tmpMapDir));
32.1760 - zipProc->addArgument ("unzip");
32.1761 - zipProc->addArgument (fn );
32.1762 - zipProc->addArgument ("-d");
32.1763 - zipProc->addArgument (tmpMapDir);
32.1764 -
32.1765 - if (!zipProc->start() )
32.1766 + err=unzipDir (tmpMapDir,fn);
32.1767 + if (err==nozip)
32.1768 {
32.1769 - QMessageBox::critical( 0, tr( "Critical Load Error" ),
32.1770 - tr("Couldn't start unzip to decompress data."));
32.1771 - err=aborted;
32.1772 -
32.1773 + mapfile=fn;
32.1774 + me->setZipped(false);
32.1775 } else
32.1776 {
32.1777 - zipProc->waitFinished();
32.1778 - if (!zipProc->normalExit() )
32.1779 + me->setZipped(true);
32.1780 +
32.1781 + // Look for mapname.xml
32.1782 + mapfile= fn.left(fn.findRev(".",-1,true));
32.1783 + mapfile=mapfile.section( '/', -1 );
32.1784 + QFile file( tmpMapDir + "/" + mapfile + ".xml");
32.1785 + if (!file.exists() )
32.1786 {
32.1787 - QMessageBox::critical( 0, tr( "Critical Load Error" ),
32.1788 - tr("unzip didn't exit normally") +
32.1789 - zipProc->getErrout() );
32.1790 - err=aborted;
32.1791 - } else
32.1792 - {
32.1793 - if (zipProc->exitStatus()>0)
32.1794 + // mapname.xml does not exist, well,
32.1795 + // maybe some renamed the mapname.vym file...
32.1796 + // Try to find any .xml in the toplevel
32.1797 + // directory of the .vym file
32.1798 + QStringList flist=QDir (tmpMapDir).entryList("*.xml");
32.1799 + if (flist.count()==1)
32.1800 {
32.1801 - if (zipProc->exitStatus()==9)
32.1802 - {
32.1803 - // no zipped file, but maybe .xml or old version? Try again.
32.1804 - mapfile=fn;
32.1805 - me->setZipped(false);
32.1806 - }
32.1807 - else
32.1808 - {
32.1809 - QMessageBox::critical( 0, tr( "Critical Load Error" ),
32.1810 - QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
32.1811 - zipProc->getErrout() );
32.1812 - err=aborted;
32.1813 - }
32.1814 + // Only one entry, take this one
32.1815 + mapfile=tmpMapDir + "/"+flist.first();
32.1816 } else
32.1817 - { // Uncompressing was successfull,
32.1818 - // load from uncompressed temporary directory
32.1819 -
32.1820 - me->setZipped(true);
32.1821 -
32.1822 + {
32.1823 + for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
32.1824 + *it=tmpMapDir + "/" + *it;
32.1825 + // TODO Multiple entries, load all (but only the first one into this ME)
32.1826 + //mainWindow->fileLoadFromTmp (flist);
32.1827 + //returnCode=1; // Silently forget this attempt to load
32.1828 + qWarning ("MainWindow::load (fn) multimap found...");
32.1829 + }
32.1830
32.1831 - // Look for mapname.xml
32.1832 - mapfile= fn.left(fn.findRev(".",-1,true));
32.1833 - mapfile=mapfile.section( '/', -1 );
32.1834 - QFile file( tmpMapDir + "/" + mapfile + ".xml");
32.1835 - if (!file.exists() )
32.1836 - {
32.1837 - // mapname.xml does not exist, well,
32.1838 - // maybe some renamed the mapname.vym file...
32.1839 - // Try to find any .xml in the toplevel
32.1840 - // directory of the .vym file
32.1841 - QStringList flist=QDir (tmpMapDir).entryList("*.xml");
32.1842 - if (flist.count()==1)
32.1843 - {
32.1844 - // Only one entry, take this one
32.1845 - mapfile=tmpMapDir + "/"+flist.first();
32.1846 - } else
32.1847 - {
32.1848 - for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
32.1849 - *it=tmpMapDir + "/" + *it;
32.1850 - // FIXME
32.1851 - // Multiple entries, load all (but only the first one into this ME)
32.1852 - //mainWindow->fileLoadFromTmp (flist);
32.1853 - //returnCode=1; // Silently forget this attempt to load
32.1854 - qWarning ("MainWindow::load (fn) multimap found...");
32.1855 - }
32.1856 -
32.1857 - if (flist.isEmpty() )
32.1858 - {
32.1859 - QMessageBox::critical( 0, tr( "Critical Load Error" ),
32.1860 - tr("Couldn't find a map (*.xml) in .vym archive.\n"));
32.1861 - err=aborted;
32.1862 - }
32.1863 - } //file doesn't exist
32.1864 - else
32.1865 - mapfile=file.name();
32.1866 - } // Uncompressing successfull
32.1867 - }
32.1868 + if (flist.isEmpty() )
32.1869 + {
32.1870 + QMessageBox::critical( 0, tr( "Critical Load Error" ),
32.1871 + tr("Couldn't find a map (*.xml) in .vym archive.\n"));
32.1872 + err=aborted;
32.1873 + }
32.1874 + } //file doesn't exist
32.1875 + else
32.1876 + mapfile=file.name();
32.1877 }
32.1878
32.1879 - // Finally load map into mapEditor
32.1880 - me->setFilePath (mapfile,fn);
32.1881 - if (me->load(mapfile,lmode))
32.1882 - err=aborted;
32.1883 + if (err!=aborted)
32.1884 + {
32.1885 + // Save existing filename in case we import
32.1886 + QString fn_org=me->getFilePath();
32.1887
32.1888 - // Delete tmpDir
32.1889 - system ( "rm -rf "+tmpMapDir);
32.1890 + // Finally load map into mapEditor
32.1891 + me->setFilePath (mapfile,fn);
32.1892 + err=me->load(mapfile,lmode);
32.1893
32.1894 - // Check for errors
32.1895 - if (err==success)
32.1896 + // Restore old (maybe empty) filepath, if this is an import
32.1897 + if (lmode!=NewMap)
32.1898 + me->setFilePath (fn_org);
32.1899 + }
32.1900 +
32.1901 + // Finally check for errors and go home
32.1902 + if (err==aborted)
32.1903 + {
32.1904 + if (lmode==NewMap) fileCloseMap();
32.1905 + statusBar()->message( "Could not load " + fn, statusbarTime );
32.1906 + } else
32.1907 {
32.1908 if (lmode==NewMap)
32.1909 {
32.1910 me->setFilePath (fn);
32.1911 tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
32.1912 - lastMaps.prepend(me->getFilePath() );
32.1913 - setupLastMapsMenu();
32.1914 + if (fn.left(9)!="/tmp/vym-")
32.1915 + {
32.1916 + // Only append to lastMaps if not loaded from a tmpDir
32.1917 + // e.g. imported bookmarks are in a tmpDir
32.1918 + lastMaps.prepend(me->getFilePath() );
32.1919 + setupLastMapsMenu();
32.1920 + }
32.1921 actionFilePrint->setEnabled (true);
32.1922 }
32.1923 statusBar()->message( "Loaded " + fn, statusbarTime );
32.1924 - return;
32.1925 - } else
32.1926 - {
32.1927 - if (lmode==NewMap)
32.1928 - fileCloseMap();
32.1929 }
32.1930
32.1931 -
32.1932 + // Delete tmpDir
32.1933 + removeDir (QDir(tmpMapDir));
32.1934 }
32.1935 - statusBar()->message( "Could not load " + fn, statusbarTime );
32.1936 + return err;
32.1937 }
32.1938
32.1939
32.1940 void Main::fileLoad(const LoadMode &lmode)
32.1941 {
32.1942 - QFileDialog *fd=new QFileDialog( this);
32.1943 + Q3FileDialog *fd=new Q3FileDialog( this);
32.1944 if (!lastFileDir.isEmpty())
32.1945 fd->setDir (lastFileDir);
32.1946 + fd->setMode (Q3FileDialog::ExistingFiles);
32.1947 fd->addFilter ("XML (*.xml)");
32.1948 fd->addFilter ("VYM map (*.vym *.vyp)");
32.1949 switch (lmode)
32.1950 @@ -1256,9 +1800,16 @@
32.1951 if ( fd->exec() == QDialog::Accepted )
32.1952 {
32.1953 lastFileDir=fd->dirPath();
32.1954 - fn = fd->selectedFile();
32.1955 - fileLoad(fn, lmode);
32.1956 + QStringList flist = fd->selectedFiles();
32.1957 + QStringList::Iterator it = flist.begin();
32.1958 + while( it != flist.end() )
32.1959 + {
32.1960 + fn = *it;
32.1961 + fileLoad(*it, lmode);
32.1962 + ++it;
32.1963 + }
32.1964 }
32.1965 + delete (fd);
32.1966 }
32.1967
32.1968 void Main::fileLoad()
32.1969 @@ -1268,7 +1819,7 @@
32.1970
32.1971 void Main::fileLoadLast(int i)
32.1972 {
32.1973 - fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);
32.1974 + fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);
32.1975 }
32.1976
32.1977 void Main::fileSave(const SaveMode &savemode)
32.1978 @@ -1277,16 +1828,16 @@
32.1979 QString tmpMapDir;
32.1980
32.1981 // Error codes
32.1982 - enum errorCode {success,aborted};
32.1983 - errorCode err=success;
32.1984 + ErrorCode err=success;
32.1985
32.1986 QString safeFilePath;
32.1987
32.1988 bool saveZipped=currentMapEditor()->saveZipped();
32.1989
32.1990 - if (currentMapEditor())
32.1991 + MapEditor * me=currentMapEditor();
32.1992 + if (me)
32.1993 {
32.1994 - QString fn=currentMapEditor()->getFilePath();
32.1995 + QString fn=me->getFilePath();
32.1996 // filename=unnamed, filepath="" in constructor...
32.1997 if ( !fn.isEmpty() )
32.1998 {
32.1999 @@ -1302,12 +1853,11 @@
32.2000 // Look, if we should zip the data:
32.2001 if (!saveZipped)
32.2002 {
32.2003 - QMessageBox mb( "VYM",
32.2004 - tr("The map ") + fn +
32.2005 - tr ("\ndid not use the compressed "
32.2006 + QMessageBox mb( __VYM,
32.2007 + tr("The map %1\ndid not use the compressed "
32.2008 "vym file format.\nWriting it uncompressed will also write images \n"
32.2009 "and flags and thus may overwrite files in the "
32.2010 - "given directory\n\nDo you want to write the map"),
32.2011 + "given directory\n\nDo you want to write the map").arg(fn),
32.2012 QMessageBox::Warning,
32.2013 QMessageBox::Yes | QMessageBox::Default,
32.2014 QMessageBox::No ,
32.2015 @@ -1337,57 +1887,22 @@
32.2016 char tmpdir1[]="/tmp/vym-XXXXXX";
32.2017 tmpMapDir=mkdtemp(tmpdir1);
32.2018
32.2019 - safeFilePath=currentMapEditor()->getFilePath();
32.2020 - currentMapEditor()->setFilePath (tmpMapDir+"/"+
32.2021 - currentMapEditor()->getMapName()+ ".xml",
32.2022 + safeFilePath=me->getFilePath();
32.2023 + me->setFilePath (tmpMapDir+"/"+
32.2024 + me->getMapName()+ ".xml",
32.2025 safeFilePath);
32.2026 - currentMapEditor()->save (savemode);
32.2027 - currentMapEditor()->setFilePath (safeFilePath);
32.2028 + me->save (savemode);
32.2029 + me->setFilePath (safeFilePath);
32.2030
32.2031 - // zip the temporary directory
32.2032 - Process *zipProc=new Process ();
32.2033 - zipProc->clearArguments();
32.2034 - zipProc->setWorkingDirectory (QDir(tmpMapDir));
32.2035 - zipProc->addArgument ("zip");
32.2036 - zipProc->addArgument ("-r");
32.2037 - zipProc->addArgument (fn);
32.2038 - zipProc->addArgument (".");
32.2039 -
32.2040 - if (!zipProc->start() )
32.2041 - {
32.2042 - // zip could not be started
32.2043 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
32.2044 - tr("Couldn't start zip to compress data."));
32.2045 - err=aborted;
32.2046 - } else
32.2047 - {
32.2048 - // zip could be started
32.2049 - zipProc->waitFinished();
32.2050 - if (!zipProc->normalExit() )
32.2051 - {
32.2052 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
32.2053 - tr("zip didn't exit normally")+
32.2054 - "\n" + zipProc->getErrout());
32.2055 - err=aborted;
32.2056 - } else
32.2057 - {
32.2058 - if (zipProc->exitStatus()>0)
32.2059 - {
32.2060 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
32.2061 - QString("zip exit code: %1").arg(zipProc->exitStatus() )+
32.2062 - "\n" + zipProc->getErrout() );
32.2063 - err=aborted;
32.2064 - }
32.2065 - }
32.2066 - } // zip could be started
32.2067 + zipDir (tmpMapDir,fn);
32.2068 } // save zipped
32.2069 else
32.2070 {
32.2071 // Save unzipped.
32.2072 - safeFilePath=currentMapEditor()->getFilePath();
32.2073 - currentMapEditor()->setFilePath (fn, safeFilePath);
32.2074 - currentMapEditor()->save (savemode);
32.2075 - currentMapEditor()->setFilePath (safeFilePath);
32.2076 + safeFilePath=me->getFilePath();
32.2077 + me->setFilePath (fn, safeFilePath);
32.2078 + me->save (savemode);
32.2079 + me->setFilePath (safeFilePath);
32.2080 } // save zipped
32.2081 } // filepath available
32.2082 else
32.2083 @@ -1399,19 +1914,20 @@
32.2084 }
32.2085 }
32.2086
32.2087 - if (currentMapEditor()->saveZipped())
32.2088 - {
32.2089 + if (saveZipped && !tmpMapDir.isEmpty())
32.2090 // Delete tmpDir
32.2091 - system ( "rm -rf "+ tmpMapDir );
32.2092 - }
32.2093 + removeDir (QDir(tmpMapDir));
32.2094
32.2095 if (err==success)
32.2096 + {
32.2097 statusBar()->message(
32.2098 - tr("Saved")+" " + currentMapEditor()->getFilePath(),
32.2099 + tr("Saved %1").arg(me->getFilePath()),
32.2100 statusbarTime );
32.2101 - else
32.2102 + lastMaps.prepend(me->getFilePath() );
32.2103 + setupLastMapsMenu();
32.2104 + } else
32.2105 statusBar()->message(
32.2106 - tr("Couldn't save")+" " + currentMapEditor()->getFilePath(),
32.2107 + tr("Couldn't save ").arg(me->getFilePath()),
32.2108 statusbarTime );
32.2109 }
32.2110
32.2111 @@ -1422,26 +1938,25 @@
32.2112
32.2113 void Main::fileSaveAs(const SaveMode& savemode)
32.2114 {
32.2115 - QString tmpMapDir;
32.2116 QString fn;
32.2117
32.2118 if (currentMapEditor())
32.2119 {
32.2120 if (savemode==CompleteMap)
32.2121 - fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
32.2122 + fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
32.2123 else
32.2124 - fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
32.2125 + fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
32.2126 if ( !fn.isEmpty() )
32.2127 {
32.2128 // Check for existing file
32.2129 if (QFile (fn).exists())
32.2130 {
32.2131 - QMessageBox mb( "VYM",
32.2132 - tr("The file ") + fn + tr ("\nexists already. Do you want to"),
32.2133 + QMessageBox mb( __VYM,
32.2134 + tr("The file %1\nexists already. Do you want to").arg(fn),
32.2135 QMessageBox::Warning,
32.2136 QMessageBox::Yes | QMessageBox::Default,
32.2137 QMessageBox::Cancel | QMessageBox::Escape,
32.2138 - QMessageBox::QMessageBox::NoButton);
32.2139 + QMessageBox::NoButton);
32.2140 mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
32.2141 mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
32.2142 switch( mb.exec() )
32.2143 @@ -1477,8 +1992,9 @@
32.2144 fileSave(savemode);
32.2145
32.2146 // Set name of tab
32.2147 - tabWidget->setTabLabel (currentMapEditor(),
32.2148 - currentMapEditor()->getFileName() );
32.2149 + if (savemode==CompleteMap)
32.2150 + tabWidget->setTabLabel (currentMapEditor(),
32.2151 + currentMapEditor()->getFileName() );
32.2152 return;
32.2153 }
32.2154 }
32.2155 @@ -1489,6 +2005,73 @@
32.2156 fileSaveAs (CompleteMap);
32.2157 }
32.2158
32.2159 +void Main::fileImportKDEBookmarks()
32.2160 +{
32.2161 + ImportKDEBookmarks im;
32.2162 + im.transform();
32.2163 + if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
32.2164 + currentMapEditor()->setFilePath ("");
32.2165 +}
32.2166 +
32.2167 +void Main::fileImportFirefoxBookmarks()
32.2168 +{
32.2169 + Q3FileDialog *fd=new Q3FileDialog( this);
32.2170 + fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
32.2171 + fd->setMode (Q3FileDialog::ExistingFiles);
32.2172 + fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
32.2173 + fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
32.2174 + fd->show();
32.2175 +
32.2176 + if ( fd->exec() == QDialog::Accepted )
32.2177 + {
32.2178 + ImportFirefoxBookmarks im;
32.2179 + QStringList flist = fd->selectedFiles();
32.2180 + QStringList::Iterator it = flist.begin();
32.2181 + while( it != flist.end() )
32.2182 + {
32.2183 + im.setFile (*it);
32.2184 + if (im.transform() &&
32.2185 + success==fileLoad (im.getTransformedFile(),NewMap) &&
32.2186 + currentMapEditor() )
32.2187 + currentMapEditor()->setFilePath ("");
32.2188 + ++it;
32.2189 + }
32.2190 + }
32.2191 + delete (fd);
32.2192 +}
32.2193 +
32.2194 +void Main::fileImportMM()
32.2195 +{
32.2196 + ImportMM im;
32.2197 +
32.2198 + Q3FileDialog *fd=new Q3FileDialog( this);
32.2199 + if (!lastFileDir.isEmpty())
32.2200 + fd->setDir (lastFileDir);
32.2201 + fd->setMode (Q3FileDialog::ExistingFiles);
32.2202 + fd->addFilter ("Mind Manager (*.mmap)");
32.2203 + fd->setCaption(tr("Import")+" "+"Mind Manager");
32.2204 + fd->show();
32.2205 +
32.2206 + if ( fd->exec() == QDialog::Accepted )
32.2207 + {
32.2208 + lastFileDir=fd->dirPath();
32.2209 + QStringList flist = fd->selectedFiles();
32.2210 + QStringList::Iterator it = flist.begin();
32.2211 + while( it != flist.end() )
32.2212 + {
32.2213 + im.setFile (*it);
32.2214 + if (im.transform() &&
32.2215 + success==fileLoad (im.getTransformedFile(),NewMap) &&
32.2216 + currentMapEditor() )
32.2217 + currentMapEditor()->setFilePath ("");
32.2218 +
32.2219 + ++it;
32.2220 + }
32.2221 + }
32.2222 + delete (fd);
32.2223 +
32.2224 +}
32.2225 +
32.2226 void Main::fileImportDir()
32.2227 {
32.2228 if (currentMapEditor())
32.2229 @@ -1505,32 +2088,16 @@
32.2230 }
32.2231 }
32.2232
32.2233 -void Main::fileExportHTML()
32.2234 -{
32.2235 - if (currentMapEditor())
32.2236 - {
32.2237 - ExportHTMLDialog dia(this);
32.2238 -
32.2239 - if (dia.exec()==QDialog::Accepted)
32.2240 - {
32.2241 - QString dir=dia.getDir();
32.2242 - if (reallyWriteDirectory(dir) )
32.2243 - {
32.2244 - currentMapEditor()->exportXML (dia.getDir() );
32.2245 - dia.doExport(currentMapEditor()->getMapName() );
32.2246 - }
32.2247 - }
32.2248 - }
32.2249 -}
32.2250
32.2251 void Main::fileExportXHTML()
32.2252 {
32.2253 + MapEditor *me=currentMapEditor();
32.2254 QString dir;
32.2255 - if (currentMapEditor())
32.2256 + if (me)
32.2257 {
32.2258 ExportXHTMLDialog dia(this);
32.2259 - dia.setFilePath (currentMapEditor()->getFilePath() );
32.2260 - dia.setMapName (currentMapEditor()->getMapName() );
32.2261 + dia.setFilePath (me->getFilePath() );
32.2262 + dia.setMapName (me->getMapName() );
32.2263 dia.readSettings();
32.2264
32.2265 if (dia.exec()==QDialog::Accepted)
32.2266 @@ -1546,10 +2113,10 @@
32.2267
32.2268 if (ok)
32.2269 {
32.2270 - currentMapEditor()->exportXML (dia.getDir() );
32.2271 - dia.doExport(currentMapEditor()->getMapName() );
32.2272 + me->exportXML (dia.getDir() );
32.2273 + dia.doExport(me->getMapName() );
32.2274 if (dia.hasChanged())
32.2275 - currentMapEditor()->setChanged();
32.2276 + me->setChanged();
32.2277 }
32.2278 }
32.2279 }
32.2280 @@ -1557,23 +2124,103 @@
32.2281
32.2282 void Main::fileExportImage(int item)
32.2283 {
32.2284 - if (currentMapEditor())
32.2285 + MapEditor *me=currentMapEditor();
32.2286 + if (me)
32.2287 {
32.2288 - QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
32.2289 + QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
32.2290 this );
32.2291 if ( !fn.isEmpty() )
32.2292 - {
32.2293 - currentMapEditor()->exportImage(fn,item);
32.2294 - } else {
32.2295 - statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
32.2296 - }
32.2297 + me->exportImage(fn,item);
32.2298 + else
32.2299 + statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
32.2300 +
32.2301 }
32.2302 }
32.2303
32.2304 void Main::fileExportASCII()
32.2305 {
32.2306 - if (currentMapEditor())
32.2307 - currentMapEditor()->exportASCII();
32.2308 + MapEditor *me=currentMapEditor();
32.2309 + if (me)
32.2310 + {
32.2311 + ExportASCII ex;
32.2312 + ex.setMapCenter(me->getMapCenter());
32.2313 + ex.addFilter ("TXT (*.txt)");
32.2314 + ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
32.2315 + if (ex.execDialog() )
32.2316 + {
32.2317 + me->setExportMode(true);
32.2318 + ex.doExport();
32.2319 + me->setExportMode(false);
32.2320 + }
32.2321 + }
32.2322 +}
32.2323 +
32.2324 +void Main::fileExportLaTeX()
32.2325 +{
32.2326 + MapEditor *me=currentMapEditor();
32.2327 + if (me)
32.2328 + {
32.2329 + ExportLaTeX ex;
32.2330 + ex.setMapCenter(me->getMapCenter());
32.2331 + ex.addFilter ("Tex (*.tex)");
32.2332 + ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
32.2333 + if (ex.execDialog() )
32.2334 + {
32.2335 + me->setExportMode(true);
32.2336 + ex.doExport();
32.2337 + me->setExportMode(false);
32.2338 + }
32.2339 + }
32.2340 +}
32.2341 +
32.2342 +void Main::fileExportKDEBookmarks()
32.2343 +{
32.2344 + ExportKDEBookmarks ex;
32.2345 + MapEditor *me=currentMapEditor();
32.2346 + if (me)
32.2347 + {
32.2348 + ex.setMapCenter (me->getMapCenter() );
32.2349 + ex.doExport();
32.2350 + }
32.2351 +}
32.2352 +
32.2353 +void Main::fileExportTaskjuggler()
32.2354 +{
32.2355 + ExportTaskjuggler ex;
32.2356 + MapEditor *me=currentMapEditor();
32.2357 + if (me)
32.2358 + {
32.2359 + ex.setMapCenter (me->getMapCenter() );
32.2360 + ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
32.2361 + ex.addFilter ("Taskjuggler (*.tjp)");
32.2362 + if (ex.execDialog() )
32.2363 + {
32.2364 + me->setExportMode(true);
32.2365 + ex.doExport();
32.2366 + me->setExportMode(false);
32.2367 + }
32.2368 + }
32.2369 +}
32.2370 +
32.2371 +void Main::fileExportOOPresentation()
32.2372 +{
32.2373 + ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
32.2374 + // FIXME add extra info in dialog
32.2375 + //ImagePreview *p =new ImagePreview (fd);
32.2376 + //fd->setContentsPreviewEnabled( TRUE );
32.2377 + //fd->setContentsPreview( p, p );
32.2378 + //fd->setPreviewMode( QFileDialog::Contents );
32.2379 + fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
32.2380 + //fd->setDir (lastImageDir);
32.2381 + fd->show();
32.2382 +
32.2383 + if ( fd->exec() == QDialog::Accepted )
32.2384 + {
32.2385 + QString fn=fd->selectedFile();
32.2386 + //lastImageDir=fn.left(fn.findRev ("/"));
32.2387 + if (currentMapEditor())
32.2388 + currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());
32.2389 + }
32.2390 }
32.2391
32.2392 void Main::fileCloseMap()
32.2393 @@ -1582,9 +2229,8 @@
32.2394 {
32.2395 if (currentMapEditor()->hasChanged())
32.2396 {
32.2397 - QMessageBox mb( "VYM",
32.2398 - tr("The map ") + currentMapEditor()->getFileName() +
32.2399 - tr(" has been modified but not saved yet. Do you want to"),
32.2400 + QMessageBox mb( __VYM,
32.2401 + tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
32.2402 QMessageBox::Warning,
32.2403 QMessageBox::Yes | QMessageBox::Default,
32.2404 QMessageBox::No,
32.2405 @@ -1632,7 +2278,7 @@
32.2406 if (me->isUnsaved())
32.2407 {
32.2408 tabWidget->setCurrentPage(i);
32.2409 - QMessageBox mb( "VYM",
32.2410 + QMessageBox mb( __VYM,
32.2411 tr("This map is not saved yet. Do you want to"),
32.2412 QMessageBox::Warning,
32.2413 QMessageBox::Yes | QMessageBox::Default,
32.2414 @@ -1641,12 +2287,6 @@
32.2415 mb.setButtonText( QMessageBox::Yes, tr("Save map") );
32.2416 mb.setButtonText( QMessageBox::No, tr("Discard changes") );
32.2417 mb.show();
32.2418 - // Call undocumented function: setActiveWindow is only
32.2419 - // possible, if widget is visible. This depends on
32.2420 - // windowmanager...
32.2421 -#if defined(Q_OS_LINUX)
32.2422 - qt_wait_for_window_manager( this);
32.2423 -#endif
32.2424 mb.setActiveWindow();
32.2425 switch( mb.exec() ) {
32.2426 case QMessageBox::Yes:
32.2427 @@ -1671,8 +2311,10 @@
32.2428 currentMapEditor()->undo();
32.2429 }
32.2430
32.2431 -void Main::editRedo() // TODO
32.2432 +void Main::editRedo()
32.2433 {
32.2434 + if (currentMapEditor())
32.2435 + currentMapEditor()->redo();
32.2436 }
32.2437
32.2438 void Main::editCopy()
32.2439 @@ -1697,13 +2339,6 @@
32.2440 {
32.2441 findWindow->popup();
32.2442 findWindow->raise();
32.2443 -
32.2444 - // Call undocumented function: setActiveWindow is only
32.2445 - // possible, if widget is visible. This depends on
32.2446 - // windowmanager...
32.2447 -#if defined(Q_OS_LINUX)
32.2448 - qt_wait_for_window_manager( this);
32.2449 -#endif
32.2450 findWindow->setActiveWindow();
32.2451 }
32.2452
32.2453 @@ -1717,8 +2352,7 @@
32.2454 } else
32.2455 {
32.2456 QMessageBox::information( findWindow, tr( "VYM -Information:" ),
32.2457 - tr("No matches found for ")+
32.2458 - "'<b>"+s+"</b>'");
32.2459 + tr("No matches found for \"%1\"").arg(s));
32.2460 }
32.2461 }
32.2462
32.2463 @@ -1729,8 +2363,70 @@
32.2464
32.2465 void Main::editOpenURL()
32.2466 {
32.2467 + // Open new browser
32.2468 if (currentMapEditor())
32.2469 - currentMapEditor()->openURL();
32.2470 + {
32.2471 + QString url=currentMapEditor()->getURL();
32.2472 + if (url=="") return;
32.2473 + QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
32.2474 + procBrowser = new Q3Process( this );
32.2475 +
32.2476 + procBrowser->addArgument( browser);
32.2477 + procBrowser->addArgument( url);
32.2478 +
32.2479 + if ( !procBrowser->start() )
32.2480 + {
32.2481 + // try to set path to browser
32.2482 + QMessageBox::warning(0,
32.2483 + tr("Warning"),
32.2484 + tr("Couldn't find a viewer to open %1.\n").arg(url)+
32.2485 + tr("Please use Settings->")+tr("Set application to open an URL"));
32.2486 + settingsURL() ;
32.2487 + }
32.2488 + }
32.2489 +}
32.2490 +void Main::editOpenURLTab()
32.2491 +{
32.2492 + if (currentMapEditor())
32.2493 + {
32.2494 + QString url=currentMapEditor()->getURL();
32.2495 + if (url=="") return;
32.2496 + QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
32.2497 + if (procBrowser && procBrowser->isRunning())
32.2498 + {
32.2499 + if (browser.contains("konqueror"))
32.2500 + {
32.2501 + // Try to open new tab in existing konqueror started previously by vym
32.2502 + Q3Process *p=new Q3Process (this);
32.2503 + p->addArgument ("dcop");
32.2504 + p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
32.2505 + p->addArgument ("konqueror-mainwindow#1");
32.2506 + p->addArgument ("newTab");
32.2507 + p->addArgument (url);
32.2508 + if ( !p->start() )
32.2509 + // try to set browser
32.2510 + QMessageBox::warning(0,
32.2511 + tr("Warning"),
32.2512 + tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
32.2513 + return;
32.2514 + } else if (browser.contains ("firefox") || browser.contains ("mozilla") )
32.2515 + {
32.2516 + // Try to open new tab in firefox
32.2517 + Q3Process *p=new Q3Process (this);
32.2518 + p->addArgument (browser);
32.2519 + p->addArgument ("-remote");
32.2520 + p->addArgument (QString("openurl(%1,new-tab)").arg(url));
32.2521 + if ( !p->start() )
32.2522 + // try to set browser
32.2523 + QMessageBox::warning(0,
32.2524 + tr("Warning"),
32.2525 + tr("Couldn't start %1 to open a new tab").arg(browser));
32.2526 + return;
32.2527 + }
32.2528 + }
32.2529 + // Open new browser
32.2530 + editOpenURL();
32.2531 + }
32.2532 }
32.2533
32.2534 void Main::editURL()
32.2535 @@ -1751,6 +2447,12 @@
32.2536 currentMapEditor()->editBugzilla2URL();
32.2537 }
32.2538
32.2539 +void Main::editFATE2URL()
32.2540 +{
32.2541 + if (currentMapEditor())
32.2542 + currentMapEditor()->editFATE2URL();
32.2543 +}
32.2544 +
32.2545 void Main::editOpenVymLink()
32.2546 {
32.2547 // Get current path to map
32.2548 @@ -1776,7 +2478,7 @@
32.2549 {
32.2550 if (!QFile(currentVymLink).exists() )
32.2551 QMessageBox::critical( 0, tr( "Critical Error" ),
32.2552 - tr("Couldn't open map " +currentVymLink)+".");
32.2553 + tr("Couldn't open map %1").arg(currentVymLink));
32.2554 else
32.2555 {
32.2556 fileLoad (currentVymLink, NewMap);
32.2557 @@ -1800,6 +2502,12 @@
32.2558 currentMapEditor()->deleteVymLink();
32.2559 }
32.2560
32.2561 +void Main::editToggleHideExport()
32.2562 +{
32.2563 + if (currentMapEditor())
32.2564 + currentMapEditor()->toggleHideExport();
32.2565 +}
32.2566 +
32.2567 void Main::editMapInfo()
32.2568 {
32.2569 if (currentMapEditor())
32.2570 @@ -1846,6 +2554,12 @@
32.2571 currentMapEditor()->addNewBranch(0);
32.2572 }
32.2573
32.2574 +void Main::editNewBranchHere()
32.2575 +{
32.2576 + if (currentMapEditor())
32.2577 + currentMapEditor()->addNewBranchHere();
32.2578 +}
32.2579 +
32.2580 void Main::editNewBranchAbove()
32.2581 {
32.2582 if (currentMapEditor())
32.2583 @@ -1873,9 +2587,21 @@
32.2584 fileSaveAs (PartOfMap);
32.2585 }
32.2586
32.2587 +void Main::editRemoveBranchKeepChilds()
32.2588 +{
32.2589 + if (currentMapEditor())
32.2590 + currentMapEditor()->removeBranchKeepChilds();
32.2591 +}
32.2592 +
32.2593 +void Main::editRemoveChilds()
32.2594 +{
32.2595 + if (currentMapEditor())
32.2596 + currentMapEditor()->removeChilds();
32.2597 +}
32.2598 +
32.2599 void Main::editDeleteSelection()
32.2600 {
32.2601 - if (currentMapEditor())
32.2602 + if (currentMapEditor() && actionSettingsUseDelKey->isOn())
32.2603 currentMapEditor()->deleteSelection();
32.2604 }
32.2605
32.2606 @@ -1927,10 +2653,16 @@
32.2607 currentMapEditor()->saveFloatImage(item);
32.2608 }
32.2609
32.2610 -void Main::editToggleFloatExport()
32.2611 +void Main::editFollowXLink(int item)
32.2612 {
32.2613 if (currentMapEditor())
32.2614 - currentMapEditor()->toggleFloatExport();
32.2615 + currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
32.2616 +}
32.2617 +
32.2618 +void Main::editEditXLink(int item)
32.2619 +{
32.2620 + if (currentMapEditor())
32.2621 + currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
32.2622 }
32.2623
32.2624 void Main::formatSelectColor()
32.2625 @@ -2022,11 +2754,29 @@
32.2626 currentMapEditor()->setFrame(Rectangle);
32.2627 }
32.2628
32.2629 +void Main::formatIncludeImagesVer()
32.2630 +{
32.2631 + if (currentMapEditor())
32.2632 + currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
32.2633 +}
32.2634 +
32.2635 +void Main::formatIncludeImagesHor()
32.2636 +{
32.2637 + if (currentMapEditor())
32.2638 + currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
32.2639 +}
32.2640 +
32.2641 +void Main::formatHideLinkUnselected()
32.2642 +{
32.2643 + if (currentMapEditor())
32.2644 + currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
32.2645 +}
32.2646 +
32.2647 void Main::viewZoomReset()
32.2648 {
32.2649 if (currentMapEditor())
32.2650 {
32.2651 - QWMatrix m;
32.2652 + QMatrix m;
32.2653 m.reset();
32.2654 currentMapEditor()->setWorldMatrix( m );
32.2655 currentMapEditor()->setViewCenter();
32.2656 @@ -2038,7 +2788,7 @@
32.2657 {
32.2658 if (currentMapEditor())
32.2659 {
32.2660 - QWMatrix m = currentMapEditor()->worldMatrix();
32.2661 + QMatrix m = currentMapEditor()->worldMatrix();
32.2662 m.scale( 1.25, 1.25 );
32.2663 currentMapEditor()->setWorldMatrix( m );
32.2664 currentMapEditor()->setViewCenter();
32.2665 @@ -2050,19 +2800,28 @@
32.2666 {
32.2667 if (currentMapEditor())
32.2668 {
32.2669 - QWMatrix m = currentMapEditor()->worldMatrix();
32.2670 + QMatrix m = currentMapEditor()->worldMatrix();
32.2671 m.scale( 0.8, 0.8 );
32.2672 currentMapEditor()->setWorldMatrix( m );
32.2673 currentMapEditor()->setViewCenter();
32.2674 currentMapEditor()->adjustCanvasSize();
32.2675 }
32.2676 }
32.2677 +
32.2678 +void Main::modModeColor()
32.2679 +{
32.2680 +}
32.2681 +
32.2682 +void Main::modModeLink()
32.2683 +{
32.2684 +}
32.2685 +
32.2686 bool Main::settingsPDF()
32.2687 {
32.2688 // Default browser is set in constructor
32.2689 bool ok;
32.2690 QString text = QInputDialog::getText(
32.2691 - "VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
32.2692 + "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
32.2693 settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
32.2694 if (ok)
32.2695 settings.writeEntry ("/vym/mainwindow/readerPDF",text);
32.2696 @@ -2075,7 +2834,7 @@
32.2697 // Default browser is set in constructor
32.2698 bool ok;
32.2699 QString text = QInputDialog::getText(
32.2700 - "VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
32.2701 + "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
32.2702 settings.readEntry("/vym/mainwindow/readerURL")
32.2703 , &ok, this );
32.2704 if (ok)
32.2705 @@ -2083,6 +2842,17 @@
32.2706 return ok;
32.2707 }
32.2708
32.2709 +void Main::settingsToggleDelKey()
32.2710 +{
32.2711 + if (actionSettingsUseDelKey->isOn())
32.2712 + {
32.2713 + actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
32.2714 + } else
32.2715 + {
32.2716 + actionEditDelete->setAccel (QKeySequence (""));
32.2717 + }
32.2718 +}
32.2719 +
32.2720 void Main::windowToggleNoteEditor()
32.2721 {
32.2722 if (textEditor->showWithMain() )
32.2723 @@ -2091,6 +2861,18 @@
32.2724 windowShowNoteEditor();
32.2725 }
32.2726
32.2727 +void Main::windowToggleHistory()
32.2728 +{
32.2729 + if (currentMapEditor())
32.2730 + currentMapEditor()->toggleHistoryWindow();
32.2731 +}
32.2732 +
32.2733 +void Main::updateNoteFlag()
32.2734 +{
32.2735 + if (currentMapEditor())
32.2736 + currentMapEditor()->updateNoteFlag();
32.2737 +}
32.2738 +
32.2739 void Main::windowShowNoteEditor()
32.2740 {
32.2741 textEditor->setShowWithMain(true);
32.2742 @@ -2124,20 +2906,18 @@
32.2743
32.2744 void Main::testFunction()
32.2745 {
32.2746 - //textEditor->stackUnder(this);
32.2747 currentMapEditor()->testFunction();
32.2748 }
32.2749
32.2750 -void Main::testShowClipboard()
32.2751 -{
32.2752 - clipboardME->show();
32.2753 -}
32.2754 -
32.2755 void Main::helpDoc()
32.2756 {
32.2757 QString docpath;
32.2758 - // default path in SUSE LINUX
32.2759 - docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
32.2760 + #if defined(Q_OS_MACX)
32.2761 + docpath="./vym.app/Contents/vym.pdf";
32.2762 + #else
32.2763 + // default path in SUSE LINUX
32.2764 + docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
32.2765 + #endif
32.2766
32.2767 if (!QFile (docpath).exists() )
32.2768 {
32.2769 @@ -2149,11 +2929,16 @@
32.2770 docpath="doc/tex/vym.pdf";
32.2771 if (!QFile (docpath).exists() )
32.2772 {
32.2773 - QMessageBox::critical(0,
32.2774 - tr("Critcal error"),
32.2775 - tr("Couldn't find the documentation\n"
32.2776 - "vym.pdf in various places."));
32.2777 - return;
32.2778 + // Try yet another one for Knoppix
32.2779 + docpath="/usr/share/doc/packages/vym/vym.pdf";
32.2780 + if (!QFile (docpath).exists() )
32.2781 + {
32.2782 + QMessageBox::critical(0,
32.2783 + tr("Critcal error"),
32.2784 + tr("Couldn't find the documentation\n"
32.2785 + "vym.pdf in various places."));
32.2786 + return;
32.2787 + }
32.2788 }
32.2789 }
32.2790 }
32.2791 @@ -2166,10 +2951,11 @@
32.2792 if ( !pdfProc->start() )
32.2793 {
32.2794 // error handling
32.2795 - QMessageBox::critical(0,
32.2796 - tr("Critcal error"),
32.2797 - tr("Couldn't find a viewer to read vym.pdf.\n"
32.2798 - "Please use Settings->")+tr("Set application to open pdf files"));
32.2799 + QMessageBox::warning(0,
32.2800 + tr("Warning"),
32.2801 + tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
32.2802 + tr("Please use Settings->")+tr("Set application to open PDF files"));
32.2803 + settingsPDF();
32.2804 return;
32.2805 }
32.2806 }
32.2807 @@ -2177,33 +2963,11 @@
32.2808
32.2809 void Main::helpAbout()
32.2810 {
32.2811 - static QMessageBox* about = new QMessageBox( "VYM",
32.2812 - "<h3>VYM - View Your Mind </h3>"
32.2813 - "<p> A tool to put the things you have got in your mind into a map.</p>"
32.2814 - "<ul>"
32.2815 - "<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
32.2816 - "<li> vym is released under the GPL (Gnu General Public License)"
32.2817 - ", with one exception (see the file \"LICENSE\"which "
32.2818 - "comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
32.2819 - "<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
32.2820 - "http:/www.InSilmaril.de/vym</a></li>"
32.2821 - "<li> Credits "
32.2822 - "<ul>"
32.2823 - "<li>Thomas Schraitle for the stylesheet used for XHTML-export </li>"
32.2824 - "<li>Clemens Kraus for stylesheets and script used for HTML-export "
32.2825 - "<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
32.2826 - "<li>Alexander Johannesen for providing stylesheets from his xsiteable project "
32.2827 - "<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
32.2828 - "<li>Ken Wimer and Olaf Hering for Mac support</li>"
32.2829 - "</ul>"
32.2830 - "</li>"
32.2831 - "<li> Version " __VYM_VERSION__ "</li>"
32.2832 - "<li> Build date " __BUILD_DATE__"</li>"
32.2833 - "</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
32.2834 - about->setButtonText( 1, "Dismiss" );
32.2835 - about->setMinimumSize(QSize(300,300));
32.2836 - about->setIconPixmap (QPixmap(vym_logo_xpm));
32.2837 - about->show();
32.2838 + AboutDialog ad;
32.2839 + ad.setName ("aboutwindow");
32.2840 + ad.setMinimumSize(500,500);
32.2841 + ad.resize (QSize (500,500));
32.2842 + ad.exec();
32.2843 }
32.2844
32.2845 void Main::helpAboutQT()
33.1 --- a/mainwindow.h Sun Jan 30 12:58:47 2005 +0000
33.2 +++ b/mainwindow.h Tue Jun 06 14:58:11 2006 +0000
33.3 @@ -1,28 +1,33 @@
33.4 #ifndef MAINWINDOW_H
33.5 #define MAINWINDOW_H
33.6
33.7 -#include <qpopupmenu.h>
33.8 -#include <qmainwindow.h>
33.9 -#include <qtextedit.h>
33.10 -#include <qintdict.h>
33.11 -#include <qcanvas.h>
33.12 +#include <q3popupmenu.h>
33.13 +#include <q3mainwindow.h>
33.14 +#include <q3textedit.h>
33.15 +#include <q3intdict.h>
33.16 +#include <q3canvas.h>
33.17 #include <qlineedit.h>
33.18 #include <qaction.h>
33.19 #include <qcursor.h>
33.20 #include <qtabwidget.h>
33.21 #include <qmap.h>
33.22 +//Added by qt3to4:
33.23 +#include <QCloseEvent>
33.24 +#include <QShowEvent>
33.25 +#include <QHideEvent>
33.26
33.27 +#include "file.h"
33.28 +#include "findwindow.h"
33.29 +#include "mapeditor.h"
33.30 +#include "texteditor.h"
33.31 #include "xml.h"
33.32 -#include "texteditor.h"
33.33 -#include "mapeditor.h"
33.34 -#include "findwindow.h"
33.35
33.36 -class Main : public QMainWindow
33.37 +class Main : public Q3MainWindow
33.38 {
33.39 Q_OBJECT
33.40
33.41 public:
33.42 - Main(QWidget* parent=0, const char* name=0, WFlags f=0);
33.43 + Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
33.44 ~Main();
33.45 void loadCmdLine();
33.46 void statusMessage (const QString &);
33.47 @@ -38,6 +43,7 @@
33.48 void setupEditActions();
33.49 void setupFormatActions();
33.50 void setupViewActions();
33.51 + void setupModeActions();
33.52 void setupWindowActions();
33.53 void setupFlagActions();
33.54 void setupSettingsActions();
33.55 @@ -55,7 +61,7 @@
33.56 void newView();
33.57 void editorChanged(QWidget*);
33.58
33.59 - void fileLoad(QString ,const LoadMode &);
33.60 + ErrorCode fileLoad(QString ,const LoadMode &);
33.61 void fileLoad(const LoadMode &);
33.62 void fileLoad();
33.63 void fileLoadLast(int);
33.64 @@ -63,12 +69,18 @@
33.65 void fileSave();
33.66 void fileSaveAs(const SaveMode &);
33.67 void fileSaveAs();
33.68 + void fileImportKDEBookmarks();
33.69 + void fileImportFirefoxBookmarks();
33.70 + void fileImportMM();
33.71 void fileImportDir();
33.72 void fileExportXML();
33.73 - void fileExportHTML();
33.74 void fileExportXHTML();
33.75 void fileExportImage(int);
33.76 void fileExportASCII();
33.77 + void fileExportLaTeX();
33.78 + void fileExportKDEBookmarks();
33.79 + void fileExportTaskjuggler();
33.80 + void fileExportOOPresentation();
33.81 void fileCloseMap();
33.82 void filePrint();
33.83 void fileExitVYM();
33.84 @@ -83,15 +95,18 @@
33.85 void editFindChanged();
33.86 public slots:
33.87 void editOpenURL();
33.88 + void editOpenURLTab();
33.89 private slots:
33.90 void editURL();
33.91 void editHeading2URL();
33.92 void editBugzilla2URL();
33.93 + void editFATE2URL();
33.94 void editVymLink();
33.95 public slots:
33.96 void editOpenVymLink();
33.97 private slots:
33.98 void editDeleteVymLink();
33.99 + void editToggleHideExport();
33.100 void editMapInfo();
33.101 void editMoveUp();
33.102 void editMoveDown();
33.103 @@ -99,11 +114,14 @@
33.104 void editUnScrollAll();
33.105 void editHeading();
33.106 void editNewBranch();
33.107 + void editNewBranchHere();
33.108 void editNewBranchAbove();
33.109 void editNewBranchBelow();
33.110 void editImportAdd();
33.111 void editImportReplace();
33.112 void editSaveBranch();
33.113 + void editRemoveBranchKeepChilds();
33.114 + void editRemoveChilds();
33.115 void editDeleteSelection();
33.116 void editUpperBranch();
33.117 void editLowerBranch();
33.118 @@ -113,7 +131,8 @@
33.119 void editLastBranch();
33.120 void editLoadImage();
33.121 void editSaveImage(int);
33.122 - void editToggleFloatExport();
33.123 + void editFollowXLink (int);
33.124 + void editEditXLink (int);
33.125
33.126 void formatSelectColor();
33.127 void formatPickColor();
33.128 @@ -129,16 +148,26 @@
33.129 void formatToggleLinkColorHint();
33.130 void formatFrameNone();
33.131 void formatFrameRectangle();
33.132 + void formatIncludeImagesVer();
33.133 + void formatIncludeImagesHor();
33.134 + void formatHideLinkUnselected();
33.135
33.136 void viewZoomReset();
33.137 void viewZoomIn();
33.138 void viewZoomOut();
33.139
33.140 + void modModeColor();
33.141 + void modModeLink();
33.142 +
33.143 public slots:
33.144 bool settingsPDF();
33.145 bool settingsURL();
33.146 + void settingsToggleDelKey();
33.147
33.148 void windowToggleNoteEditor();
33.149 + void windowToggleHistory();
33.150 + void updateNoteFlag();
33.151 +
33.152 private slots:
33.153 void windowNextEditor();
33.154 void windowPreviousEditor();
33.155 @@ -148,19 +177,19 @@
33.156 void standardFlagChanged();
33.157
33.158 void testFunction();
33.159 - void testShowClipboard();
33.160
33.161 void helpDoc();
33.162 void helpAbout();
33.163 void helpAboutQT();
33.164
33.165 private:
33.166 - QCanvas* canvas;
33.167 +// not needed? QCanvas* canvas;
33.168 QTabWidget *tabWidget;
33.169 FindWindow *findWindow;
33.170 QStringList lastMaps;
33.171 int maxLastMaps;
33.172 QString lastFileDir;
33.173 + Q3Process *procBrowser;
33.174 };
33.175
33.176
34.1 --- a/mapcenterobj.cpp Sun Jan 30 12:58:47 2005 +0000
34.2 +++ b/mapcenterobj.cpp Tue Jun 06 14:58:11 2006 +0000
34.3 @@ -13,7 +13,7 @@
34.4 init();
34.5 }
34.6
34.7 -MapCenterObj::MapCenterObj(QCanvas* c) : BranchObj (c)
34.8 +MapCenterObj::MapCenterObj(Q3Canvas* c) : BranchObj (c)
34.9 {
34.10 // cout << "Const MapCenterObj canvas="<<c<<"\n";
34.11 init();
34.12 @@ -27,26 +27,18 @@
34.13 void MapCenterObj::clear()
34.14 {
34.15 BranchObj::clear();
34.16 - init();
34.17 }
34.18
34.19 void MapCenterObj::init ()
34.20 {
34.21 + BranchObj::init();
34.22 orientation=OrientUndef;
34.23 - absPos=QPoint (canvas->width()/2, canvas->height()/2);
34.24
34.25 // FIXME this should be done in TextObj later...
34.26 - QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");
34.27 - heading->setFont(font);
34.28 -
34.29 - branch.setAutoDelete (TRUE);
34.30 - floatimage.setAutoDelete (TRUE);
34.31 -
34.32 - move (absPos.x(), absPos.y() );
34.33 + //QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");
34.34 + //heading->setFont(font);
34.35 depth=0;
34.36 -
34.37 - scrolled=false;
34.38 - tmpUnscrolled=false;
34.39 + setDefAttr(MovedBranch);
34.40
34.41 frame->setFrameType (Rectangle);
34.42 }
34.43 @@ -54,13 +46,11 @@
34.44 void MapCenterObj::move (double x, double y)
34.45 {
34.46 BranchObj::move(x,y);
34.47 - positionBBox();
34.48 }
34.49
34.50 void MapCenterObj::moveBy (double x, double y)
34.51 {
34.52 BranchObj::moveBy(x,y);
34.53 - positionBBox();
34.54 }
34.55
34.56 void MapCenterObj::moveAll (double x, double y)
34.57 @@ -77,16 +67,13 @@
34.58 {
34.59 // Move myself
34.60 moveBy(dx,dy);
34.61 -
34.62 - positionBBox();
34.63 }
34.64
34.65 void MapCenterObj::updateLink()
34.66 {
34.67 // set childPos to middle of MapCenterObj
34.68 - childPos=QPoint(
34.69 - absPos.x() + QSize(getSize() ).width()/2,
34.70 - absPos.y() + QSize(getSize() ).height()/2);
34.71 + childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
34.72 + childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
34.73 parPos=childPos;
34.74 BranchObj *b;
34.75 for (b=branch.first(); b; b=branch.next() )
34.76 @@ -102,19 +89,15 @@
34.77 for (bo=branch.first(); bo; bo=branch.next() )
34.78 {
34.79 lmo = bo->findMapObj(p, excludeLMO);
34.80 -
34.81 - if (lmo!= NULL)
34.82 - {
34.83 - return lmo;
34.84 - }
34.85 + if (lmo!= NULL) return lmo;
34.86 }
34.87 // is p in MapCenter?
34.88 - if (inBBox (p) && (this != excludeLMO) ) return this;
34.89 + if (inBox (p) && (this != excludeLMO) ) return this;
34.90
34.91 // Search float images
34.92 FloatImageObj *foi;
34.93 for (foi=floatimage.first(); foi; foi=floatimage.next() )
34.94 - if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
34.95 + if (foi->inBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
34.96
34.97 // nothing found
34.98 return NULL;
34.99 @@ -131,13 +114,21 @@
34.100 attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
34.101 attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
34.102
34.103 + // Providing an ID for a branch makes export to XHTML easier
34.104 + QString idAttr;
34.105 + if (countXLinks()>0)
34.106 + idAttr=attribut ("id",getSelectString());
34.107 + else
34.108 + idAttr="";
34.109 +
34.110 + QString linkAttr=getLinkAttr();
34.111 +
34.112 s=beginElement ("mapcenter"
34.113 - +attribut("absPosX",QString().setNum(absPos.x(),10))
34.114 - +attribut("absPosY",QString().setNum(absPos.y(),10))
34.115 + +getOrnAttr()
34.116 +attribut("frameType",frame->getFrameTypeName())
34.117 +areaAttr
34.118 - );
34.119 -
34.120 + +idAttr
34.121 + +getIncludeImageAttr() );
34.122 incIndent();
34.123 if (heading->getColor()!=QColor("black"))
34.124 a=attribut ("textColor",QColor(heading->getColor()).name() );
34.125 @@ -149,23 +140,25 @@
34.126 s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
34.127 s=s+valueElement("heading", getHeading(),a);
34.128
34.129 - // Reset the counters before saving
34.130 - FloatImageObj (canvas).resetSaveCounter();
34.131 -
34.132 // add link to file in s
34.133 if (!note.isEmpty() )
34.134 s+=note.saveToDir();
34.135
34.136 - // Save FloatImages
34.137 - FloatImageObj *fio;
34.138 - for (fio=floatimage.first(); fio; fio=floatimage.next() )
34.139 - s+=fio->saveToDir (tmpdir,prefix);
34.140 -
34.141 // Save branches
34.142 BranchObj *bo;
34.143 for (bo=branch.first(); bo; bo=branch.next() )
34.144 s+=bo->saveToDir(tmpdir,prefix, offset);
34.145
34.146 + // Save FloatImages
34.147 + FloatImageObj *fio;
34.148 + for (fio=floatimage.first(); fio; fio=floatimage.next() )
34.149 + s+=fio->saveToDir (tmpdir,prefix,offset);
34.150 +
34.151 + // Save XLinks
34.152 + XLinkObj *xlo;
34.153 + for (xlo=xlink.first(); xlo; xlo=xlink.next() )
34.154 + s+=xlo->saveToDir();
34.155 +
34.156 decIndent();
34.157 s+=endElement ("mapcenter");
34.158 return s;
34.159 @@ -184,9 +177,9 @@
34.160 QString s2=version.section (".",1,1);
34.161 QString s3=version.section (".",2,2);
34.162 bool ok;
34.163 - int vv1 =QString(__VYM_VERSION__).section (".",0,0).toInt(&ok,10);
34.164 - int vv2 =QString(__VYM_VERSION__).section (".",1,1).toInt(&ok,10);
34.165 - int vv3 =QString(__VYM_VERSION__).section (".",2,2).toInt(&ok,10);
34.166 + int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
34.167 + int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
34.168 + int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
34.169 int mv1=0;
34.170 int mv2=0;
34.171 int mv3=0;
34.172 @@ -233,3 +226,4 @@
34.173 {
34.174 return QDate::currentDate().toString ("yyyy-MM-dd");
34.175 }
34.176 +
35.1 --- a/mapcenterobj.h Sun Jan 30 12:58:47 2005 +0000
35.2 +++ b/mapcenterobj.h Tue Jun 06 14:58:11 2006 +0000
35.3 @@ -1,14 +1,18 @@
35.4 #ifndef MAPCENTEROBJ_H
35.5 #define MAPCENTEROBJ_H
35.6
35.7 +
35.8 +#include <QDate>
35.9 +
35.10 #include "branchobj.h"
35.11 +#include "xlinkobj.h"
35.12 #include "version.h"
35.13
35.14 /////////////////////////////////////////////////////////////////////////////
35.15 class MapCenterObj:public BranchObj {
35.16 public:
35.17 MapCenterObj ();
35.18 - MapCenterObj (QCanvas*);
35.19 + MapCenterObj (Q3Canvas*);
35.20 ~MapCenterObj ();
35.21 void clear();
35.22 void init();
36.1 --- a/mapeditor.cpp Sun Jan 30 12:58:47 2005 +0000
36.2 +++ b/mapeditor.cpp Tue Jun 06 14:58:11 2006 +0000
36.3 @@ -4,61 +4,63 @@
36.4 #include <qmessagebox.h>
36.5 #include <qapplication.h>
36.6 #include <qpainter.h>
36.7 -#include <qpopupmenu.h>
36.8 +#include <q3popupmenu.h>
36.9 #include <qprinter.h>
36.10 -#include <qpaintdevicemetrics.h>
36.11 +#include <q3paintdevicemetrics.h>
36.12 #include <qfile.h>
36.13 -#include <qfiledialog.h>
36.14 +#include <q3filedialog.h>
36.15 #include <qdir.h>
36.16 #include <qcolor.h>
36.17 #include <qcolordialog.h>
36.18 #include <qbitmap.h>
36.19 -#include <qprocess.h>
36.20 +#include <q3process.h>
36.21 #include <qinputdialog.h>
36.22 +#include <q3dragobject.h>
36.23 +#include <q3urloperator.h>
36.24 +#include <q3networkprotocol.h>
36.25 +#include <qregexp.h>
36.26 +//Added by qt3to4:
36.27 +#include <QResizeEvent>
36.28 +#include <QContextMenuEvent>
36.29 +#include <Q3StrList>
36.30 +#include <QPixmap>
36.31 +#include <QMouseEvent>
36.32 +#include <QDragEnterEvent>
36.33 +#include <QTextStream>
36.34 +#include <QDropEvent>
36.35 +#include <Q3ActionGroup>
36.36 +#include <Q3PtrList>
36.37
36.38 #include <iostream>