1.1 --- a/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000
1.2 +++ b/mainwindow.cpp Tue Jan 03 09:44:41 2006 +0000
1.3 @@ -12,13 +12,14 @@
1.4 #include <qcolordialog.h>
1.5 #include <qbitmap.h>
1.6 #include <qinputdialog.h>
1.7 -#include <qdatetime.h> // for random seed
1.8 +//#include <qdatetime.h> // for random seed
1.9
1.10
1.11 #include <iostream>
1.12 #include <cstdlib>
1.13 #include <typeinfo>
1.14
1.15 +#include "file.h"
1.16 #include "misc.h"
1.17 #include "version.h"
1.18 #include "aboutdialog.h"
1.19 @@ -104,6 +105,7 @@
1.20 extern QAction* actionEditURL;
1.21 extern QAction* actionEditHeading2URL;
1.22 extern QAction* actionEditBugzilla2URL;
1.23 +extern QAction* actionEditFATE2URL;
1.24 extern QAction *actionEditOpenVymLink;
1.25 extern QAction *actionEditVymLink;
1.26 extern QAction *actionEditDeleteVymLink;
1.27 @@ -131,6 +133,8 @@
1.28 extern QAction* actionFormatLinkColorHint;
1.29 extern QAction* actionFormatBackColor;
1.30 extern QAction* actionFormatLinkColor;
1.31 +extern QAction *actionFormatIncludeImagesVer;
1.32 +extern QAction *actionFormatIncludeImagesHor;
1.33
1.34 extern QActionGroup* actionGroupModModes;
1.35 extern QAction* actionModModeColor;
1.36 @@ -519,6 +523,11 @@
1.37 actionListBranches.append(a);
1.38 actionEditBugzilla2URL=a;
1.39
1.40 + a = new QAction( tr( "Create URL to FATE" ), QPixmap(), tr( "Create URL to FATE" ), 0, this, "FATE2url" );
1.41 + connect( a, SIGNAL( activated() ), this, SLOT( editFATE2URL() ) );
1.42 + a->setEnabled (false);
1.43 + actionListBranches.append(a);
1.44 + actionEditFATE2URL=a;
1.45
1.46 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" );
1.47 connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
1.48 @@ -572,6 +581,7 @@
1.49 a->setEnabled (false);
1.50 actionListBranches.append(a);
1.51 #if defined (Q_OS_MACX)
1.52 + // In OSX show different shortcut in menues, the keys work independtly always
1.53 actionEditAddBranch=alt;
1.54 #else
1.55 actionEditAddBranch=a;
1.56 @@ -583,6 +593,9 @@
1.57 a->setEnabled (false);
1.58 actionListBranches.append(a);
1.59 actionEditAddBranchHere=a;
1.60 + a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_A, this, "newBranchHere" );
1.61 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
1.62 + actionListBranches.append(a);
1.63
1.64 // Add branch above
1.65 a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
1.66 @@ -590,6 +603,9 @@
1.67 a->setEnabled (false);
1.68 actionListBranches.append(a);
1.69 actionEditAddBranchAbove=a;
1.70 + a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_A, this, "newBranch" );
1.71 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
1.72 + actionListBranches.append(a);
1.73
1.74 // Add branch below
1.75 a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
1.76 @@ -597,6 +613,9 @@
1.77 a->setEnabled (false);
1.78 actionListBranches.append(a);
1.79 actionEditAddBranchBelow=a;
1.80 + a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_A, this, "newBranch" );
1.81 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
1.82 + actionListBranches.append(a);
1.83
1.84 // Import at selection (adding to selection)
1.85 a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
1.86 @@ -729,6 +748,16 @@
1.87 connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
1.88 actionFormatFrameRectangle=a;
1.89
1.90 + a = new QAction( tr ("Include top and bottom position of images into branch"), tr( "Include images vertically" ), 0, actionFormatIncludeImagesVer, "includeImagesVer" );
1.91 + a->setToggleAction(true);
1.92 + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesVer() ) );
1.93 + actionFormatIncludeImagesVer=a;
1.94 +
1.95 + a = new QAction( tr ("Include left and right position of images into branch"), tr( "Include images horizontally" ), 0, actionFormatIncludeImagesHor, "includeImagesHor" );
1.96 + a->setToggleAction(true);
1.97 + connect( a, SIGNAL( activated() ), this, SLOT( formatIncludeImagesHor() ) );
1.98 + actionFormatIncludeImagesHor=a;
1.99 +
1.100 a = new QAction( tr( "Hide link" ),tr( "Hide link if object is not selected" ), 0, actionFormatHideLinkUnselected, "hideLinkUnselected" );
1.101 a->setToggleAction(true);
1.102 connect( a, SIGNAL( activated() ), this, SLOT( formatHideLinkUnselected() ) );
1.103 @@ -1012,7 +1041,7 @@
1.104 menuBar()->insertItem( tr( "&Test" ), menu );
1.105
1.106 QAction *a;
1.107 - a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
1.108 + a = new QAction( tr( "Call test function" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
1.109 connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
1.110 a->addTo( menu );
1.111 }
1.112 @@ -1075,8 +1104,10 @@
1.113 actionEditURL->addTo ( branchContextMenu );
1.114 actionEditHeading2URL->addTo ( branchContextMenu );
1.115 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
1.116 + {
1.117 actionEditBugzilla2URL->addTo( branchContextMenu );
1.118 -
1.119 + actionEditFATE2URL->addTo( branchContextMenu );
1.120 + }
1.121 branchContextMenu->insertSeparator();
1.122 actionEditOpenVymLink->addTo ( branchContextMenu );
1.123 actionEditVymLink->addTo ( branchContextMenu );
1.124 @@ -1086,6 +1117,8 @@
1.125 actionGroupFormatFrameTypes->addTo( branchContextMenu );
1.126
1.127 branchContextMenu->insertSeparator();
1.128 + actionFormatIncludeImagesVer->addTo( branchContextMenu );
1.129 + actionFormatIncludeImagesHor->addTo( branchContextMenu );
1.130 actionFormatHideLinkUnselected->addTo( branchContextMenu );
1.131
1.132 // Context Menu for links in a branch menu
1.133 @@ -1522,7 +1555,7 @@
1.134 me->setFilePath (fn_org);
1.135
1.136 // Delete tmpDir
1.137 - system ( "rm -rf "+tmpMapDir);
1.138 + removeDir (QDir(tmpMapDir));
1.139
1.140 // Check for errors
1.141 if (err==success)
1.142 @@ -1662,42 +1695,7 @@
1.143 me->save (savemode);
1.144 me->setFilePath (safeFilePath);
1.145
1.146 - // zip the temporary directory
1.147 - Process *zipProc=new Process ();
1.148 - zipProc->clearArguments();
1.149 - zipProc->setWorkingDirectory (QDir(tmpMapDir));
1.150 - zipProc->addArgument ("zip");
1.151 - zipProc->addArgument ("-r");
1.152 - zipProc->addArgument (fn);
1.153 - zipProc->addArgument (".");
1.154 -
1.155 - if (!zipProc->start() )
1.156 - {
1.157 - // zip could not be started
1.158 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
1.159 - tr("Couldn't start zip to compress data."));
1.160 - err=aborted;
1.161 - } else
1.162 - {
1.163 - // zip could be started
1.164 - zipProc->waitFinished();
1.165 - if (!zipProc->normalExit() )
1.166 - {
1.167 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
1.168 - tr("zip didn't exit normally")+
1.169 - "\n" + zipProc->getErrout());
1.170 - err=aborted;
1.171 - } else
1.172 - {
1.173 - if (zipProc->exitStatus()>0)
1.174 - {
1.175 - QMessageBox::critical( 0, tr( "Critical Save Error" ),
1.176 - QString("zip exit code: %1").arg(zipProc->exitStatus() )+
1.177 - "\n" + zipProc->getErrout() );
1.178 - err=aborted;
1.179 - }
1.180 - }
1.181 - } // zip could be started
1.182 + zipDir (tmpMapDir,fn);
1.183 } // save zipped
1.184 else
1.185 {
1.186 @@ -1720,7 +1718,7 @@
1.187 if (me->saveZipped())
1.188 {
1.189 // Delete tmpDir
1.190 - system ( "rm -rf "+ tmpMapDir );
1.191 + removeDir (QDir(tmpMapDir));
1.192 }
1.193
1.194 if (err==success)
1.195 @@ -2085,6 +2083,12 @@
1.196 currentMapEditor()->editBugzilla2URL();
1.197 }
1.198
1.199 +void Main::editFATE2URL()
1.200 +{
1.201 + if (currentMapEditor())
1.202 + currentMapEditor()->editFATE2URL();
1.203 +}
1.204 +
1.205 void Main::editOpenVymLink()
1.206 {
1.207 // Get current path to map
1.208 @@ -2386,6 +2390,18 @@
1.209 currentMapEditor()->setFrame(Rectangle);
1.210 }
1.211
1.212 +void Main::formatIncludeImagesVer()
1.213 +{
1.214 + if (currentMapEditor())
1.215 + currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
1.216 +}
1.217 +
1.218 +void Main::formatIncludeImagesHor()
1.219 +{
1.220 + if (currentMapEditor())
1.221 + currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
1.222 +}
1.223 +
1.224 void Main::formatHideLinkUnselected()
1.225 {
1.226 if (currentMapEditor())
1.227 @@ -2533,11 +2549,16 @@
1.228 docpath="doc/tex/vym.pdf";
1.229 if (!QFile (docpath).exists() )
1.230 {
1.231 - QMessageBox::critical(0,
1.232 - tr("Critcal error"),
1.233 - tr("Couldn't find the documentation\n"
1.234 - "vym.pdf in various places."));
1.235 - return;
1.236 + // Try yet another one for Knoppix
1.237 + docpath="/usr/share/doc/packages/vym/vym.pdf";
1.238 + if (!QFile (docpath).exists() )
1.239 + {
1.240 + QMessageBox::critical(0,
1.241 + tr("Critcal error"),
1.242 + tr("Couldn't find the documentation\n"
1.243 + "vym.pdf in various places."));
1.244 + return;
1.245 + }
1.246 }
1.247 }
1.248 }