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.
"
+
+ "
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.
"
+
+ "
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.
GNU GENERAL PUBLIC LICENSE "
+"Version 2, June 1991
"
+
+"
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"
+
+"
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
"
+
+"
Preamble
"
+
+"
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
"
+
+"
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
"
+
+"
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
"
+
+"
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
"
+
+"
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
"
+
+"
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
"
+
+"
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
"
+
+"
The precise terms and conditions for copying, distribution and modification follow.
"
+
+"
GNU GENERAL PUBLIC LICENSE
"
+"
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
"
+
+"
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The \"Program\", below, refers to any such program or work, and a \"work based on the Program\" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term \"modification\".) Each licensee is addressed as \"you\".
"
+
+"
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
"
+
+"
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
"
+
+"
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
"
+
+"
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:"
+"
"
+ "
You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
"
+
+ "
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.
"
+
+ "
If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
"
+""
+"
"
+
+"
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
"
+
+"
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
"
+
+"
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
"
+
+"
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:" "
"
+
+"
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,
"
+
+"
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,
"
+
+"
Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
"
+""
+
+"
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
"
+
+"
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
"
+
+"
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
"
+
+"
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
"
+
+"
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
"
+
+"
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
"
+
+"
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
"
+
+"
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
"
+
+"
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
"
+
+"
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
"
+
+"
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
"
+
+"
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and \"any later version\", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
"
+
+"
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
"
+
+"
NO WARRANTY
"
+
+"
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
"
+
+"
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
"
+
+"
END OF TERMS AND CONDITIONS
"
+
+ );
+ credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
+ tabs->addTab (license,"License");
+
+ mainLayout->addWidget (tabs);
+ tabs->showPage (credits);
+
+ okbutton =new QPushButton (this,"okbutton");
+ okbutton->setText (tr("Ok"));
+ okbutton->setMaximumSize (QSize (50,30));
+ okbutton->setAutoDefault (true);
+ mainLayout->addWidget( okbutton);
+
+ connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+}
+
+AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
+ : Q3TextBrowser(parent, name)
+{
+
+}
+
+void AboutTextBrowser::setSource(const QString &name)
+{
+ Q3MimeSourceFactory *factory = Q3MimeSourceFactory::defaultFactory();
+ const QMimeSource *data = factory->data(name);
+ if (data) {
+ Q3TextBrowser::setSource(name);
+ } else {
+ Q3Process *proc = new Q3Process( this );
+ proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
+ proc->addArgument( name);
+
+ if ( !proc->start() )
+ if (mainWindow->settingsURL() )
+ setSource(name);
+ }
+}
diff -r 9eb7767c2dfa -r 608f976aa7bb aboutdialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/aboutdialog.h Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,41 @@
+#ifndef ABOUTDIALOG_H
+#define ABOUTDIALOG_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class AboutTextBrowser;
+/////////////////////////////////////////////////////////////////////////////
+class AboutDialog :public QDialog
+{
+ Q_OBJECT
+
+public:
+ AboutDialog(QWidget* parent = 0, const char* name = 0);
+
+private:
+ QTabWidget *tabs;
+ AboutTextBrowser *credits;
+ AboutTextBrowser *license;
+
+ QLayout *mainLayout;
+ QLayout *topLayout;
+ QLayout *bottomLayout;
+ QPushButton *okbutton;
+
+};
+
+class AboutTextBrowser : public Q3TextBrowser
+{
+ Q_OBJECT;
+ public:
+ AboutTextBrowser(QWidget *parent, const char *name = 0);
+ public slots:
+ void setSource(const QString &name);
+};
+
+#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb branchobj.cpp
--- a/branchobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/branchobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -24,13 +24,14 @@
depth=-1;
}
-BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c)
+BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c)
{
// cout << "Const BranchObj (c) called from MapCenterObj (c)\n";
+ parObj=NULL;
canvas=c;
}
-BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c)
+BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
{
// cout << "Const BranchObj (c,p)\n";
canvas=c;
@@ -47,16 +48,18 @@
BranchObj::~BranchObj ()
{
- //cout << "Destr BranchObj\n";
+// cout << "Destr BranchObj of "<getLastBranch();
+ bo=((BranchObj*)(parObj))->getLastBranch();
if (!bo) po->unScroll();
}
+ clear();
}
bool BranchObj::operator< ( const BranchObj & other )
@@ -69,7 +72,7 @@
return angle == other.angle;
}
-int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j)
+int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
{
// Make sure PtrList::find works
if (i==j) return 0;
@@ -82,17 +85,15 @@
void BranchObj::init ()
{
- branch.setAutoDelete (true);
+ branch.setAutoDelete (false);
floatimage.setAutoDelete (true);
+ xlink.setAutoDelete (false);
- absPos=getRandPos();
- absPos+=parObj->getChildPos();
-
- // TODO This should be done in TextObj later
- QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
-// font.setPointSize(12);
- heading->setFont(font );
-// heading->setText(QObject::tr("new branch"));
+ if (parObj)
+ {
+ absPos=getRandPos();
+ absPos+=parObj->getChildPos();
+ }
lastSelectedBranch=-1;
@@ -101,8 +102,8 @@
scrolled=false;
tmpUnscrolled=false;
- url="";
- vymLink="";
+ includeImagesVer=false;
+ includeImagesHor=false;
}
void BranchObj::copy (BranchObj* other)
@@ -125,9 +126,6 @@
tmpUnscrolled=other->tmpUnscrolled;
setVisibility (other->visible);
- url=other->url;
- vymLink=other->vymLink;
-
angle=other->angle;
positionBBox();
@@ -135,8 +133,17 @@
void BranchObj::clear()
{
- branch.clear();
floatimage.clear();
+ while (!xlink.isEmpty())
+ deleteXLink (xlink.first() );
+
+ BranchObj *bo;
+ while (!branch.isEmpty())
+ {
+ bo=branch.first();
+ branch.removeFirst();
+ delete (bo);
+ }
}
int BranchObj::getNum()
@@ -149,7 +156,12 @@
int BranchObj::getNum(BranchObj *bo)
{
- return branch.findRef (bo);
+ // keep current pointer in branch,
+ // otherwise save might fail
+ int cur=branch.at();
+ int ind=branch.findRef (bo);
+ branch.at(cur);
+ return ind;
}
int BranchObj::getFloatImageNum(FloatImageObj *fio)
@@ -167,6 +179,11 @@
return floatimage.count();
}
+int BranchObj::countXLinks()
+{
+ return xlink.count();
+}
+
void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
{
// Temporary link to lmo
@@ -181,19 +198,10 @@
// ignore mapcenter and mainbranch
if (lmo->getDepth()<2) off=0;
if (off==0)
- {
link2ParPos=false;
- parObj=o;
- }
else
- {
link2ParPos=true;
- if (off>0)
- parObj=o->getParObj();
- else
- parObj=o->getParObj();
- parObj=o;
- }
+ parObj=o;
depth=parObj->getDepth()+1;
@@ -254,6 +262,7 @@
parObjTmpBuf=NULL;
depth=parObj->getDepth()+1;
setLinkStyle (getDefLinkStyle() );
+ updateLink();
}
}
@@ -350,6 +359,7 @@
standardFlags->setVisibility(v);
LinkableMapObj::setVisibility (v);
+ // Only change childs, if I am not scrolled
if (!scrolled && (depth < toDepth))
{
// Now go recursivly through all childs
@@ -359,9 +369,11 @@
FloatImageObj *fio;
for (fio=floatimage.first(); fio; fio=floatimage.next())
fio->setVisibility (v);
+ XLinkObj* xlo;
+ for (xlo=xlink.first(); xlo;xlo=xlink.next() )
+ xlo->setVisibility ();
}
} // depth <= toDepth
- move (absPos.x(), absPos.y() );
requestReposition();
}
@@ -376,25 +388,21 @@
// Overloaded from LinkableMapObj
// BranchObj can use color of heading
- if (mapEditor->getLinkColorHint()==HeadingColor)
- LinkableMapObj::setLinkColor (heading->getColor() );
- else
- LinkableMapObj::setLinkColor ();
+ if (mapEditor)
+ if (mapEditor->getLinkColorHint()==HeadingColor)
+ LinkableMapObj::setLinkColor (heading->getColor() );
+ else
+ LinkableMapObj::setLinkColor ();
}
-void BranchObj::setColor (QColor col, bool colorChilds)
+void BranchObj::setColorChilds (QColor col)
{
- heading->setColor(col);
- setLinkColor();
- if (colorChilds)
- {
- BranchObj *bo;
- for (bo=branch.first(); bo; bo=branch.next() )
- bo->setColor(col,colorChilds);
- }
+ OrnamentedObj::setColor (col);
+ BranchObj *bo;
+ for (bo=branch.first(); bo; bo=branch.next() )
+ bo->setColorChilds(col);
}
-
BranchObj* BranchObj::first()
{
itLast=NULL;
@@ -521,10 +529,20 @@
itLast=it;
}
+void BranchObj::positionContents()
+{
+ FloatImageObj *fio;
+ for (fio=floatimage.first(); fio; fio=floatimage.next() )
+ fio->reposition();
+ OrnamentedObj::positionContents();
+}
void BranchObj::move (double x, double y)
{
OrnamentedObj::move (x,y);
+ FloatImageObj *fio;
+ for (fio=floatimage.first(); fio; fio=floatimage.next() )
+ fio->reposition();
positionBBox();
}
@@ -536,12 +554,12 @@
void BranchObj::moveBy (double x, double y)
{
OrnamentedObj::moveBy (x,y);
- positionBBox();
BranchObj* b;
for (b=branch.first(); b;b=branch.next() )
b->moveBy (x,y);
+ positionBBox();
}
-
+
void BranchObj::moveBy (QPoint p)
{
moveBy (p.x(), p.y());
@@ -550,30 +568,25 @@
void BranchObj::positionBBox()
{
-
- heading->positionBBox();
- systemFlags->positionBBox();
- standardFlags->positionBBox();
- // It seems that setting x,y also affects width,height
- int w_old=bbox.width();
- int h_old=bbox.height();
- bbox.setX (absPos.x() );
- bbox.setY (absPos.y() );
- bbox.setWidth(w_old);
- bbox.setHeight(h_old);
-
-
+ QPoint ap=getAbsPos();
+ bbox.moveTopLeft (ap);
+ positionContents();
setSelBox();
// set the frame
frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
+
+ // Update links to other branches
+ XLinkObj *xlo;
+ for (xlo=xlink.first(); xlo; xlo=xlink.next() )
+ xlo->updateXLink();
}
void BranchObj::calcBBoxSize()
{
QSize heading_r=heading->getSize();
- int heading_w=static_cast (heading_r.width() );
- int heading_h=static_cast (heading_r.height() );
+ int heading_w=(int) heading_r.width() ;
+ int heading_h=(int) heading_r.height() ;
QSize sysflags_r=systemFlags->getSize();
int sysflags_h=sysflags_r.height();
int sysflags_w=sysflags_r.width();
@@ -589,11 +602,73 @@
h=max (sysflags_h,stanflags_h);
h=max (h,heading_h);
+ // Save the dimension of flags and heading
+ ornamentsBBox.setSize ( QSize(w,h));
+
+ // clickBox includes Flags and Heading
+ clickBox.setSize (ornamentsBBox.size() );
+
+ // Floatimages
+ QPoint rp;
+ FloatImageObj *foi;
+
+ topPad=botPad=leftPad=rightPad=0;
+ if (includeImagesVer || includeImagesHor)
+ {
+ if (countFloatImages()>0)
+ {
+ for (foi=floatimage.first(); foi; foi=floatimage.next() )
+ {
+ rp=foi->getRelPos();
+ if (includeImagesVer)
+ {
+ if (rp.y() < 0)
+ topPad=max (topPad,-rp.y()-h);
+ if (rp.y()+foi->height() > 0)
+ botPad=max (botPad,rp.y()+foi->height());
+ }
+ if (includeImagesHor)
+ {
+ if (orientation==OrientRightOfCenter)
+ {
+ if (-rp.x()-w > 0)
+ leftPad=max (leftPad,-rp.x()-w);
+ if (rp.x()+foi->width() > 0)
+ rightPad=max (rightPad,rp.x()+foi->width());
+ } else
+ {
+ if (rp.x()< 0)
+ leftPad=max (leftPad,-rp.x());
+ if (rp.x()+foi->width() > w)
+ rightPad=max (rightPad,rp.x()+foi->width()-w);
+ }
+ }
+ }
+ }
+ h+=topPad+botPad;
+ w+=leftPad+rightPad;
+ }
+
+ // Frame thickness
w+=frame->getBorder();
h+=frame->getBorder();
+
+ // Finally set size
bbox.setSize (QSize (w,h));
}
+void BranchObj::setDockPos()
+{
+ if (getOrientation()==OrientLeftOfCenter )
+ {
+ childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
+ parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
+ } else
+ {
+ childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
+ parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
+ }
+}
LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
{
// Search branches
@@ -606,89 +681,67 @@
}
// Search myself
- if (inBBox (p) && (this != excludeLMO) && isVisibleObj() )
+ if (inBox (p) && (this != excludeLMO) && isVisibleObj() )
return this;
// Search float images
FloatImageObj *foi;
for (foi=floatimage.first(); foi; foi=floatimage.next() )
- if (foi->inBBox(p) && (foi != excludeLMO) && foi->getParObj()!= excludeLMO) return foi;
+ if (foi->inBox(p) &&
+ (foi != excludeLMO) &&
+ foi->getParObj()!= excludeLMO &&
+ foi->isVisibleObj()
+ ) return foi;
return NULL;
}
void BranchObj::setHeading(QString s)
{
- // Adjusting font size
- QFont font=heading->getFont();
- if (depth==0)
- font.setPointSize(16);
- else
- if (depth>1)
- font.setPointSize(10);
- else
- font.setPointSize(12);
- heading->setFont(font);
heading->setText(s); // set new heading
calcBBoxSize(); // recalculate bbox
positionBBox(); // rearrange contents
requestReposition();
}
-void BranchObj::setURL(QString s)
+void BranchObj::setHideTmp (HideTmpMode mode)
{
- url=s;
- if (!url.isEmpty())
- systemFlags->activate("url");
- else
- systemFlags->deactivate("url");
- calcBBoxSize(); // recalculate bbox
- positionBBox(); // rearrange contents
- forceReposition();
+ if (mode==HideExport && hasHiddenExportParent(this))
+ {
+ setVisibility (false);
+ hidden=true;
+ }else
+ {
+ if (hasScrolledParent(this))
+ setVisibility (false);
+ else
+ setVisibility (true);
+ hidden=false;
+ }
+
+ BranchObj *bo;
+ for (bo=branch.first(); bo; bo=branch.next() )
+ bo->setHideTmp (mode);
}
-QString BranchObj::getURL()
+bool BranchObj::hasHiddenExportParent(BranchObj *start)
{
- return url;
-}
+ // Calls parents recursivly to
+ // find out, if we are temp. hidden
-void BranchObj::setVymLink(QString s)
-{
- if (!s.isEmpty())
- {
- // We need the relative (from loading)
- // or absolute path (from User event)
- // and build the absolute path.
- // Note: If we have relative, use path of
- // current map to build absolute path
- QDir d(s);
- if (!d.path().startsWith ("/"))
- {
- QString p=mapEditor->getDestPath();
- int i=p.findRev("/",-1);
- d.setPath(p.left(i)+"/"+s);
- d.convertToAbs();
- }
- vymLink=d.path();
- systemFlags->activate("vymLink");
- }
- else
- {
- systemFlags->deactivate("vymLink");
- vymLink="";
- }
- calcBBoxSize(); // recalculate bbox
- positionBBox(); // rearrange contents
- forceReposition();
-}
+ if (hideExport) return true;
-QString BranchObj::getVymLink()
-{
- return vymLink;
+ BranchObj* bo=(BranchObj*)(parObj);
+ if (bo)
+ return bo->hasHiddenExportParent(start);
+ else
+ return false;
}
QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
{
+ if (hidden) return "";
+
QString s,a;
QString scrolledAttr;
if (scrolled)
@@ -696,21 +749,6 @@
else
scrolledAttr="";
- QString posAttr;
- if (depth<2) posAttr=
- attribut("absPosX",QString().setNum(absPos.x(),10)) +
- attribut("absPosY",QString().setNum(absPos.y(),10));
- else
- posAttr="";
-
- QString urlAttr;
- if (!url.isEmpty())
- urlAttr=attribut ("url",url);
-
- QString vymLinkAttr;
- if (!vymLink.isEmpty())
- vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
-
QString frameAttr;
if (frame->getFrameType()!=NoFrame)
frameAttr=attribut ("frameType",frame->getFrameTypeName());
@@ -730,11 +768,24 @@
} else
areaAttr="";
- s=beginElement ("branch" +scrolledAttr +posAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr);
+ // Providing an ID for a branch makes export to XHTML easier
+ QString idAttr;
+ if (countXLinks()>0)
+ idAttr=attribut ("id",getSelectString());
+ else
+ idAttr="";
+
+ s=beginElement ("branch"
+ +getOrnAttr()
+ +scrolledAttr
+ +frameAttr
+ +areaAttr
+ +idAttr
+ +getIncludeImageAttr() );
incIndent();
// save heading
- s=s+valueElement("heading", getHeading(),
+ s+=valueElement("heading", getHeading(),
attribut ("textColor",QColor(heading->getColor()).name()));
// save names of flags set
@@ -748,17 +799,120 @@
BranchObj *bo;
for (bo=branch.first(); bo; bo=branch.next() )
s+=bo->saveToDir(tmpdir,prefix,offset);
- decIndent();
// Save FloatImages
FloatImageObj *fio;
for (fio=floatimage.first(); fio; fio=floatimage.next() )
- s+=fio->saveToDir (tmpdir,prefix);
+ s+=fio->saveToDir (tmpdir,prefix,offset);
+ // Save XLinks
+ XLinkObj *xlo;
+ //FIXME exponential increase in xlinks...
+ QString ol; // old link
+ QString cl; // current link
+ for (xlo=xlink.first(); xlo; xlo=xlink.next() )
+ {
+ cl=xlo->saveToDir();
+ if (cl!=ol)
+ {
+ s+=cl;
+ ol=cl;
+ } else
+ {
+ qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
+ }
+ }
+
+ decIndent();
s+=endElement ("branch");
return s;
}
+void BranchObj::addXLink (XLinkObj *xlo)
+{
+ xlink.append (xlo);
+
+}
+
+void BranchObj::removeXLinkRef (XLinkObj *xlo)
+{
+ xlink.remove (xlo);
+}
+
+void BranchObj::deleteXLink(XLinkObj *xlo)
+{
+ xlo->deactivate();
+ if (!xlo->isUsed()) delete (xlo);
+}
+
+void BranchObj::deleteXLinkAt (int i)
+{
+ XLinkObj *xlo=xlink.at(i);
+ xlo->deactivate();
+ if (!xlo->isUsed()) delete(xlo);
+}
+
+XLinkObj* BranchObj::XLinkAt (int i)
+{
+ return xlink.at(i);
+}
+
+int BranchObj::countXLink()
+{
+ return xlink.count();
+}
+
+
+BranchObj* BranchObj::XLinkTargetAt (int i)
+{
+ if (xlink.at(i))
+ return xlink.at(i)->otherBranch (this);
+ else
+ return NULL;
+}
+
+void BranchObj::setIncludeImagesVer(bool b)
+{
+ includeImagesVer=b;
+ calcBBoxSize();
+ positionBBox();
+ requestReposition();
+ //FIXME undo needed
+}
+
+bool BranchObj::getIncludeImagesVer()
+{
+ return includeImagesVer;
+}
+
+void BranchObj::setIncludeImagesHor(bool b)
+{
+ includeImagesHor=b;
+ calcBBoxSize();
+ positionBBox();
+ requestReposition();
+ //FIXME undo needed
+}
+
+bool BranchObj::getIncludeImagesHor()
+{
+ return includeImagesHor;
+}
+
+QString BranchObj::getIncludeImageAttr()
+{
+ QString a;
+ if (includeImagesVer)
+ a=attribut ("incImgV","true");
+ else
+ a=attribut ("incImgV","false");
+ if (includeImagesHor)
+ a+=attribut ("incImgH","true");
+ else
+ a+=attribut ("incImgH","false");
+ return a;
+}
+
LinkableMapObj* BranchObj::addFloatImage ()
{
FloatImageObj *newfi=new FloatImageObj (canvas,this);
@@ -767,8 +921,11 @@
newfi->setVisibility (false);
else
newfi->setVisibility(visible);
+ calcBBoxSize();
+ positionBBox();
requestReposition();
return newfi;
+ //FIXME undo needed
}
LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
@@ -780,8 +937,11 @@
newfi->setVisibility (false);
else
newfi->setVisibility(visible);
+ calcBBoxSize();
+ positionBBox();
requestReposition();
return newfi;
+ // FIMXE undo needed
}
FloatImageObj* BranchObj::getFirstFloatImage ()
@@ -802,7 +962,10 @@
void BranchObj::removeFloatImage (FloatImageObj *fio)
{
floatimage.remove (fio);
+ calcBBoxSize();
+ positionBBox();
requestReposition();
+ // FIMXE undo needed
}
void BranchObj::savePosInAngle ()
@@ -817,19 +980,40 @@
}
}
+void BranchObj::setDefAttr (BranchModification mod)
+{
+ int fontsize;
+ switch (depth)
+ {
+ case 0: fontsize=16; break;
+ case 1: fontsize=12; break;
+ default: fontsize=10; break;
+ }
+
+ setLinkColor ();
+ setLinkStyle(getDefLinkStyle());
+ QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
+ font.setPointSize(fontsize);
+ heading->setFont(font );
+
+ if (mod==NewBranch)
+ setColor (((BranchObj*)(parObj))->getColor());
+
+ calcBBoxSize();
+}
+
BranchObj* BranchObj::addBranch()
{
BranchObj* newbo=new BranchObj(canvas,this);
branch.append (newbo);
newbo->setParObj(this);
- newbo->setColor(getColor(),false);
- newbo->setLinkColor();
+ newbo->setDefAttr(NewBranch);
newbo->setHeading ("new");
- newbo->setLinkStyle (newbo->getDefLinkStyle());
if (scrolled)
newbo->setVisibility (false);
else
newbo->setVisibility(visible);
+ newbo->updateLink();
requestReposition();
return newbo;
}
@@ -840,16 +1024,27 @@
branch.append (newbo);
newbo->copy(bo);
newbo->setParObj(this);
- newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth
- newbo->setLinkStyle (newbo->getDefLinkStyle());
+ newbo->setDefAttr(MovedBranch);
if (scrolled)
newbo->setVisibility (false);
else
newbo->setVisibility(bo->visible);
+ newbo->updateLink();
requestReposition();
return newbo;
}
+BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
+{
+ branch.append (bo);
+ bo->setParObj (this);
+ bo->depth=depth+1;
+ bo->setDefAttr(MovedBranch);
+ if (scrolled) tmpUnscroll();
+ setLastSelectedBranch (bo);
+ return bo;
+}
+
BranchObj* BranchObj::insertBranch(int pos)
{
savePosInAngle();
@@ -870,11 +1065,56 @@
return newbo;
}
+BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
+{
+ savePosInAngle();
+ // Add new bo and resort branches
+ bo->angle=pos-0.5;
+ branch.append (bo);
+ bo->setParObj (this);
+ bo->depth=depth+1;
+ bo->setDefAttr (MovedBranch);
+ if (scrolled) tmpUnscroll();
+ setLastSelectedBranch (bo);
+ branch.sort();
+ return bo;
+}
+
+void BranchObj::removeBranchHere(BranchObj* borem)
+{
+ // This removes the branch bo from list, but
+ // inserts its childs at the place of bo
+ BranchObj *bo;
+ bo=borem->getLastBranch();
+ int pos=borem->getNum();
+ while (bo)
+ {
+ bo->moveBranchTo (this,pos+1);
+ bo=borem->getLastBranch();
+ }
+ removeBranch (borem);
+}
+
+void BranchObj::removeChilds()
+{
+ clear();
+}
+
void BranchObj::removeBranch(BranchObj* bo)
{
// if bo is not in branch remove returns false, we
// don't care...
- branch.remove (bo);
+
+ if (branch.remove (bo))
+ delete (bo);
+ else
+ qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
+ requestReposition();
+}
+
+void BranchObj::removeBranchPtr(BranchObj* bo)
+{
+ branch.remove (bo);
requestReposition();
}
@@ -908,6 +1148,15 @@
return branch.at(i);
}
+bool BranchObj::canMoveBranchUp()
+{
+ if (!parObj) return false;
+ BranchObj* par=(BranchObj*)parObj;
+ if (this==par->getFirstBranch())
+ return false;
+ else
+ return true;
+}
BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
{
@@ -923,6 +1172,16 @@
return branch.at(i);
}
+bool BranchObj::canMoveBranchDown()
+{
+ if (!parObj) return false;
+ BranchObj* par=(BranchObj*)parObj;
+ if (this==par->getLastBranch())
+ return false;
+ else
+ return true;
+}
+
BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
{
savePosInAngle();
@@ -939,29 +1198,63 @@
return branch.at(i);
}
+BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
+{
+ // Find current parent and
+ // remove pointer to myself there
+ if (!dst) return NULL;
+ BranchObj *par=(BranchObj*)(parObj);
+ if (par)
+ par->removeBranchPtr (this);
+ else
+ return NULL;
+
+ // Create new pointer to myself at dst
+ if (pos<0||dst->getDepth()==0)
+ {
+ // links myself as last branch at dst
+ dst->addBranchPtr (this);
+ updateLink();
+ return this;
+ } else
+ {
+ // inserts me at pos in parent of dst
+ if (par)
+ {
+ BranchObj *bo=dst->insertBranchPtr (this,pos);
+ bo->setDefAttr(MovedBranch);
+ updateLink();
+ return bo;
+
+ } else
+ return NULL;
+ }
+}
+
void BranchObj::alignRelativeTo (QPoint ref)
{
-/* FIXME testing
- if (!getHeading().isEmpty())
- cout << "BO::alignRelTo "<reposition();
-
if (scrolled) return;
// Set reference point for alignment of childs
QPoint ref2;
if (orientation==OrientLeftOfCenter)
- ref2.setX(childPos.x() - linkwidth);
+ ref2.setX(bbox.topLeft().x() - linkwidth);
else
- ref2.setX(childPos.x() + linkwidth);
+ ref2.setX(bbox.topRight().x() + linkwidth);
if (depth==1)
ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
@@ -1003,15 +1292,18 @@
BranchObj *b;
for (b=branch.first(); b; b=branch.next() )
{
- b->alignRelativeTo (ref2);
- ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
+ if (!b->isHidden())
+ {
+ b->alignRelativeTo (ref2);
+ ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
+ }
}
}
void BranchObj::reposition()
{
-/* FIXME testing
+/* TODO testing only
if (!getHeading().isEmpty())
cout << "BO::reposition "<getTotalBBox(),r);
+ if (!b->isHidden())
+ r=addBBox(b->getTotalBBox(),r);
FloatImageObj* fio;
for (fio=floatimage.first();fio ;fio=floatimage.next() )
- r=addBBox(fio->getTotalBBox(),r);
+ if (!fio->isHidden())
+ r=addBBox(fio->getTotalBBox(),r);
return r;
}
@@ -1059,14 +1357,14 @@
}
void BranchObj::calcBBoxSizeWithChilds()
-{
- // This is called only from reposition and
+{
+ // This is initially called only from reposition and
// and only for mapcenter. So it won't be
// called more than once for a single user
// action
+
// Calculate size of LMO including all childs (to align them later)
-
bboxTotal.setX(bbox.x() );
bboxTotal.setY(bbox.y() );
@@ -1078,6 +1376,22 @@
return;
}
+ if (hidden)
+ {
+ bboxTotal.setWidth (0);
+ bboxTotal.setHeight(0);
+ if (parObj)
+ {
+ bboxTotal.setX (parObj->x());
+ bboxTotal.setY (parObj->y());
+ } else
+ {
+ bboxTotal.setX (bbox.x());
+ bboxTotal.setY (bbox.y());
+ }
+ return;
+ }
+
QRect r(0,0,0,0);
QRect br;
// Now calculate recursivly
@@ -1087,11 +1401,14 @@
BranchObj* b;
for (b=branch.first();b ;b=branch.next() )
{
- b->calcBBoxSizeWithChilds();
- br=b->getBBoxSizeWithChilds();
- r.setWidth( max (br.width(), r.width() ));
- r.setHeight(br.height() + r.height() );
- if (br.y()isHidden())
+ {
+ b->calcBBoxSizeWithChilds();
+ br=b->getBBoxSizeWithChilds();
+ r.setWidth( max (br.width(), r.width() ));
+ r.setHeight(br.height() + r.height() );
+ if (br.y()setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
+
+ bboxTotal.setHeight(max (r.height(), bbox.height()));
}
void BranchObj::select()
{
+ // set Text in Editor
+ textEditor->setText(note.getNote() );
+ QString fnh=note.getFilenameHint();
+ if (fnh!="")
+ textEditor->setFilenameHint(note.getFilenameHint() );
+ else
+ textEditor->setFilenameHint(getHeading() );
+ textEditor->setFontHint (note.getFontHint() );
+
LinkableMapObj::select();
// Tell parent that I am selected now:
BranchObj* po=(BranchObj*)(parObj);
@@ -1114,13 +1440,6 @@
// temporary unscroll, if we have scrolled parents somewhere
if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
- // set Text in Editor
- textEditor->setText(note.getNote() );
- textEditor->setFilename(note.getFilenameHint() );
- textEditor->setFontHint (note.getFontHint() );
- connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) );
- connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) );
-
// Show URL and link in statusbar
QString status;
if (!url.isEmpty()) status+="URL: "+url+" ";
@@ -1128,13 +1447,7 @@
if (!status.isEmpty()) mainWindow->statusMessage (status);
// Update Toolbar
- standardFlags->updateToolBar();
-
- // Update Browserbutton
- if (!url.isEmpty())
- actionEditOpenURL->setEnabled (true);
- else
- actionEditOpenURL->setEnabled (false);
+ standardFlags->updateToolbar();
// Update actions in mapeditor
mapEditor->updateActions();
@@ -1154,15 +1467,11 @@
// reset temporary unscroll, if we have scrolled parents somewhere
if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
- // Disconnect textEditor from this LMO
- disconnect( textEditor, SIGNAL(textHasChanged()), 0, 0 );
- disconnect( textEditor, SIGNAL (fontSizeHasChanged()),0,0 );
-
// Erase content of editor
textEditor->setInactive();
// unselect all buttons in toolbar
- standardFlagsDefault->updateToolBar();
+ standardFlagsDefault->updateToolbar();
}
QString BranchObj::getSelectString()
@@ -1170,15 +1479,12 @@
QString s;
if (parObj)
{
- if (parObj->getDepth()==0)
+ if (depth==1)
s= "bo:" + QString("%1").arg(getNum());
else
s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
} else
- {
s="mc:";
- }
-
return s;
}
diff -r 9eb7767c2dfa -r 608f976aa7bb branchobj.h
--- a/branchobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/branchobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -4,18 +4,24 @@
#include "floatimageobj.h"
#include "linkablemapobj.h"
#include "ornamentedobj.h"
+#include "xlinkobj.h"
+//Added by qt3to4:
+#include
-class BranchObjPtrList : public QPtrList
+class BranchObjPtrList : public Q3PtrList
{
- virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
+ virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j);
};
+enum BranchModification {NewBranch, MovedBranch};
+enum HideTmpMode {HideNone, HideExport};
+
/////////////////////////////////////////////////////////////////////////////
class BranchObj:public OrnamentedObj {
public:
BranchObj ();
- BranchObj (QCanvas*);
- BranchObj (QCanvas*, LinkableMapObj* parent);
+ BranchObj (Q3Canvas*);
+ BranchObj (Q3Canvas*, LinkableMapObj* parent);
~BranchObj ();
bool operator< ( const BranchObj & );
bool operator== ( const BranchObj & );
@@ -27,6 +33,7 @@
virtual int getFloatImageNum(FloatImageObj*);
virtual int countBranches();
virtual int countFloatImages();
+ virtual int countXLinks();
virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
virtual void unsetParObjTmp(); // reuse original ParObj
@@ -40,27 +47,40 @@
virtual void setVisibility(bool,int); // set visibility
virtual void setVisibility(bool); // set vis. for w
virtual void setLinkColor(); // set the color of link
- virtual void setColor(QColor,bool); // set the color of heading
-
+ virtual void setColorChilds(QColor); // set the color of heading
BranchObj* first (); // set Iterator to first LMO
BranchObj* next (); // find next LMO after given one
BranchObj* getLastIterator(); // to interrupt and resume next iteration
void setLastIterator (BranchObj*); // needed by next()
+ virtual void positionContents();
virtual void move (double x,double y);
virtual void move (QPoint);
virtual void moveBy (double x,double y);
virtual void moveBy (QPoint);
virtual void positionBBox();
virtual void calcBBoxSize();
+ virtual void setDockPos();
virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
virtual void setHeading (QString);
- virtual void setURL (QString);
- virtual QString getURL ();
- virtual void setVymLink (QString);
- virtual QString getVymLink ();
+
+ virtual void setHideTmp (HideTmpMode);
+ virtual bool hasHiddenExportParent (BranchObj*);
+
virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
+ virtual void addXLink (XLinkObj*);
+ virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
+ virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
+ virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
+ virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
+ virtual int countXLink ();
+ virtual BranchObj* XLinkTargetAt (int);
+ void setIncludeImagesVer(bool);
+ bool getIncludeImagesVer();
+ void setIncludeImagesHor(bool);
+ bool getIncludeImagesHor();
+ QString getIncludeImageAttr();
virtual LinkableMapObj* addFloatImage();
virtual LinkableMapObj* addFloatImage(FloatImageObj*);
virtual void removeFloatImage(FloatImageObj*);
@@ -68,21 +88,29 @@
virtual FloatImageObj* getLastFloatImage();
virtual FloatImageObj* getFloatImageNum(const uint &);
protected:
- virtual void savePosInAngle(); // write pos in angle for resorting
+ virtual void savePosInAngle(); // write pos in angle for resorting
+ virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
public:
virtual BranchObj* addBranch();
virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
+ virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
virtual BranchObj* insertBranch(int);
virtual BranchObj* insertBranch(BranchObj*,int);
+ virtual BranchObj* insertBranchPtr (BranchObj*,int);
+ virtual void removeBranchHere(BranchObj*);
+ virtual void removeChilds();
virtual void removeBranch(BranchObj*);
+ virtual void removeBranchPtr (BranchObj*);
virtual void setLastSelectedBranch(BranchObj*);
virtual BranchObj* getLastSelectedBranch();
virtual BranchObj* getFirstBranch();
virtual BranchObj* getLastBranch();
virtual BranchObj* getBranchNum(const uint &);
+ virtual bool canMoveBranchUp();
virtual BranchObj* moveBranchUp(BranchObj*);
+ virtual bool canMoveBranchDown();
virtual BranchObj* moveBranchDown(BranchObj*);
-
+ virtual BranchObj* moveBranchTo (BranchObj*, int);
virtual void alignRelativeTo(const QPoint );
virtual void reposition();
@@ -97,15 +125,17 @@
protected:
static BranchObj* itLast; // iterator for first(), next()
BranchObjPtrList branch; // all child branches
- QPtrList floatimage; // child images
+ Q3PtrList floatimage; // child images
+ Q3PtrList xlink; // xlinks to other branches
public:
float angle; // used in mainbranch to reorder mainbranches
protected:
int lastSelectedBranch; // for going deeper into tree
bool scrolled; // true if all childs are scrolled and thus invisible
bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
- QString url; // url to external doc
- QString vymLink; // path to another map
+ bool includeImagesVer; // include floatimages in bbox vertically
+ bool includeImagesHor; // include floatimages in bbox horizontally
+
};
diff -r 9eb7767c2dfa -r 608f976aa7bb demos/todo.vym
Binary file demos/todo.vym has changed
diff -r 9eb7767c2dfa -r 608f976aa7bb exportoofiledialog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/exportoofiledialog.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,87 @@
+#include
+
+#include "exportoofiledialog.h"
+
+ExportOOFileDialog::ExportOOFileDialog():Q3FileDialog()
+{
+ init();
+}
+
+ExportOOFileDialog::ExportOOFileDialog (QWidget * parent, const char* name, bool modal):Q3FileDialog(parent, name,modal)
+{
+ init();
+}
+
+QString ExportOOFileDialog::selectedConfig()
+{
+ QStringList::Iterator itpath=configPaths.begin();
+ QStringList::Iterator itf=filters.begin();
+ while (itf != filters.end())
+ {
+ if (*itf==lastFilter) return *itpath;
+ itpath++;
+ itf++;
+ }
+ qWarning ("ExportOOFileDialog::selectedConfig No filter found!");
+ return "";
+}
+
+void ExportOOFileDialog::newConfigPath(const QString &s)
+{
+ lastFilter=s;
+}
+
+QString ExportOOFileDialog::selectedFile()
+{
+ return Q3FileDialog::selectedFile();
+}
+
+
+void ExportOOFileDialog::addFilter(const QString &f)
+{
+ lastFilter=f;
+ filters.append (f);
+ Q3FileDialog::addFilter (f);
+}
+
+void ExportOOFileDialog::init()
+{
+ setMode( Q3FileDialog::AnyFile );
+ QDir d;
+ d.setPath ("/usr/share/vym/exports");
+ scanExportConfigs(d);
+ d.setPath (d.homeDirPath()+"/.vym/exports");
+ scanExportConfigs(d);
+ d.setPath ("exports");
+ scanExportConfigs(d);
+
+ connect (
+ this,SIGNAL (filterSelected(const QString&)),
+ this, SLOT( newConfigPath(const QString &)));
+}
+
+void ExportOOFileDialog::scanExportConfigs(QDir dir)
+{
+ // Scan existing export configurations
+ SimpleSettings set;
+ QFile f;
+ if (dir.exists())
+ {
+ // Traverse files
+ QDir dir;
+ dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
+
+ QFileInfoList list = dir.entryInfoList();
+ for (int i = 0; i < list.size(); ++i) {
+ QFileInfo fi = list.at(i);
+
+ if (fi.fileName().endsWith(".conf") )
+ {
+ configPaths.append (fi.absFilePath());
+ set.clear();
+ set.readSettings (fi.absFilePath());
+ addFilter (set.readEntry("Name") + " (*.odp)");
+ }
+ }
+ }
+}
diff -r 9eb7767c2dfa -r 608f976aa7bb exportoofiledialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/exportoofiledialog.h Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,32 @@
+#ifndef EXPORTOOFILEDIALOG
+#define EXPORTOOFILEDIALOG
+
+#include
+#include
+
+#include "settings.h"
+
+class ExportOOFileDialog:public Q3FileDialog
+{
+ Q_OBJECT
+public:
+ ExportOOFileDialog();
+
+ ExportOOFileDialog (QWidget * parent = 0, const char * name = 0, bool
+ modal = false);
+ QString selectedConfig();
+ QString selectedFile();
+ void addFilter(const QString &);
+
+private slots:
+ void newConfigPath (const QString&f);
+
+private:
+ void init();
+ void scanExportConfigs(QDir );
+ QStringList configPaths;
+ QStringList filters;
+ QString lastFilter;
+
+};
+#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb exports.cpp
--- a/exports.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/exports.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,87 +1,103 @@
+#include
+#include
+#include
+//Added by qt3to4:
+#include
+
#include "exports.h"
+#include "file.h"
+#include "linkablemapobj.h"
+#include "misc.h"
+#include "mainwindow.h"
+#include "warningdialog.h"
+#include "xsltproc.h"
-#include "linkablemapobj.h"
+extern Main *mainWindow;
+extern QDir vymBaseDir;
-Export::Export()
+ExportBase::ExportBase()
{
indentPerDepth=" ";
+ // Create tmpdir
+ tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
}
-bool Export::setOutputDir(QString dirname)
+ExportBase::~ExportBase()
{
- outdir.setPath (dirname);
- if ( outdir.exists() )
- {
- // FIXME
- // ask for confirmation
- // then delete outdir
- return true;
- } else
- {
- // try to create directory
- //return outdir.mkdir (outdir.absPath());
- // FIXME
- return true;
- }
+ // Remove tmpdir
+ removeDir (tmpDir);
}
-void Export::setPath (const QString &p)
+void ExportBase::setDir(const QString &p)
{
- filepath=p;
+ outputDir=p;
}
-void Export::setMapCenter(MapCenterObj *mc)
+void ExportBase::setFile (const QString &p)
+{
+ outputFile=p;
+}
+
+void ExportBase::setMapCenter(MapCenterObj *mc)
{
mapCenter=mc;
}
-void Export::exportMap()
+void ExportBase::setCaption (const QString &s)
{
- QFile file (filepath);
- if ( !file.open( IO_WriteOnly ) )
- {
- // FIXME
- cout << "Export::exportMap couldn't open "<first();
- while (bo)
- {
- // Make indentstring
- for (i=0;igetDepth();i++) actIndent+= indentPerDepth;
-
- // Write heading
- // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
- if (bo->getDepth()==1)
- ts << (getSectionString(bo) + bo->getHeading()+ "\n");
- else
- ts << (actIndent + " - " + bo->getHeading()+ "\n");
-
- // If necessary, write note
- if (!bo->getNote().isEmpty())
- {
- ts << ("-------------------Begin of Note-----------------\n");
- ts << (bo->getNote());
- ts << ("\n");
- ts << ("-------------------End of Note-------------------\n");
- }
-
- bo=bo->next();
- actIndent="";
- }
- file.close();
+ caption=s;
}
-QString Export::getSectionString(BranchObj *bostart)
+void ExportBase::addFilter(const QString &s)
{
+ filter=s;
+}
+
+bool ExportBase::execDialog()
+{
+ if (mapCenter && mapCenter->getMapEditor())
+ {
+ Q3FileDialog *fd=new Q3FileDialog( mapCenter->getMapEditor(), caption);
+ fd->addFilter (filter);
+ fd->setCaption(caption);
+ fd->setMode( Q3FileDialog::AnyFile );
+ fd->show();
+
+ if ( fd->exec() == QDialog::Accepted )
+ {
+ if (QFile (fd->selectedFile()).exists() )
+ {
+ QMessageBox mb( __VYM,
+ QObject::tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()),
+ QMessageBox::Warning,
+ QMessageBox::Yes | QMessageBox::Default,
+ QMessageBox::Cancel | QMessageBox::Escape,
+ Qt::NoButton );
+ mb.setButtonText( QMessageBox::Yes, QObject::tr("Overwrite") );
+ mb.setButtonText( QMessageBox::No, QObject::tr("Cancel"));
+ ExportBase ex;
+ switch( mb.exec() )
+ {
+ case QMessageBox::Yes:
+ // save
+ break;;
+ case QMessageBox::Cancel:
+ // return, do nothing
+ return false;
+ break;
+ }
+ }
+ outputFile=fd->selectedFile();
+ return true;
+ }
+ }
+ return false;
+}
+
+QString ExportBase::getSectionString(BranchObj *bostart)
+{
+ // Make prefix like "2.5.3" for "bo:2,bo:5,bo:3"
QString r;
BranchObj *bo=bostart;
int depth=bo->getDepth();
@@ -97,13 +113,24 @@
return r + " ";
}
-void Export::exportAsHTML()
+
+////////////////////////////////////////////////////////////////////////
+void ExportASCII::doExport()
{
- // FIXME just testing...
+ QFile file (outputFile);
+ if ( !file.open( QIODevice::WriteOnly ) )
+ {
+ // FIXME experimental, testing
+ qWarning ("ExportBase::exportXML couldn't open "+outputFile);
+ return;
+ }
+ QTextStream ts( &file ); // use LANG decoding here...
+
// Main loop over all branches
QString s;
QString actIndent("");
int i;
+ uint j;
BranchObj *bo;
bo=mapCenter->first();
while (bo)
@@ -111,22 +138,338 @@
// Make indentstring
for (i=0;igetDepth();i++) actIndent+= indentPerDepth;
- // Write heading
- write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
+ if (bo->getDepth()==0)
+ {
+ ts << (bo->getHeading()+ "\n");
+ for (j=0;jgetHeading().length();j++) ts<<"=";
+ ts << "\n";
+ } else if (bo->getDepth()==1)
+ ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
+ else if (bo->getDepth()==2)
+ ts << (actIndent + " o " + bo->getHeading()+ "\n");
+ else
+ ts << (actIndent + " - " + bo->getHeading()+ "\n");
// If necessary, write note
if (!bo->getNote().isEmpty())
{
- write (bo->getNote());
+ s =bo->getNoteASCII();
+ s=s.replace ("\n","\n"+actIndent);
+ ts << (s+"\n\n");
}
-
bo=bo->next();
actIndent="";
}
+ file.close();
}
-void Export::write(QString s)
+////////////////////////////////////////////////////////////////////////
+void ExportKDEBookmarks::doExport()
{
- cout << s;
+ MapEditor *me=NULL;
+ if (mapCenter) me=mapCenter->getMapEditor();
+ if (me)
+ {
+ WarningDialog dia;
+ dia.setCancelButton (true);
+ dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
+ dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
+ dia.setShowAgainName("/vym/warnings/overwriteKDEBookmarks");
+ if (dia.exec()==QDialog::Accepted)
+ {
+ me->exportXML(tmpDir.path());
+
+ XSLTProc p;
+ p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
+ p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
+ p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
+ p.process();
+
+ QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
+ Q3Process *proc = new Q3Process( );
+ proc->addArgument(ub);
+
+ if ( !proc->start() )
+ {
+ QMessageBox::warning(0,
+ QObject::tr("Warning"),
+ QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
+ }
+
+
+ }
+ }
+
}
+////////////////////////////////////////////////////////////////////////
+void ExportFirefoxBookmarks::doExport()
+{
+ MapEditor *me=NULL;
+ if (mapCenter) me=mapCenter->getMapEditor();
+ if (me)
+ {
+ WarningDialog dia;
+ dia.setCancelButton (true);
+ dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
+ dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
+ dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
+ if (dia.exec()==QDialog::Accepted)
+ {
+ me->exportXML(tmpDir.path());
+
+/*
+ XSLTProc p;
+ p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
+ p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
+ p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
+ p.process();
+
+ QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
+ QProcess *proc = new QProcess( );
+ proc->addArgument(ub);
+
+ if ( !proc->start() )
+ {
+ QMessageBox::warning(0,
+ QObject::tr("Warning"),
+ QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
+ }
+
+*/
+
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////
+void ExportTaskjuggler::doExport()
+{
+ MapEditor *me=NULL;
+ if (mapCenter) me=mapCenter->getMapEditor();
+ if (me)
+ {
+ me->exportXML(tmpDir.path());
+
+ XSLTProc p;
+ p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
+ p.setOutputFile (outputFile);
+ p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
+ p.process();
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////
+void ExportLaTeX::doExport()
+{
+ // Exports a map to a LaTex file.
+ // This file needs to be included
+ // or inported into a LaTex document
+ // it will not add a preamble, or anything
+ // that makes a full LaTex document.
+ QFile file (outputFile);
+ if ( !file.open( QIODevice::WriteOnly ) ) {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(outputFile));
+ mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
+ return;
+ }
+ QTextStream ts( &file ); // use LANG decoding here...
+ ts.setEncoding (QTextStream::UnicodeUTF8); // Force UTF8
+
+ // Main loop over all branches
+ QString s;
+ // QString actIndent("");
+ // int i;
+ BranchObj *bo;
+ bo=mapCenter->first();
+ while (bo) {
+ if (bo->getDepth()==0);
+ else if (bo->getDepth()==1) {
+ ts << ("\\chapter{" + bo->getHeading()+ "}\n");
+ }
+ else if (bo->getDepth()==2) {
+ ts << ("\\section{" + bo->getHeading()+ "}\n");
+ }
+ else if (bo->getDepth()==3) {
+ ts << ("\\subsection{" + bo->getHeading()+ "}\n");
+ }
+ else if (bo->getDepth()==4) {
+ ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
+ }
+ else {
+ ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
+ }
+
+ // If necessary, write note
+ if (!bo->getNote().isEmpty()) {
+ ts << (bo->getNoteASCII());
+ ts << ("\n");
+ }
+ bo=bo->next();
+ }
+ file.close();
+}
+
+////////////////////////////////////////////////////////////////////////
+ExportOO::ExportOO()
+{
+ useSections=false;
+}
+
+ExportOO::~ExportOO()
+{
+}
+
+QString ExportOO::buildList (BranchObj *current)
+{
+ QString r;
+ BranchObj *bo;
+
+ uint i=0;
+ bo=current->getFirstBranch();
+ if (bo)
+ {
+ // Start list
+ r+="\n";
+ while (bo)
+ {
+ r+="";
+ r+=quotemeta(bo->getHeading());
+ // If necessary, write note
+ if (!bo->getNote().isEmpty())
+ r+=bo->getNoteOpenDoc();
+ r+="";
+ r+=buildList (bo); // recursivly add deeper branches
+ r+="\n";
+ i++;
+ bo=current->getBranchNum(i);
+ }
+ r+="\n";
+ }
+ return r;
+}
+
+
+void ExportOO::exportPresentation()
+{
+ QString allPages;
+
+ // Insert new content
+ content.replace ("",quotemeta(mapCenter->getHeading()));
+ content.replace ("",quotemeta(mapCenter->getAuthor()));
+
+ QString onePage;
+ QString list;
+
+ BranchObj *sectionBO=mapCenter->getFirstBranch();
+ int i=0;
+ BranchObj *pagesBO;
+ int j=0;
+
+ // Walk sections
+ while (sectionBO)
+ {
+ if (useSections)
+ {
+ // Add page with section title
+ onePage=sectionTemplate;
+ onePage.replace ("", quotemeta(sectionBO->getHeading() ) );
+ allPages+=onePage;
+ } else
+ {
+ i=-2; // only use inner loop to
+ // turn mainbranches into pages
+ sectionBO=mapCenter;
+ }
+
+ // Walk mainpages
+ pagesBO=sectionBO->getFirstBranch();
+ j=0;
+ while (pagesBO)
+ {
+ // Add page with list of items
+ onePage=pageTemplate;
+ onePage.replace ("", quotemeta (pagesBO->getHeading() ) );
+ list=buildList (pagesBO);
+ onePage.replace ("", list);
+ allPages+=onePage;
+ j++;
+ pagesBO=sectionBO->getBranchNum(j);
+ }
+ i++;
+ sectionBO=mapCenter->getBranchNum(i);
+ }
+
+ content.replace ("",allPages);
+
+ // Write modified content
+ QFile f (contentFile);
+ if ( !f.open( QIODevice::WriteOnly ) )
+ {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not write %1").arg(contentFile));
+ mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
+ return;
+ }
+
+ QTextStream t( &f );
+ t << content;
+ f.close();
+
+ // zip tmpdir to destination
+ zipDir (tmpDir,outputFile);
+}
+
+bool ExportOO::setConfigFile (const QString &cf)
+{
+ configFile=cf;
+ int i=cf.findRev ("/");
+ if (i>=0) configDir=cf.left(i);
+ SimpleSettings set;
+ set.readSettings(configFile);
+
+ // set paths
+ templateDir=configDir+"/"+set.readEntry ("Template");
+
+ QDir d (templateDir);
+ if (!d.exists())
+ {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Check \"%1\" in\n%2").arg("Template="+set.readEntry ("Template")).arg(configFile));
+ return false;
+
+ }
+
+ contentTemplateFile=templateDir+"content-template.xml";
+ contentFile=tmpDir.path()+"/content.xml";
+ pageTemplateFile=templateDir+"page-template.xml";
+ sectionTemplateFile=templateDir+"section-template.xml";
+
+ if (set.readEntry("useSections").contains("yes"))
+ useSections=true;
+
+ // Copy template to tmpdir
+ system ("cp -r "+templateDir+"* "+tmpDir.path());
+
+ // Read content-template
+ if (!loadStringFromDisk (contentTemplateFile,content))
+ {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(contentTemplateFile));
+ return false;
+ }
+
+ // Read page-template
+ if (!loadStringFromDisk (pageTemplateFile,pageTemplate))
+ {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(pageTemplateFile));
+ return false;
+ }
+
+ // Read section-template
+ if (useSections && !loadStringFromDisk (sectionTemplateFile,sectionTemplate))
+ {
+ QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("Could not read %1").arg(sectionTemplateFile));
+ return false;
+ }
+ return true;
+}
+
diff -r 9eb7767c2dfa -r 608f976aa7bb exportxhtmldialog.ui.h
--- a/exportxhtmldialog.ui.h Sun Jan 30 12:58:47 2005 +0000
+++ b/exportxhtmldialog.ui.h Tue Jun 06 14:58:11 2006 +0000
@@ -1,3 +1,6 @@
+//Added by qt3to4:
+#include
+#include
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
@@ -9,22 +12,22 @@
extern Settings settings;
+extern QDir vymBaseDir;
+extern Options options;
void ExportXHTMLDialog::init()
{
- dia=new ShowTextDialog ();
- xsltprocessor="xsltproc";
filepath="";
settingsChanged=false;
+ scriptProc=new Process;
}
void ExportXHTMLDialog::readSettings()
{
- dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
+ dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
lineEditDir->setText(dir);
-
if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
useImage=true;
else
@@ -63,12 +66,19 @@
showOutput=false;
outputButton->setChecked(showOutput);
- xsl=settings.readLocalEntry
- (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
+ // For testing better use local styles
+ if (options.isOn ("local"))
+ {
+ xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl";
+ css=vymBaseDir.path()+"/styles/vym.css";
+ } else
+ {
+ xsl=settings.readLocalEntry
+ (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
+ css=settings.readLocalEntry
+ (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");
+ }
lineEditXSL->setText(xsl);
-
- css=settings.readLocalEntry
- (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css");
lineEditCSS->setText(css);
prescript=settings.readLocalEntry
@@ -83,17 +93,16 @@
{
QMessageBox::warning( 0, tr( "Warning" ),tr(
"The settings saved in the map "
- "would like to run scripts:\n\n") +
- prescript +" "+postscript +"\n\n"+
- tr("Please check, if you really\n"
- "want to allow this in your system!"));
+ "would like to run scripts:\n\n"
+ "%1\n\n"
+ "Please check, if you really\n"
+ "want to allow this in your system!").arg(prescript+" "+postscript));
}
}
void ExportXHTMLDialog::destroy()
{
- delete (dia);
}
void ExportXHTMLDialog::dirChanged()
@@ -106,8 +115,8 @@
void ExportXHTMLDialog::browseDirectoryPressed()
{
- QFileDialog fd( this, tr("VYM - Export HTML to directory"));
- fd.setMode (QFileDialog::DirectoryOnly);
+ Q3FileDialog fd( this, tr("VYM - Export HTML to directory"));
+ fd.setMode (Q3FileDialog::DirectoryOnly);
fd.setCaption(tr("VYM - Export HTML to directory"));
fd.setModal (true);
fd.show();
@@ -159,7 +168,7 @@
void ExportXHTMLDialog::browseCSSPressed()
{
- QFileDialog fd( this, tr("VYM - Path to CSS file"));
+ Q3FileDialog fd( this, tr("VYM - Path to CSS file"));
fd.setModal (true);
fd.addFilter ("Cascading Stylesheet (*.css)");
fd.show();
@@ -186,9 +195,9 @@
void ExportXHTMLDialog::browseXSLPressed()
{
- QFileDialog fd( this, tr("VYM - Path to XSL file"));
+ Q3FileDialog fd( this, tr("VYM - Path to XSL file"));
fd.setModal (true);
- fd.addFilter ("Extensible Styleshee Language (*.xsl)");
+ fd.addFilter ("Extensible Stylesheet Language (*.xsl)");
fd.show();
if ( fd.exec() == QDialog::Accepted )
@@ -207,7 +216,7 @@
void ExportXHTMLDialog::browsePreExportButtonPressed()
{
- QFileDialog fd( this, tr("VYM - Path to pre export script"));
+ Q3FileDialog fd( this, tr("VYM - Path to pre export script"));
fd.setModal (true);
fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
fd.show();
@@ -223,7 +232,7 @@
void ExportXHTMLDialog::browsePostExportButtonPressed()
{
- QFileDialog fd( this, tr("VYM - Path to post export script"));
+ Q3FileDialog fd( this, tr("VYM - Path to post export script"));
fd.setModal (true);
fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
fd.show();
@@ -243,7 +252,6 @@
// (but don't save at destructor, which
// is called for "cancel", too)
settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir);
-
settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript);
settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript);
@@ -266,19 +274,25 @@
settings.writeEntry ("/vym/export/xhtml/showOutput","yes");
else
settings.writeEntry ("/vym/export/xhtml/showOutput","no");
-
- settings.setLocalEntry
- (filepath,"/vym/export/xhtml/xsl",xsl);
- settings.setLocalEntry
- (filepath,"/vym/export/xhtml/css",css);
- //FIXME add option for url image (globe flag) here
- if (true)
- {
- QPixmap pm (flag_url_xpm);
- pm.save (dir + "/flags/url.png","PNG");
+ QString ipath;
+ ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
+ if (!options.isOn ("local"))
+ {
+ settings.setLocalEntry
+ (filepath,"/vym/export/xhtml/xsl",xsl);
+ settings.setLocalEntry
+ (filepath,"/vym/export/xhtml/css",css);
}
+ // Provide a smaller URL-icon to improve Layout
+ QPixmap pm;
+ if (!pm.load(ipath,"PNG") )
+ QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
+
+
+ if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
+ QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
if (!saveSettingsInMap)
settings.clearLocal("/vym/export/xhtml");
else
@@ -288,12 +302,12 @@
// Copy CSS file
QFile css_src (css);
QFile css_dst (dir+"vym.css");
- if (!css_src.open ( IO_ReadOnly))
- QMessageBox::warning( 0, tr( "Warning" ),css +tr(" could not be opened!"));
+ if (!css_src.open ( QIODevice::ReadOnly))
+ QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css));
else
{
- if (!css_dst.open( IO_WriteOnly))
- QMessageBox::warning( 0, tr( "Warning" ), dir+"vym.css" +tr(" could not be opened!"));
+ if (!css_dst.open( QIODevice::WriteOnly))
+ QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css"));
else
{
@@ -308,52 +322,19 @@
if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
- Process *xsltProc=new Process ();
- xsltProc->clearArguments();
- xsltProc->addArgument (xsltprocessor);
if (useImage)
- {
- xsltProc->addArgument ("--stringparam");
- xsltProc->addArgument ("imagemap");
- xsltProc->addArgument ("images/"+mapname+".png");
- }
+ p.addStringParam ("imagemap","images/"+mapname+".png");
if (useTextColor)
- {
- xsltProc->addArgument ("--stringparam");
- xsltProc->addArgument ("use.textcolor");
- xsltProc->addArgument ("1");
- }
- xsltProc->addArgument ("--stringparam");
- xsltProc->addArgument ("mapname");
- xsltProc->addArgument (mapname+".vym");
+ p.addStringParam ("use.textcolor","1");
+ p.addStringParam ("mapname",mapname+".vym");
- xsltProc->addArgument ("--output");
- xsltProc->addArgument (dir+mapname+".html");
- xsltProc->addArgument (xsl);
- xsltProc->addArgument (dir+mapname+".xml");
- dia->append ("vym is executing: \n" + xsltProc->arguments().join(" ") );
- if (!xsltProc->start() )
- {
- QMessageBox::critical( 0, tr( "Critical Error" ),
- tr("Couldn't start ") + xsltprocessor );
- } else
- {
- xsltProc->waitFinished();
- if (!xsltProc->normalExit() )
- QMessageBox::critical( 0, tr( "Critical Error" ),
- xsltprocessor +" " +tr("didn't exit normally") +
- xsltProc->getErrout() );
- else
- if (xsltProc->exitStatus()>0) showOutput=true;
-
- }
- dia->append ("\n");
- dia->append (xsltProc->getErrout());
- dia->append (xsltProc->getStdout());
-
+ p.setOutputFile (dir+mapname+".html");
+ p.setInputFile (dir+mapname+".xml");
+ p.setXSLFile (xsl);
+ p.process();
+
if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
- if (showOutput) dia->exec();
}
void ExportXHTMLDialog::setFilePath(const QString &s)
@@ -387,26 +368,25 @@
spath.replace ("%f",fpath);
QStringList args=QStringList::split (' ',spath,false);
- Process *scriptProc=new Process ();
scriptProc->clearArguments();
scriptProc->setArguments (args);
- dia->append ("vym is executing: \n" + scriptProc->arguments().join(" ") );
+ p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );
if (!scriptProc->start() )
{
QMessageBox::critical( 0, tr( "Critical Error" ),
- tr("Couldn't start ") + spath );
+ tr("Could not start %1").arg(spath) );
} else
{
scriptProc->waitFinished();
if (!scriptProc->normalExit() )
QMessageBox::critical( 0, tr( "Critical Error" ),
- spath +" " +tr("didn't exit normally") +
+ tr("%1 didn't exit normally").arg(spath) +
scriptProc->getErrout() );
else
if (scriptProc->exitStatus()>0) showOutput=true;
}
- dia->append ("\n");
- dia->append (scriptProc->getErrout());
- dia->append (scriptProc->getStdout());
+ p.addOutput ("\n");
+ p.addOutput (scriptProc->getErrout());
+ p.addOutput (scriptProc->getStdout());
}
diff -r 9eb7767c2dfa -r 608f976aa7bb file.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/file.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,305 @@
+#include
+#include
+//Added by qt3to4:
+#include
+#include
+#include
+#include
+
+#include "file.h"
+#include "process.h"
+
+
+QString maskPath(QString p)
+{
+ // Change " " to "\ " to enable blanks in filenames
+ p=p.replace(QChar('&'),"\\&");
+ return p.replace(QChar(' '),"\\ ");
+}
+
+QString convertToRel (const QString &src, const QString &dst)
+{
+ QString s=src;
+ QString d=dst;
+ int i;
+
+ if (s==d)
+ {
+ // Special case, we just need the name of the file,
+ // not the complete path
+ i=d.findRev ("/");
+ d=d.right (d.length()-i-1);
+ } else
+ {
+ // Find relative path from src to dst
+
+ // Remove the first "/"
+ if (s.section ("/",0,0).isEmpty())
+ {
+ s=s.right (s.length()-1);
+ d=d.right (d.length()-1);
+ }
+
+ // remove identical left parts
+ while (s.section("/",0,0) == d.section("/",0,0) )
+ {
+ i=s.find ("/");
+ s=s.right (s.length()-i-1);
+ d=d.right (d.length()-i-1);
+ }
+
+ // Now take care of paths where we have to go back first
+ int srcsep=s.count("/");
+ int dstsep=d.count("/");
+ if (srcsep <= dstsep )
+ {
+ // find path to go up first and then back to dst
+ i=1;
+ while (i<=srcsep)
+ {
+ d="../"+d;
+ i++;
+ }
+ }
+ }
+ return d;
+}
+
+QString makeUniqueDir (QString s)
+{
+ // Create unique directory e.g. s="/tmp/vym-XXXXXX"
+
+ // Convert QString to string first
+ char *p;
+ int bytes=s.length();
+ p=(char*) malloc (bytes+1);
+ int i;
+ for (i=0;iclearArguments();
+ zipProc->setWorkingDirectory (QDir(zipDir));
+ zipProc->addArgument ("zip");
+ zipProc->addArgument ("-r");
+ zipProc->addArgument (zipName);
+ zipProc->addArgument (".");
+
+ if (!zipProc->start() )
+ {
+ // zip could not be started
+ QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+ QObject::tr("Couldn't start zip to compress data."));
+ err=aborted;
+ } else
+ {
+ // zip could be started
+ zipProc->waitFinished();
+ if (!zipProc->normalExit() )
+ {
+ QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+ QObject::tr("zip didn't exit normally")+
+ "\n" + zipProc->getErrout());
+ err=aborted;
+ } else
+ {
+ if (zipProc->exitStatus()>0)
+ {
+ QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+ QString("zip exit code: %1").arg(zipProc->exitStatus() )+
+ "\n" + zipProc->getErrout() );
+ err=aborted;
+ }
+ }
+ } // zip could be started
+ return err;
+}
+
+ErrorCode unzipDir (const QDir &zipDir, const QString &zipName)
+{
+ ErrorCode err=success;
+
+ // Try to unzip file
+ Process *zipProc=new Process ();
+ zipProc->clearArguments();
+ zipProc->setWorkingDirectory (zipDir);
+ zipProc->addArgument ("unzip");
+ zipProc->addArgument ("-o"); // overwrite existing files!
+ zipProc->addArgument (zipName );
+ zipProc->addArgument ("-d");
+ zipProc->addArgument (zipDir.path());
+
+ if (!zipProc->start() )
+ {
+ QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+ QObject::tr("Couldn't start unzip to decompress data."));
+ err=aborted;
+
+ } else
+ {
+ zipProc->waitFinished();
+ if (!zipProc->normalExit() )
+ {
+ QMessageBox::critical( 0,QObject::tr( "Critical Error" ),
+ QObject::tr("unzip didn't exit normally") +
+ zipProc->getErrout() );
+ err=aborted;
+ } else
+ {
+ if (zipProc->exitStatus()>0)
+ {
+ if (zipProc->exitStatus()==9)
+ // no zipped file, but maybe .xml or old version? Try again.
+ err=nozip;
+ else
+ {
+ QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+ QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
+ zipProc->getErrout() );
+ err=aborted;
+ }
+ }
+ }
+ }
+ return err;
+}
+
+bool loadStringFromDisk (const QString &fname, QString &s)
+{
+ s="";
+ QFile file ( fname);
+ if ( !file.open( QIODevice::ReadOnly ) ) return false;
+
+ QTextStream ts( &file );
+ ts.setEncoding (QTextStream::UnicodeUTF8);
+ while ( !ts.atEnd() )
+ s+=ts.readLine()+"\n";
+ file.close();
+ return true;
+}
+
+bool saveStringToDisk (const QString &fname, const QString &s)
+{
+ QFile file( fname);
+
+ file.setName ( fname);
+ if ( !file.open( QIODevice::WriteOnly ) )
+ {
+ file.close();
+ return false;
+ }
+
+ // Write it finally, and write in UTF8, no matter what
+ QTextStream ts( &file );
+ ts.setEncoding (QTextStream::UnicodeUTF8);
+ ts << s;
+ file.close();
+ return true;
+}
+
+
+ImagePreview::ImagePreview (QWidget *par=0): QLabel (par)
+{
+ fdia=(Q3FileDialog*)par;
+}
+
+void ImagePreview::previewUrl( const Q3Url &u )
+{
+ QString path = u.path();
+ QPixmap pix( path );
+ if ( pix.isNull() )
+ {
+ // Strange: If we have fd->setMode (QFileDialog::ExistingFiles)
+ // in the filedialog, then there are 3 calls to previewURL
+ // for each selection. And only the first is the actual selected file
+ // while the following 2 point to the directory above the current one.
+ // So here's my workaround:
+
+ if (fdia && fdia->selectedFiles().count()==0)
+ setText( QObject::tr("This is not an image.") );
+ if (fdia &&fdia->selectedFiles().count()>1)
+ setText( QObject::tr("Sorry, no preview for\nmultiple selected files.") );
+ }
+ else
+ {
+ float max_w=300;
+ float max_h=300;
+ float r;
+ if (pix.width()>max_w)
+ {
+ r=max_w / pix.width();
+ pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
+ // FIXME not a resize, but a shrink/enlarge is needed here...
+ }
+ if (pix.height()>max_h)
+ {
+ r=max_h / pix.height();
+ pix.resize(qRound(pix.width()*r), qRound(pix.height()*r));
+ // FIXME not a resize, but a shrink/enlarge is needed here...
+ }
+ setPixmap( pix );
+ }
+}
+
diff -r 9eb7767c2dfa -r 608f976aa7bb file.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/file.h Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,36 @@
+#ifndef FILE_H
+#define FILE_H
+
+#include
+
+enum LoadMode {NewMap,ImportAdd,ImportReplace};
+enum SaveMode {PartOfMap,CompleteMap,UndoCommand};
+enum ErrorCode {success,aborted,nozip};
+
+
+/////////////////////////////////////////////////////////////////////////////
+QString maskPath (QString );
+QString convertToRel (const QString &,const QString &);
+QString makeUniqueDir (QString);
+void removeDir(QDir);
+void makeSubDirs (const QString &);
+ErrorCode zipDir (const QDir &,const QString&);
+ErrorCode unzipDir (const QDir &,const QString&);
+bool loadStringFromDisk (const QString &, QString &);
+bool saveStringToDisk (const QString &, const QString &s);
+
+/////////////////////////////////////////////////////////////////////////////
+#include
+#include
+#include
+
+class ImagePreview : public QLabel, public Q3FilePreview
+{
+public:
+ ImagePreview( QWidget * );
+ void previewUrl( const Q3Url & );
+protected:
+ Q3FileDialog *fdia;
+};
+
+#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb findwindow.cpp
--- a/findwindow.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/findwindow.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,21 +1,26 @@
#include
+//Added by qt3to4:
+#include
+#include
+#include
#include "findwindow.h"
+#include "version.h"
-FindWindow::FindWindow(QWidget* parent, const char* name, WFlags f)
- : QGroupBox( 0, Horizontal, "Find", parent, name )
+FindWindow::FindWindow(QWidget* parent, const char* name)
+ : Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name )
{
- setCaption ("VYM - Find Text");
+ setCaption (__VYM " - " +tr("Find Text"));
//resize (180,130);
move (130,130);
- setMargin( 100 );
+ //FIXME not avail in QT4 setMargin( 100 );
- QVBoxLayout* box = new QVBoxLayout( layout() );
+ Q3VBoxLayout* box = new Q3VBoxLayout( layout() );
- QHBoxLayout *row1 = new QHBoxLayout( box );
+ Q3HBoxLayout *row1 = new Q3HBoxLayout( box );
row1->setMargin( 10 );
// Create a Label
@@ -23,7 +28,7 @@
row1->addWidget( label );
// Create LineEdit (here QComboBox)
- QHBoxLayout *row2 = new QHBoxLayout( box );
+ Q3HBoxLayout *row2 = new Q3HBoxLayout( box );
row2->setMargin( 10 );
findcombo = new QComboBox( true, this );
findcombo->setMinimumWidth(150);
@@ -35,7 +40,7 @@
//findcombo->insertItem( "Normal", -1 );
// Create Buttons
- QHBoxLayout *row3 = new QHBoxLayout( box );
+ Q3HBoxLayout *row3 = new Q3HBoxLayout( box );
row3->setMargin( 10 );
clearbutton = new QPushButton (tr("Clear"),this);
connect ( clearbutton, SIGNAL( clicked() ),
@@ -46,7 +51,7 @@
row3->addItem(si1);
cancelbutton = new QPushButton (tr("Cancel"),this);
- cancelbutton->setAccel (Key_Escape);
+ cancelbutton->setAccel (Qt::Key_Escape);
connect ( cancelbutton, SIGNAL( clicked() ),
this, SLOT( cancelPressed() ) );
row3->addWidget (cancelbutton);
diff -r 9eb7767c2dfa -r 608f976aa7bb findwindow.h
--- a/findwindow.h Sun Jan 30 12:58:47 2005 +0000
+++ b/findwindow.h Tue Jun 06 14:58:11 2006 +0000
@@ -1,20 +1,20 @@
#ifndef FINDWINDOW_H
#define FINDWINDOW_H
-#include
+#include
#include
#include
-#include
+#include
#include
#include
-class FindWindow : public QGroupBox
+class FindWindow : public Q3GroupBox
{
Q_OBJECT
public:
- FindWindow (QWidget* parent=0, const char* namme=0, WFlags f=0);
+ FindWindow (QWidget* parent=0, const char* namme=0);
public slots:
void popup();
@@ -27,7 +27,7 @@
void somethingChanged(); // emit to mainwindow
private:
- QGroupBox *findbox;
+ Q3GroupBox *findbox;
QComboBox *findcombo;
QPushButton *clearbutton;
QPushButton *findbutton;
diff -r 9eb7767c2dfa -r 608f976aa7bb flagobj.cpp
--- a/flagobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/flagobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,17 +1,19 @@
#include "flagobj.h"
+//Added by qt3to4:
+#include
/////////////////////////////////////////////////////////////////
// FlagObj
/////////////////////////////////////////////////////////////////
FlagObj::FlagObj()
{
-// cout << "Const FlagObj ()\n";
+// cout << "Const FlagObj ()\n";
init ();
}
-FlagObj::FlagObj(QCanvas* c):MapObj(c)
+FlagObj::FlagObj(Q3Canvas* c):MapObj(c)
{
-// cout << "Const FlagObj\n";
+// cout << "Const FlagObj canvas="<move (absPos.x(), absPos.y() );
@@ -41,6 +44,7 @@
{
MapObj::copy(other);
name=other->name;
+ group=other->group;
tooltip=other->tooltip;
state=other->state;
icon->copy(other->icon);
@@ -95,6 +99,16 @@
return name;
}
+void FlagObj::setGroup (const QString &n)
+{
+ group=n;
+}
+
+const QString FlagObj::getGroup()
+{
+ return group;
+}
+
void FlagObj::setToolTip(const QString &n)
{
tooltip=n;
@@ -182,8 +196,8 @@
void FlagObj::positionBBox()
{
- bbox.setX (absPos.x() );
- bbox.setY (absPos.y() );
+ bbox.moveTopLeft (absPos );
+ clickBox.moveTopLeft (absPos );
}
void FlagObj::calcBBoxSize()
@@ -197,5 +211,6 @@
{
bbox.setSize (QSize(0,0));
}
+ clickBox.setSize (bbox.size());
}
diff -r 9eb7767c2dfa -r 608f976aa7bb flagobj.h
--- a/flagobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/flagobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -2,8 +2,10 @@
#define FLAGOBJ_H
-#include
+#include
#include
+//Added by qt3to4:
+#include
#include "mapobj.h"
#include "imageobj.h"
@@ -12,7 +14,7 @@
class FlagObj:public MapObj {
public:
FlagObj ();
- FlagObj (QCanvas*);
+ FlagObj (Q3Canvas*);
FlagObj (FlagObj*);
~FlagObj ();
virtual void init ();
@@ -24,6 +26,8 @@
void load (const QPixmap&);
void setName (const QString&);
const QString getName ();
+ void setGroup (const QString&);
+ const QString getGroup();
void setToolTip(const QString&);
const QString getToolTip();
void setButton (QAction*);
@@ -40,6 +44,7 @@
protected:
QString name;
+ QString group;
QString tooltip;
bool state;
bool used;
diff -r 9eb7767c2dfa -r 608f976aa7bb flagrowobj.cpp
--- a/flagrowobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/flagrowobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -5,11 +5,11 @@
/////////////////////////////////////////////////////////////////
FlagRowObj::FlagRowObj()
{
- cout << "Const FlagRowObj ()\n";
+// cout << "Const FlagRowObj ()\n";
init ();
}
-FlagRowObj::FlagRowObj(QCanvas* c):MapObj(c)
+FlagRowObj::FlagRowObj(Q3Canvas* c):MapObj(c)
{
// cout << "Const FlagRowObj\n";
init ();
@@ -25,6 +25,7 @@
{
flag.setAutoDelete (true);
parentRow=NULL;
+ showFlags=true;
}
void FlagRowObj::copy (FlagRowObj* other)
@@ -86,8 +87,8 @@
void FlagRowObj::positionBBox()
{
- bbox.setX (absPos.x() );
- bbox.setY (absPos.y() );
+ bbox.moveTopLeft(absPos );
+ clickBox.moveTopLeft(absPos );
}
void FlagRowObj::calcBBoxSize()
@@ -104,15 +105,16 @@
if (size.height() > boxsize.height() )
boxsize.setHeight(size.height() );
}
- bbox.setSize (QSize(boxsize.width(), boxsize.height() ));
+ bbox.setSize (boxsize);
+ clickBox.setSize (boxsize);
}
QString FlagRowObj::getFlagName (const QPoint &p)
{
- if (!inBBox (p)) return "";
+ if (!inBox (p)) return "";
FlagObj *fo;
for (fo=flag.first();fo; fo=flag.next() )
- if (fo->inBBox (p)) return fo->getName();
+ if (fo->inBox (p)) return fo->getName();
return "";
@@ -121,19 +123,14 @@
bool FlagRowObj::isActive (const QString &foname)
{
FlagObj *fo=findFlag (foname);
- if (parentRow)
- {
- if (fo)
- return fo->isActive();
- else
- qWarning ("FlagRowObj::isActive of "+name+" couldn't find "+foname);
-
- } else
+ if (parentRow && fo)
+ return fo->isActive();
+ else
if (fo) return true;
return false;
}
-void FlagRowObj::toggle (const QString &foname)
+void FlagRowObj::toggle (const QString &foname, bool exclusive)
{
FlagObj *fo=findFlag (foname);
if (fo)
@@ -150,6 +147,11 @@
{
fo=addFlag (fo);
fo->activate();
+ if (exclusive)
+ {
+ deactivateGroup (fo);
+ updateToolbar();
+ }
} else
qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow");
}
@@ -159,6 +161,8 @@
void FlagRowObj::activate (const QString &foname)
{
+ // Note: "activate" is also called during loading of a map
+ // Here we do not check for exclusive flags!
FlagObj *fo=findFlag (foname);
if (parentRow)
{
@@ -171,9 +175,11 @@
{
fo=addFlag (fo);
fo->activate();
- fo->setVisibility (visible);
+ if (showFlags)
+ fo->setVisibility (visible);
+ else
+ fo->setVisibility (false);
calcBBoxSize();
- positionBBox();
} else
qWarning ("FlagRowObj ("+name+")::activate ("+foname+") failed - could not find it in parentRow");
}
@@ -190,6 +196,7 @@
}
}
+
void FlagRowObj::deactivate (const QString &foname)
{
FlagObj *fo=findFlag (foname);
@@ -204,13 +211,27 @@
{
FlagObj *fo;
for (fo=flag.first();fo; fo=flag.next() )
- {
fo->deactivate();
- }
} else
qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
}
+void FlagRowObj::deactivateGroup (FlagObj *keepfo)
+{
+ // deactivate all flags in keepof, but keep keepfo [sic!]
+ if (keepfo)
+ {
+ QString g=keepfo->getGroup();
+ if (g!="undefined")
+ {
+ FlagObj *fo;
+ for (fo=flag.first();fo; fo=flag.next() )
+ if (g==fo->getGroup() && keepfo!=fo)
+ flag.remove(fo);
+ }
+ }
+}
+
void FlagRowObj::setEnabled (bool b)
{
// If we have no parent, we are the default FlagRowObj
@@ -223,6 +244,11 @@
}
}
+void FlagRowObj::setShowFlags (bool b)
+{
+ showFlags=b;
+}
+
void FlagRowObj::resetUsedCounter()
{
FlagObj *fo;
@@ -260,26 +286,28 @@
name=n;
}
-void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n)
+void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
{
+ //Only make toolbar for the parentrow, not each row in branches
if (!parentRow)
{
// create bar and buttons
- QToolBar* tb = new QToolBar( w);
+ Q3ToolBar* tb = new Q3ToolBar( w);
tb->setLabel (n);
QAction *a;
FlagObj *fo;
for (fo=flag.first();fo; fo=flag.next() )
{
a=new QAction (
- fo->getToolTip(),
+// FIXME was in QT3: fo->getToolTip(),
fo->getPixmap(),
fo->getName(),
- 0,
- w,
- fo->getName()
+// 0,
+ w
+// fo->getName()
);
a->setToggleAction(true);
+// a->setTooltip (fo->getToolTip());
// FIXME should not be enabled by default, later in updateToolbar
a->setEnabled(true);
a->addTo (tb);
@@ -288,10 +316,10 @@
w, SLOT( standardFlagChanged() ) );
}
} else
- qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows");
+ qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
}
-void FlagRowObj::updateToolBar()
+void FlagRowObj::updateToolbar()
{
FlagObj *fo;
if (parentRow)
@@ -301,7 +329,7 @@
// In parentRow activate all existing (==active) flags
for (fo=flag.first();fo; fo=flag.next() )
parentRow->activate(fo->getName());
- parentRow->updateToolBar();
+ parentRow->updateToolbar();
} else
{
// We are the toolbar default
diff -r 9eb7767c2dfa -r 608f976aa7bb flagrowobj.h
--- a/flagrowobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/flagrowobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -1,7 +1,9 @@
#ifndef FLAGROWOBJ_H
#define FLAGROWOBJ_H
-#include
+#include
+//Added by qt3to4:
+#include
#include "mapobj.h"
#include "flagobj.h"
@@ -9,7 +11,7 @@
class FlagRowObj:public QObject,public MapObj {
public:
FlagRowObj ();
- FlagRowObj (QCanvas*);
+ FlagRowObj (Q3Canvas*);
~FlagRowObj ();
virtual void init ();
virtual void copy (FlagRowObj*);
@@ -22,20 +24,23 @@
virtual void calcBBoxSize();
virtual QString getFlagName (const QPoint &p); // Find flag by position
bool isActive(const QString&);
- void toggle (const QString&);
+ void toggle (const QString&,bool);
void activate(const QString&);
void deactivate(const QString&);
void deactivateAll();
+ void deactivateGroup(FlagObj *);
void setEnabled (bool);
+ void setShowFlags (bool);
void resetUsedCounter();
QString saveToDir (const QString &,const QString &,bool);
void setName (const QString&); // prefix for exporting flags to dir
- void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons
- void updateToolBar(); // Update Toolbar buttons
+ void makeToolbar (Q3MainWindow*, const QString &); // Create Toolbar buttons
+ void updateToolbar(); // Update Toolbar buttons
private:
FlagRowObj* parentRow; // look for flags in this row
FlagObj* findFlag (const QString&);
- QPtrList flag;
+ Q3PtrList flag;
QString name;
+ bool showFlags; // FloatObjects want to hide their flags
};
#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb floatimageobj.cpp
--- a/floatimageobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/floatimageobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,13 +1,14 @@
#include "floatimageobj.h"
#include "branchobj.h"
-#include
+//Added by qt3to4:
+#include
/////////////////////////////////////////////////////////////////
// FloatImageObj
/////////////////////////////////////////////////////////////////
-int FloatImageObj::counter=0; // make instance
+uint FloatImageObj::saveCounter=0; // make instance
FloatImageObj::FloatImageObj ():FloatObj()
@@ -18,7 +19,7 @@
depth=-1;
}
-FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
+FloatImageObj::FloatImageObj (Q3Canvas* c):FloatObj(c)
{
// cout << "Const FloatImageObj (c) called from MapCenterObj (c)\n";
setParObj (this);
@@ -26,7 +27,7 @@
depth=-1;
}
-FloatImageObj::FloatImageObj (QCanvas* c, LinkableMapObj* p):FloatObj(c,p)
+FloatImageObj::FloatImageObj (Q3Canvas* c, OrnamentedObj* p):FloatObj(c,p)
{
// cout << "Const FloatImageObj (c,p)\n";
init();
@@ -43,18 +44,26 @@
icon=new ImageObj (canvas);
icon->move (absPos.x(), absPos.y() );
icon->setVisibility (true);
+ setZ (Z_FLOATIMG);
bbox.setSize (QSize(icon->size().width(), icon->size().height()));
+ clickBox.setSize (QSize(icon->size().width(), icon->size().height()));
filename="";
originalFilename="no original name available";
filetype="";
saveInMap=true;
+ useRelPos=true;
+
+ //Hide flags
+ systemFlags->setShowFlags(false);
}
void FloatImageObj::copy (FloatImageObj* other)
{
FloatObj::copy (other);
icon->copy (other->icon);
+ filetype=other->filetype;
filename=other->filename;
+ originalFilename=other->originalFilename;
saveInMap=other->saveInMap;
positionBBox();
}
@@ -67,7 +76,17 @@
int FloatImageObj::z ()
{
- return lrint (icon->z());
+ return qRound (icon->z());
+}
+
+void FloatImageObj::load (const QPixmap &pixmap)
+{
+ icon->load(pixmap);
+ bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
+ clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
+ positionBBox();
+ filetype="PNG";
+ filename="noname.png";
}
bool FloatImageObj::load (const QString &fn)
@@ -77,7 +96,8 @@
bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
positionBBox();
filename=fn;
- filetype=QPixmap::imageFormat (fn);
+//FIXME QT3 was filetype=QPixmap::imageFormat (fn);
+ setOriginalFilename (fn);
return true;
} else
return false;
@@ -92,6 +112,10 @@
void FloatImageObj::setOriginalFilename(const QString & fn)
{
originalFilename=fn;
+
+ // Set short name, too. Search from behind:
+ int i=originalFilename.findRev("/");
+ if (i>=0) originalFilename=originalFilename.remove (0,i+1);
}
QString FloatImageObj::getOriginalFilename()
@@ -101,7 +125,7 @@
void FloatImageObj::setVisibility(bool v)
{
- LinkableMapObj::setVisibility(v);
+ OrnamentedObj::setVisibility(v);
if (v)
icon->setVisibility(true);
else
@@ -122,7 +146,7 @@
void FloatImageObj::positionBBox()
{
- // TODO
+ clickBox=bbox;
}
void FloatImageObj::calcBBoxSize()
@@ -130,14 +154,12 @@
// TODO
}
-QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
+QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint &p)
{
- counter++;
+ if (hidden) return "";
- QString posAttr=
- attribut("relPosX",QString().setNum(relPos.x(),10)) +
- attribut("relPosY",QString().setNum(relPos.y(),10));
-
+ saveCounter++;
+
QString useOrientAttr;
if (useOrientation)
useOrientAttr=attribut ("useOrientation","true");
@@ -164,24 +186,27 @@
if (filetype=="GIF")
filetype="PNG";
- url="images/"+prefix+"image-" + QString().number(counter,10) + "." +filetype;
+ url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype;
// And really save the image
icon->save (tmpdir + "/" + url, filetype);
+
+ QString nameAttr=attribut ("orgName",originalFilename);
return singleElement ("floatimage",
- posAttr +
- useOrientAttr +
- saveInMapAttr +
- exportAttr +
- zAttr +
- attribut ("href",QString ("file:")+url)
+ getOrnAttr()
+ +useOrientAttr
+ +saveInMapAttr
+ +exportAttr
+ +zAttr
+ +attribut ("href",QString ("file:")+url)
+ +nameAttr
);
}
void FloatImageObj::resetSaveCounter()
{
- counter=0;
+ saveCounter=0;
}
diff -r 9eb7767c2dfa -r 608f976aa7bb floatimageobj.h
--- a/floatimageobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/floatimageobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -2,19 +2,22 @@
#define FLOATIMAGEOBJ_H
#include "floatobj.h"
+//Added by qt3to4:
+#include
/////////////////////////////////////////////////////////////////////////////
class FloatImageObj:public FloatObj {
public:
FloatImageObj ();
- FloatImageObj (QCanvas*);
- FloatImageObj (QCanvas*, LinkableMapObj* parent);
+ FloatImageObj (Q3Canvas*);
+ FloatImageObj (Q3Canvas*, OrnamentedObj* parent);
~FloatImageObj ();
virtual void init ();
virtual void copy (FloatImageObj*);
virtual void setZ (const int&);
virtual int z();
+ virtual void load (const QPixmap &);
virtual bool load (const QString &);
virtual void save (const QString &, const char *);
virtual void setOriginalFilename(const QString &);
@@ -27,7 +30,7 @@
virtual QRect getTotalBBox(); // return BBox including childs
virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
- virtual QString saveToDir(const QString &,const QString&);
+ virtual QString saveToDir(const QString &,const QString&, const QPoint &);
virtual void resetSaveCounter();
virtual QString getSelectString();
@@ -35,7 +38,7 @@
protected:
ImageObj *icon;
bool saveInMap;
- static int counter; // numerate the files during saveToDir
+ static uint saveCounter; // numerate the files during saveToDir
QString filetype;
QString filename;
QString originalFilename;
diff -r 9eb7767c2dfa -r 608f976aa7bb floatobj.cpp
--- a/floatobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/floatobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -6,7 +6,7 @@
// FloatObj
/////////////////////////////////////////////////////////////////
-FloatObj::FloatObj ():LinkableMapObj()
+FloatObj::FloatObj ():OrnamentedObj()
{
// cout << "Const FloatObj ()\n";
setParObj (this);
@@ -14,7 +14,7 @@
depth=-1;
}
-FloatObj::FloatObj (QCanvas* c):LinkableMapObj(c)
+FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
{
// cout << "Const FloatObj (c) called from MapCenterObj (c)\n";
setParObj (this);
@@ -22,7 +22,7 @@
depth=-1;
}
-FloatObj::FloatObj (QCanvas* c, LinkableMapObj* p):LinkableMapObj (c)
+FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
{
// cout << "Const FloatObj (c,p)\n";
setParObj (p);
@@ -38,39 +38,18 @@
void FloatObj::init ()
{
setChildObj(this);
- relPos=getRandPos();
- useOrientation=true;
floatExport=true;
zPlane=Z_ICON;
+ setLinkStyle (StyleParabel);
+ setHideLinkUnselected(true);
}
void FloatObj::copy (FloatObj* other)
{
LinkableMapObj::copy (other);
- relPos=other->relPos;
- useOrientation=other->useOrientation;
setVisibility (other->visible);
}
-void FloatObj::setRelPos()
-{
- if (useOrientation)
- {
- if (parObj->getOrientation()==OrientLeftOfCenter)
- relPos.setX ( parObj->x() +parObj->width() - bbox.width() -absPos.x());
- else
- relPos.setX (absPos.x() - parObj->x() );
- }
- else
- relPos.setX (absPos.x() - parObj->x() );
- relPos.setY (absPos.y() - parObj->y() );
-}
-
-void FloatObj::setRelPos(const QPoint &p)
-{
- relPos=p;
-}
-
void FloatObj::setZ(const int &i)
{
zPlane=i;
@@ -81,16 +60,6 @@
return zPlane;
}
-
-void FloatObj::setUseOrientation (const bool &b)
-{
- if (useOrientation!=b)
- {
- useOrientation=b;
- requestReposition();
- }
-}
-
void FloatObj::setFloatExport(const bool& b)
{
floatExport=b;
@@ -112,17 +81,15 @@
move (p.x(), p.y());
}
+void FloatObj::setDockPos()
+{
+ parPos=absPos;
+ childPos=absPos;
+}
+
void FloatObj::reposition()
{
- if (useOrientation)
- {
- if (parObj->getOrientation()==OrientLeftOfCenter)
- move (parObj->x() - relPos.x() + parObj->width() - bbox.width(), parObj->y()+relPos.y());
- else
- move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
- }
- else
- move (parObj->x()+relPos.x(), parObj->y()+relPos.y());
+ move (parObj->getChildPos().x()+relPos.x(), parObj->getChildPos().y()+relPos.y());
updateLink();
}
@@ -139,25 +106,11 @@
void FloatObj::select()
{
LinkableMapObj::select();
- // Temporary draw the link while FO is selected
- if (style==StyleUndef)
- {
- setLinkStyle(getDefLinkStyle());
- setLinkColor(parObj->getLinkColor());
- }
-
- // Update FloatExport switch in context menu
- if (floatExport)
- actionEditToggleFloatExport->setEnabled (true);
- else
- actionEditToggleFloatExport->setEnabled (true);
-
-
+ LinkableMapObj::setLinkColor(parObj->getLinkColor());
}
void FloatObj::unselect()
{
LinkableMapObj::unselect();
- setLinkStyle (StyleUndef);
}
diff -r 9eb7767c2dfa -r 608f976aa7bb floatobj.h
--- a/floatobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/floatobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -1,43 +1,37 @@
#ifndef FLOATOBJ_H
#define FLOATOBJ_H
-#include "linkablemapobj.h"
+#include "ornamentedobj.h"
/////////////////////////////////////////////////////////////////////////////
-class FloatObj:public LinkableMapObj {
+class FloatObj:public OrnamentedObj {
public:
FloatObj ();
- FloatObj (QCanvas*);
- FloatObj (QCanvas*, LinkableMapObj* parent);
+ FloatObj (Q3Canvas*);
+ FloatObj (Q3Canvas*, LinkableMapObj* parent);
~FloatObj ();
virtual void init ();
virtual void copy (FloatObj*);
virtual bool load (const QString&)=0;
- virtual void setRelPos(); // set relPos to current parentPos
- virtual void setRelPos(const QPoint&);
virtual void setZ(const int&); // set zPlane
virtual int z();
- virtual void setUseOrientation (const bool &);
virtual void setFloatExport (const bool &);
virtual bool getFloatExport ();
virtual void move (double,double);
virtual void move (QPoint);
-
+ virtual void setDockPos();
virtual void reposition();
virtual QRect getTotalBBox(); // return BBox including childs
virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
- virtual QString saveToDir(const QString &,const QString&)=0;
virtual void resetSaveCounter()=0;
virtual void select();
virtual void unselect();
protected:
- QPoint relPos;
- bool useOrientation;
bool floatExport;
int zPlane;
};
diff -r 9eb7767c2dfa -r 608f976aa7bb frameobj.cpp
--- a/frameobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/frameobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -11,7 +11,7 @@
init ();
}
-FrameObj::FrameObj(QCanvas* c) :MapObj(c)
+FrameObj::FrameObj(Q3Canvas* c) :MapObj(c)
{
// cout << "Const FrameObj\n";
init ();
@@ -117,16 +117,13 @@
break;
case Rectangle:
border=10;
- rectFrame = new QCanvasRectangle (canvas);
+ rectFrame = new Q3CanvasRectangle (canvas);
rectFrame->setZ(Z_FRAME);
rectFrame->setBrush( QColor("white") );
rectFrame->setPen( QPen(QColor("black") ));
- if (visible)
- rectFrame->show();
- else
- rectFrame->hide();
break;
}
+ setVisibility (visible);
}
}
@@ -141,6 +138,16 @@
void FrameObj::setVisibility (bool v)
{
MapObj::setVisibility(v);
- setFrameType (type); // changes on visibility depend on type...
+ switch (type)
+ {
+ case NoFrame:
+ break;
+ case Rectangle:
+ if (visible)
+ rectFrame->show();
+ else
+ rectFrame->hide();
+ break;
+ }
}
diff -r 9eb7767c2dfa -r 608f976aa7bb frameobj.h
--- a/frameobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/frameobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -8,7 +8,7 @@
class FrameObj:public MapObj {
public:
FrameObj();
- FrameObj(QCanvas*);
+ FrameObj(Q3Canvas*);
~FrameObj();
void init();
void clear();
@@ -26,7 +26,7 @@
protected:
FrameType type;
- QCanvasRectangle* rectFrame;
+ Q3CanvasRectangle* rectFrame;
int border; // distance text - frame
};
#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb headingobj.cpp
--- a/headingobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/headingobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,4 +1,5 @@
#include "headingobj.h"
+#include
/////////////////////////////////////////////////////////////////
// HeadingObj
@@ -9,7 +10,7 @@
init ();
}
-HeadingObj::HeadingObj(QCanvas* c) :MapObj(c)
+HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
{
// cout << "Const HeadingObj\n";
init ();
@@ -26,6 +27,7 @@
textwidth=40;
color=QColor ("black");
font=QFont();
+ heading="";
}
void HeadingObj::copy(HeadingObj *other)
@@ -40,13 +42,15 @@
void HeadingObj::move(double x, double y)
{
MapObj::move(x,y);
+
int h; // height of a textline
int ho; // offset of height while drawing all lines
+
if (textline.first() )
h=textline.first()->boundingRect().height();
else
h=2;
- QCanvasText *t;
+ Q3CanvasText *t;
ho=0;
for (t=textline.first(); t; t=textline.next() )
{
@@ -76,7 +80,7 @@
// then no selection would be visible, thus we prevent it in ::setText()
if (!textline.isEmpty() )
{
- QCanvasText *t;
+ Q3CanvasText *t;
for (t=textline.first(); t; t=textline.next() )
{
h+=t->boundingRect().height();
@@ -87,14 +91,15 @@
bbox.setSize (QSize(w,h));
}
-QCanvasText* HeadingObj::newLine(QString s)
+Q3CanvasText* HeadingObj::newLine(QString s)
{
- QCanvasText *t;
- t = new QCanvasText(canvas);
+ Q3CanvasText *t;
+ t = new Q3CanvasText(canvas);
t->setFont (font);
t->setColor (color);
t->setZ(Z_TEXT);
t->setText(s);
+ t->setTextFlags(Qt::AlignLeft);
t->show();
return t;
}
@@ -114,15 +119,17 @@
int j=0; // index of last ws
int k=0; // index of " " or similar linebreak
int br=0; // width of found break, e.g. for it is 4
+ QRegExp re("");
+ re.setMinimal (true);
// set the text and wrap lines
while (s.length()>0)
{
// ok, some people wanted manual linebreaks, here we go
- k=s.find (" ",i,false);
+ k=re.search (s,i);
if (k>=0)
{
- br=4;
+ br=re.cap(0).length();
i=k;
} else
i=s.find (" ",i,false);
@@ -184,6 +191,7 @@
}
}
setVisibility (visible);
+ move (absPos.x(),absPos.y());
calcBBoxSize();
}
@@ -212,7 +220,7 @@
if (color!=c)
{
color=c;
- QCanvasText *t;
+ Q3CanvasText *t;
for (t=textline.first(); t; t=textline.next() )
t->setColor(c);
}
@@ -226,7 +234,7 @@
void HeadingObj::setVisibility (bool v)
{
MapObj::setVisibility(v);
- QCanvasText *t;
+ Q3CanvasText *t;
for (t=textline.first(); t; t=textline.next() )
if (v)
t->show();
diff -r 9eb7767c2dfa -r 608f976aa7bb headingobj.h
--- a/headingobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/headingobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -2,11 +2,13 @@
#define HEADINGOBJ_H
#include "mapobj.h"
+//Added by qt3to4:
+#include
class HeadingObj:public MapObj {
public:
HeadingObj();
- HeadingObj(QCanvas*);
+ HeadingObj(Q3Canvas*);
virtual ~HeadingObj();
virtual void init();
virtual void copy(HeadingObj*);
@@ -15,7 +17,7 @@
virtual void positionBBox();
virtual void calcBBoxSize();
private:
- QCanvasText* newLine(QString); // generate new textline
+ Q3CanvasText* newLine(QString); // generate new textline
public:
virtual void setText(QString);
virtual QString text();
@@ -30,7 +32,7 @@
protected:
QString heading;
uint textwidth; // width for formatting text
- QPtrList textline; // a part of e.g. the parabel
+ Q3PtrList textline; // a part of e.g. the parabel
QColor color;
QFont font;
};
diff -r 9eb7767c2dfa -r 608f976aa7bb imageobj.cpp
--- a/imageobj.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/imageobj.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,10 +1,12 @@
#include "imageobj.h"
+//Added by qt3to4:
+#include
/////////////////////////////////////////////////////////////////
// ImageObj
/////////////////////////////////////////////////////////////////
-ImageObj::ImageObj( QCanvas *canvas )
- : QCanvasRectangle( canvas )
+ImageObj::ImageObj( Q3Canvas *canvas )
+ : Q3CanvasRectangle( canvas )
{
// cout << "Const ImageObj (canvas)\n";
setZ(Z_ICON);
@@ -39,7 +41,7 @@
{
switch (type)
{
- case undef: qWarning("undef");break;
+ case undef: qWarning("Warning: ImageObj::save() type=undef");break;
case qimage: image.save (fn,format,-1);break;
case qpixmap: pixmap.save (fn,format,-1);break;
}
@@ -54,7 +56,7 @@
type=qimage;
#if !defined(Q_WS_QWS)
- pixmap.convertFromImage(image, OrderedAlphaDither);
+ pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
#endif
return true;
}
@@ -78,7 +80,7 @@
{
type=qimage;
image=img;
- pixmap.convertFromImage(image, OrderedAlphaDither);
+ pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
}
QPixmap ImageObj::getPixmap()
@@ -91,7 +93,7 @@
// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
// but on other platforms, we need to use a QPixmap.
#if defined(Q_WS_QWS)
- p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
+ p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
#else
p.drawPixmap( int(x()), int(y()), pixmap );
#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb imageobj.h
--- a/imageobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/imageobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -2,17 +2,19 @@
#define IMAGEOBJ_H
#include
-#include
+#include
#include
+//Added by qt3to4:
+#include
#include "mapobj.h"
enum ImageType {qimage,qpixmap,undef};
-class ImageObj: public QCanvasRectangle
+class ImageObj: public Q3CanvasRectangle
{
public:
- ImageObj( QCanvas *canvas );
+ ImageObj( Q3Canvas *canvas );
~ImageObj();
virtual void copy (ImageObj*);
virtual void setVisibility(bool);
diff -r 9eb7767c2dfa -r 608f976aa7bb imports.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/imports.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -0,0 +1,115 @@
+#include
+//Added by qt3to4:
+#include
+
+#include "file.h"
+#include "imports.h"
+#include "linkablemapobj.h"
+#include "misc.h"
+#include "mainwindow.h"
+#include "xsltproc.h"
+
+extern Main *mainWindow;
+extern QDir vymBaseDir;
+
+ImportBase::ImportBase()
+{
+ // Create tmpdir
+ tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
+}
+
+
+ImportBase::~ImportBase()
+{
+ // Remove tmpdir
+ removeDir (tmpDir);
+}
+
+void ImportBase::setDir(const QString &p)
+{
+ inputDir=p;
+}
+
+void ImportBase::setFile (const QString &p)
+{
+ inputFile=p;
+}
+
+void ImportBase::setMapCenter(MapCenterObj *mc)
+{
+ mapCenter=mc;
+}
+
+bool ImportBase::transform()
+{
+ return true;
+}
+
+QString ImportBase::getTransformedFile()
+{
+ return transformedFile;
+}
+
+/////////////////////////////////////////////////
+bool ImportKDEBookmarks::transform()
+{
+ transformedFile=tmpDir.path()+"/bookmarks.xml";
+
+ XSLTProc p;
+ p.setInputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
+ p.setOutputFile (transformedFile);
+ p.setXSLFile (vymBaseDir.path()+"/styles/kdebookmarks2vym.xsl");
+ p.process();
+
+ return true;
+}
+
+
+/////////////////////////////////////////////////
+bool ImportFirefoxBookmarks::transform()
+{
+ transformedFile=tmpDir.path()+"/bookmarks.xml";
+
+ QStringList lines;
+ QFile file( inputFile );
+ if ( file.open( QIODevice::ReadOnly ) )
+ {
+ QTextStream stream( &file );
+ while ( !stream.atEnd() )
+ lines += stream.readLine(); // line of text excluding '\n'
+ file.close();
+ }
+ // FIXME
+ // Generate vym from broken bookmarks above...
+
+ return true;
+}
+
+
+/////////////////////////////////////////////////
+bool ImportMM::transform()
+{
+ // try to unzip
+ if (success==unzipDir (tmpDir, inputFile))
+ {
+
+ // Set short name, too. Search from behind:
+ transformedFile=inputFile;
+ int i=transformedFile.findRev("/");
+ if (i>=0) transformedFile=transformedFile.remove (0,i+1);
+ transformedFile.replace(".mmap",".xml");
+ transformedFile=tmpDir.path()+"/"+transformedFile;
+
+ XSLTProc p;
+ p.setInputFile (tmpDir.path()+"/Document.xml");
+ p.setOutputFile (transformedFile);
+ p.setXSLFile (vymBaseDir.path()+"/styles/mmap2vym.xsl");
+ p.process();
+
+ cout << " xslt done"<
+#include
#include "linkablemapobj.h"
#include "branchobj.h"
#include "mapeditor.h"
#include "version.h"
+//Added by qt3to4:
+#include
/////////////////////////////////////////////////////////////////
@@ -17,7 +19,7 @@
init ();
}
-LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c)
+LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
{
// cout << "Const LinkableMapObj\n";
init ();
@@ -62,6 +64,7 @@
void LinkableMapObj::init ()
{
depth=-1;
+ mapEditor=NULL;
childObj=NULL;
parObj=NULL;
parObjTmpBuf=NULL;
@@ -76,35 +79,45 @@
linkpos=LinkBottom;
segment.setAutoDelete (TRUE);
arcsegs=13;
- QPointArray pa(arcsegs*2+2);
+ Q3PointArray pa(arcsegs*2+2);
- bottomline=new QCanvasLine(canvas);
+ bottomline=new Q3CanvasLine(canvas);
bottomline->setPen( QPen(linkcolor, 1) );
bottomline->setZ(Z_LINK);
bottomline->show();
// Prepare showing the selection of a MapObj
- selbox = new QCanvasRectangle (canvas);
+ selbox = new Q3CanvasRectangle (canvas);
selbox->setZ(Z_SELBOX);
selbox->setBrush( QColor(255,255,0) );
selbox->setPen( QPen(QColor(255,255,0) ));
selbox->hide();
selected=false;
+ hideLinkUnselected=false;
+
+ topPad=botPad=leftPad=rightPad=0;
+
// initialize frame
frame = new FrameObj (canvas);
repositionRequest=false;
+
+ // Rel Positions
+ relPos=QPoint(0,0);
+ useRelPos=false;
+ useOrientation=true;
}
void LinkableMapObj::copy (LinkableMapObj* other)
{
MapObj::copy(other);
bboxTotal=other->bboxTotal;
-// linkwidth=other->linkwidth;
-
setLinkStyle(other->style);
setLinkColor (other->linkcolor);
+ relPos=other->relPos;
+ useOrientation=other->useOrientation;
+
}
void LinkableMapObj::setChildObj(LinkableMapObj* o)
@@ -126,8 +139,57 @@
{
}
+bool LinkableMapObj::hasParObjTmp()
+{
+ if (parObjTmpBuf) return true;
+ return false;
+}
+
+void LinkableMapObj::setUseRelPos (const bool &b)
+{
+ useRelPos=b;
+}
+
+void LinkableMapObj::setRelPos()
+{
+ if (parObj)
+ {
+ relPos.setX (absPos.x() - parObj->getChildPos().x() );
+ relPos.setY (absPos.y() - parObj->getChildPos().y() );
+
+ parObj->calcBBoxSize();
+ parObj->requestReposition();
+ }
+}
+
+void LinkableMapObj::setRelPos(const QPoint &p)
+{
+ relPos=p;
+ if (parObj)
+ { parObj->calcBBoxSize();
+ parObj->requestReposition();
+ }
+}
+
+int LinkableMapObj::getTopPad()
+{
+ return topPad;
+}
+
+int LinkableMapObj::getLeftPad()
+{
+ return leftPad;
+}
+
+int LinkableMapObj::getRightPad()
+{
+ return rightPad;
+}
+
LinkStyle LinkableMapObj::getDefLinkStyle ()
{
+ if (!mapEditor) return StyleUndef;
+
LinkStyle ls=mapEditor->getLinkStyle();
switch (ls)
{
@@ -157,6 +219,7 @@
void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
{
+ //if (newstyle=style) return;
delLink();
style=newstyle;
@@ -164,14 +227,14 @@
if (childObj!=NULL && parObj != NULL)
{
int i;
- QCanvasLine* cl;
+ Q3CanvasLine* cl;
switch (style)
{
case StyleUndef:
bottomline->hide();
break;
case StyleLine:
- l = new QCanvasLine(canvas);
+ l = new Q3CanvasLine(canvas);
l->setPen( QPen(linkcolor, 1) );
l->setZ(Z_LINK);
if (visible)
@@ -182,7 +245,7 @@
case StyleParabel:
for (i=0;isetPen( QPen(linkcolor, 1) );
cl->setPoints( 0,0,i*10,100);
cl->setZ(Z_LINK);
@@ -195,7 +258,7 @@
pa0.resize (arcsegs+1);
break;
case StylePolyLine:
- p = new QCanvasPolygon(canvas);
+ p = new Q3CanvasPolygon(canvas);
p->setBrush( linkcolor );
p->setZ(Z_LINK);
if (visible)
@@ -203,10 +266,9 @@
else
p->hide();
pa0.resize (3);
- // TODO
- // a bit awkward: draw the lines additionally to polygon, to avoid
+ // TODO a bit awkward: draw the lines additionally to polygon, to avoid
// missing pixels, when polygon is extremly flat
- l = new QCanvasLine(canvas);
+ l = new Q3CanvasLine(canvas);
l->setPen( QPen(linkcolor, 1) );
l->setZ(Z_LINK);
if (visible)
@@ -215,7 +277,7 @@
l->hide();
break;
case StylePolyParabel:
- p = new QCanvasPolygon(canvas);
+ p = new Q3CanvasPolygon(canvas);
p->setBrush( linkcolor );
p->setZ(Z_LINK);
if (visible)
@@ -226,13 +288,12 @@
pa1.resize (arcsegs+1);
pa2.resize (arcsegs+1);
- // TODO
- // a bit awkward: draw the lines additionally
+ // TODO a bit awkward: draw the lines additionally
// to polygon, to avoid missing pixels,
// if polygon is extremly flat
for (i=0;isetPen( QPen(linkcolor, 1) );
cl->setPoints( 0,0,i*10,100);
cl->setZ(Z_LINK);
@@ -246,10 +307,7 @@
default:
break;
}
- } else
- {
- cout << "Error: ChildObj or parObj == NULL in LinkableMapObj::setLinkStyle\n";
- }
+ }
}
LinkStyle LinkableMapObj::getLinkStyle()
@@ -257,6 +315,18 @@
return style;
}
+void LinkableMapObj::setHideLinkUnselected(bool b)
+{
+ hideLinkUnselected=b;
+ setVisibility (visible);
+ updateLink();
+}
+
+bool LinkableMapObj::getHideLinkUnselected()
+{
+ return hideLinkUnselected;
+}
+
void LinkableMapObj::setLinkPos(LinkPos lp)
{
linkpos=lp;
@@ -272,14 +342,15 @@
{
// Overloaded in BranchObj and childs
// here only set default color
- setLinkColor (mapEditor->getDefLinkColor());
+ if (mapEditor)
+ setLinkColor (mapEditor->getDefLinkColor());
}
void LinkableMapObj::setLinkColor(QColor col)
{
linkcolor=col;
bottomline->setPen( QPen(linkcolor, 1) );
- QCanvasLine *cl;
+ Q3CanvasLine *cl;
switch (style)
{
case StyleLine:
@@ -301,7 +372,6 @@
default:
break;
} // switch (style)
- updateLink();
}
QColor LinkableMapObj::getLinkColor()
@@ -332,32 +402,62 @@
void LinkableMapObj::setVisibility (bool v)
{
+ Q3CanvasLine* cl;
MapObj::setVisibility (v);
- if (visible)
+ bool visnow=visible;
+
+ // We can hide the link, while object is not selected
+ if (hideLinkUnselected && !selected)
+ visnow=false;
+
+ if (visnow)
{
bottomline->show();
- // FIXME lines and segments should be done in LMO?
- if (style==StyleLine && l)
+ switch (style)
{
- l->show();
- } else
- {
- QCanvasLine* cl;
- for (cl=segment.first(); cl; cl=segment.next() )
- cl->show();
- }
+ case StyleLine:
+ if (l) l->show();
+ break;
+ case StyleParabel:
+ for (cl=segment.first(); cl; cl=segment.next() )
+ cl->show();
+ break;
+ case StylePolyLine:
+ if (p) p->show();
+ if (l) l->show();
+ break;
+ case StylePolyParabel:
+ for (cl=segment.first(); cl; cl=segment.next() )
+ cl->show();
+ if (p) p->show();
+ break;
+ default:
+ break;
+ }
} else
{
bottomline->hide();
- if (style==StyleLine && l)
+ switch (style)
{
- l->hide();
- } else
- {
- QCanvasLine* cl;
- for (cl=segment.first(); cl; cl=segment.next() )
- cl->hide();
- }
+ case StyleLine:
+ if (l) l->hide();
+ break;
+ case StyleParabel:
+ for (cl=segment.first(); cl; cl=segment.next() )
+ cl->hide();
+ break;
+ case StylePolyLine:
+ if (p) p->hide();
+ if (l) l->hide();
+ break;
+ case StylePolyParabel:
+ for (cl=segment.first(); cl; cl=segment.next() )
+ cl->hide();
+ if (p) p->hide();
+ break;
+ default:
+ break;
+ }
}
}
@@ -370,12 +470,11 @@
//
// sets:
// orientation
- // childPos
- // parPos
- // offset
+ // childPos (by calling setDockPos())
+ // parPos (by calling setDockPos())
+ // bottomlineY
// drawing of the link itself
-
// updateLink is called from move, but called from constructor we don't
// have parents yet...
if (style==StyleUndef) return;
@@ -387,10 +486,10 @@
switch (linkpos)
{
case LinkMiddle:
- offset=bbox.height() /2;
+ bottomlineY=bbox.top()+bbox.height() /2; // draw link to middle (of frame)
break;
default :
- offset=bbox.height()-1; // draw link to bottom of bbox
+ bottomlineY=bbox.bottom()-1; // draw link to bottom of box
break;
}
@@ -431,23 +530,7 @@
reposition();
}
- if (orientation==OrientLeftOfCenter )
- {
- childPos=QPoint (absPos.x(),absPos.y()+offset);
- parPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
- } else
- {
- childPos=QPoint (absPos.x()+ bbox.width(), absPos.y() + offset );
- parPos=QPoint (absPos.x(),absPos.y()+offset);
- }
- /* FIXME
- cout << " LMO::updateLink absPos="<setPoints( lrint (parPos.x()),
- lrint(parPos.y()),
- lrint(p2x),
- lrint(p2y) );
+ l->setPoints( qRound (parPos.x()),
+ qRound(parPos.y()),
+ qRound(p2x),
+ qRound(p2y) );
break;
case StyleParabel:
parabel (pa0, p1x,p1y,p2x,p2y);
@@ -492,15 +575,15 @@
}
break;
case StylePolyLine:
- pa0[0]=QPoint (lrint(p2x+tp.x()), lrint(p2y+tp.y()));
- pa0[1]=QPoint (lrint(p2x-tp.x()), lrint(p2y-tp.y()));
- pa0[2]=QPoint (lrint (parPos.x()), lrint(parPos.y()) );
+ pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
+ pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
+ pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
p->setPoints (pa0);
// here too, draw line to avoid missing pixels
- l->setPoints( lrint (parPos.x()),
- lrint(parPos.y()),
- lrint(p2x),
- lrint(p2y) );
+ l->setPoints( qRound (parPos.x()),
+ qRound(parPos.y()),
+ qRound(p2x),
+ qRound(p2y) );
break;
case StylePolyParabel:
parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
@@ -534,6 +617,44 @@
return parObj;
}
+LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
+{
+ LinkableMapObj *lmo=this;
+ QString part;
+ QString typ;
+ QString num;
+ while (!s.isEmpty() )
+ {
+ part=s.section(",",0,0);
+ typ=part.left (3);
+ num=part.right(part.length() - 3);
+ if (typ=="mc:")
+ {
+ if (depth>0)
+ return false; // in a subtree there is no center
+ else
+ break;
+ } else
+ if (typ=="bo:")
+ lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
+ else
+ if (typ=="fi:")
+ lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
+ if (!lmo) break;
+
+ if (s.contains(","))
+ s=s.right(s.length() - part.length() -1 );
+ else
+ break;
+ }
+ return lmo;
+}
+
+void LinkableMapObj::setDockPos()
+{
+ cout <<"LMO::setDockPos()\n";
+}
+
QPoint LinkableMapObj::getChildPos()
{
return childPos;
@@ -546,11 +667,26 @@
QPoint LinkableMapObj::getRelPos()
{
+ return relPos;
+/* FIXME not needed? relPos was moved in 1.7.10 from
+ floatobj to linkablemapobj. Before we had:
+
if (!parObj) return QPoint (0,0);
return QPoint(
absPos.x() - parObj->x(),
absPos.y() - parObj->y()
);
+*/
+}
+
+
+void LinkableMapObj::setUseOrientation (const bool &b)
+{
+ if (useOrientation!=b)
+ {
+ useOrientation=b;
+ requestReposition();
+ }
}
LinkOrient LinkableMapObj::getOrientation()
@@ -583,11 +719,12 @@
void LinkableMapObj::alignRelativeTo (QPoint ref)
{
+ // FIXME testing, seems not to be used right now...
+ cout << "LMO::alignRelTo ref="<blockReposition()) return;
+ if (mapEditor->isRepositionBlocked()) return;
// Pass on the request to parental objects, if this hasn't been done yet
if (parObj)
parObj->forceReposition();
else
- reposition(); }
+ reposition();
+}
bool LinkableMapObj::repositionRequested()
{
@@ -643,9 +781,9 @@
void LinkableMapObj::setSelBox()
{
- selbox->setX (bbox.x() );
- selbox->setY (bbox.y() );
- selbox->setSize (bbox.width(), bbox.height() );
+ selbox->setX (clickBox.x() );
+ selbox->setY (clickBox.y() );
+ selbox->setSize (clickBox.width(), clickBox.height() );
}
void LinkableMapObj::select()
@@ -653,6 +791,8 @@
setSelBox();
selected=true;
selbox->show();
+// FIXME not needed?
+ setVisibility (visible);
}
@@ -660,9 +800,11 @@
{
selected=false;
selbox->hide();
+ // Maybe we have to hide the link:
+ setVisibility (visible);
}
-void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y)
+void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
{
double vx=p2x - p1x; // V=P2-P1
@@ -680,14 +822,22 @@
m=(vy / (vx*vx));
dx=vx/(arcsegs);
int i;
- ya.setPoint (0,QPoint (lrint(p1x),lrint(p1y)));
+ ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
for (i=1;i<=arcsegs;i++)
{
pnx=p1x+dx;
pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
- ya.setPoint (i,QPoint (lrint(pnx),lrint(pny)));
+ ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
p1x=pnx;
p1y=pny;
}
}
+QString LinkableMapObj::getLinkAttr ()
+{
+ if (hideLinkUnselected)
+ return attribut ("hideLink","true");
+ else
+ return attribut ("hideLink","false");
+
+}
diff -r 9eb7767c2dfa -r 608f976aa7bb linkablemapobj.h
--- a/linkablemapobj.h Sun Jan 30 12:58:47 2005 +0000
+++ b/linkablemapobj.h Tue Jun 06 14:58:11 2006 +0000
@@ -5,6 +5,9 @@
#include "noteobj.h"
#include "headingobj.h"
#include "flagrowobj.h"
+//Added by qt3to4:
+#include
+#include
#define MAX_DEPTH 999
@@ -23,7 +26,7 @@
Q_OBJECT
public:
LinkableMapObj ();
- LinkableMapObj (QCanvas*);
+ LinkableMapObj (Q3Canvas*);
LinkableMapObj (LinkableMapObj*);
~LinkableMapObj ();
virtual void delLink();
@@ -33,9 +36,22 @@
virtual void setParObj (LinkableMapObj*);
virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
virtual void unsetParObjTmp(); // reuse original ParObj
+ virtual bool hasParObjTmp();
+
+ virtual void setUseRelPos (const bool&);
+ virtual void setRelPos(); // set relPos to current parentPos
+ virtual void setRelPos(const QPoint&);
+ virtual void setUseOrientation (const bool &);
+
+
+ virtual int getTopPad();
+ virtual int getLeftPad();
+ virtual int getRightPad();
LinkStyle getDefLinkStyle();
void setLinkStyle(LinkStyle);
LinkStyle getLinkStyle();
+ void setHideLinkUnselected(bool);
+ bool getHideLinkUnselected();
void setLinkPos (LinkPos);
LinkPos getLinkPos ();
@@ -51,6 +67,8 @@
// redraw link with given style
LinkableMapObj* getChildObj(); // returns pointer to fromObj
LinkableMapObj* getParObj(); // returns pointer to toObj
+ virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
+ virtual void setDockPos(); // sets childPos and parPos
QPoint getChildPos(); // returns pos where childs dock
QPoint getParPos(); // returns pos where parents dock
QPoint getRelPos(); // get position relative to parent (or (0,0))
@@ -75,9 +93,12 @@
virtual void select();
virtual void unselect();
virtual QString getSelectString()=0;
+ virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
protected:
- void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
+ void parabel(Q3PointArray &,double,double,double,double); // Create Parabel connecting two points
+ QString getLinkAttr();
+
QPoint childPos;
QPoint parPos;
bool link2ParPos; // While moving around, sometimes link to parent
@@ -90,24 +111,31 @@
LinkableMapObj* childObj;
LinkableMapObj* parObj;
LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
- int offset; // vertical offset of dockpos to pos
+ int bottomlineY; // vertical offset of dockpos to pos
int thickness_start; // for StylePoly*
- LinkStyle style;
- LinkPos linkpos;
+ LinkStyle style; // Current style
+ LinkPos linkpos; // Link at bottom of object or middle of height
QColor linkcolor; // Link color
- QCanvasLine* l; // line style
- QCanvasPolygon* p; // poly styles
+ Q3CanvasLine* l; // line style
+ Q3CanvasPolygon* p; // poly styles
int arcsegs; // arc: number of segments
- QPtrList segment; // a part of e.g. the parabel
- QPointArray pa0; // For drawing of PolyParabel and PolyLine
- QPointArray pa1; // For drawing of PolyParabel
- QPointArray pa2; // For drawing of PolyParabel
- QCanvasLine* bottomline; // on bottom of BBox
+ Q3PtrList segment; // a part of e.g. the parabel
+ Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
+ Q3PointArray pa1; // For drawing of PolyParabel
+ Q3PointArray pa2; // For drawing of PolyParabel
+ Q3CanvasLine* bottomline; // on bottom of BBox
bool repositionRequest; //
bool selected; // Used for marking the selection
- QCanvasRectangle* selbox;
+ bool hideLinkUnselected; // to hide links if unselected
+ Q3CanvasRectangle* selbox;
FrameObj *frame; // frame around object
+ int topPad, botPad,
+ leftPad, rightPad; // padding within bbox
+
+ QPoint relPos; // position relative to childPos of parent
+ bool useRelPos;
+ bool useOrientation;
};
#endif
diff -r 9eb7767c2dfa -r 608f976aa7bb main.cpp
--- a/main.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/main.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -1,14 +1,19 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+//Added by qt3to4:
+#include
+#include
#include "settings.h"
#include "options.h"
#include "mainwindow.h"
-#include "icons/vym-48x48.xpm"
-#include "icons/vym-editor.xpm"
-
#include "flagrowobj.h"
// Global variables
@@ -16,14 +21,24 @@
// initialized in mainwindow
Main *mainWindow; // used in BranchObj::select()
-MapEditor *clipboardME;
+QString tmpVymDir; // All temp files go there, created in mainwindow
+QString clipboardDir; // Clipboard used in all mapEditors
+QDir vymBaseDir; // Containing all styles, scripts, images, ...
+QString iconPath; // Pointing to icons used for toolbars
+QString flagsPath; // Pointing to flags
+bool clipboardEmpty;
FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
FlagRowObj *standardFlagsDefault;
+// Lists of actions
+// (QActionGroup could not be "enabled")
+Q3PtrList actionListBranches;
+
// Actions which change sometimes
QAction *actionFileSave;
QAction *actionFilePrint;
QAction *actionEditUndo;
+QAction *actionEditRedo;
QAction *actionEditCopy;
QAction *actionEditCut;
QAction *actionEditPaste;
@@ -31,25 +46,30 @@
QAction *actionEditMoveDown;
QAction *actionEditToggleScroll;
QAction *actionEditOpenURL;
+QAction *actionEditOpenURLTab;
QAction *actionEditURL;
QAction *actionEditHeading2URL;
QAction *actionEditBugzilla2URL;
+QAction *actionEditFATE2URL;
QAction *actionEditOpenVymLink;
QAction *actionEditVymLink;
+QAction *actionEditToggleHideExport;
QAction *actionEditDeleteVymLink;
QAction *actionEditMapInfo;
QAction *actionEditHeading;
QAction *actionEditDelete;
QAction *actionEditAddBranch;
+QAction *actionEditAddBranchHere;
QAction *actionEditAddBranchAbove;
QAction *actionEditAddBranchBelow;
+QAction *actionEditRemoveBranchKeepChilds;
+QAction *actionEditRemoveChilds;
QAction *actionEditImportAdd;
QAction *actionEditImportReplace;
QAction *actionEditSaveBranch;
QAction *actionEditSelectFirst;
QAction *actionEditSelectLast;
QAction *actionEditLoadImage;
-QAction *actionEditToggleFloatExport;
QAction *actionFormatColor;
QAction *actionFormatPickColor;
@@ -59,31 +79,47 @@
QAction *actionFormatLinkColorHint;
QAction *actionFormatLinkColor;
-QActionGroup *actionGroupFormatFrameTypes;
+Q3ActionGroup *actionGroupModModes;
+QAction *actionModModeColor;
+QAction *actionModModeLink;
+QAction *actionModModeCopy;
+
+Q3ActionGroup *actionGroupFormatFrameTypes;
QAction *actionFormatFrameNone;
QAction *actionFormatFrameRectangle;
-QActionGroup *actionGroupFormatLinkStyles;
+Q3ActionGroup *actionGroupFormatLinkStyles;
+QAction *actionFormatIncludeImagesVer;
+QAction *actionFormatIncludeImagesHor;
+QAction *actionFormatHideLinkUnselected;
QAction *actionFormatLinkStyleLine;
QAction *actionFormatLinkStyleParabel;
QAction *actionFormatLinkStylePolyLine;
QAction *actionFormatLinkStylePolyParabel;
QAction *actionViewToggleNoteEditor;
+QAction *actionViewToggleHistoryWindow;
QAction *actionSettingsAutoselectHeading;
QAction *actionSettingsAutoselectText;
QAction *actionSettingsPasteNewHeading;
QAction *actionSettingsAutoedit;
QAction *actionSettingsUseDelKey;
+QAction *actionSettingsUseFlagGroups;
+QAction *actionSettingsUseHideExport;
-QPopupMenu *branchContextMenu;
-QPopupMenu *floatimageContextMenu;
-QPopupMenu *saveImageFormatMenu;
-QPopupMenu *canvasContextMenu;
-QPopupMenu *lastMapsMenu;
-QPopupMenu *exportMenu;
-QPopupMenu *exportImageFormatMenu;
+Q3PopupMenu *branchContextMenu;
+Q3PopupMenu *branchAddContextMenu;
+Q3PopupMenu *branchRemoveContextMenu;
+Q3PopupMenu *branchLinksContextMenu;
+Q3PopupMenu *branchLinksContextMenuDup;
+Q3PopupMenu *floatimageContextMenu;
+Q3PopupMenu *saveImageFormatMenu;
+Q3PopupMenu *canvasContextMenu;
+Q3PopupMenu *lastMapsMenu;
+Q3PopupMenu *importMenu;
+Q3PopupMenu *exportMenu;
+Q3PopupMenu *exportImageFormatMenu;
Settings settings;
@@ -96,19 +132,9 @@
QApplication app(argc,argv);
- // Initialize translations
- QTranslator translator (0);
- translator.load( "vym_de", "." );
- app.installTranslator( &translator );
-
- // Initializing the row of system flags
- // is done in first call to MapEditor(),
- // because we need at least one canvas first
- systemFlagsDefault=NULL;
- standardFlagsDefault=NULL;
-
// Reading and initializing options commandline options
options.add ("version", SwitchOption, "v","version");
+ options.add ("local", SwitchOption, "l", "local");
options.add ("help", SwitchOption, "h", "help");
options.add ("quit", SwitchOption, "q", "quit");
options.add ("test", StringOption, "t", "test");
@@ -121,45 +147,82 @@
"http://www.InSilmaril.de/vym\n");
if (options.parse())
{
- cout << endl << options.getHelpText()<setPixmap("vym-128x128", QPixmap(iconPath+"vym-128x128.png"));
+ q3InitNetworkProtocols();
+
+
+ // Initialize translations
+ QTranslator translator (0);
+ translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
+ app.installTranslator( &translator );
+
+ // Initializing the row of system flags
+ // is done in first call to MapEditor(),
+ // because we need at least one canvas first
+ systemFlagsDefault=NULL;
+ standardFlagsDefault=NULL;
+
// Initialize window of TextEditor
textEditor = new TextEditor();
- textEditor->setIcon (QPixmap (vym_editor_xpm));
+ textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
if (textEditor->showWithMain()) textEditor->show();
- clipboardME = new MapEditor();
- clipboardME->resize (800,600);
- clipboardME->setCaption("VYM - clipboard");
- clipboardME->hide();
-
- // Initialize mainwindow after Mapeditors (because of Flags)
+ // Initialize mainwindow
Main m;
//m.resize(m.sizeHint());
- m.setIcon (QPixmap (vym_logo_xpm));
+ m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
m.show();
m.fileNew();
m.loadCmdLine();
diff -r 9eb7767c2dfa -r 608f976aa7bb mainwindow.cpp
--- a/mainwindow.cpp Sun Jan 30 12:58:47 2005 +0000
+++ b/mainwindow.cpp Tue Jun 06 14:58:11 2006 +0000
@@ -7,61 +7,58 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
#include
+//Added by qt3to4:
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+//#include // for random seed
#include
-#include
+#include
#include
-#include "version.h"
-
-#include "icons/filenew.xpm"
-#include "icons/fileopen.xpm"
-#include "icons/filesave.xpm"
-#include "icons/fileprint.xpm"
-#include "icons/editundo.xpm"
-//#include "icons/editredo.xpm" // TODO
-#include "icons/editcopy.xpm"
-#include "icons/editcut.xpm"
-#include "icons/editpaste.xpm"
-#include "icons/editmoveup.xpm"
-#include "icons/editmovedown.xpm"
-#include "icons/formatcoloritem.xpm"
-#include "icons/formatcolorbranch.xpm"
-#include "icons/formatcolorpicker.xpm"
-#include "icons/viewzoomreset.xpm"
-#include "icons/viewzoomin.xpm"
-#include "icons/viewzoomout.xpm"
-#include "icons/vym-48x48.xpm"
-#include "icons/flag-note.xpm"
-#include "icons/flag-url.xpm"
-#include "icons/flag-vymlink.xpm"
-#include "icons/flag-scrolled-right.xpm"
-
+#include "aboutdialog.h"
+#include "exportoofiledialog.h"
+#include "exports.h"
+#include "exportxhtmldialog.h"
+#include "file.h"
#include "flagrowobj.h"
-#include "texteditor.h"
+#include "imports.h"
#include "mapeditor.h"
-#include "exporthtmldialog.h"
-#include "exportxhtmldialog.h"
-#include "showtextdialog.h"
+#include "misc.h"
+#include "options.h"
#include "process.h"
#include "settings.h"
-#include "options.h"
+#include "showtextdialog.h"
+#include "texteditor.h"
+#include "version.h"
extern TextEditor *textEditor;
extern Main *mainWindow;
+extern QString tmpVymDir;
+extern QString clipboardDir;
+extern bool clipboardEmpty;
extern int statusbarTime;
-extern MapEditor *clipboardME;
extern FlagRowObj* standardFlagsDefault;
+extern FlagRowObj* systemFlagsDefault;
+
+extern Q3PtrList actionListBranches;
extern QAction* actionFileSave;
extern QAction* actionFilePrint;
extern QAction* actionEditUndo;
+extern QAction* actionEditRedo;
extern QAction *actionEditCopy;
extern QAction *actionEditCut;
extern QAction *actionEditPaste;
@@ -69,25 +66,30 @@
extern QAction *actionEditMoveDown;
extern QAction *actionEditToggleScroll;
extern QAction* actionEditOpenURL;
+extern QAction* actionEditOpenURLTab;
extern QAction* actionEditURL;
extern QAction* actionEditHeading2URL;
extern QAction* actionEditBugzilla2URL;
+extern QAction* actionEditFATE2URL;
extern QAction *actionEditOpenVymLink;
extern QAction *actionEditVymLink;
extern QAction *actionEditDeleteVymLink;
+extern QAction *actionEditToggleHideExport;
extern QAction *actionEditMapInfo;
extern QAction *actionEditHeading;
extern QAction *actionEditDelete;
extern QAction *actionEditAddBranch;
+extern QAction *actionEditAddBranchHere;
extern QAction *actionEditAddBranchAbove;
extern QAction *actionEditAddBranchBelow;
+extern QAction *actionEditRemoveBranchKeepChilds;
+extern QAction *actionEditRemoveChilds;
extern QAction *actionEditImportAdd;
extern QAction *actionEditImportReplace;
extern QAction *actionEditSaveBranch;
extern QAction *actionEditSelectFirst;
extern QAction *actionEditSelectLast;
extern QAction *actionEditLoadImage;
-extern QAction *actionEditToggleFloatExport;
extern QAction* actionFormatColor;
extern QAction* actionFormatPickColor;
@@ -96,18 +98,27 @@
extern QAction* actionFormatLinkColorHint;
extern QAction* actionFormatBackColor;
extern QAction* actionFormatLinkColor;
+extern QAction *actionFormatIncludeImagesVer;
+extern QAction *actionFormatIncludeImagesHor;
-extern QActionGroup *actionGroupFormatFrameTypes;
+extern Q3ActionGroup* actionGroupModModes;
+extern QAction* actionModModeColor;
+extern QAction* actionModModeLink;
+extern QAction* actionModModeCopy;
+
+extern Q3ActionGroup *actionGroupFormatFrameTypes;
extern QAction *actionFormatFrameNone;
extern QAction *actionFormatFrameRectangle;
-extern QActionGroup *actionGroupFormatLinkStyles;
+extern Q3ActionGroup *actionGroupFormatLinkStyles;
extern QAction *actionFormatLinkStyleLine;
extern QAction *actionFormatLinkStyleParabel;
extern QAction *actionFormatLinkStylePolyLine;
extern QAction *actionFormatLinkStylePolyParabel;
+extern QAction *actionFormatHideLinkUnselected;
extern QAction *actionViewToggleNoteEditor;
+extern QAction *actionViewToggleHistoryWindow;
extern QAction* actionSettingsAutoedit;
extern QAction* actionSettingsAutoselectHeading;
@@ -115,25 +126,31 @@
extern QAction* actionSettingsAutoselectText;
extern QAction* actionSettingsPasteNewHeading;
extern QAction* actionSettingsUseDelKey;
+extern QAction* actionSettingsUseFlagGroups;
+extern QAction* actionSettingsUseHideExport;
-extern QPopupMenu* branchContextMenu;
-extern QPopupMenu* floatimageContextMenu;
-extern QPopupMenu* saveImageFormatMenu;
-extern QPopupMenu* canvasContextMenu;
-extern QPopupMenu* lastMapsMenu;
-extern QPopupMenu* exportMenu;
-extern QPopupMenu* exportImageFormatMenu;
+extern Q3PopupMenu* branchContextMenu;
+extern Q3PopupMenu* branchAddContextMenu;
+extern Q3PopupMenu* branchRemoveContextMenu;
+extern Q3PopupMenu* branchLinksContextMenu;
+extern Q3PopupMenu* branchLinksContextMenuDup;
+extern Q3PopupMenu* floatimageContextMenu;
+extern Q3PopupMenu* saveImageFormatMenu;
+extern Q3PopupMenu* canvasContextMenu;
+extern Q3PopupMenu* lastMapsMenu;
+extern Q3PopupMenu* importMenu;
+extern Q3PopupMenu* exportMenu;
+extern Q3PopupMenu* exportImageFormatMenu;
extern Settings settings;
extern Options options;
+extern QDir vymBaseDir;
+extern QString iconPath;
+extern QString flagsPath;
-#if defined(Q_OS_LINUX)
-extern void qt_wait_for_window_manager( QWidget* w );
-#endif
-
-Main::Main(QWidget* parent, const char* name, WFlags f) :
- QMainWindow(parent,name,f)
+Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
+ Q3MainWindow(parent,name,f)
{
mainWindow=this;
@@ -146,6 +163,24 @@
settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
+ // Create unique temporary directory
+ tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
+
+ // Create direcctory for clipboard
+ clipboardDir=tmpVymDir+"/clipboard";
+ QDir d(clipboardDir);
+ d.mkdir (clipboardDir,true);
+ makeSubDirs (clipboardDir);
+ clipboardEmpty=true;
+
+ procBrowser=NULL;
+
+ // FIXME not used currently
+ // Set random seed (random used for object IDs)
+ // QTime t = QTime::currentTime(); // set random seed
+ // srand( t.hour()*12+t.minute()*60+t.second()*60 );
+
+
// Initialize some settings, which are platform dependant
QString p,s;
@@ -155,7 +190,7 @@
s=settings.readEntry (p,"konqueror");
#else
#if defined(Q_OS_MACX)
- s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
+ s=settings.readEntry (p,"/usr/bin/open");
#else
s=settings.readEntry (p,"mozilla");
#endif
@@ -168,7 +203,7 @@
s=settings.readEntry (p,"acroread");
#else
#if defined(Q_OS_MACX)
- s=settings.readEntry (p,"/Applications/Safari.app/Contents/MacOS/Safari");
+ s=settings.readEntry (p,"/usr/bin/open");
#else
s=settings.readEntry (p,"acroread");
#endif
@@ -189,6 +224,7 @@
setupEditActions();
setupFormatActions();
setupViewActions();
+ setupModeActions();
setupFlagActions();
setupSettingsActions();
setupContextMenus();
@@ -200,10 +236,6 @@
statusBar();
- // Create the default map into first tab
-// fileNew();
-// tabWidget->addTab (new MapEditor(tabWidget,true), "unnamed");
-// currentMapEditor()->show();
// Initialize Find window
findWindow=new FindWindow(NULL,"findwindow");
@@ -212,6 +244,9 @@
connect (findWindow, SIGNAL( somethingChanged() ),
this, SLOT(editFindChanged() ) );
+ // Connect TextEditor, so that we can update flags if text changes
+ connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
+
updateGeometry();
}
@@ -223,29 +258,33 @@
settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
- settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
- settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
+ settings.writeEntry( "/vym/version/version", __VYM_VERSION );
+ settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
+ settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
+ settings.writeEntry( "/vym/export/useHideExport",actionSettingsUseHideExport->isOn() );
QString s;
int maps=lastMaps.count();
settings.writeEntry( "/vym/lastMaps/number",maps );
for (int i=1;i<=maps;i++)
{
- QStringList::Iterator it = lastMaps.at(i-1);
s=QString("/vym/lastMaps/map-%1").arg(i);
if (!s.isEmpty() && i<=maxLastMaps)
- settings.writeEntry (s, *it);
+ settings.writeEntry (s, lastMaps.at(i-1));
}
// To make the texteditor save its settings, call the destructor
delete (textEditor);
+
+ // Remove temporary directory
+ removeDir (QDir(tmpVymDir));
}
void Main::loadCmdLine()
@@ -280,385 +319,622 @@
// File Actions
void Main::setupFileActions()
{
- QToolBar *tb = new QToolBar( this );
+ Q3ToolBar *tb = new Q3ToolBar( this );
tb->setLabel( "File Actions" );
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&File" ), menu );
// Keycodes: /usr/lib64/qt3/include/qnamespace.h
QAction *a;
- a = new QAction( tr( "New map" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
+ a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
+ a->setStatusTip ( tr( "New map","File menu" ) );
+ a->setShortcut ( Qt::CTRL + Qt::Key_N );
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
- a = new QAction( tr( "Open" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
+ a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
+ a->setStatusTip (tr( "Open","File menu" ) );
+ a->setShortcut ( Qt::CTRL + Qt::Key_O );
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
- lastMapsMenu = new QPopupMenu (this);
+ lastMapsMenu = new Q3PopupMenu (this);
menu->insertItem (tr("Open Recent"),lastMapsMenu );
menu->insertSeparator();
- a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
+ a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
+ a->setStatusTip ( tr( "Save" ));
+ a->setShortcut (Qt::CTRL + Qt::Key_S );
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
actionFileSave=a;
- a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
+ a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
+ a->setStatusTip (tr( "Save &As" ) );
+ a->addTo( menu );
connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
- a->addTo( menu );
menu->insertSeparator();
- a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
+ importMenu = new Q3PopupMenu (this);
+ menu->insertItem (tr("Import"),importMenu );
+
+ a = new QAction(tr("KDE Bookmarks"), this);
+ a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
+ a->addTo (importMenu);
+ connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
+
+ if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
+ {
+ a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
+ a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
+ a->addTo (importMenu);
+ connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
+ }
+
+ a = new QAction("Mind Manager...",this);
+ a->setStatusTip ( tr( "Import")+" Mind Manager" );
+ a->addTo (importMenu);
+ connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
+
+ a = new QAction( tr( "Import Dir"+QString("...") ), this);
+ a->setStatusTip (tr( "Import directory structure (experimental)" ) );
+ a->addTo( importMenu);
connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
- a->addTo( menu );
- exportMenu = new QPopupMenu (this);
+ exportMenu = new Q3PopupMenu (this);
menu->insertItem (tr("Export"),exportMenu );
menu->insertSeparator();
- a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
- connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
+ a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
+ a->setStatusTip ( tr( "Print" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_P );
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
actionFilePrint=a;
- a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
+ a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
+ a->setStatusTip (tr( "Close Map" ) );
+ a->setShortcut (Qt::ALT + Qt::Key_C );
+ a->addTo( menu );
connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
+
+ a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
+ a->setStatusTip ( tr( "Exit")+" "+__VYM );
+ a->setShortcut (Qt::CTRL + Qt::Key_Q );
a->addTo( menu );
-
- a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
- a->addTo( menu );
}
//Edit Actions
void Main::setupEditActions()
{
- QToolBar *tb = new QToolBar( this );
+ Q3ToolBar *tb = new Q3ToolBar( this );
tb->setLabel( "Edit Actions" );
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&Edit" ), menu );
QAction *a;
- a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
+ QAction *alt;
+ a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
+ a->setStatusTip (tr( "Undo" ) );
+ a->setShortcut ( Qt::CTRL + Qt::Key_Z );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
actionEditUndo=a;
- /*
- a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
- connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
- a->addTo( tb );
- a->addTo( menu );
- */
+
+ if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
+ {
+ a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this);
+ a->setStatusTip (tr( "Redo" ));
+ a->setShortcut (Qt::CTRL + Qt::Key_Y );
+ a->addTo( tb );
+ a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
+ }
+
menu->insertSeparator();
- a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
- connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
+ a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
+ a->setStatusTip ( tr( "Copy" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_C );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
actionEditCopy=a;
- a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
- connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
+
+ a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
+ a->setStatusTip ( tr( "Cut" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_X );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
actionEditCut=a;
- a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
+ connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
+
+ a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
+ a->setStatusTip ( tr( "Paste" ) );
+ a->setShortcut ( Qt::CTRL + Qt::Key_V );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
actionEditPaste=a;
- a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
- connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
+
+ a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
+ a->setStatusTip ( tr( "Move branch up" ) );
+ a->setShortcut (Qt::Key_PageUp );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
actionEditMoveUp=a;
- a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
+
+ a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
+ a->setStatusTip (tr( "Move branch down" ) );
+ a->setShortcut ( Qt::Key_PageDown );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
actionEditMoveDown=a;
+
- a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
+ a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
+ a->setShortcut ( Qt::Key_ScrollLock );
+ a->setStatusTip (tr( "Scroll branch" ) );
connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
- a->setEnabled (false);
- a->addTo( tb );
+ alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
+ alt->setShortcut ( Qt::Key_S );
+ alt->setStatusTip (tr( "Scroll branch" ));
+ connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
+ #if defined(Q_OS_MACX)
+ actionEditToggleScroll=alt;
+ #else
+ actionEditToggleScroll=a;
+ #endif
+ actionEditToggleScroll->setEnabled (false);
+ actionEditToggleScroll->setToggleAction(true);
+ actionEditToggleScroll->addTo( tb );
+ actionEditToggleScroll->addTo( menu );
+ actionListBranches.append(actionEditToggleScroll);
+
+ a = new QAction( tr( "Unscroll all scrolled branches" ), this);
+ a->setStatusTip (tr( "Unscroll all" ));
a->addTo( menu );
- actionEditToggleScroll=a;
-
- a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
- a->addTo( menu );
menu->insertSeparator();
- a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
+ a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
+ a->setStatusTip (tr( "Find" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_F );
+ a->addTo( menu );
connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
- a->addTo( menu );
menu->insertSeparator();
- a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
- connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
- a->addTo( menu );
+ a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
+ a->setShortcut (Qt::CTRL + Qt::Key_U );
+ a->setShortcut (tr( "Open URL" ));
a->addTo( tb );
a->setEnabled (false);
+ connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
actionEditOpenURL=a;
- a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
+ a = new QAction( tr( "Open URL in new tab" ), this);
+ a->setStatusTip (tr( "Open URL in new tab" ));
+ a->setShortcut (Qt::CTRL+Qt::Key_U );
+ a->setEnabled (false);
+ connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
+ actionEditOpenURLTab=a;
+
+ a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
+ a->setStatusTip ( tr( "Edit URL" ) );
+ a->setShortcut (Qt::SHIFT + Qt::CTRL+Qt::Key_U );
+ a->setEnabled (false);
+ actionListBranches.append(a);
connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
- a->addTo( menu );
- a->setEnabled (false);
actionEditURL=a;
- a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
+ a = new QAction( tr( "Use heading for URL" ), this);
+ a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
+ a->setEnabled (false);
+ actionListBranches.append(a);
connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
- a->addTo( menu );
- a->setEnabled (false);
actionEditHeading2URL=a;
- a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
+ a = new QAction(tr( "Create URL to Bugzilla" ), this);
+ a->setStatusTip ( tr( "Create URL to Bugzilla" ));
+ a->setEnabled (false);
+ actionListBranches.append(a);
connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
- a->setEnabled (false);
actionEditBugzilla2URL=a;
- menu->insertSeparator();
+ a = new QAction(tr( "Create URL to FATE" ), this);
+ a->setStatusTip ( tr( "Create URL to FATE" ));
+ a->setEnabled (false);
+ actionListBranches.append(a);
+ connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
+ actionEditFATE2URL=a;
- 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" );
- connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
- a->addTo( menu );
+ a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
+ a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
a->addTo( tb );
a->setEnabled (false);
+ connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
actionEditOpenVymLink=a;
- a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
+ a = new QAction(tr( "Edit vym link"+QString("...") ), this);
+ a->setEnabled (false);
+ a->setStatusTip ( tr( "Edit link to another vym map" ));
connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
- a->addTo( menu );
- a->setEnabled (false);
+ actionListBranches.append(a);
actionEditVymLink=a;
- a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
+ a = new QAction(tr( "Delete vym link" ),this);
+ a->setStatusTip ( tr( "Delete link to another vym map" ));
+ a->setEnabled (false);
connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
- a->addTo( menu );
- a->setEnabled (false);
actionEditDeleteVymLink=a;
- menu->insertSeparator();
+ a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
+ a->setStatusTip ( tr( "Hide object in exports" ) );
+ a->setShortcut (Qt::Key_H );
+ a->setToggleAction(true);
+ a->addTo( tb );
+ a->setEnabled (false);
+ connect( a, SIGNAL( activated() ), this, SLOT( editToggleHideExport() ) );
+ actionEditToggleHideExport=a;
- a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
+ a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
+ a->setStatusTip ( tr( "Edit Map Info" ));
+ a->setEnabled (true);
connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
- a->addTo( menu );
- a->setEnabled (true);
actionEditMapInfo=a;
menu->insertSeparator();
// Shortcuts to modify heading:
- a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
+ a = new QAction(tr( "Edit heading" ),this);
+ a->setStatusTip ( tr( "edit Heading" ));
+ a->setShortcut ( Qt::Key_Enter );
+ connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
+ actionListBranches.append(a);
+ a = new QAction( tr( "Edit heading" ), this);
+ a->setStatusTip (tr( "edit Heading" ));
+ a->setShortcut (Qt::Key_Return );
+ connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
+ actionListBranches.append(a);
+ actionEditHeading=a;
+ a = new QAction( tr( "Edit heading" ),this);
+ a->setStatusTip (tr( "edit Heading" ));
+ a->setShortcut ( Qt::Key_F2 );
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
a->setEnabled (false);
- a->addTo ( menu );
actionEditHeading=a;
- a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
- connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
- //a->addTo ( menu );
+ actionListBranches.append(a);
// Shortcut to delete selection
- a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
+ a = new QAction( tr( "Delete Selection" ),this);
+ a->setStatusTip (tr( "Delete Selection" ));
+ a->setShortcut ( Qt::Key_Delete);
connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
a->setEnabled (false);
- a->addTo ( menu );
actionEditDelete=a;
// Shortcut to add branch
+ alt = new QAction(tr( "Add branch as child" ), this);
+ alt->setStatusTip ( tr( "Add a branch as child of selection" ));
+ alt->setShortcut (Qt::Key_A);
+ connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
+ a = new QAction(tr( "Add branch as child" ), this);
+ a->setStatusTip ( tr( "Add a branch as child of selection" ));
+ a->setShortcut (Qt::Key_Insert);
+ a->setEnabled (false);
+ connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
+ actionListBranches.append(a);
#if defined (Q_OS_MACX)
- a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), CTRL + Key_I, this, "newBranch" );
- #else
- a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
- #endif
- connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
+ // In OSX show different shortcut in menues, the keys work independtly always
+ actionEditAddBranch=alt;
+ #else
+ actionEditAddBranch=a;
+ #endif
+
+ // Add branch by inserting it at selection
+ a = new QAction(tr( "Add branch (insert)" ), this);
+ a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
+ a->setShortcut (Qt::ALT + Qt::Key_Insert );
+ connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
a->setEnabled (false);
- a->addTo ( menu );
- actionEditAddBranch=a;
+ actionListBranches.append(a);
+ actionEditAddBranchHere=a;
+ a = new QAction(tr( "Add branch (insert)" ),this);
+ a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
+ a->setShortcut ( Qt::ALT + Qt::Key_A );
+ connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
+ actionListBranches.append(a);
// Add branch above
- a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
+ a = new QAction(tr( "Add branch above" ), this);
+ a->setStatusTip ( tr( "Add a branch above selection" ));
+ a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
a->setEnabled (false);
- a->addTo ( menu );
+ actionListBranches.append(a);
actionEditAddBranchAbove=a;
+ a = new QAction(tr( "Add branch above" ), this);
+ a->setStatusTip ( tr( "Add a branch above selection" ));
+ a->setShortcut (Qt::SHIFT+Qt::Key_A );
+ connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
+ actionListBranches.append(a);
// Add branch below
- a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
+ a = new QAction(tr( "Add branch below" ), this);
+ a->setStatusTip ( tr( "Add a branch below selection" ));
+ a->setShortcut (Qt::CTRL +Qt::Key_Insert );
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
a->setEnabled (false);
- a->addTo ( menu );
+ actionListBranches.append(a);
actionEditAddBranchBelow=a;
+ a = new QAction(tr( "Add branch below" ), this);
+ a->setStatusTip ( tr( "Add a branch below selection" ));
+ a->setShortcut (Qt::CTRL +Qt::Key_A );
+ connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
+ actionListBranches.append(a);
// Import at selection (adding to selection)
- a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
+ a = new QAction( tr( "Add map (insert)" ),this);
+ a->setStatusTip (tr( "Add map at selection" ));
connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
a->setEnabled (false);
- a->addTo ( menu );
+ actionListBranches.append(a);
actionEditImportAdd=a;
// Import at selection (replacing selection)
- a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
+ a = new QAction( tr( "Add map (replace)" ), this);
+ a->setStatusTip (tr( "Replace selection with map" ));
connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
a->setEnabled (false);
- a->addTo ( menu );
+ actionListBranches.append(a);
actionEditImportReplace=a;
// Save selection
- a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
+ a = new QAction( tr( "Save selection" ), this);
+ a->setStatusTip (tr( "Save selection" ));
connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
a->setEnabled (false);
- a->addTo ( menu );
+ actionListBranches.append(a);
actionEditSaveBranch=a;
+ // Only remove branch, not its childs
+ a = new QAction(tr( "Remove only branch " ), this);
+ a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
+ a->setShortcut (Qt::ALT + Qt::Key_Delete );
+ connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchKeepChilds() ) );
+ a->setEnabled (false);
+ actionListBranches.append(a);
+ actionEditRemoveBranchKeepChilds=a;
+
+ // Only remove childs of a branch
+ a = new QAction( tr( "Remove childs" ), this);
+ a->setStatusTip (tr( "Remove childs of branch" ));
+ a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
+ connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
+ a->setEnabled (false);
+ actionListBranches.append(a);
+ actionEditRemoveChilds=a;
+
// Shortcuts for navigating with cursor:
- a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
+ a = new QAction(tr( "Select upper branch" ), this);
+ a->setStatusTip ( tr( "Select upper branch" ));
+ a->setShortcut (Qt::Key_Up );
connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
- a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
+ a = new QAction( tr( "Select lower branch" ),this);
+ a->setStatusTip (tr( "Select lower branch" ));
+ a->setShortcut ( Qt::Key_Down );
connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
- a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
+ a = new QAction(tr( "Select left branch" ), this);
+ a->setStatusTip ( tr( "Select left branch" ));
+ a->setShortcut (Qt::Key_Left );
connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
- a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
+ a = new QAction( tr( "Select child branch" ), this);
+ a->setStatusTip (tr( "Select right branch" ));
+ a->setShortcut (Qt::Key_Right);
connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
- a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
+ a = new QAction( tr( "Select first branch" ), this);
+ a->setStatusTip (tr( "Select first branch" ));
+ a->setShortcut (Qt::Key_Home );
a->setEnabled (false);
a->addTo ( menu );
+ actionListBranches.append(a);
actionEditSelectFirst=a;
connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
- a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
+ a = new QAction( tr( "Select last branch" ),this);
+ a->setStatusTip (tr( "Select last branch" ));
+ a->setShortcut ( Qt::Key_End );
connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
a->setEnabled (false);
a->addTo ( menu );
+ actionListBranches.append(a);
actionEditSelectLast=a;
- a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
+ a = new QAction( tr( "Add Image" )+QString("..."), this);
+ a->setStatusTip (tr( "Add Image" ));
connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
actionEditLoadImage=a;
+
}
// Format Actions
void Main::setupFormatActions()
{
- QPopupMenu *menu = new QPopupMenu( this );
- menuBar()->insertItem( tr( "&Format" ), menu );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
+ menuBar()->insertItem( tr( "F&ormat" ), menu );
- QToolBar *tb = new QToolBar( this );
+ Q3ToolBar *tb = new Q3ToolBar( this );
QAction *a;
QPixmap pix( 16,16);
- pix.fill (black);
- actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
- connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
- actionFormatColor->addTo( tb );
- actionFormatColor->addTo( menu );
- 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" );
+ pix.fill (Qt::black);
+ a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
+ a->setStatusTip ( tr( "Set Color" ));
+ connect( a, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
+ a->addTo( tb );
+ a->addTo( menu );
+ actionFormatColor=a;
+ a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
+ a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_K );
connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
+ actionListBranches.append(a);
actionFormatPickColor=a;
- a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
+
+ a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
+ a->setStatusTip ( tr( "Color branch" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_I);
connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
a->setEnabled (false);
a->addTo( tb );
a->addTo( menu );
+ actionListBranches.append(a);
actionFormatColorBranch=a;
- a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
+
+ a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
+ a->setStatusTip ( tr( "Color Subtree" ));
+ a->setShortcut (Qt::CTRL + Qt::Key_T);
connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
a->setEnabled (false);
a->addTo( menu );
a->addTo( tb );
+ actionListBranches.append(a);
actionFormatColorSubtree=a;
menu->insertSeparator();
- actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
+ actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
actionGroupFormatLinkStyles->setExclusive (true);
- a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
+ a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
+ a->setStatusTip (tr( "Line" ));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
actionFormatLinkStyleLine=a;
- a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
+ a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
+ a->setStatusTip (tr( "Line" ));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
actionFormatLinkStyleParabel=a;
- a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
+ a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
+ a->setStatusTip (tr( "PolyLine" ));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
actionFormatLinkStylePolyLine=a;
- a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
+ a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
+ a->setStatusTip (tr( "PolyParabel" ) );
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
actionFormatLinkStylePolyParabel=a;
actionGroupFormatLinkStyles->addTo (menu);
- actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
+ actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
actionGroupFormatFrameTypes->setExclusive (true);
- a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
+ a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
+ a->setStatusTip (tr("No Frame"));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
actionFormatFrameNone=a;
- a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
+ a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
+ a->setStatusTip (tr( "Rectangle" ));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
actionFormatFrameRectangle=a;
+ a = new QAction( tr( "Include images vertically" ), actionFormatIncludeImagesVer);
+ a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
+ a->setToggleAction(true);
+ connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
+ actionFormatIncludeImagesVer=a;
+
+ a = new QAction( tr( "Include images horizontally" ), actionFormatIncludeImagesHor );
+ a->setStatusTip ( tr ("Include left and right position of images into branch"));
+ a->setToggleAction(true);
+ connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
+ actionFormatIncludeImagesHor=a;
+
+ a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
+ a->setStatusTip (tr( "Hide link" ));
+ a->setToggleAction(true);
+ connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
+ actionFormatHideLinkUnselected=a;
+
menu->insertSeparator();
- a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
+ a= new QAction( tr( "&Use color of heading for link" ), this);
+ a->setStatusTip (tr( "Use same color for links and headings" ));
a->setToggleAction(true);
connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
a->addTo( menu );
actionFormatLinkColorHint=a;
- pix.fill (white);
- actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
- connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
- actionFormatLinkColor->addTo( menu );
- actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
- connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
- actionFormatBackColor->addTo( menu );
+
+ pix.fill (Qt::white);
+ a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this );
+ a->setStatusTip (tr( "Set Link Color" ));
+ a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
+ actionFormatLinkColor=a;
+
+ a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
+ a->setStatusTip (tr( "Set Background Color" ));
+ a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
+ actionFormatBackColor=a;
}
// View Actions
void Main::setupViewActions()
{
- QToolBar *tb = new QToolBar( this );
+ Q3ToolBar *tb = new Q3ToolBar( this );
tb->setLabel( "View Actions" );
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&View" ), menu );
QAction *a;
- a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
- connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
+ a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
+ a->setStatusTip ( tr( "Zoom reset" ) );
+ a->setShortcut (Qt::CTRL + Qt::Key_0 );
a->addTo( tb );
a->addTo( menu );
- a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
- connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
+ connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
+
+ a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
+ a->setStatusTip (tr( "Zoom in" ));
+ a->setShortcut (Qt::CTRL + Qt::Key_Plus);
a->addTo( tb );
a->addTo( menu );
- a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
- connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
+ connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
+
+ a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
+ a->setStatusTip (tr( "Zoom out" ));
+ a->setShortcut (Qt::CTRL + Qt::Key_Minus );
a->addTo( tb );
a->addTo( menu );
- a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
- connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
+ connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
+
+
+ a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
+ a->setStatusTip ( tr( "Show Note Editor" ));
+ a->setShortcut ( Qt::CTRL + Qt::Key_E );
a->setToggleAction(true);
if (textEditor->showWithMain())
a->setOn(true);
@@ -666,102 +942,348 @@
a->setOn(false);
a->addTo( tb );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
actionViewToggleNoteEditor=a;
- a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
+
+ a = new QAction( tr( "Show history window" ),this );
+ a->setStatusTip ( tr( "Show history window" ));
+ a->setShortcut ( Qt::CTRL + Qt::Key_H );
+ a->setToggleAction(false);
+ a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT(windowToggleHistory() ) );
+ actionViewToggleHistoryWindow=a;
+
+ a = new QAction(tr( "Next Window" ), this);
+ a->setStatusTip ( tr( "&Next Window" ) );
+ a->setShortcut (Qt::ALT + Qt::Key_N );
+ a->addTo( menu );
connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
+
+ a = new QAction (tr( "Previous Window" ), this );
+ a->setStatusTip (tr( "&Previous Window" ));
+ a->setShortcut (Qt::ALT + Qt::Key_P );
a->addTo( menu );
- a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
- a->addTo( menu );
+}
+
+// Mode Actions
+void Main::setupModeActions()
+{
+ //QPopupMenu *menu = new QPopupMenu( this );
+ //menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
+
+ Q3ToolBar *tb = new Q3ToolBar( this );
+ tb->setLabel( tr ("Modes when using modifiers") );
+ QAction *a;
+ actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
+ actionGroupModModes->setExclusive (true);
+ a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
+ a->setShortcut (Qt::Key_J);
+ a->setStatusTip ( tr( "Use modifier to color branches" ));
+ a->setToggleAction(true);
+ a->addTo (tb);
+ a->setOn(true);
+ actionModModeColor=a;
+
+ a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
+ a->setShortcut( Qt::Key_K);
+ a->setStatusTip( tr( "Use modifier to copy" ));
+ a->setToggleAction(true);
+ a->addTo (tb);
+ actionModModeCopy=a;
+
+ a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
+ a->setShortcut (Qt::Key_L);
+ a->setStatusTip( tr( "Use modifier to draw xLinks" ));
+ a->setToggleAction(true);
+ a->addTo (tb);
+ actionModModeLink=a;
}
// Flag Actions
void Main::setupFlagActions()
{
+ // Create System Flags
+ systemFlagsDefault = new FlagRowObj ();
+ systemFlagsDefault->setVisibility (false);
+ systemFlagsDefault->setName ("systemFlagsDef");
+
+ FlagObj *fo = new FlagObj ();
+ fo->load(QPixmap(flagsPath+"flag-note.png"));
+ fo->setName("note");
+ fo->setToolTip(tr("Note","Systemflag"));
+ systemFlagsDefault->addFlag (fo); // makes deep copy
+
+ fo->load(QPixmap(flagsPath+"flag-url.png"));
+ fo->setName("url");
+ fo->setToolTip(tr("WWW Document (external)","Systemflag"));
+ systemFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
+ fo->setName("vymLink");
+ fo->setToolTip(tr("Link to another vym map","Systemflag"));
+ systemFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
+ fo->setName("scrolledright");
+ fo->setToolTip(tr("subtree is scrolled","Systemflag"));
+ systemFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
+ fo->setName("tmpUnscrolledright");
+ fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
+ systemFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
+ fo->setName("hideInExport");
+ fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
+ systemFlagsDefault->addFlag (fo);
+
+ // Create Standard Flags
+ standardFlagsDefault = new FlagRowObj ();
+ standardFlagsDefault->setVisibility (false);
+ standardFlagsDefault->setName ("standardFlagsDef");
+
+ fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
+ fo->setName ("exclamationmark");
+ fo->setGroup("standard-mark");
+ fo->setToolTip(tr("Take care!","Standardflag"));
+ standardFlagsDefault->addFlag (fo); // makes deep copy
+
+ fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
+ fo->setName("questionmark");
+ fo->setGroup("standard-mark");
+ fo->setToolTip(tr("Really?","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
+ fo->setName("hook-green");
+ fo->setGroup("standard-hook");
+ fo->setToolTip(tr("ok!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
+ fo->setName("cross-red");
+ fo->setGroup("standard-hook");
+ fo->setToolTip(tr("Not ok!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
+ fo->setName("stopsign");
+ fo->setToolTip(tr("This won't work!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
+ fo->setName("smiley-good");
+ fo->setGroup("standard-smiley");
+ fo->setToolTip(tr("Good","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
+ fo->setName("smiley-sad");
+ fo->setGroup("standard-smiley");
+ fo->setToolTip(tr("Bad","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
+ // Original omg.png (in KDE emoticons)
+ fo->setName("smiley-omg");
+ fo->setGroup("standard-smiley");
+ fo->setToolTip(tr("Oh no!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
+ fo->setName("clock");
+ fo->setToolTip(tr("Time critical","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-phone.png"));
+ fo->setName("phone");
+ fo->setToolTip(tr("Call...","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-lamp.png"));
+ fo->setName("lamp");
+ fo->setToolTip(tr("Idea!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
+ fo->setName("arrow-up");
+ fo->setGroup("standard-arrow");
+ fo->setToolTip(tr("Important","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
+ fo->setName("arrow-down");
+ fo->setGroup("standard-arrow");
+ fo->setToolTip(tr("Unimportant","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
+ fo->setName("2arrow-up");
+ fo->setGroup("standard-arrow");
+ fo->setToolTip(tr("Very important!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
+ fo->setName("2arrow-down");
+ fo->setGroup("standard-arrow");
+ fo->setToolTip(tr("Very unimportant!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
+ fo->setName("thumb-up");
+ fo->setGroup("standard-thumb");
+ fo->setToolTip(tr("I like this","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
+ fo->setName("thumb-down");
+ fo->setGroup("standard-thumb");
+ fo->setToolTip(tr("I like this","Standardflag"));
+ fo->setToolTip(tr("I do not like this","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-rose.png"));
+ fo->setName("rose");
+ fo->setToolTip(tr("Rose","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-heart.png"));
+ fo->setName("heart");
+ fo->setToolTip(tr("I just love... ","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-present.png"));
+ fo->setName("present");
+ fo->setToolTip(tr("Surprise!","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-flash.png"));
+ fo->setName("flash");
+ fo->setToolTip(tr("Dangerous","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-info.png"));
+ // Original: xsldbg_output.png
+ fo->setName("info");
+ fo->setToolTip(tr("Info","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
+ // Original khelpcenter.png
+ fo->setName("lifebelt");
+ fo->setToolTip(tr("This will help","Standardflag"));
+ standardFlagsDefault->addFlag (fo);
+
+ delete (fo);
+
standardFlagsDefault->makeToolbar(this, "Standard Flags");
}
// Settings Actions
void Main::setupSettingsActions()
{
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&Settings" ), menu );
QAction *a;
- a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
+ a = new QAction( tr( "Set application to open pdf files"), this);
+ a->setStatusTip ( tr( "Set application to open pdf files"));
connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
a->addTo( menu );
- a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
+ a = new QAction( tr( "Set application to open external links"), this);
+ a->setStatusTip( tr( "Set application to open external links"));
connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
a->addTo( menu );
menu->insertSeparator();
- a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
+ a = new QAction( tr( "Edit branch after adding it" ), this );
+ a->setStatusTip( tr( "Edit branch after adding it" ));
a->setToggleAction(true);
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
a->addTo( menu );
actionSettingsAutoedit=a;
- a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
+ a= new QAction( tr( "Select branch after adding it" ), this );
+ a->setStatusTip( tr( "Select branch after adding it" ));
a->setToggleAction(true);
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
a->addTo( menu );
actionSettingsAutoselectHeading=a;
- a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
+ a= new QAction(tr( "Select existing heading" ), this);
+ a->setStatusTip( tr( "Select heading before editing" ));
a->setToggleAction(true);
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
a->addTo( menu );
actionSettingsAutoselectText=a;
- a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
+ a= new QAction(tr( "pasting into new branch" ), this );
+ a->setStatusTip( tr( "Pasting into new branch" ));
a->setToggleAction(true);
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
a->addTo( menu );
actionSettingsPasteNewHeading=a;
- a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
+ a= new QAction( tr( "Delete key" ), this);
+ a->setStatusTip( tr( "Delete key for deleting branches" ));
a->setToggleAction(true);
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
a->addTo( menu );
+ connect( a, SIGNAL( activated() ), this, SLOT( settingsToggleDelKey() ) );
actionSettingsUseDelKey=a;
+
+ a= new QAction( tr( "Exclusive flags" ), this);
+ a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
+ a->setToggleAction(true);
+ a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
+ a->addTo( menu );
+ actionSettingsUseFlagGroups=a;
+
+ a= new QAction( tr( "Use hide flags" ), this);
+ a->setStatusTip( tr( "Use hide flag during exports " ));
+ a->setToggleAction(true);
+ a->setOn ( settings.readBoolEntry ("/vym/export/useHideExport",true) );
+ a->addTo( menu );
+ actionSettingsUseHideExport=a;
}
// Test Actions
void Main::setupTestActions()
{
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&Test" ), menu );
QAction *a;
- a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
+ a = new QAction( tr( "test flag" ), this);
+ a->setStatusTip( tr( "Call test function" ));
connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
a->addTo( menu );
-
- a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
- connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
- a->addTo( menu );
}
// Help Actions
void Main::setupHelpActions()
{
- QPopupMenu *menu = new QPopupMenu( this );
+ Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&Help" ), menu );
QAction *a;
- a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
+ a = new QAction( tr( "Open VYM Documentation (pdf) " ), this );
+ a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
a->addTo( menu );
- a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
+ a = new QAction( tr( "About VYM" ), this);
+ a->setStatusTip( tr( "About VYM")+" "__VYM);
connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
a->addTo( menu );
- a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
+ a = new QAction( tr( "About QT" ), this);
+ a->setStatusTip( tr( "Information about QT toolkit" ));
connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
a->addTo( menu );
}
@@ -772,44 +1294,89 @@
QAction*a;
// Context Menu for branch or mapcenter
- branchContextMenu =new QPopupMenu (this);
- actionEditAddBranch->addTo ( branchContextMenu );
- actionEditAddBranchAbove->addTo ( branchContextMenu );
- actionEditAddBranchBelow->addTo ( branchContextMenu );
+ branchContextMenu =new Q3PopupMenu (this);
+
+ // Submenu "Add"
+ branchAddContextMenu =new Q3PopupMenu (this);
+ actionEditPaste->addTo ( branchAddContextMenu );
+ actionEditAddBranch->addTo ( branchAddContextMenu );
+ actionEditAddBranchHere->addTo ( branchAddContextMenu );
+ actionEditAddBranchAbove->addTo ( branchAddContextMenu );
+ actionEditAddBranchBelow->addTo ( branchAddContextMenu );
+ branchAddContextMenu->insertSeparator();
+ actionEditLoadImage->addTo( branchAddContextMenu );
+ branchAddContextMenu->insertSeparator();
+ actionEditImportAdd->addTo ( branchAddContextMenu );
+ actionEditImportReplace->addTo ( branchAddContextMenu );
+
+ // Submenu "Remove"
+ branchRemoveContextMenu =new Q3PopupMenu (this);
+ actionEditCut->addTo ( branchRemoveContextMenu );
+ actionEditDelete->addTo ( branchRemoveContextMenu );
+ actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
+ actionEditRemoveChilds->addTo( branchRemoveContextMenu );
+
+ branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
+ branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
+
actionEditSaveBranch->addTo( branchContextMenu );
- branchContextMenu->insertSeparator();
- actionEditImportAdd->addTo ( branchContextMenu );
- actionEditImportReplace->addTo ( branchContextMenu );
+
branchContextMenu->insertSeparator();
actionEditOpenURL->addTo ( branchContextMenu );
+ actionEditOpenURLTab->addTo ( branchContextMenu );
actionEditURL->addTo ( branchContextMenu );
actionEditHeading2URL->addTo ( branchContextMenu );
+ actionEditBugzilla2URL->addTo( branchContextMenu );
if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
- actionEditBugzilla2URL->addTo( branchContextMenu );
+ {
+ actionEditFATE2URL->addTo( branchContextMenu );
+ }
branchContextMenu->insertSeparator();
actionEditOpenVymLink->addTo ( branchContextMenu );
actionEditVymLink->addTo ( branchContextMenu );
actionEditDeleteVymLink->addTo ( branchContextMenu );
- branchContextMenu->insertSeparator();
- actionEditLoadImage->addTo( branchContextMenu );
- branchContextMenu->insertSeparator();
- actionEditCopy->addTo( branchContextMenu );
- actionEditCut->addTo( branchContextMenu );
- actionEditPaste->addTo( branchContextMenu );
+
branchContextMenu->insertSeparator();
actionGroupFormatFrameTypes->addTo( branchContextMenu );
+ branchContextMenu->insertSeparator();
+ actionFormatIncludeImagesVer->addTo( branchContextMenu );
+ actionFormatIncludeImagesHor->addTo( branchContextMenu );
+ actionFormatHideLinkUnselected->addTo( branchContextMenu );
+
+ // Context Menu for links in a branch menu
+ // This will be populated "on demand" in MapEditor::updateActions
+ branchContextMenu->insertSeparator();
+ branchLinksContextMenu =new Q3PopupMenu (this);
+ branchLinksContextMenuDup =new Q3PopupMenu (this);
+ branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
+ connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
+
+ branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
+ connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
+
// Context menu for floatimage
- floatimageContextMenu =new QPopupMenu (this);
- saveImageFormatMenu=new QPopupMenu (this);
- exportImageFormatMenu=new QPopupMenu (this);
+ floatimageContextMenu =new Q3PopupMenu (this);
+ saveImageFormatMenu=new Q3PopupMenu (this);
+ exportImageFormatMenu=new Q3PopupMenu (this);
- QStrList fmt = QImage::outputFormats();
+/* FIXME strange error
+ foreach (QByteArray format, QImageWriter::supportedImageFormats())
+ {
+ QString text = tr("%1...").arg(QString(format).toUpper());
+ saveImageFormatMenu->insertItem( text );
+ exportImageFormatMenu->insertItem( text );
+ }
+*/
+
+/* FIXME not needed any longer
+ Q3StrList fmt = QImageWriter::supportedImageFormats();
for (const char* f = fmt.first(); f; f = fmt.next())
{
saveImageFormatMenu->insertItem( f );
exportImageFormatMenu->insertItem( f );
}
+*/
connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
@@ -819,39 +1386,48 @@
actionEditCut->addTo( floatimageContextMenu );
floatimageContextMenu->insertSeparator();
- a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
- a->setToggleAction(true);
- connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
- a->addTo( floatimageContextMenu);
- actionEditToggleFloatExport=a;
+ actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
+ exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
+ a = new QAction( "Open Office"+QString("..."), this);
+ a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
+ a->addTo (exportMenu);
- // Context menu for exports
- exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
-
- a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
+ a = new QAction( "Webpage (XHTML)...",this );
+ a->setShortcut (Qt::ALT + Qt::Key_X);
+ a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
a->addTo( exportMenu );
- a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" );
+ a = new QAction( "Text (ASCII)...", this);
+ a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
+ a->addTo( exportMenu );
+
+ a = new QAction( tr("KDE Bookmarks"), this);
+ a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
+ a->addTo (exportMenu);
+
+ a = new QAction( "Taskjuggler...", this );
+ a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
+ a->addTo( exportMenu );
+
+ a = new QAction( "LaTeX...", this);
+ a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
+ connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
+ a->addTo( exportMenu );
+
+ a = new QAction( "XML..." , this );
+ a->setStatusTip (tr( "Export as")+" XML");
connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
a->addTo( exportMenu );
- if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
- {
- a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
- a->addTo( exportMenu );
- }
-
- a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
- connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
- a->addTo( exportMenu );
-
-
// Context menu for canvas
- canvasContextMenu =new QPopupMenu (this);
+ canvasContextMenu =new Q3PopupMenu (this);
actionEditMapInfo->addTo( canvasContextMenu );
canvasContextMenu->insertSeparator();
actionGroupFormatLinkStyles->addTo( canvasContextMenu );
@@ -910,7 +1486,7 @@
void Main::showEvent (QShowEvent * )
{
- if (textEditor->showWithMain()) textEditor->show();
+ if (textEditor->showWithMain()) textEditor->showNormal();
}
bool Main::reallyWriteDirectory(const QString &dir)
@@ -920,9 +1496,8 @@
if (eList.first() =="..") eList.pop_front(); // remove "."
if (!eList.isEmpty())
{
- QMessageBox mb( "VYM",
- tr("The directory ") + dir +
- tr(" is not empty. Do you risk to overwrite its contents?"),
+ QMessageBox mb( __VYM,
+ tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
QMessageBox::Warning,
QMessageBox::Yes ,
QMessageBox::Cancel | QMessageBox::Default,
@@ -945,9 +1520,9 @@
QString Main::browseDirectory (const QString &caption)
{
- QFileDialog fd(this,caption);
- fd.setMode (QFileDialog::DirectoryOnly);
- fd.setCaption("VYM - "+caption);
+ Q3FileDialog fd(this,caption);
+ fd.setMode (Q3FileDialog::DirectoryOnly);
+ fd.setCaption(__VYM " - "+caption);
fd.show();
if ( fd.exec() == QDialog::Accepted )
@@ -968,7 +1543,7 @@
void Main::newView()
{
// Open a new view... have it delete when closed.
- Main *m = new Main(0, 0, WDestructiveClose);
+ Main *m = new Main(0, 0, Qt::WDestructiveClose);
qApp->setMainWidget(m);
m->show();
qApp->setMainWidget(0);
@@ -995,18 +1570,17 @@
void Main::fileNew()
{
QString fn="unnamed";
- MapEditor* medit = new MapEditor (tabWidget, true);
+ MapEditor* medit = new MapEditor ( NULL,true);
tabWidget->addTab (medit,fn);
tabWidget->showPage(medit);
medit->viewport()->setFocus();
+ // For the very first map we do not have flagrows yet...
medit->select("mc:");
}
-void Main::fileLoad(QString fn, const LoadMode &lmode)
+ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
{
- // Error codes
- enum errorCode {success,aborted};
- errorCode err=success;
+ ErrorCode err=success;
// fn is usually the archive, mapfile the file after uncompressing
QString mapfile;
@@ -1026,15 +1600,15 @@
if (me->getFilePath() == fn)
{
// Already there, ask for confirmation
- QMessageBox mb( "VYM",
- tr("The map ") + fn + tr ("\n is already opened."
+ QMessageBox mb( __VYM,
+ tr("The map %1\nis already opened."
"Opening the same map in multiple editors may lead \n"
"to confusion when finishing working with vym."
- "Do you want to"),
+ "Do you want to").arg(fn),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::Cancel | QMessageBox::Escape,
- QMessageBox::QMessageBox::NoButton);
+ QMessageBox::NoButton);
mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
switch( mb.exec() )
@@ -1045,7 +1619,7 @@
break;
case QMessageBox::Cancel:
// do nothing
- return;
+ return aborted;
break;
}
}
@@ -1074,13 +1648,12 @@
// from command line
if (!QFile(fn).exists() )
{
- QMessageBox mb( "VYM",
- tr("The map") + fn +
- tr(" does not exist.\n Do you want to create a new one?"),
+ QMessageBox mb( __VYM,
+ tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
QMessageBox::Question,
QMessageBox::Yes ,
QMessageBox::Cancel | QMessageBox::Default,
- QMessageBox::QMessageBox::NoButton );
+ QMessageBox::NoButton );
mb.setButtonText( QMessageBox::Yes, tr("Create"));
mb.setButtonText( QMessageBox::No, tr("Cancel"));
@@ -1092,13 +1665,13 @@
tabWidget->setTabLabel (currentMapEditor(),
currentMapEditor()->getFileName() );
statusBar()->message( "Created " + fn , statusbarTime );
- return;
+ return success;
case QMessageBox::Cancel:
// don't create new map
statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
fileCloseMap();
- return;
+ return aborted;
}
}
@@ -1112,130 +1685,101 @@
QString tmpMapDir=mkdtemp(tmpdir1);
// Try to unzip file
- Process *zipProc=new Process ();
- zipProc->clearArguments();
- zipProc->setWorkingDirectory (QDir(tmpMapDir));
- zipProc->addArgument ("unzip");
- zipProc->addArgument (fn );
- zipProc->addArgument ("-d");
- zipProc->addArgument (tmpMapDir);
-
- if (!zipProc->start() )
+ err=unzipDir (tmpMapDir,fn);
+ if (err==nozip)
{
- QMessageBox::critical( 0, tr( "Critical Load Error" ),
- tr("Couldn't start unzip to decompress data."));
- err=aborted;
-
+ mapfile=fn;
+ me->setZipped(false);
} else
{
- zipProc->waitFinished();
- if (!zipProc->normalExit() )
+ me->setZipped(true);
+
+ // Look for mapname.xml
+ mapfile= fn.left(fn.findRev(".",-1,true));
+ mapfile=mapfile.section( '/', -1 );
+ QFile file( tmpMapDir + "/" + mapfile + ".xml");
+ if (!file.exists() )
{
- QMessageBox::critical( 0, tr( "Critical Load Error" ),
- tr("unzip didn't exit normally") +
- zipProc->getErrout() );
- err=aborted;
- } else
- {
- if (zipProc->exitStatus()>0)
+ // mapname.xml does not exist, well,
+ // maybe some renamed the mapname.vym file...
+ // Try to find any .xml in the toplevel
+ // directory of the .vym file
+ QStringList flist=QDir (tmpMapDir).entryList("*.xml");
+ if (flist.count()==1)
{
- if (zipProc->exitStatus()==9)
- {
- // no zipped file, but maybe .xml or old version? Try again.
- mapfile=fn;
- me->setZipped(false);
- }
- else
- {
- QMessageBox::critical( 0, tr( "Critical Load Error" ),
- QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
- zipProc->getErrout() );
- err=aborted;
- }
+ // Only one entry, take this one
+ mapfile=tmpMapDir + "/"+flist.first();
} else
- { // Uncompressing was successfull,
- // load from uncompressed temporary directory
-
- me->setZipped(true);
-
+ {
+ for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
+ *it=tmpMapDir + "/" + *it;
+ // TODO Multiple entries, load all (but only the first one into this ME)
+ //mainWindow->fileLoadFromTmp (flist);
+ //returnCode=1; // Silently forget this attempt to load
+ qWarning ("MainWindow::load (fn) multimap found...");
+ }
- // Look for mapname.xml
- mapfile= fn.left(fn.findRev(".",-1,true));
- mapfile=mapfile.section( '/', -1 );
- QFile file( tmpMapDir + "/" + mapfile + ".xml");
- if (!file.exists() )
- {
- // mapname.xml does not exist, well,
- // maybe some renamed the mapname.vym file...
- // Try to find any .xml in the toplevel
- // directory of the .vym file
- QStringList flist=QDir (tmpMapDir).entryList("*.xml");
- if (flist.count()==1)
- {
- // Only one entry, take this one
- mapfile=tmpMapDir + "/"+flist.first();
- } else
- {
- for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
- *it=tmpMapDir + "/" + *it;
- // FIXME
- // Multiple entries, load all (but only the first one into this ME)
- //mainWindow->fileLoadFromTmp (flist);
- //returnCode=1; // Silently forget this attempt to load
- qWarning ("MainWindow::load (fn) multimap found...");
- }
-
- if (flist.isEmpty() )
- {
- QMessageBox::critical( 0, tr( "Critical Load Error" ),
- tr("Couldn't find a map (*.xml) in .vym archive.\n"));
- err=aborted;
- }
- } //file doesn't exist
- else
- mapfile=file.name();
- } // Uncompressing successfull
- }
+ if (flist.isEmpty() )
+ {
+ QMessageBox::critical( 0, tr( "Critical Load Error" ),
+ tr("Couldn't find a map (*.xml) in .vym archive.\n"));
+ err=aborted;
+ }
+ } //file doesn't exist
+ else
+ mapfile=file.name();
}
- // Finally load map into mapEditor
- me->setFilePath (mapfile,fn);
- if (me->load(mapfile,lmode))
- err=aborted;
+ if (err!=aborted)
+ {
+ // Save existing filename in case we import
+ QString fn_org=me->getFilePath();
- // Delete tmpDir
- system ( "rm -rf "+tmpMapDir);
+ // Finally load map into mapEditor
+ me->setFilePath (mapfile,fn);
+ err=me->load(mapfile,lmode);
- // Check for errors
- if (err==success)
+ // Restore old (maybe empty) filepath, if this is an import
+ if (lmode!=NewMap)
+ me->setFilePath (fn_org);
+ }
+
+ // Finally check for errors and go home
+ if (err==aborted)
+ {
+ if (lmode==NewMap) fileCloseMap();
+ statusBar()->message( "Could not load " + fn, statusbarTime );
+ } else
{
if (lmode==NewMap)
{
me->setFilePath (fn);
tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
- lastMaps.prepend(me->getFilePath() );
- setupLastMapsMenu();
+ if (fn.left(9)!="/tmp/vym-")
+ {
+ // Only append to lastMaps if not loaded from a tmpDir
+ // e.g. imported bookmarks are in a tmpDir
+ lastMaps.prepend(me->getFilePath() );
+ setupLastMapsMenu();
+ }
actionFilePrint->setEnabled (true);
}
statusBar()->message( "Loaded " + fn, statusbarTime );
- return;
- } else
- {
- if (lmode==NewMap)
- fileCloseMap();
}
-
+ // Delete tmpDir
+ removeDir (QDir(tmpMapDir));
}
- statusBar()->message( "Could not load " + fn, statusbarTime );
+ return err;
}
void Main::fileLoad(const LoadMode &lmode)
{
- QFileDialog *fd=new QFileDialog( this);
+ Q3FileDialog *fd=new Q3FileDialog( this);
if (!lastFileDir.isEmpty())
fd->setDir (lastFileDir);
+ fd->setMode (Q3FileDialog::ExistingFiles);
fd->addFilter ("XML (*.xml)");
fd->addFilter ("VYM map (*.vym *.vyp)");
switch (lmode)
@@ -1256,9 +1800,16 @@
if ( fd->exec() == QDialog::Accepted )
{
lastFileDir=fd->dirPath();
- fn = fd->selectedFile();
- fileLoad(fn, lmode);
+ QStringList flist = fd->selectedFiles();
+ QStringList::Iterator it = flist.begin();
+ while( it != flist.end() )
+ {
+ fn = *it;
+ fileLoad(*it, lmode);
+ ++it;
+ }
}
+ delete (fd);
}
void Main::fileLoad()
@@ -1268,7 +1819,7 @@
void Main::fileLoadLast(int i)
{
- fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);
+ fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);
}
void Main::fileSave(const SaveMode &savemode)
@@ -1277,16 +1828,16 @@
QString tmpMapDir;
// Error codes
- enum errorCode {success,aborted};
- errorCode err=success;
+ ErrorCode err=success;
QString safeFilePath;
bool saveZipped=currentMapEditor()->saveZipped();
- if (currentMapEditor())
+ MapEditor * me=currentMapEditor();
+ if (me)
{
- QString fn=currentMapEditor()->getFilePath();
+ QString fn=me->getFilePath();
// filename=unnamed, filepath="" in constructor...
if ( !fn.isEmpty() )
{
@@ -1302,12 +1853,11 @@
// Look, if we should zip the data:
if (!saveZipped)
{
- QMessageBox mb( "VYM",
- tr("The map ") + fn +
- tr ("\ndid not use the compressed "
+ QMessageBox mb( __VYM,
+ tr("The map %1\ndid not use the compressed "
"vym file format.\nWriting it uncompressed will also write images \n"
"and flags and thus may overwrite files in the "
- "given directory\n\nDo you want to write the map"),
+ "given directory\n\nDo you want to write the map").arg(fn),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No ,
@@ -1337,57 +1887,22 @@
char tmpdir1[]="/tmp/vym-XXXXXX";
tmpMapDir=mkdtemp(tmpdir1);
- safeFilePath=currentMapEditor()->getFilePath();
- currentMapEditor()->setFilePath (tmpMapDir+"/"+
- currentMapEditor()->getMapName()+ ".xml",
+ safeFilePath=me->getFilePath();
+ me->setFilePath (tmpMapDir+"/"+
+ me->getMapName()+ ".xml",
safeFilePath);
- currentMapEditor()->save (savemode);
- currentMapEditor()->setFilePath (safeFilePath);
+ me->save (savemode);
+ me->setFilePath (safeFilePath);
- // zip the temporary directory
- Process *zipProc=new Process ();
- zipProc->clearArguments();
- zipProc->setWorkingDirectory (QDir(tmpMapDir));
- zipProc->addArgument ("zip");
- zipProc->addArgument ("-r");
- zipProc->addArgument (fn);
- zipProc->addArgument (".");
-
- if (!zipProc->start() )
- {
- // zip could not be started
- QMessageBox::critical( 0, tr( "Critical Save Error" ),
- tr("Couldn't start zip to compress data."));
- err=aborted;
- } else
- {
- // zip could be started
- zipProc->waitFinished();
- if (!zipProc->normalExit() )
- {
- QMessageBox::critical( 0, tr( "Critical Save Error" ),
- tr("zip didn't exit normally")+
- "\n" + zipProc->getErrout());
- err=aborted;
- } else
- {
- if (zipProc->exitStatus()>0)
- {
- QMessageBox::critical( 0, tr( "Critical Save Error" ),
- QString("zip exit code: %1").arg(zipProc->exitStatus() )+
- "\n" + zipProc->getErrout() );
- err=aborted;
- }
- }
- } // zip could be started
+ zipDir (tmpMapDir,fn);
} // save zipped
else
{
// Save unzipped.
- safeFilePath=currentMapEditor()->getFilePath();
- currentMapEditor()->setFilePath (fn, safeFilePath);
- currentMapEditor()->save (savemode);
- currentMapEditor()->setFilePath (safeFilePath);
+ safeFilePath=me->getFilePath();
+ me->setFilePath (fn, safeFilePath);
+ me->save (savemode);
+ me->setFilePath (safeFilePath);
} // save zipped
} // filepath available
else
@@ -1399,19 +1914,20 @@
}
}
- if (currentMapEditor()->saveZipped())
- {
+ if (saveZipped && !tmpMapDir.isEmpty())
// Delete tmpDir
- system ( "rm -rf "+ tmpMapDir );
- }
+ removeDir (QDir(tmpMapDir));
if (err==success)
+ {
statusBar()->message(
- tr("Saved")+" " + currentMapEditor()->getFilePath(),
+ tr("Saved %1").arg(me->getFilePath()),
statusbarTime );
- else
+ lastMaps.prepend(me->getFilePath() );
+ setupLastMapsMenu();
+ } else
statusBar()->message(
- tr("Couldn't save")+" " + currentMapEditor()->getFilePath(),
+ tr("Couldn't save ").arg(me->getFilePath()),
statusbarTime );
}
@@ -1422,26 +1938,25 @@
void Main::fileSaveAs(const SaveMode& savemode)
{
- QString tmpMapDir;
QString fn;
if (currentMapEditor())
{
if (savemode==CompleteMap)
- fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
+ fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
else
- fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
+ fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
if ( !fn.isEmpty() )
{
// Check for existing file
if (QFile (fn).exists())
{
- QMessageBox mb( "VYM",
- tr("The file ") + fn + tr ("\nexists already. Do you want to"),
+ QMessageBox mb( __VYM,
+ tr("The file %1\nexists already. Do you want to").arg(fn),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::Cancel | QMessageBox::Escape,
- QMessageBox::QMessageBox::NoButton);
+ QMessageBox::NoButton);
mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
switch( mb.exec() )
@@ -1477,8 +1992,9 @@
fileSave(savemode);
// Set name of tab
- tabWidget->setTabLabel (currentMapEditor(),
- currentMapEditor()->getFileName() );
+ if (savemode==CompleteMap)
+ tabWidget->setTabLabel (currentMapEditor(),
+ currentMapEditor()->getFileName() );
return;
}
}
@@ -1489,6 +2005,73 @@
fileSaveAs (CompleteMap);
}
+void Main::fileImportKDEBookmarks()
+{
+ ImportKDEBookmarks im;
+ im.transform();
+ if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
+ currentMapEditor()->setFilePath ("");
+}
+
+void Main::fileImportFirefoxBookmarks()
+{
+ Q3FileDialog *fd=new Q3FileDialog( this);
+ fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
+ fd->setMode (Q3FileDialog::ExistingFiles);
+ fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
+ fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
+ fd->show();
+
+ if ( fd->exec() == QDialog::Accepted )
+ {
+ ImportFirefoxBookmarks im;
+ QStringList flist = fd->selectedFiles();
+ QStringList::Iterator it = flist.begin();
+ while( it != flist.end() )
+ {
+ im.setFile (*it);
+ if (im.transform() &&
+ success==fileLoad (im.getTransformedFile(),NewMap) &&
+ currentMapEditor() )
+ currentMapEditor()->setFilePath ("");
+ ++it;
+ }
+ }
+ delete (fd);
+}
+
+void Main::fileImportMM()
+{
+ ImportMM im;
+
+ Q3FileDialog *fd=new Q3FileDialog( this);
+ if (!lastFileDir.isEmpty())
+ fd->setDir (lastFileDir);
+ fd->setMode (Q3FileDialog::ExistingFiles);
+ fd->addFilter ("Mind Manager (*.mmap)");
+ fd->setCaption(tr("Import")+" "+"Mind Manager");
+ fd->show();
+
+ if ( fd->exec() == QDialog::Accepted )
+ {
+ lastFileDir=fd->dirPath();
+ QStringList flist = fd->selectedFiles();
+ QStringList::Iterator it = flist.begin();
+ while( it != flist.end() )
+ {
+ im.setFile (*it);
+ if (im.transform() &&
+ success==fileLoad (im.getTransformedFile(),NewMap) &&
+ currentMapEditor() )
+ currentMapEditor()->setFilePath ("");
+
+ ++it;
+ }
+ }
+ delete (fd);
+
+}
+
void Main::fileImportDir()
{
if (currentMapEditor())
@@ -1505,32 +2088,16 @@
}
}
-void Main::fileExportHTML()
-{
- if (currentMapEditor())
- {
- ExportHTMLDialog dia(this);
-
- if (dia.exec()==QDialog::Accepted)
- {
- QString dir=dia.getDir();
- if (reallyWriteDirectory(dir) )
- {
- currentMapEditor()->exportXML (dia.getDir() );
- dia.doExport(currentMapEditor()->getMapName() );
- }
- }
- }
-}
void Main::fileExportXHTML()
{
+ MapEditor *me=currentMapEditor();
QString dir;
- if (currentMapEditor())
+ if (me)
{
ExportXHTMLDialog dia(this);
- dia.setFilePath (currentMapEditor()->getFilePath() );
- dia.setMapName (currentMapEditor()->getMapName() );
+ dia.setFilePath (me->getFilePath() );
+ dia.setMapName (me->getMapName() );
dia.readSettings();
if (dia.exec()==QDialog::Accepted)
@@ -1546,10 +2113,10 @@
if (ok)
{
- currentMapEditor()->exportXML (dia.getDir() );
- dia.doExport(currentMapEditor()->getMapName() );
+ me->exportXML (dia.getDir() );
+ dia.doExport(me->getMapName() );
if (dia.hasChanged())
- currentMapEditor()->setChanged();
+ me->setChanged();
}
}
}
@@ -1557,23 +2124,103 @@
void Main::fileExportImage(int item)
{
- if (currentMapEditor())
+ MapEditor *me=currentMapEditor();
+ if (me)
{
- QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
+ QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
this );
if ( !fn.isEmpty() )
- {
- currentMapEditor()->exportImage(fn,item);
- } else {
- statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
- }
+ me->exportImage(fn,item);
+ else
+ statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
+
}
}
void Main::fileExportASCII()
{
- if (currentMapEditor())
- currentMapEditor()->exportASCII();
+ MapEditor *me=currentMapEditor();
+ if (me)
+ {
+ ExportASCII ex;
+ ex.setMapCenter(me->getMapCenter());
+ ex.addFilter ("TXT (*.txt)");
+ ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
+ if (ex.execDialog() )
+ {
+ me->setExportMode(true);
+ ex.doExport();
+ me->setExportMode(false);
+ }
+ }
+}
+
+void Main::fileExportLaTeX()
+{
+ MapEditor *me=currentMapEditor();
+ if (me)
+ {
+ ExportLaTeX ex;
+ ex.setMapCenter(me->getMapCenter());
+ ex.addFilter ("Tex (*.tex)");
+ ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
+ if (ex.execDialog() )
+ {
+ me->setExportMode(true);
+ ex.doExport();
+ me->setExportMode(false);
+ }
+ }
+}
+
+void Main::fileExportKDEBookmarks()
+{
+ ExportKDEBookmarks ex;
+ MapEditor *me=currentMapEditor();
+ if (me)
+ {
+ ex.setMapCenter (me->getMapCenter() );
+ ex.doExport();
+ }
+}
+
+void Main::fileExportTaskjuggler()
+{
+ ExportTaskjuggler ex;
+ MapEditor *me=currentMapEditor();
+ if (me)
+ {
+ ex.setMapCenter (me->getMapCenter() );
+ ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
+ ex.addFilter ("Taskjuggler (*.tjp)");
+ if (ex.execDialog() )
+ {
+ me->setExportMode(true);
+ ex.doExport();
+ me->setExportMode(false);
+ }
+ }
+}
+
+void Main::fileExportOOPresentation()
+{
+ ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
+ // FIXME add extra info in dialog
+ //ImagePreview *p =new ImagePreview (fd);
+ //fd->setContentsPreviewEnabled( TRUE );
+ //fd->setContentsPreview( p, p );
+ //fd->setPreviewMode( QFileDialog::Contents );
+ fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
+ //fd->setDir (lastImageDir);
+ fd->show();
+
+ if ( fd->exec() == QDialog::Accepted )
+ {
+ QString fn=fd->selectedFile();
+ //lastImageDir=fn.left(fn.findRev ("/"));
+ if (currentMapEditor())
+ currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());
+ }
}
void Main::fileCloseMap()
@@ -1582,9 +2229,8 @@
{
if (currentMapEditor()->hasChanged())
{
- QMessageBox mb( "VYM",
- tr("The map ") + currentMapEditor()->getFileName() +
- tr(" has been modified but not saved yet. Do you want to"),
+ QMessageBox mb( __VYM,
+ tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No,
@@ -1632,7 +2278,7 @@
if (me->isUnsaved())
{
tabWidget->setCurrentPage(i);
- QMessageBox mb( "VYM",
+ QMessageBox mb( __VYM,
tr("This map is not saved yet. Do you want to"),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
@@ -1641,12 +2287,6 @@
mb.setButtonText( QMessageBox::Yes, tr("Save map") );
mb.setButtonText( QMessageBox::No, tr("Discard changes") );
mb.show();
- // Call undocumented function: setActiveWindow is only
- // possible, if widget is visible. This depends on
- // windowmanager...
-#if defined(Q_OS_LINUX)
- qt_wait_for_window_manager( this);
-#endif
mb.setActiveWindow();
switch( mb.exec() ) {
case QMessageBox::Yes:
@@ -1671,8 +2311,10 @@
currentMapEditor()->undo();
}
-void Main::editRedo() // TODO
+void Main::editRedo()
{
+ if (currentMapEditor())
+ currentMapEditor()->redo();
}
void Main::editCopy()
@@ -1697,13 +2339,6 @@
{
findWindow->popup();
findWindow->raise();
-
- // Call undocumented function: setActiveWindow is only
- // possible, if widget is visible. This depends on
- // windowmanager...
-#if defined(Q_OS_LINUX)
- qt_wait_for_window_manager( this);
-#endif
findWindow->setActiveWindow();
}
@@ -1717,8 +2352,7 @@
} else
{
QMessageBox::information( findWindow, tr( "VYM -Information:" ),
- tr("No matches found for ")+
- "'"+s+"'");
+ tr("No matches found for \"%1\"").arg(s));
}
}
@@ -1729,8 +2363,70 @@
void Main::editOpenURL()
{
+ // Open new browser
if (currentMapEditor())
- currentMapEditor()->openURL();
+ {
+ QString url=currentMapEditor()->getURL();
+ if (url=="") return;
+ QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
+ procBrowser = new Q3Process( this );
+
+ procBrowser->addArgument( browser);
+ procBrowser->addArgument( url);
+
+ if ( !procBrowser->start() )
+ {
+ // try to set path to browser
+ QMessageBox::warning(0,
+ tr("Warning"),
+ tr("Couldn't find a viewer to open %1.\n").arg(url)+
+ tr("Please use Settings->")+tr("Set application to open an URL"));
+ settingsURL() ;
+ }
+ }
+}
+void Main::editOpenURLTab()
+{
+ if (currentMapEditor())
+ {
+ QString url=currentMapEditor()->getURL();
+ if (url=="") return;
+ QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
+ if (procBrowser && procBrowser->isRunning())
+ {
+ if (browser.contains("konqueror"))
+ {
+ // Try to open new tab in existing konqueror started previously by vym
+ Q3Process *p=new Q3Process (this);
+ p->addArgument ("dcop");
+ p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
+ p->addArgument ("konqueror-mainwindow#1");
+ p->addArgument ("newTab");
+ p->addArgument (url);
+ if ( !p->start() )
+ // try to set browser
+ QMessageBox::warning(0,
+ tr("Warning"),
+ tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
+ return;
+ } else if (browser.contains ("firefox") || browser.contains ("mozilla") )
+ {
+ // Try to open new tab in firefox
+ Q3Process *p=new Q3Process (this);
+ p->addArgument (browser);
+ p->addArgument ("-remote");
+ p->addArgument (QString("openurl(%1,new-tab)").arg(url));
+ if ( !p->start() )
+ // try to set browser
+ QMessageBox::warning(0,
+ tr("Warning"),
+ tr("Couldn't start %1 to open a new tab").arg(browser));
+ return;
+ }
+ }
+ // Open new browser
+ editOpenURL();
+ }
}
void Main::editURL()
@@ -1751,6 +2447,12 @@
currentMapEditor()->editBugzilla2URL();
}
+void Main::editFATE2URL()
+{
+ if (currentMapEditor())
+ currentMapEditor()->editFATE2URL();
+}
+
void Main::editOpenVymLink()
{
// Get current path to map
@@ -1776,7 +2478,7 @@
{
if (!QFile(currentVymLink).exists() )
QMessageBox::critical( 0, tr( "Critical Error" ),
- tr("Couldn't open map " +currentVymLink)+".");
+ tr("Couldn't open map %1").arg(currentVymLink));
else
{
fileLoad (currentVymLink, NewMap);
@@ -1800,6 +2502,12 @@
currentMapEditor()->deleteVymLink();
}
+void Main::editToggleHideExport()
+{
+ if (currentMapEditor())
+ currentMapEditor()->toggleHideExport();
+}
+
void Main::editMapInfo()
{
if (currentMapEditor())
@@ -1846,6 +2554,12 @@
currentMapEditor()->addNewBranch(0);
}
+void Main::editNewBranchHere()
+{
+ if (currentMapEditor())
+ currentMapEditor()->addNewBranchHere();
+}
+
void Main::editNewBranchAbove()
{
if (currentMapEditor())
@@ -1873,9 +2587,21 @@
fileSaveAs (PartOfMap);
}
+void Main::editRemoveBranchKeepChilds()
+{
+ if (currentMapEditor())
+ currentMapEditor()->removeBranchKeepChilds();
+}
+
+void Main::editRemoveChilds()
+{
+ if (currentMapEditor())
+ currentMapEditor()->removeChilds();
+}
+
void Main::editDeleteSelection()
{
- if (currentMapEditor())
+ if (currentMapEditor() && actionSettingsUseDelKey->isOn())
currentMapEditor()->deleteSelection();
}
@@ -1927,10 +2653,16 @@
currentMapEditor()->saveFloatImage(item);
}
-void Main::editToggleFloatExport()
+void Main::editFollowXLink(int item)
{
if (currentMapEditor())
- currentMapEditor()->toggleFloatExport();
+ currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
+}
+
+void Main::editEditXLink(int item)
+{
+ if (currentMapEditor())
+ currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
}
void Main::formatSelectColor()
@@ -2022,11 +2754,29 @@
currentMapEditor()->setFrame(Rectangle);
}
+void Main::formatIncludeImagesVer()
+{
+ if (currentMapEditor())
+ currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
+}
+
+void Main::formatIncludeImagesHor()
+{
+ if (currentMapEditor())
+ currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
+}
+
+void Main::formatHideLinkUnselected()
+{
+ if (currentMapEditor())
+ currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
+}
+
void Main::viewZoomReset()
{
if (currentMapEditor())
{
- QWMatrix m;
+ QMatrix m;
m.reset();
currentMapEditor()->setWorldMatrix( m );
currentMapEditor()->setViewCenter();
@@ -2038,7 +2788,7 @@
{
if (currentMapEditor())
{
- QWMatrix m = currentMapEditor()->worldMatrix();
+ QMatrix m = currentMapEditor()->worldMatrix();
m.scale( 1.25, 1.25 );
currentMapEditor()->setWorldMatrix( m );
currentMapEditor()->setViewCenter();
@@ -2050,19 +2800,28 @@
{
if (currentMapEditor())
{
- QWMatrix m = currentMapEditor()->worldMatrix();
+ QMatrix m = currentMapEditor()->worldMatrix();
m.scale( 0.8, 0.8 );
currentMapEditor()->setWorldMatrix( m );
currentMapEditor()->setViewCenter();
currentMapEditor()->adjustCanvasSize();
}
}
+
+void Main::modModeColor()
+{
+}
+
+void Main::modModeLink()
+{
+}
+
bool Main::settingsPDF()
{
// Default browser is set in constructor
bool ok;
QString text = QInputDialog::getText(
- "VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
+ "VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
if (ok)
settings.writeEntry ("/vym/mainwindow/readerPDF",text);
@@ -2075,7 +2834,7 @@
// Default browser is set in constructor
bool ok;
QString text = QInputDialog::getText(
- "VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
+ "VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
settings.readEntry("/vym/mainwindow/readerURL")
, &ok, this );
if (ok)
@@ -2083,6 +2842,17 @@
return ok;
}
+void Main::settingsToggleDelKey()
+{
+ if (actionSettingsUseDelKey->isOn())
+ {
+ actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
+ } else
+ {
+ actionEditDelete->setAccel (QKeySequence (""));
+ }
+}
+
void Main::windowToggleNoteEditor()
{
if (textEditor->showWithMain() )
@@ -2091,6 +2861,18 @@
windowShowNoteEditor();
}
+void Main::windowToggleHistory()
+{
+ if (currentMapEditor())
+ currentMapEditor()->toggleHistoryWindow();
+}
+
+void Main::updateNoteFlag()
+{
+ if (currentMapEditor())
+ currentMapEditor()->updateNoteFlag();
+}
+
void Main::windowShowNoteEditor()
{
textEditor->setShowWithMain(true);
@@ -2124,20 +2906,18 @@
void Main::testFunction()
{
- //textEditor->stackUnder(this);
currentMapEditor()->testFunction();
}
-void Main::testShowClipboard()
-{
- clipboardME->show();
-}
-
void Main::helpDoc()
{
QString docpath;
- // default path in SUSE LINUX
- docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
+ #if defined(Q_OS_MACX)
+ docpath="./vym.app/Contents/vym.pdf";
+ #else
+ // default path in SUSE LINUX
+ docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
+ #endif
if (!QFile (docpath).exists() )
{
@@ -2149,11 +2929,16 @@
docpath="doc/tex/vym.pdf";
if (!QFile (docpath).exists() )
{
- QMessageBox::critical(0,
- tr("Critcal error"),
- tr("Couldn't find the documentation\n"
- "vym.pdf in various places."));
- return;
+ // Try yet another one for Knoppix
+ docpath="/usr/share/doc/packages/vym/vym.pdf";
+ if (!QFile (docpath).exists() )
+ {
+ QMessageBox::critical(0,
+ tr("Critcal error"),
+ tr("Couldn't find the documentation\n"
+ "vym.pdf in various places."));
+ return;
+ }
}
}
}
@@ -2166,10 +2951,11 @@
if ( !pdfProc->start() )
{
// error handling
- QMessageBox::critical(0,
- tr("Critcal error"),
- tr("Couldn't find a viewer to read vym.pdf.\n"
- "Please use Settings->")+tr("Set application to open pdf files"));
+ QMessageBox::warning(0,
+ tr("Warning"),
+ tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
+ tr("Please use Settings->")+tr("Set application to open PDF files"));
+ settingsPDF();
return;
}
}
@@ -2177,33 +2963,11 @@
void Main::helpAbout()
{
- static QMessageBox* about = new QMessageBox( "VYM",
- "
VYM - View Your Mind
"
- "
A tool to put the things you have got in your mind into a map.
"
- "
"
- "
(c) by Uwe Drechsel (vym@InSilmaril.de)
"
- "
vym is released under the GPL (Gnu General Public License)"
- ", with one exception (see the file \"LICENSE\"which "
- "comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.