mainwindow.cpp
changeset 166 325958acb69b
parent 164 d442a66e9121
child 175 728f51b71e71
     1.1 --- a/mainwindow.cpp	Thu Sep 22 12:56:05 2005 +0000
     1.2 +++ b/mainwindow.cpp	Mon Oct 10 11:20:25 2005 +0000
     1.3 @@ -19,6 +19,7 @@
     1.4  #include <cstdlib>
     1.5  #include <typeinfo>
     1.6  
     1.7 +#include "misc.h"
     1.8  #include "version.h"
     1.9  #include "aboutdialog.h"
    1.10  
    1.11 @@ -43,10 +44,29 @@
    1.12  #include "icons/modelink.xpm"
    1.13  #include "icons/modecopy.xpm"
    1.14  //#include "icons/vym-48x48.xpm"
    1.15 +
    1.16 +#include "icons/flag-questionmark.xpm"
    1.17 +#include "icons/flag-exclamationmark.xpm"
    1.18 +#include "icons/flag-hook-green.xpm"
    1.19 +#include "icons/flag-cross-red.xpm"
    1.20 +#include "icons/flag-stopsign.xpm"
    1.21 +#include "icons/flag-smiley-good.xpm"
    1.22 +#include "icons/flag-smiley-sad.xpm"
    1.23 +#include "icons/flag-clock.xpm"
    1.24 +#include "icons/flag-lamp.xpm"
    1.25 +#include "icons/flag-arrow-up.xpm"
    1.26 +#include "icons/flag-arrow-down.xpm"
    1.27 +#include "icons/flag-thumb-up.xpm"
    1.28 +#include "icons/flag-thumb-down.xpm"
    1.29 +#include "icons/flag-heart.xpm"
    1.30 +#include "icons/flag-flash.xpm"
    1.31 +#include "icons/flag-lifebelt.xpm"
    1.32 +
    1.33  #include "icons/flag-note.xpm"
    1.34  #include "icons/flag-url.xpm"
    1.35  #include "icons/flag-vymlink.xpm"	
    1.36  #include "icons/flag-scrolled-right.xpm"
    1.37 +#include "icons/flag-tmpUnscrolled-right.xpm"
    1.38  
    1.39  #include "flagrowobj.h"
    1.40  #include "texteditor.h"
    1.41 @@ -61,9 +81,12 @@
    1.42  extern TextEditor *textEditor;
    1.43  extern Main *mainWindow;
    1.44  extern QString tmpVymDir;
    1.45 +extern QString clipboardDir;
    1.46 +extern bool clipboardEmpty;
    1.47  extern int statusbarTime;
    1.48  extern MapEditor *clipboardME;
    1.49  extern FlagRowObj* standardFlagsDefault;
    1.50 +extern FlagRowObj* systemFlagsDefault;
    1.51  
    1.52  extern QPtrList <QAction> actionListBranches;
    1.53  
    1.54 @@ -172,11 +195,17 @@
    1.55  	// Create unique temporary directory
    1.56  	tmpVymDir=makeUniqueDir ("/tmp/vym-XXXXXX");
    1.57  
    1.58 -	// TODO Create direcctory for clipboard
    1.59 +	// Create direcctory for clipboard
    1.60 +	clipboardDir=tmpVymDir+"/clipboard";
    1.61 +	QDir d(clipboardDir);
    1.62 +	d.mkdir (clipboardDir,true);
    1.63 +	makeSubDirs (clipboardDir);
    1.64 +	clipboardEmpty=true;
    1.65  
    1.66 +	// FIXME not used currently
    1.67  	// Set random seed (random used for object IDs)
    1.68 -    QTime t = QTime::currentTime();		// set random seed
    1.69 -    srand( t.hour()*12+t.minute()*60+t.second()*60 );
    1.70 +    // QTime t = QTime::currentTime();		// set random seed
    1.71 +    // srand( t.hour()*12+t.minute()*60+t.second()*60 );
    1.72  
    1.73  
    1.74  	// Initialize some settings, which are platform dependant
    1.75 @@ -246,8 +275,6 @@
    1.76  	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
    1.77  
    1.78  	updateGeometry();
    1.79 -
    1.80 -	// Creating  the default map into first tab is done in main.cpp now...
    1.81  }
    1.82  
    1.83  Main::~Main()
    1.84 @@ -792,6 +819,134 @@
    1.85  // Flag Actions
    1.86  void Main::setupFlagActions()
    1.87  {
    1.88 +	// Create System Flags
    1.89 +	systemFlagsDefault = new FlagRowObj ();
    1.90 +	systemFlagsDefault->setVisibility (false);
    1.91 +	systemFlagsDefault->setName ("systemFlagsDef");
    1.92 +
    1.93 +	FlagObj *fo = new FlagObj ();
    1.94 +	fo->load(QPixmap(flag_note_xpm));
    1.95 +	fo->setName("note");
    1.96 +	fo->setToolTip(tr("Note","Systemflag"));
    1.97 +	systemFlagsDefault->addFlag (fo);	// makes deep copy
    1.98 +
    1.99 +	fo->load(QPixmap(flag_url_xpm));
   1.100 +	fo->setName("url");
   1.101 +	fo->setToolTip(tr("WWW Document (external)","Systemflag"));
   1.102 +	systemFlagsDefault->addFlag (fo);
   1.103 +	
   1.104 +	fo->load(QPixmap(flag_vymlink_xpm));
   1.105 +	fo->setName("vymLink");
   1.106 +	fo->setToolTip(tr("Link to another vym map","Systemflag"));
   1.107 +	systemFlagsDefault->addFlag (fo);	
   1.108 +
   1.109 +	fo->load(QPixmap(flag_scrolled_right_xpm));
   1.110 +	fo->setName("scrolledright");
   1.111 +	fo->setToolTip(tr("subtree is scrolled","Systemflag"));
   1.112 +	systemFlagsDefault->addFlag (fo);
   1.113 +	
   1.114 +	fo->load(QPixmap(flag_tmpUnscrolled_right_xpm));
   1.115 +	fo->setName("tmpUnscrolledright");
   1.116 +	fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
   1.117 +	systemFlagsDefault->addFlag (fo);
   1.118 +
   1.119 +	// Create Standard Flags
   1.120 +	standardFlagsDefault = new FlagRowObj ();
   1.121 +	standardFlagsDefault->setVisibility (false);
   1.122 +	standardFlagsDefault->setName ("standardFlagsDef");
   1.123 +
   1.124 +	fo->load(QPixmap(flag_exclamationmark_xpm));
   1.125 +	fo->setName ("exclamationmark");
   1.126 +	fo->setGroup("standard-mark");
   1.127 +	fo->setToolTip(tr("Take care!","Standardflag"));
   1.128 +	standardFlagsDefault->addFlag (fo);	// makes deep copy
   1.129 +	
   1.130 +	fo->load(QPixmap(flag_questionmark_xpm));
   1.131 +	fo->setName("questionmark");
   1.132 +	fo->setGroup("standard-mark");
   1.133 +	fo->setToolTip(tr("Really?","Standardflag"));
   1.134 +	standardFlagsDefault->addFlag (fo);	
   1.135 +
   1.136 +	fo->load(QPixmap(flag_hook_green_xpm));
   1.137 +	fo->setName("hook-green");
   1.138 +	fo->setGroup("standard-hook");
   1.139 +	fo->setToolTip(tr("ok!","Standardflag"));
   1.140 +	standardFlagsDefault->addFlag (fo);	
   1.141 +
   1.142 +	fo->load(QPixmap(flag_cross_red_xpm));
   1.143 +	fo->setName("cross-red");
   1.144 +	fo->setGroup("standard-hook");
   1.145 +	fo->setToolTip(tr("Not ok!","Standardflag"));
   1.146 +	standardFlagsDefault->addFlag (fo);	
   1.147 +
   1.148 +	fo->load(QPixmap(flag_stopsign_xpm));
   1.149 +	fo->setName("stopsign");
   1.150 +	fo->setToolTip(tr("This won't work!","Standardflag"));
   1.151 +	standardFlagsDefault->addFlag (fo);	
   1.152 +
   1.153 +	fo->load(QPixmap(flag_smiley_good_xpm));
   1.154 +	fo->setName("smiley-good");
   1.155 +	fo->setGroup("standard-smiley");
   1.156 +	fo->setToolTip(tr("Good","Standardflag"));
   1.157 +	standardFlagsDefault->addFlag (fo);	
   1.158 +
   1.159 +	fo->load(QPixmap(flag_smiley_sad_xpm));
   1.160 +	fo->setName("smiley-sad");
   1.161 +	fo->setGroup("standard-smiley");
   1.162 +	fo->setToolTip(tr("Bad","Standardflag"));
   1.163 +	standardFlagsDefault->addFlag (fo);	
   1.164 +
   1.165 +	fo->load(QPixmap(flag_clock_xpm));
   1.166 +	fo->setName("clock");
   1.167 +	fo->setToolTip(tr("Time critical","Standardflag"));
   1.168 +	standardFlagsDefault->addFlag (fo);	
   1.169 +
   1.170 +	fo->load(QPixmap(flag_lamp_xpm));
   1.171 +	fo->setName("lamp");
   1.172 +	fo->setToolTip(tr("Idea!","Standardflag"));
   1.173 +	standardFlagsDefault->addFlag (fo);	
   1.174 +
   1.175 +	fo->load(QPixmap(flag_arrow_up_xpm));
   1.176 +	fo->setName("arrow-up");
   1.177 +	fo->setGroup("standard-arrow");
   1.178 +	fo->setToolTip(tr("Important","Standardflag"));
   1.179 +	standardFlagsDefault->addFlag (fo);	
   1.180 +
   1.181 +	fo->load(QPixmap(flag_arrow_down_xpm));
   1.182 +	fo->setName("arrow-down");
   1.183 +	fo->setGroup("standard-arrow");
   1.184 +	fo->setToolTip(tr("Unimportant","Standardflag"));
   1.185 +	standardFlagsDefault->addFlag (fo);	
   1.186 +
   1.187 +	fo->load(QPixmap(flag_thumb_up_xpm));
   1.188 +	fo->setName("thumb-up");
   1.189 +	fo->setGroup("standard-thumb");
   1.190 +	fo->setToolTip(tr("I like this","Standardflag"));
   1.191 +	standardFlagsDefault->addFlag (fo);	
   1.192 +
   1.193 +	fo->load(QPixmap(flag_thumb_down_xpm));
   1.194 +	fo->setName("thumb-down");
   1.195 +	fo->setGroup("standard-thumb");
   1.196 +	fo->setToolTip(tr("I like this","Standardflag"));
   1.197 +	fo->setToolTip(tr("I do not like this","Standardflag"));
   1.198 +	standardFlagsDefault->addFlag (fo);	
   1.199 +	
   1.200 +	fo->load(QPixmap(flag_heart_xpm));
   1.201 +	fo->setName("heart");
   1.202 +	fo->setToolTip(tr("I just love... ","Standardflag"));
   1.203 +	standardFlagsDefault->addFlag (fo);	
   1.204 +
   1.205 +	fo->load(QPixmap(flag_flash_xpm));
   1.206 +	fo->setName("flash");
   1.207 +	fo->setToolTip(tr("Dangerous","Standardflag"));
   1.208 +	standardFlagsDefault->addFlag (fo);	
   1.209 +	
   1.210 +	fo->load(QPixmap(flag_lifebelt_xpm));
   1.211 +	fo->setName("lifebelt");
   1.212 +	fo->setToolTip(tr("This will help","Standardflag"));
   1.213 +	standardFlagsDefault->addFlag (fo);	
   1.214 +	delete (fo);
   1.215 +
   1.216  	standardFlagsDefault->makeToolbar(this, "Standard Flags");
   1.217  }
   1.218  
   1.219 @@ -860,10 +1015,6 @@
   1.220      a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
   1.221      connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
   1.222      a->addTo( menu );
   1.223 -
   1.224 -	a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
   1.225 -    connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
   1.226 -    a->addTo( menu );
   1.227  }
   1.228  
   1.229  // Help Actions
   1.230 @@ -1159,7 +1310,8 @@
   1.231  	tabWidget->addTab (medit,fn);
   1.232  	tabWidget->showPage(medit);
   1.233  	medit->viewport()->setFocus();
   1.234 -	medit->select("mc:");
   1.235 +		// For the very first map we do not have flagrows yet...
   1.236 +		medit->select("mc:");
   1.237  }
   1.238  
   1.239  void Main::fileLoad(QString fn, const LoadMode &lmode)
   1.240 @@ -2361,11 +2513,6 @@
   1.241  	currentMapEditor()->testFunction();
   1.242  }
   1.243  
   1.244 -void Main::testShowClipboard()
   1.245 -{
   1.246 -	clipboardME->show();
   1.247 -}
   1.248 -
   1.249  void Main::helpDoc()
   1.250  {
   1.251  	QString docpath;