insilmaril@0
|
1 |
#include "mainwindow.h"
|
insilmaril@0
|
2 |
|
insilmaril@0
|
3 |
#include <qstatusbar.h>
|
insilmaril@0
|
4 |
#include <qmessagebox.h>
|
insilmaril@0
|
5 |
#include <qmenubar.h>
|
insilmaril@0
|
6 |
#include <qapplication.h>
|
insilmaril@0
|
7 |
#include <qpainter.h>
|
insilmaril@0
|
8 |
#include <qprinter.h>
|
insilmaril@0
|
9 |
#include <qfile.h>
|
insilmaril@0
|
10 |
#include <qfiledialog.h>
|
insilmaril@0
|
11 |
#include <qcolor.h>
|
insilmaril@0
|
12 |
#include <qcolordialog.h>
|
insilmaril@0
|
13 |
#include <qbitmap.h>
|
insilmaril@0
|
14 |
#include <qinputdialog.h>
|
insilmaril@93
|
15 |
#include <qdatetime.h> // for random seed
|
insilmaril@0
|
16 |
|
insilmaril@0
|
17 |
|
insilmaril@0
|
18 |
#include <iostream>
|
insilmaril@95
|
19 |
#include <cstdlib>
|
insilmaril@0
|
20 |
#include <typeinfo>
|
insilmaril@0
|
21 |
|
insilmaril@0
|
22 |
#include "version.h"
|
insilmaril@0
|
23 |
|
insilmaril@0
|
24 |
#include "icons/filenew.xpm"
|
insilmaril@0
|
25 |
#include "icons/fileopen.xpm"
|
insilmaril@0
|
26 |
#include "icons/filesave.xpm"
|
insilmaril@0
|
27 |
#include "icons/fileprint.xpm"
|
insilmaril@0
|
28 |
#include "icons/editundo.xpm"
|
insilmaril@0
|
29 |
//#include "icons/editredo.xpm" // TODO
|
insilmaril@0
|
30 |
#include "icons/editcopy.xpm"
|
insilmaril@0
|
31 |
#include "icons/editcut.xpm"
|
insilmaril@0
|
32 |
#include "icons/editpaste.xpm"
|
insilmaril@0
|
33 |
#include "icons/editmoveup.xpm"
|
insilmaril@0
|
34 |
#include "icons/editmovedown.xpm"
|
insilmaril@0
|
35 |
#include "icons/formatcoloritem.xpm"
|
insilmaril@0
|
36 |
#include "icons/formatcolorbranch.xpm"
|
insilmaril@0
|
37 |
#include "icons/formatcolorpicker.xpm"
|
insilmaril@0
|
38 |
#include "icons/viewzoomreset.xpm"
|
insilmaril@0
|
39 |
#include "icons/viewzoomin.xpm"
|
insilmaril@0
|
40 |
#include "icons/viewzoomout.xpm"
|
insilmaril@89
|
41 |
#include "icons/modecolor.xpm"
|
insilmaril@89
|
42 |
#include "icons/modelink.xpm"
|
insilmaril@93
|
43 |
#include "icons/modecopy.xpm"
|
insilmaril@0
|
44 |
#include "icons/vym-48x48.xpm"
|
insilmaril@0
|
45 |
#include "icons/flag-note.xpm"
|
insilmaril@0
|
46 |
#include "icons/flag-url.xpm"
|
insilmaril@0
|
47 |
#include "icons/flag-vymlink.xpm"
|
insilmaril@0
|
48 |
#include "icons/flag-scrolled-right.xpm"
|
insilmaril@0
|
49 |
|
insilmaril@0
|
50 |
#include "flagrowobj.h"
|
insilmaril@0
|
51 |
#include "texteditor.h"
|
insilmaril@0
|
52 |
#include "mapeditor.h"
|
insilmaril@0
|
53 |
#include "exporthtmldialog.h"
|
insilmaril@0
|
54 |
#include "exportxhtmldialog.h"
|
insilmaril@0
|
55 |
#include "showtextdialog.h"
|
insilmaril@0
|
56 |
#include "process.h"
|
insilmaril@0
|
57 |
#include "settings.h"
|
insilmaril@0
|
58 |
#include "options.h"
|
insilmaril@0
|
59 |
|
insilmaril@0
|
60 |
extern TextEditor *textEditor;
|
insilmaril@0
|
61 |
extern Main *mainWindow;
|
insilmaril@0
|
62 |
extern int statusbarTime;
|
insilmaril@0
|
63 |
extern MapEditor *clipboardME;
|
insilmaril@0
|
64 |
extern FlagRowObj* standardFlagsDefault;
|
insilmaril@0
|
65 |
|
insilmaril@98
|
66 |
extern QPtrList <QAction> actionListBranches;
|
insilmaril@98
|
67 |
|
insilmaril@0
|
68 |
extern QAction* actionFileSave;
|
insilmaril@0
|
69 |
extern QAction* actionFilePrint;
|
insilmaril@0
|
70 |
extern QAction* actionEditUndo;
|
insilmaril@0
|
71 |
extern QAction *actionEditCopy;
|
insilmaril@0
|
72 |
extern QAction *actionEditCut;
|
insilmaril@0
|
73 |
extern QAction *actionEditPaste;
|
insilmaril@0
|
74 |
extern QAction *actionEditMoveUp;
|
insilmaril@0
|
75 |
extern QAction *actionEditMoveDown;
|
insilmaril@0
|
76 |
extern QAction *actionEditToggleScroll;
|
insilmaril@0
|
77 |
extern QAction* actionEditOpenURL;
|
insilmaril@0
|
78 |
extern QAction* actionEditURL;
|
insilmaril@0
|
79 |
extern QAction* actionEditHeading2URL;
|
insilmaril@0
|
80 |
extern QAction* actionEditBugzilla2URL;
|
insilmaril@0
|
81 |
extern QAction *actionEditOpenVymLink;
|
insilmaril@0
|
82 |
extern QAction *actionEditVymLink;
|
insilmaril@0
|
83 |
extern QAction *actionEditDeleteVymLink;
|
insilmaril@0
|
84 |
extern QAction *actionEditMapInfo;
|
insilmaril@0
|
85 |
extern QAction *actionEditHeading;
|
insilmaril@0
|
86 |
extern QAction *actionEditDelete;
|
insilmaril@0
|
87 |
extern QAction *actionEditAddBranch;
|
insilmaril@98
|
88 |
extern QAction *actionEditAddBranchHere;
|
insilmaril@0
|
89 |
extern QAction *actionEditAddBranchAbove;
|
insilmaril@0
|
90 |
extern QAction *actionEditAddBranchBelow;
|
insilmaril@98
|
91 |
extern QAction *actionEditRemoveBranchHere;
|
insilmaril@98
|
92 |
extern QAction *actionEditRemoveChilds;
|
insilmaril@0
|
93 |
extern QAction *actionEditImportAdd;
|
insilmaril@0
|
94 |
extern QAction *actionEditImportReplace;
|
insilmaril@0
|
95 |
extern QAction *actionEditSaveBranch;
|
insilmaril@0
|
96 |
extern QAction *actionEditSelectFirst;
|
insilmaril@0
|
97 |
extern QAction *actionEditSelectLast;
|
insilmaril@0
|
98 |
extern QAction *actionEditLoadImage;
|
insilmaril@0
|
99 |
extern QAction *actionEditToggleFloatExport;
|
insilmaril@0
|
100 |
|
insilmaril@0
|
101 |
extern QAction* actionFormatColor;
|
insilmaril@0
|
102 |
extern QAction* actionFormatPickColor;
|
insilmaril@0
|
103 |
extern QAction* actionFormatColorBranch;
|
insilmaril@0
|
104 |
extern QAction* actionFormatColorSubtree;
|
insilmaril@0
|
105 |
extern QAction* actionFormatLinkColorHint;
|
insilmaril@0
|
106 |
extern QAction* actionFormatBackColor;
|
insilmaril@0
|
107 |
extern QAction* actionFormatLinkColor;
|
insilmaril@0
|
108 |
|
insilmaril@89
|
109 |
extern QActionGroup* actionGroupModModes;
|
insilmaril@89
|
110 |
extern QAction* actionModModeColor;
|
insilmaril@89
|
111 |
extern QAction* actionModModeLink;
|
insilmaril@93
|
112 |
extern QAction* actionModModeCopy;
|
insilmaril@89
|
113 |
|
insilmaril@0
|
114 |
extern QActionGroup *actionGroupFormatFrameTypes;
|
insilmaril@0
|
115 |
extern QAction *actionFormatFrameNone;
|
insilmaril@0
|
116 |
extern QAction *actionFormatFrameRectangle;
|
insilmaril@0
|
117 |
|
insilmaril@0
|
118 |
extern QActionGroup *actionGroupFormatLinkStyles;
|
insilmaril@0
|
119 |
extern QAction *actionFormatLinkStyleLine;
|
insilmaril@0
|
120 |
extern QAction *actionFormatLinkStyleParabel;
|
insilmaril@0
|
121 |
extern QAction *actionFormatLinkStylePolyLine;
|
insilmaril@0
|
122 |
extern QAction *actionFormatLinkStylePolyParabel;
|
insilmaril@0
|
123 |
|
insilmaril@0
|
124 |
extern QAction *actionViewToggleNoteEditor;
|
insilmaril@0
|
125 |
|
insilmaril@0
|
126 |
extern QAction* actionSettingsAutoedit;
|
insilmaril@0
|
127 |
extern QAction* actionSettingsAutoselectHeading;
|
insilmaril@0
|
128 |
extern QAction* actionSettingsAutoselectHeading;
|
insilmaril@0
|
129 |
extern QAction* actionSettingsAutoselectText;
|
insilmaril@0
|
130 |
extern QAction* actionSettingsPasteNewHeading;
|
insilmaril@0
|
131 |
extern QAction* actionSettingsUseDelKey;
|
insilmaril@103
|
132 |
extern QAction* actionSettingsUseFlagGroups;
|
insilmaril@0
|
133 |
|
insilmaril@0
|
134 |
extern QPopupMenu* branchContextMenu;
|
insilmaril@98
|
135 |
extern QPopupMenu* branchAddContextMenu;
|
insilmaril@98
|
136 |
extern QPopupMenu* branchRemoveContextMenu;
|
insilmaril@89
|
137 |
extern QPopupMenu* branchLinksContextMenu;
|
insilmaril@94
|
138 |
extern QPopupMenu* branchLinksContextMenuDup;
|
insilmaril@0
|
139 |
extern QPopupMenu* floatimageContextMenu;
|
insilmaril@0
|
140 |
extern QPopupMenu* saveImageFormatMenu;
|
insilmaril@0
|
141 |
extern QPopupMenu* canvasContextMenu;
|
insilmaril@0
|
142 |
extern QPopupMenu* lastMapsMenu;
|
insilmaril@0
|
143 |
extern QPopupMenu* exportMenu;
|
insilmaril@0
|
144 |
extern QPopupMenu* exportImageFormatMenu;
|
insilmaril@0
|
145 |
|
insilmaril@0
|
146 |
|
insilmaril@0
|
147 |
extern Settings settings;
|
insilmaril@0
|
148 |
extern Options options;
|
insilmaril@0
|
149 |
|
insilmaril@0
|
150 |
#if defined(Q_OS_LINUX)
|
insilmaril@0
|
151 |
extern void qt_wait_for_window_manager( QWidget* w );
|
insilmaril@0
|
152 |
#endif
|
insilmaril@0
|
153 |
|
insilmaril@0
|
154 |
Main::Main(QWidget* parent, const char* name, WFlags f) :
|
insilmaril@0
|
155 |
QMainWindow(parent,name,f)
|
insilmaril@0
|
156 |
{
|
insilmaril@0
|
157 |
mainWindow=this;
|
insilmaril@0
|
158 |
|
insilmaril@0
|
159 |
setCaption ("VYM - View Your Mind");
|
insilmaril@0
|
160 |
|
insilmaril@0
|
161 |
// Load window settings
|
insilmaril@0
|
162 |
resize (settings.readNumEntry( "/vym/mainwindow/geometry/width", 800),
|
insilmaril@0
|
163 |
settings.readNumEntry( "/vym/mainwindow/geometry/height",600));
|
insilmaril@0
|
164 |
move (settings.readNumEntry( "/vym/mainwindow/geometry/posX", 100),
|
insilmaril@0
|
165 |
settings.readNumEntry( "/vym/mainwindow/geometry/posY", 100));
|
insilmaril@0
|
166 |
|
insilmaril@0
|
167 |
|
insilmaril@93
|
168 |
// Set random seed (random used for object IDs)
|
insilmaril@93
|
169 |
QTime t = QTime::currentTime(); // set random seed
|
insilmaril@93
|
170 |
srand( t.hour()*12+t.minute()*60+t.second()*60 );
|
insilmaril@93
|
171 |
|
insilmaril@93
|
172 |
|
insilmaril@0
|
173 |
// Initialize some settings, which are platform dependant
|
insilmaril@0
|
174 |
QString p,s;
|
insilmaril@0
|
175 |
|
insilmaril@0
|
176 |
// application to open URLs
|
insilmaril@0
|
177 |
p="/vym/mainwindow/readerURL";
|
insilmaril@0
|
178 |
#if defined(Q_OS_LINUX)
|
insilmaril@0
|
179 |
s=settings.readEntry (p,"konqueror");
|
insilmaril@0
|
180 |
#else
|
insilmaril@0
|
181 |
#if defined(Q_OS_MACX)
|
insilmaril@104
|
182 |
s=settings.readEntry (p,"/usr/bin/open");
|
insilmaril@0
|
183 |
#else
|
insilmaril@0
|
184 |
s=settings.readEntry (p,"mozilla");
|
insilmaril@0
|
185 |
#endif
|
insilmaril@0
|
186 |
#endif
|
insilmaril@0
|
187 |
settings.writeEntry( p,s);
|
insilmaril@0
|
188 |
|
insilmaril@0
|
189 |
// application to open PDFs
|
insilmaril@0
|
190 |
p="/vym/mainwindow/readerPDF";
|
insilmaril@0
|
191 |
#if defined(Q_OS_LINUX)
|
insilmaril@0
|
192 |
s=settings.readEntry (p,"acroread");
|
insilmaril@0
|
193 |
#else
|
insilmaril@0
|
194 |
#if defined(Q_OS_MACX)
|
insilmaril@104
|
195 |
s=settings.readEntry (p,"/usr/bin/open");
|
insilmaril@0
|
196 |
#else
|
insilmaril@0
|
197 |
s=settings.readEntry (p,"acroread");
|
insilmaril@0
|
198 |
#endif
|
insilmaril@0
|
199 |
#endif
|
insilmaril@0
|
200 |
settings.writeEntry( p,s);
|
insilmaril@0
|
201 |
|
insilmaril@0
|
202 |
|
insilmaril@0
|
203 |
maxLastMaps=9;
|
insilmaril@0
|
204 |
|
insilmaril@0
|
205 |
// Create tab widget which holds the maps
|
insilmaril@0
|
206 |
tabWidget= new QTabWidget (this);
|
insilmaril@0
|
207 |
connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ),
|
insilmaril@0
|
208 |
this, SLOT( editorChanged( QWidget * ) ) );
|
insilmaril@0
|
209 |
|
insilmaril@0
|
210 |
setCentralWidget(tabWidget);
|
insilmaril@0
|
211 |
|
insilmaril@0
|
212 |
setupFileActions();
|
insilmaril@0
|
213 |
setupEditActions();
|
insilmaril@0
|
214 |
setupFormatActions();
|
insilmaril@0
|
215 |
setupViewActions();
|
insilmaril@89
|
216 |
setupModeActions();
|
insilmaril@0
|
217 |
setupFlagActions();
|
insilmaril@0
|
218 |
setupSettingsActions();
|
insilmaril@0
|
219 |
setupContextMenus();
|
insilmaril@0
|
220 |
if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) setupTestActions();
|
insilmaril@0
|
221 |
setupHelpActions();
|
insilmaril@0
|
222 |
|
insilmaril@0
|
223 |
// After menu is created, we can enable some actions
|
insilmaril@0
|
224 |
actionFilePrint->setEnabled (true);
|
insilmaril@0
|
225 |
|
insilmaril@0
|
226 |
statusBar();
|
insilmaril@0
|
227 |
|
insilmaril@0
|
228 |
|
insilmaril@0
|
229 |
// Initialize Find window
|
insilmaril@0
|
230 |
findWindow=new FindWindow(NULL,"findwindow");
|
insilmaril@0
|
231 |
connect (findWindow, SIGNAL( findButton(QString) ),
|
insilmaril@0
|
232 |
this, SLOT(editFind(QString) ) );
|
insilmaril@0
|
233 |
connect (findWindow, SIGNAL( somethingChanged() ),
|
insilmaril@0
|
234 |
this, SLOT(editFindChanged() ) );
|
insilmaril@0
|
235 |
|
insilmaril@0
|
236 |
updateGeometry();
|
insilmaril@93
|
237 |
|
insilmaril@93
|
238 |
// Creating the default map into first tab is done in main.cpp now...
|
insilmaril@0
|
239 |
}
|
insilmaril@0
|
240 |
|
insilmaril@0
|
241 |
Main::~Main()
|
insilmaril@0
|
242 |
{
|
insilmaril@0
|
243 |
// Save Settings
|
insilmaril@0
|
244 |
settings.writeEntry( "/vym/mainwindow/geometry/width", width() );
|
insilmaril@0
|
245 |
settings.writeEntry( "/vym/mainwindow/geometry/height", height() );
|
insilmaril@0
|
246 |
settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
|
insilmaril@0
|
247 |
settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
|
insilmaril@0
|
248 |
|
insilmaril@0
|
249 |
settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
|
insilmaril@0
|
250 |
settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
|
insilmaril@0
|
251 |
|
insilmaril@0
|
252 |
settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
|
insilmaril@0
|
253 |
settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
|
insilmaril@0
|
254 |
settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
|
insilmaril@0
|
255 |
settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
|
insilmaril@0
|
256 |
settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
|
insilmaril@103
|
257 |
settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
|
insilmaril@0
|
258 |
|
insilmaril@0
|
259 |
QString s;
|
insilmaril@0
|
260 |
int maps=lastMaps.count();
|
insilmaril@0
|
261 |
settings.writeEntry( "/vym/lastMaps/number",maps );
|
insilmaril@0
|
262 |
for (int i=1;i<=maps;i++)
|
insilmaril@0
|
263 |
{
|
insilmaril@0
|
264 |
QStringList::Iterator it = lastMaps.at(i-1);
|
insilmaril@0
|
265 |
s=QString("/vym/lastMaps/map-%1").arg(i);
|
insilmaril@0
|
266 |
if (!s.isEmpty() && i<=maxLastMaps)
|
insilmaril@0
|
267 |
settings.writeEntry (s, *it);
|
insilmaril@0
|
268 |
}
|
insilmaril@0
|
269 |
|
insilmaril@0
|
270 |
|
insilmaril@0
|
271 |
// To make the texteditor save its settings, call the destructor
|
insilmaril@0
|
272 |
delete (textEditor);
|
insilmaril@0
|
273 |
}
|
insilmaril@0
|
274 |
|
insilmaril@0
|
275 |
void Main::loadCmdLine()
|
insilmaril@0
|
276 |
{
|
insilmaril@0
|
277 |
/* TODO draw some kind of splashscreen while loading...
|
insilmaril@0
|
278 |
if (qApp->argc()>1)
|
insilmaril@0
|
279 |
{
|
insilmaril@0
|
280 |
}
|
insilmaril@0
|
281 |
*/
|
insilmaril@0
|
282 |
|
insilmaril@0
|
283 |
QStringList flist=options.getFileList();
|
insilmaril@0
|
284 |
QStringList::Iterator it=flist.begin();
|
insilmaril@0
|
285 |
|
insilmaril@0
|
286 |
while (it !=flist.end() )
|
insilmaril@0
|
287 |
{
|
insilmaril@0
|
288 |
fileLoad (*it, NewMap);
|
insilmaril@0
|
289 |
*it++;
|
insilmaril@0
|
290 |
}
|
insilmaril@0
|
291 |
}
|
insilmaril@0
|
292 |
|
insilmaril@0
|
293 |
|
insilmaril@0
|
294 |
void Main::statusMessage(const QString &s)
|
insilmaril@0
|
295 |
{
|
insilmaril@0
|
296 |
statusBar()->message (s);
|
insilmaril@0
|
297 |
}
|
insilmaril@0
|
298 |
|
insilmaril@0
|
299 |
void Main::closeEvent (QCloseEvent* )
|
insilmaril@0
|
300 |
{
|
insilmaril@0
|
301 |
fileExitVYM();
|
insilmaril@0
|
302 |
}
|
insilmaril@0
|
303 |
|
insilmaril@0
|
304 |
// File Actions
|
insilmaril@0
|
305 |
void Main::setupFileActions()
|
insilmaril@0
|
306 |
{
|
insilmaril@0
|
307 |
QToolBar *tb = new QToolBar( this );
|
insilmaril@0
|
308 |
tb->setLabel( "File Actions" );
|
insilmaril@0
|
309 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
310 |
menuBar()->insertItem( tr( "&File" ), menu );
|
insilmaril@0
|
311 |
|
insilmaril@0
|
312 |
// Keycodes: /usr/lib64/qt3/include/qnamespace.h
|
insilmaril@0
|
313 |
|
insilmaril@0
|
314 |
QAction *a;
|
insilmaril@91
|
315 |
a = new QAction( tr( "New map","File menu" ), QPixmap( filenew_xpm ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
|
insilmaril@0
|
316 |
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
|
insilmaril@0
|
317 |
a->addTo( tb );
|
insilmaril@0
|
318 |
a->addTo( menu );
|
insilmaril@0
|
319 |
|
insilmaril@91
|
320 |
a = new QAction( tr( "Open","File menu" ), QPixmap( fileopen_xpm), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
|
insilmaril@0
|
321 |
connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
|
insilmaril@0
|
322 |
a->addTo( tb );
|
insilmaril@0
|
323 |
a->addTo( menu );
|
insilmaril@0
|
324 |
|
insilmaril@0
|
325 |
lastMapsMenu = new QPopupMenu (this);
|
insilmaril@0
|
326 |
|
insilmaril@0
|
327 |
menu->insertItem (tr("Open Recent"),lastMapsMenu );
|
insilmaril@0
|
328 |
menu->insertSeparator();
|
insilmaril@0
|
329 |
|
insilmaril@0
|
330 |
a = new QAction( tr( "Save" ), QPixmap( filesave_xpm ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
|
insilmaril@0
|
331 |
connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
|
insilmaril@0
|
332 |
a->addTo( tb );
|
insilmaril@0
|
333 |
a->addTo( menu );
|
insilmaril@0
|
334 |
actionFileSave=a;
|
insilmaril@0
|
335 |
|
insilmaril@0
|
336 |
a = new QAction( tr( "Save &As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
|
insilmaril@0
|
337 |
connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
|
insilmaril@0
|
338 |
a->addTo( menu );
|
insilmaril@0
|
339 |
|
insilmaril@0
|
340 |
menu->insertSeparator();
|
insilmaril@0
|
341 |
|
insilmaril@0
|
342 |
a = new QAction( tr( "Import directory structure (experimental)" ), QPixmap(), tr( "Import Dir" ), 0, this, "export" );
|
insilmaril@0
|
343 |
connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
|
insilmaril@0
|
344 |
a->addTo( menu );
|
insilmaril@0
|
345 |
|
insilmaril@0
|
346 |
exportMenu = new QPopupMenu (this);
|
insilmaril@0
|
347 |
menu->insertItem (tr("Export"),exportMenu );
|
insilmaril@0
|
348 |
|
insilmaril@0
|
349 |
menu->insertSeparator();
|
insilmaril@0
|
350 |
|
insilmaril@0
|
351 |
|
insilmaril@0
|
352 |
a = new QAction( tr( "Print" ), QPixmap( fileprint_xpm ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
|
insilmaril@0
|
353 |
connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
|
insilmaril@0
|
354 |
a->addTo( tb );
|
insilmaril@0
|
355 |
a->addTo( menu );
|
insilmaril@0
|
356 |
actionFilePrint=a;
|
insilmaril@0
|
357 |
|
insilmaril@0
|
358 |
a = new QAction( tr( "Close Map" ), QPixmap(), tr( "&Close Map" ), ALT + Key_C, this, "fileCloseMap" );
|
insilmaril@0
|
359 |
connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
|
insilmaril@0
|
360 |
a->addTo( menu );
|
insilmaril@0
|
361 |
|
insilmaril@0
|
362 |
a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
|
insilmaril@0
|
363 |
connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
|
insilmaril@0
|
364 |
a->addTo( menu );
|
insilmaril@0
|
365 |
}
|
insilmaril@0
|
366 |
|
insilmaril@0
|
367 |
|
insilmaril@0
|
368 |
//Edit Actions
|
insilmaril@0
|
369 |
void Main::setupEditActions()
|
insilmaril@0
|
370 |
{
|
insilmaril@0
|
371 |
QToolBar *tb = new QToolBar( this );
|
insilmaril@0
|
372 |
tb->setLabel( "Edit Actions" );
|
insilmaril@0
|
373 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
374 |
menuBar()->insertItem( tr( "&Edit" ), menu );
|
insilmaril@0
|
375 |
|
insilmaril@0
|
376 |
QAction *a;
|
insilmaril@102
|
377 |
QAction *alt;
|
insilmaril@0
|
378 |
a = new QAction( tr( "Undo" ), QPixmap( editundo_xpm ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
|
insilmaril@0
|
379 |
connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
|
insilmaril@0
|
380 |
a->setEnabled (false);
|
insilmaril@0
|
381 |
a->addTo( tb );
|
insilmaril@0
|
382 |
a->addTo( menu );
|
insilmaril@0
|
383 |
actionEditUndo=a;
|
insilmaril@0
|
384 |
/*
|
insilmaril@0
|
385 |
a = new QAction( tr( "Redo" ), QPixmap( editredo_xpm ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
|
insilmaril@0
|
386 |
connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
|
insilmaril@0
|
387 |
a->addTo( tb );
|
insilmaril@0
|
388 |
a->addTo( menu );
|
insilmaril@0
|
389 |
*/
|
insilmaril@0
|
390 |
menu->insertSeparator();
|
insilmaril@0
|
391 |
a = new QAction( tr( "Copy" ), QPixmap( editcopy_xpm ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
|
insilmaril@0
|
392 |
connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
|
insilmaril@0
|
393 |
a->setEnabled (false);
|
insilmaril@0
|
394 |
a->addTo( tb );
|
insilmaril@0
|
395 |
a->addTo( menu );
|
insilmaril@0
|
396 |
actionEditCopy=a;
|
insilmaril@0
|
397 |
a = new QAction( tr( "Cut" ), QPixmap( editcut_xpm ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
|
insilmaril@0
|
398 |
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
|
insilmaril@0
|
399 |
a->setEnabled (false);
|
insilmaril@0
|
400 |
a->addTo( tb );
|
insilmaril@0
|
401 |
a->addTo( menu );
|
insilmaril@0
|
402 |
actionEditCut=a;
|
insilmaril@0
|
403 |
a = new QAction( tr( "Paste" ), QPixmap( editpaste_xpm ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
|
insilmaril@0
|
404 |
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
|
insilmaril@0
|
405 |
a->setEnabled (false);
|
insilmaril@0
|
406 |
a->addTo( tb );
|
insilmaril@0
|
407 |
a->addTo( menu );
|
insilmaril@0
|
408 |
actionEditPaste=a;
|
insilmaril@98
|
409 |
|
insilmaril@0
|
410 |
a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
|
insilmaril@0
|
411 |
connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
|
insilmaril@0
|
412 |
a->setEnabled (false);
|
insilmaril@0
|
413 |
a->addTo( tb );
|
insilmaril@0
|
414 |
a->addTo( menu );
|
insilmaril@98
|
415 |
actionListBranches.append(a);
|
insilmaril@0
|
416 |
actionEditMoveUp=a;
|
insilmaril@98
|
417 |
|
insilmaril@0
|
418 |
a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
|
insilmaril@0
|
419 |
connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
|
insilmaril@0
|
420 |
a->setEnabled (false);
|
insilmaril@0
|
421 |
a->addTo( tb );
|
insilmaril@0
|
422 |
a->addTo( menu );
|
insilmaril@98
|
423 |
actionListBranches.append(a);
|
insilmaril@0
|
424 |
actionEditMoveDown=a;
|
insilmaril@98
|
425 |
|
insilmaril@0
|
426 |
|
insilmaril@102
|
427 |
a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
|
insilmaril@0
|
428 |
connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
|
insilmaril@102
|
429 |
alt = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_S, this, "scroll" );
|
insilmaril@102
|
430 |
connect( alt, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
|
insilmaril@102
|
431 |
#if defined(Q_OS_MACX)
|
insilmaril@102
|
432 |
actionEditToggleScroll=alt;
|
insilmaril@102
|
433 |
#else
|
insilmaril@102
|
434 |
actionEditToggleScroll=a;
|
insilmaril@102
|
435 |
#endif
|
insilmaril@102
|
436 |
actionEditToggleScroll->setEnabled (false);
|
insilmaril@102
|
437 |
actionEditToggleScroll->addTo( tb );
|
insilmaril@102
|
438 |
actionEditToggleScroll->addTo( menu );
|
insilmaril@102
|
439 |
actionListBranches.append(actionEditToggleScroll);
|
insilmaril@0
|
440 |
|
insilmaril@0
|
441 |
a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
|
insilmaril@0
|
442 |
connect( a, SIGNAL( activated() ), this, SLOT( editUnScrollAll() ) );
|
insilmaril@0
|
443 |
a->addTo( menu );
|
insilmaril@0
|
444 |
|
insilmaril@0
|
445 |
menu->insertSeparator();
|
insilmaril@0
|
446 |
|
insilmaril@0
|
447 |
a = new QAction( tr( "Find" ), QPixmap(), tr( "Find" ), CTRL + Key_F, this, "find" );
|
insilmaril@0
|
448 |
connect( a, SIGNAL( activated() ), this, SLOT( editOpenFindWindow() ) );
|
insilmaril@0
|
449 |
a->addTo( menu );
|
insilmaril@0
|
450 |
|
insilmaril@0
|
451 |
menu->insertSeparator();
|
insilmaril@0
|
452 |
|
insilmaril@0
|
453 |
a = new QAction( tr( "Open URL" ), QPixmap(flag_url_xpm), tr( "Open URL" ), CTRL + Key_U, this, "url" );
|
insilmaril@0
|
454 |
connect( a, SIGNAL( activated() ), this, SLOT( editOpenURL() ) );
|
insilmaril@0
|
455 |
a->addTo( menu );
|
insilmaril@0
|
456 |
a->addTo( tb );
|
insilmaril@0
|
457 |
a->setEnabled (false);
|
insilmaril@0
|
458 |
actionEditOpenURL=a;
|
insilmaril@0
|
459 |
|
insilmaril@0
|
460 |
a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL" ), SHIFT + CTRL + Key_U, this, "url" );
|
insilmaril@0
|
461 |
connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
|
insilmaril@0
|
462 |
a->addTo( menu );
|
insilmaril@0
|
463 |
a->setEnabled (false);
|
insilmaril@98
|
464 |
actionListBranches.append(a);
|
insilmaril@0
|
465 |
actionEditURL=a;
|
insilmaril@0
|
466 |
|
insilmaril@0
|
467 |
a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
|
insilmaril@0
|
468 |
connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
|
insilmaril@0
|
469 |
a->addTo( menu );
|
insilmaril@0
|
470 |
a->setEnabled (false);
|
insilmaril@98
|
471 |
actionListBranches.append(a);
|
insilmaril@0
|
472 |
actionEditHeading2URL=a;
|
insilmaril@0
|
473 |
|
insilmaril@0
|
474 |
a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
|
insilmaril@0
|
475 |
connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
|
insilmaril@0
|
476 |
a->setEnabled (false);
|
insilmaril@98
|
477 |
actionListBranches.append(a);
|
insilmaril@0
|
478 |
actionEditBugzilla2URL=a;
|
insilmaril@0
|
479 |
|
insilmaril@0
|
480 |
menu->insertSeparator();
|
insilmaril@0
|
481 |
|
insilmaril@0
|
482 |
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" );
|
insilmaril@0
|
483 |
connect( a, SIGNAL( activated() ), this, SLOT( editOpenVymLink() ) );
|
insilmaril@0
|
484 |
a->addTo( menu );
|
insilmaril@0
|
485 |
a->addTo( tb );
|
insilmaril@0
|
486 |
a->setEnabled (false);
|
insilmaril@0
|
487 |
actionEditOpenVymLink=a;
|
insilmaril@0
|
488 |
|
insilmaril@0
|
489 |
a = new QAction( tr( "Edit link to another vym map" ), QPixmap(), tr( "Edit vym link" ), 0, this, "editLinkMap" );
|
insilmaril@0
|
490 |
connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
|
insilmaril@0
|
491 |
a->addTo( menu );
|
insilmaril@0
|
492 |
a->setEnabled (false);
|
insilmaril@98
|
493 |
actionListBranches.append(a);
|
insilmaril@0
|
494 |
actionEditVymLink=a;
|
insilmaril@0
|
495 |
|
insilmaril@0
|
496 |
a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
|
insilmaril@0
|
497 |
connect( a, SIGNAL( activated() ), this, SLOT( editDeleteVymLink() ) );
|
insilmaril@0
|
498 |
a->addTo( menu );
|
insilmaril@0
|
499 |
a->setEnabled (false);
|
insilmaril@0
|
500 |
actionEditDeleteVymLink=a;
|
insilmaril@0
|
501 |
|
insilmaril@0
|
502 |
menu->insertSeparator();
|
insilmaril@0
|
503 |
|
insilmaril@0
|
504 |
a = new QAction( tr( "Edit Map Info" ), QPixmap(), tr( "Edit Map Info" ), 0, this, "editMapInfo" );
|
insilmaril@0
|
505 |
connect( a, SIGNAL( activated() ), this, SLOT( editMapInfo() ) );
|
insilmaril@0
|
506 |
a->addTo( menu );
|
insilmaril@0
|
507 |
a->setEnabled (true);
|
insilmaril@0
|
508 |
actionEditMapInfo=a;
|
insilmaril@0
|
509 |
|
insilmaril@0
|
510 |
menu->insertSeparator();
|
insilmaril@0
|
511 |
|
insilmaril@0
|
512 |
// Shortcuts to modify heading:
|
insilmaril@0
|
513 |
a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Enter, this, "editHeading" );
|
insilmaril@0
|
514 |
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
|
insilmaril@98
|
515 |
actionListBranches.append(a);
|
insilmaril@0
|
516 |
a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
|
insilmaril@0
|
517 |
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
|
insilmaril@98
|
518 |
actionListBranches.append(a);
|
insilmaril@89
|
519 |
actionEditHeading=a;
|
insilmaril@89
|
520 |
a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
|
insilmaril@89
|
521 |
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
|
insilmaril@102
|
522 |
a->setEnabled (false);
|
insilmaril@102
|
523 |
a->addTo ( menu );
|
insilmaril@102
|
524 |
actionEditHeading=a;
|
insilmaril@98
|
525 |
actionListBranches.append(a);
|
insilmaril@0
|
526 |
|
insilmaril@0
|
527 |
// Shortcut to delete selection
|
insilmaril@0
|
528 |
a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
|
insilmaril@0
|
529 |
connect( a, SIGNAL( activated() ), this, SLOT( editDeleteSelection() ) );
|
insilmaril@0
|
530 |
a->setEnabled (false);
|
insilmaril@0
|
531 |
a->addTo ( menu );
|
insilmaril@0
|
532 |
actionEditDelete=a;
|
insilmaril@0
|
533 |
|
insilmaril@0
|
534 |
// Shortcut to add branch
|
insilmaril@102
|
535 |
alt = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_A, this, "newBranch" );
|
insilmaril@102
|
536 |
connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
|
insilmaril@0
|
537 |
a = new QAction( tr( "Add a branch as child of selection" ),tr( "Add branch as child" ), Key_Insert, this, "newBranch" );
|
insilmaril@0
|
538 |
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
|
insilmaril@0
|
539 |
a->setEnabled (false);
|
insilmaril@98
|
540 |
actionListBranches.append(a);
|
insilmaril@102
|
541 |
#if defined (Q_OS_MACX)
|
insilmaril@102
|
542 |
actionEditAddBranch=alt;
|
insilmaril@102
|
543 |
#else
|
insilmaril@102
|
544 |
actionEditAddBranch=a;
|
insilmaril@102
|
545 |
#endif
|
insilmaril@0
|
546 |
|
insilmaril@98
|
547 |
// Add branch by inserting it at selection
|
insilmaril@98
|
548 |
a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_Insert, this, "newBranchHere" );
|
insilmaril@98
|
549 |
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
|
insilmaril@98
|
550 |
a->setEnabled (false);
|
insilmaril@98
|
551 |
actionListBranches.append(a);
|
insilmaril@98
|
552 |
actionEditAddBranchHere=a;
|
insilmaril@98
|
553 |
|
insilmaril@0
|
554 |
// Add branch above
|
insilmaril@0
|
555 |
a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
|
insilmaril@0
|
556 |
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
|
insilmaril@0
|
557 |
a->setEnabled (false);
|
insilmaril@98
|
558 |
actionListBranches.append(a);
|
insilmaril@0
|
559 |
actionEditAddBranchAbove=a;
|
insilmaril@0
|
560 |
|
insilmaril@0
|
561 |
// Add branch below
|
insilmaril@0
|
562 |
a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
|
insilmaril@0
|
563 |
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
|
insilmaril@0
|
564 |
a->setEnabled (false);
|
insilmaril@98
|
565 |
actionListBranches.append(a);
|
insilmaril@0
|
566 |
actionEditAddBranchBelow=a;
|
insilmaril@0
|
567 |
|
insilmaril@0
|
568 |
// Import at selection (adding to selection)
|
insilmaril@0
|
569 |
a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
|
insilmaril@0
|
570 |
connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
|
insilmaril@0
|
571 |
a->setEnabled (false);
|
insilmaril@98
|
572 |
actionListBranches.append(a);
|
insilmaril@0
|
573 |
actionEditImportAdd=a;
|
insilmaril@0
|
574 |
|
insilmaril@0
|
575 |
// Import at selection (replacing selection)
|
insilmaril@0
|
576 |
a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
|
insilmaril@0
|
577 |
connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
|
insilmaril@0
|
578 |
a->setEnabled (false);
|
insilmaril@98
|
579 |
actionListBranches.append(a);
|
insilmaril@0
|
580 |
actionEditImportReplace=a;
|
insilmaril@0
|
581 |
|
insilmaril@0
|
582 |
// Save selection
|
insilmaril@98
|
583 |
a = new QAction( tr( "Save selection" ),tr( "Save selection" ), 0, this, "saveSelection" );
|
insilmaril@0
|
584 |
connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
|
insilmaril@0
|
585 |
a->setEnabled (false);
|
insilmaril@98
|
586 |
actionListBranches.append(a);
|
insilmaril@0
|
587 |
actionEditSaveBranch=a;
|
insilmaril@0
|
588 |
|
insilmaril@98
|
589 |
// Only remove branch, not its childs
|
insilmaril@98
|
590 |
a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" );
|
insilmaril@98
|
591 |
connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchHere() ) );
|
insilmaril@98
|
592 |
a->setEnabled (false);
|
insilmaril@98
|
593 |
actionListBranches.append(a);
|
insilmaril@98
|
594 |
actionEditRemoveBranchHere=a;
|
insilmaril@98
|
595 |
|
insilmaril@98
|
596 |
// Only remove childs of a branch
|
insilmaril@98
|
597 |
a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" );
|
insilmaril@98
|
598 |
connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
|
insilmaril@98
|
599 |
a->setEnabled (false);
|
insilmaril@98
|
600 |
actionListBranches.append(a);
|
insilmaril@98
|
601 |
actionEditRemoveChilds=a;
|
insilmaril@98
|
602 |
|
insilmaril@0
|
603 |
// Shortcuts for navigating with cursor:
|
insilmaril@0
|
604 |
a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
|
insilmaril@0
|
605 |
connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
|
insilmaril@0
|
606 |
a = new QAction( tr( "Select lower branch" ),tr( "Select lower branch" ), Key_Down, this, "lowerBranch" );
|
insilmaril@0
|
607 |
connect( a, SIGNAL( activated() ), this, SLOT( editLowerBranch() ) );
|
insilmaril@0
|
608 |
a = new QAction( tr( "Select left branch" ),tr( "Select left branch" ), Key_Left, this, "upperBranch" );
|
insilmaril@0
|
609 |
connect( a, SIGNAL( activated() ), this, SLOT( editLeftBranch() ) );
|
insilmaril@0
|
610 |
a = new QAction( tr( "Select right branch" ),tr( "Select child branch" ), Key_Right, this, "rightBranch" );
|
insilmaril@0
|
611 |
connect( a, SIGNAL( activated() ), this, SLOT( editRightBranch() ) );
|
insilmaril@0
|
612 |
a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
|
insilmaril@0
|
613 |
a->setEnabled (false);
|
insilmaril@0
|
614 |
a->addTo ( menu );
|
insilmaril@98
|
615 |
actionListBranches.append(a);
|
insilmaril@0
|
616 |
actionEditSelectFirst=a;
|
insilmaril@0
|
617 |
connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
|
insilmaril@0
|
618 |
a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
|
insilmaril@0
|
619 |
connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
|
insilmaril@0
|
620 |
a->setEnabled (false);
|
insilmaril@0
|
621 |
a->addTo ( menu );
|
insilmaril@98
|
622 |
actionListBranches.append(a);
|
insilmaril@0
|
623 |
actionEditSelectLast=a;
|
insilmaril@0
|
624 |
|
insilmaril@0
|
625 |
a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
|
insilmaril@0
|
626 |
connect( a, SIGNAL( activated() ), this, SLOT( editLoadImage() ) );
|
insilmaril@0
|
627 |
actionEditLoadImage=a;
|
insilmaril@89
|
628 |
|
insilmaril@0
|
629 |
}
|
insilmaril@0
|
630 |
|
insilmaril@0
|
631 |
// Format Actions
|
insilmaril@0
|
632 |
void Main::setupFormatActions()
|
insilmaril@0
|
633 |
{
|
insilmaril@0
|
634 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
635 |
menuBar()->insertItem( tr( "&Format" ), menu );
|
insilmaril@0
|
636 |
|
insilmaril@0
|
637 |
QToolBar *tb = new QToolBar( this );
|
insilmaril@0
|
638 |
QAction *a;
|
insilmaril@0
|
639 |
QPixmap pix( 16,16);
|
insilmaril@0
|
640 |
pix.fill (black);
|
insilmaril@0
|
641 |
actionFormatColor= new QAction( tr( "Set Color" ), pix, tr( "Set &Color" ), 0, this, "formatColor" );
|
insilmaril@0
|
642 |
connect( actionFormatColor, SIGNAL( activated() ), this, SLOT( formatSelectColor() ) );
|
insilmaril@0
|
643 |
actionFormatColor->addTo( tb );
|
insilmaril@0
|
644 |
actionFormatColor->addTo( menu );
|
insilmaril@0
|
645 |
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" );
|
insilmaril@0
|
646 |
connect( a, SIGNAL( activated() ), this, SLOT( formatPickColor() ) );
|
insilmaril@0
|
647 |
a->setEnabled (false);
|
insilmaril@0
|
648 |
a->addTo( tb );
|
insilmaril@0
|
649 |
a->addTo( menu );
|
insilmaril@98
|
650 |
actionListBranches.append(a);
|
insilmaril@0
|
651 |
actionFormatPickColor=a;
|
insilmaril@0
|
652 |
a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
|
insilmaril@0
|
653 |
connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
|
insilmaril@0
|
654 |
a->setEnabled (false);
|
insilmaril@0
|
655 |
a->addTo( tb );
|
insilmaril@0
|
656 |
a->addTo( menu );
|
insilmaril@98
|
657 |
actionListBranches.append(a);
|
insilmaril@0
|
658 |
actionFormatColorBranch=a;
|
insilmaril@0
|
659 |
a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
|
insilmaril@0
|
660 |
connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
|
insilmaril@0
|
661 |
a->setEnabled (false);
|
insilmaril@0
|
662 |
a->addTo( menu );
|
insilmaril@0
|
663 |
a->addTo( tb );
|
insilmaril@98
|
664 |
actionListBranches.append(a);
|
insilmaril@0
|
665 |
actionFormatColorSubtree=a;
|
insilmaril@0
|
666 |
|
insilmaril@0
|
667 |
menu->insertSeparator();
|
insilmaril@0
|
668 |
actionGroupFormatLinkStyles=new QActionGroup ( this, "formatLinkStyles");
|
insilmaril@0
|
669 |
actionGroupFormatLinkStyles->setExclusive (true);
|
insilmaril@0
|
670 |
a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
|
insilmaril@0
|
671 |
a->setToggleAction(true);
|
insilmaril@0
|
672 |
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleLine() ) );
|
insilmaril@0
|
673 |
actionFormatLinkStyleLine=a;
|
insilmaril@0
|
674 |
a= new QAction( tr( "Line" ), QPixmap(), tr( "Linkstyle Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
|
insilmaril@0
|
675 |
a->setToggleAction(true);
|
insilmaril@0
|
676 |
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStyleParabel() ) );
|
insilmaril@0
|
677 |
actionFormatLinkStyleParabel=a;
|
insilmaril@0
|
678 |
a= new QAction( tr( "PolyLine" ), QPixmap(), tr( "Linkstyle Thick Line" ), 0, actionGroupFormatLinkStyles, "formatLinkStyleLine" );
|
insilmaril@0
|
679 |
a->setToggleAction(true);
|
insilmaril@0
|
680 |
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyLine() ) );
|
insilmaril@0
|
681 |
actionFormatLinkStylePolyLine=a;
|
insilmaril@0
|
682 |
a= new QAction( tr( "PolyParabel" ), QPixmap(), tr( "Linkstyle Thick Parabel" ), 0, actionGroupFormatLinkStyles, "formatLinkStylePolyParabel" );
|
insilmaril@0
|
683 |
a->setToggleAction(true);
|
insilmaril@0
|
684 |
connect( a, SIGNAL( activated() ), this, SLOT( formatLinkStylePolyParabel() ) );
|
insilmaril@0
|
685 |
actionFormatLinkStylePolyParabel=a;
|
insilmaril@0
|
686 |
actionGroupFormatLinkStyles->addTo (menu);
|
insilmaril@0
|
687 |
|
insilmaril@0
|
688 |
actionGroupFormatFrameTypes=new QActionGroup ( this, "formatFrameTypes");
|
insilmaril@0
|
689 |
actionGroupFormatFrameTypes->setExclusive (true);
|
insilmaril@0
|
690 |
a = new QAction( tr( "No Frame" ),tr( "No Frame" ), 0, actionGroupFormatFrameTypes, "frameNone" );
|
insilmaril@0
|
691 |
a->setToggleAction(true);
|
insilmaril@0
|
692 |
connect( a, SIGNAL( activated() ), this, SLOT( formatFrameNone() ) );
|
insilmaril@0
|
693 |
actionFormatFrameNone=a;
|
insilmaril@0
|
694 |
a = new QAction( tr( "Rectangle" ),tr( "Rectangle" ), 0, actionGroupFormatFrameTypes, "frameRectangle" );
|
insilmaril@0
|
695 |
a->setToggleAction(true);
|
insilmaril@0
|
696 |
connect( a, SIGNAL( activated() ), this, SLOT( formatFrameRectangle() ) );
|
insilmaril@0
|
697 |
actionFormatFrameRectangle=a;
|
insilmaril@0
|
698 |
|
insilmaril@0
|
699 |
menu->insertSeparator();
|
insilmaril@0
|
700 |
a= new QAction( tr( "Use same color for links and headings" ), QPixmap(), tr( "&Use color of heading for link" ), 0, this, "formatLinkColorHint" );
|
insilmaril@0
|
701 |
a->setToggleAction(true);
|
insilmaril@0
|
702 |
connect( a, SIGNAL( activated() ), this, SLOT( formatToggleLinkColorHint() ) );
|
insilmaril@0
|
703 |
a->addTo( menu );
|
insilmaril@0
|
704 |
actionFormatLinkColorHint=a;
|
insilmaril@0
|
705 |
pix.fill (white);
|
insilmaril@0
|
706 |
actionFormatLinkColor= new QAction( tr( "Set Link Color" ), pix, tr( "Set &Link Color" ), 0, this, "formatLinkColor" );
|
insilmaril@0
|
707 |
connect( actionFormatLinkColor, SIGNAL( activated() ), this, SLOT( formatSelectLinkColor() ) );
|
insilmaril@0
|
708 |
actionFormatLinkColor->addTo( menu );
|
insilmaril@0
|
709 |
actionFormatBackColor= new QAction( tr( "Set Background Color" ), pix, tr( "Set &Background Color" ), 0, this, "formatBackColor" );
|
insilmaril@0
|
710 |
connect( actionFormatBackColor, SIGNAL( activated() ), this, SLOT( formatSelectBackColor() ) );
|
insilmaril@0
|
711 |
actionFormatBackColor->addTo( menu );
|
insilmaril@0
|
712 |
}
|
insilmaril@0
|
713 |
|
insilmaril@0
|
714 |
// View Actions
|
insilmaril@0
|
715 |
void Main::setupViewActions()
|
insilmaril@0
|
716 |
{
|
insilmaril@0
|
717 |
QToolBar *tb = new QToolBar( this );
|
insilmaril@0
|
718 |
tb->setLabel( "View Actions" );
|
insilmaril@0
|
719 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
720 |
menuBar()->insertItem( tr( "&View" ), menu );
|
insilmaril@0
|
721 |
|
insilmaril@0
|
722 |
QAction *a;
|
insilmaril@0
|
723 |
a = new QAction( tr( "Zoom reset" ), QPixmap(viewzoomreset_xpm), tr( "reset Zoom" ), 0, this, "zoomReset" );
|
insilmaril@0
|
724 |
connect( a, SIGNAL( activated() ), this, SLOT(viewZoomReset() ) );
|
insilmaril@0
|
725 |
a->addTo( tb );
|
insilmaril@0
|
726 |
a->addTo( menu );
|
insilmaril@0
|
727 |
a = new QAction( tr( "Zoom in" ), QPixmap(viewzoomin_xpm), tr( "Zoom in" ), CTRL + Key_Plus, this, "zoomIn" );
|
insilmaril@0
|
728 |
connect( a, SIGNAL( activated() ), this, SLOT(viewZoomIn() ) );
|
insilmaril@0
|
729 |
a->addTo( tb );
|
insilmaril@0
|
730 |
a->addTo( menu );
|
insilmaril@0
|
731 |
a = new QAction( tr( "Zoom out" ), QPixmap(viewzoomout_xpm), tr( "Zoom out" ), CTRL + Key_Minus, this, "zoomOut" );
|
insilmaril@0
|
732 |
connect( a, SIGNAL( activated() ), this, SLOT( viewZoomOut() ) );
|
insilmaril@0
|
733 |
a->addTo( tb );
|
insilmaril@0
|
734 |
a->addTo( menu );
|
insilmaril@0
|
735 |
a = new QAction( tr( "Toggle Note Editor" ), QPixmap(flag_note_xpm), tr( "Toggle Note Editor" ), CTRL + Key_E , this, "noteEditor" );
|
insilmaril@0
|
736 |
connect( a, SIGNAL( activated() ), this, SLOT(windowToggleNoteEditor() ) );
|
insilmaril@0
|
737 |
a->setToggleAction(true);
|
insilmaril@0
|
738 |
if (textEditor->showWithMain())
|
insilmaril@0
|
739 |
a->setOn(true);
|
insilmaril@0
|
740 |
else
|
insilmaril@0
|
741 |
a->setOn(false);
|
insilmaril@0
|
742 |
a->addTo( tb );
|
insilmaril@0
|
743 |
a->addTo( menu );
|
insilmaril@0
|
744 |
actionViewToggleNoteEditor=a;
|
insilmaril@0
|
745 |
a = new QAction( tr( "&Next Window" ), QPixmap(), tr( "Next Window" ), ALT + Key_N , this, "nextWindow" );
|
insilmaril@0
|
746 |
connect( a, SIGNAL( activated() ), this, SLOT(windowNextEditor() ) );
|
insilmaril@0
|
747 |
a->addTo( menu );
|
insilmaril@0
|
748 |
a = new QAction( tr( "&Previous Window" ), QPixmap(), tr( "Previous Window" ), ALT + Key_P , this, "previousWindow" );
|
insilmaril@0
|
749 |
connect( a, SIGNAL( activated() ), this, SLOT(windowPreviousEditor() ) );
|
insilmaril@0
|
750 |
a->addTo( menu );
|
insilmaril@0
|
751 |
}
|
insilmaril@0
|
752 |
|
insilmaril@89
|
753 |
// Mode Actions
|
insilmaril@89
|
754 |
void Main::setupModeActions()
|
insilmaril@89
|
755 |
{
|
insilmaril@89
|
756 |
//QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@89
|
757 |
//menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
|
insilmaril@89
|
758 |
|
insilmaril@89
|
759 |
QToolBar *tb = new QToolBar( this );
|
insilmaril@91
|
760 |
tb->setLabel( tr ("Modes when using modifiers") );
|
insilmaril@89
|
761 |
QAction *a;
|
insilmaril@89
|
762 |
actionGroupModModes=new QActionGroup ( this, "formatLinkStyles");
|
insilmaril@89
|
763 |
actionGroupModModes->setExclusive (true);
|
insilmaril@125
|
764 |
a= new QAction( tr( "Use modifier to color branches" ), QPixmap(modecolor_xpm), 0, Key_J, actionGroupModModes, "modModeColor" );
|
insilmaril@89
|
765 |
a->setToggleAction(true);
|
insilmaril@89
|
766 |
a->addTo (tb);
|
insilmaril@89
|
767 |
a->setOn(true);
|
insilmaril@89
|
768 |
actionModModeColor=a;
|
insilmaril@104
|
769 |
|
insilmaril@125
|
770 |
a= new QAction( tr( "Use modifier to copy" ), QPixmap(modecopy_xpm), 0, Key_K, actionGroupModModes, "modModeCopy" );
|
insilmaril@104
|
771 |
a->setToggleAction(true);
|
insilmaril@104
|
772 |
a->addTo (tb);
|
insilmaril@104
|
773 |
actionModModeCopy=a;
|
insilmaril@104
|
774 |
|
insilmaril@125
|
775 |
a= new QAction( tr( "Use modifier to draw xLinks" ), QPixmap(modelink_xpm), 0, Key_L, actionGroupModModes, "modModeLink" );
|
insilmaril@89
|
776 |
a->setToggleAction(true);
|
insilmaril@89
|
777 |
a->addTo (tb);
|
insilmaril@89
|
778 |
actionModModeLink=a;
|
insilmaril@89
|
779 |
}
|
insilmaril@89
|
780 |
|
insilmaril@0
|
781 |
// Flag Actions
|
insilmaril@0
|
782 |
void Main::setupFlagActions()
|
insilmaril@0
|
783 |
{
|
insilmaril@0
|
784 |
standardFlagsDefault->makeToolbar(this, "Standard Flags");
|
insilmaril@0
|
785 |
}
|
insilmaril@0
|
786 |
|
insilmaril@0
|
787 |
// Settings Actions
|
insilmaril@0
|
788 |
void Main::setupSettingsActions()
|
insilmaril@0
|
789 |
{
|
insilmaril@0
|
790 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
791 |
menuBar()->insertItem( tr( "&Settings" ), menu );
|
insilmaril@0
|
792 |
|
insilmaril@0
|
793 |
QAction *a;
|
insilmaril@0
|
794 |
|
insilmaril@0
|
795 |
|
insilmaril@0
|
796 |
a = new QAction( tr( "Set application to open pdf files" ), QPixmap(), tr( "Set application to open pdf files" ), 0, this, "setPDF" );
|
insilmaril@0
|
797 |
connect( a, SIGNAL( activated() ), this, SLOT( settingsPDF() ) );
|
insilmaril@0
|
798 |
a->addTo( menu );
|
insilmaril@0
|
799 |
|
insilmaril@0
|
800 |
a = new QAction( tr( "Set application to open an URL" ), QPixmap(), tr( "Set application to open an URL" ), 0, this, "setURL" );
|
insilmaril@0
|
801 |
connect( a, SIGNAL( activated() ), this, SLOT( settingsURL() ) );
|
insilmaril@0
|
802 |
a->addTo( menu );
|
insilmaril@0
|
803 |
|
insilmaril@0
|
804 |
menu->insertSeparator();
|
insilmaril@0
|
805 |
a = new QAction( tr( "Edit branch after adding it" ), QPixmap(), tr( "Edit branch after adding it" ), 0, this, "autoedit" );
|
insilmaril@0
|
806 |
a->setToggleAction(true);
|
insilmaril@0
|
807 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoedit",true) );
|
insilmaril@0
|
808 |
a->addTo( menu );
|
insilmaril@0
|
809 |
actionSettingsAutoedit=a;
|
insilmaril@0
|
810 |
|
insilmaril@0
|
811 |
a= new QAction( tr( "Select branch after adding it" ), QPixmap(), tr( "Select branch after adding it" ), 0, this, "autoselectheading" );
|
insilmaril@0
|
812 |
a->setToggleAction(true);
|
insilmaril@0
|
813 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselect",false) );
|
insilmaril@0
|
814 |
a->addTo( menu );
|
insilmaril@0
|
815 |
actionSettingsAutoselectHeading=a;
|
insilmaril@0
|
816 |
|
insilmaril@0
|
817 |
a= new QAction( tr( "Select heading before editing" ), QPixmap(), tr( "Select existing heading" ), 0, this, "autoselectexistingtext" );
|
insilmaril@0
|
818 |
a->setToggleAction(true);
|
insilmaril@0
|
819 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/autoselectexistingtext",true) );
|
insilmaril@0
|
820 |
a->addTo( menu );
|
insilmaril@0
|
821 |
actionSettingsAutoselectText=a;
|
insilmaril@0
|
822 |
|
insilmaril@0
|
823 |
a= new QAction( tr( "Enable pasting into new branch" ), QPixmap(), tr( "Enable pasting into new branch" ), 0, this, "pastenewheading" );
|
insilmaril@0
|
824 |
a->setToggleAction(true);
|
insilmaril@0
|
825 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/newheadingisempty",true) );
|
insilmaril@0
|
826 |
a->addTo( menu );
|
insilmaril@0
|
827 |
actionSettingsPasteNewHeading=a;
|
insilmaril@0
|
828 |
|
insilmaril@0
|
829 |
a= new QAction( tr( "Enable Delete key for deleting branches" ), QPixmap(), tr( "Enable Delete key" ), 0, this, "delkey" );
|
insilmaril@0
|
830 |
a->setToggleAction(true);
|
insilmaril@0
|
831 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) );
|
insilmaril@0
|
832 |
a->addTo( menu );
|
insilmaril@0
|
833 |
actionSettingsUseDelKey=a;
|
insilmaril@103
|
834 |
|
insilmaril@125
|
835 |
a= new QAction( tr( "Use exclusive flags in flag toolbars" ), QPixmap(), tr( "Enable exclusive flags" ), 0, this, "flaggroups" );
|
insilmaril@103
|
836 |
a->setToggleAction(true);
|
insilmaril@103
|
837 |
a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) );
|
insilmaril@103
|
838 |
a->addTo( menu );
|
insilmaril@103
|
839 |
actionSettingsUseFlagGroups=a;
|
insilmaril@0
|
840 |
}
|
insilmaril@0
|
841 |
|
insilmaril@0
|
842 |
// Test Actions
|
insilmaril@0
|
843 |
void Main::setupTestActions()
|
insilmaril@0
|
844 |
{
|
insilmaril@0
|
845 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
846 |
menuBar()->insertItem( tr( "&Test" ), menu );
|
insilmaril@0
|
847 |
|
insilmaril@0
|
848 |
QAction *a;
|
insilmaril@0
|
849 |
a = new QAction( tr( "Test Flag" ), QPixmap(), tr( "test flag" ), 0, this, "flag" );
|
insilmaril@0
|
850 |
connect( a, SIGNAL( activated() ), this, SLOT( testFunction() ) );
|
insilmaril@0
|
851 |
a->addTo( menu );
|
insilmaril@0
|
852 |
|
insilmaril@0
|
853 |
a = new QAction( tr( "Show Clipboard" ), QPixmap(), tr( "Show clipboard" ), 0, this, "clipboard" );
|
insilmaril@0
|
854 |
connect( a, SIGNAL( activated() ), this, SLOT( testShowClipboard() ) );
|
insilmaril@0
|
855 |
a->addTo( menu );
|
insilmaril@0
|
856 |
}
|
insilmaril@0
|
857 |
|
insilmaril@0
|
858 |
// Help Actions
|
insilmaril@0
|
859 |
void Main::setupHelpActions()
|
insilmaril@0
|
860 |
{
|
insilmaril@0
|
861 |
QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@0
|
862 |
menuBar()->insertItem( tr( "&Help" ), menu );
|
insilmaril@0
|
863 |
|
insilmaril@0
|
864 |
QAction *a;
|
insilmaril@0
|
865 |
a = new QAction( tr( "Open VYM Documentation (pdf)" ), QPixmap(), tr( "Open VYM Documentation (pdf) " ), 0, this, "about" );
|
insilmaril@0
|
866 |
connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
|
insilmaril@0
|
867 |
a->addTo( menu );
|
insilmaril@0
|
868 |
|
insilmaril@0
|
869 |
a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
|
insilmaril@0
|
870 |
connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
|
insilmaril@0
|
871 |
a->addTo( menu );
|
insilmaril@0
|
872 |
|
insilmaril@0
|
873 |
a = new QAction( tr( "Information about QT toolkit" ), QPixmap(), tr( "About QT" ), 0, this, "about" );
|
insilmaril@0
|
874 |
connect( a, SIGNAL( activated() ), this, SLOT( helpAboutQT() ) );
|
insilmaril@0
|
875 |
a->addTo( menu );
|
insilmaril@0
|
876 |
}
|
insilmaril@0
|
877 |
|
insilmaril@0
|
878 |
// Context Menus
|
insilmaril@0
|
879 |
void Main::setupContextMenus()
|
insilmaril@0
|
880 |
{
|
insilmaril@0
|
881 |
QAction*a;
|
insilmaril@0
|
882 |
|
insilmaril@0
|
883 |
// Context Menu for branch or mapcenter
|
insilmaril@0
|
884 |
branchContextMenu =new QPopupMenu (this);
|
insilmaril@98
|
885 |
|
insilmaril@98
|
886 |
// Submenu "Add"
|
insilmaril@98
|
887 |
branchAddContextMenu =new QPopupMenu (this);
|
insilmaril@98
|
888 |
actionEditPaste->addTo ( branchAddContextMenu );
|
insilmaril@98
|
889 |
actionEditAddBranch->addTo ( branchAddContextMenu );
|
insilmaril@98
|
890 |
actionEditAddBranchHere->addTo ( branchAddContextMenu );
|
insilmaril@98
|
891 |
actionEditAddBranchAbove->addTo ( branchAddContextMenu );
|
insilmaril@98
|
892 |
actionEditAddBranchBelow->addTo ( branchAddContextMenu );
|
insilmaril@98
|
893 |
branchAddContextMenu->insertSeparator();
|
insilmaril@98
|
894 |
actionEditLoadImage->addTo( branchAddContextMenu );
|
insilmaril@98
|
895 |
branchAddContextMenu->insertSeparator();
|
insilmaril@98
|
896 |
actionEditImportAdd->addTo ( branchAddContextMenu );
|
insilmaril@98
|
897 |
actionEditImportReplace->addTo ( branchAddContextMenu );
|
insilmaril@98
|
898 |
|
insilmaril@98
|
899 |
// Submenu "Remove"
|
insilmaril@98
|
900 |
branchRemoveContextMenu =new QPopupMenu (this);
|
insilmaril@98
|
901 |
actionEditCut->addTo ( branchRemoveContextMenu );
|
insilmaril@98
|
902 |
actionEditDelete->addTo ( branchRemoveContextMenu );
|
insilmaril@98
|
903 |
actionEditRemoveBranchHere->addTo( branchRemoveContextMenu );
|
insilmaril@98
|
904 |
actionEditRemoveChilds->addTo( branchRemoveContextMenu );
|
insilmaril@98
|
905 |
|
insilmaril@98
|
906 |
branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
|
insilmaril@98
|
907 |
branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
|
insilmaril@98
|
908 |
|
insilmaril@0
|
909 |
actionEditSaveBranch->addTo( branchContextMenu );
|
insilmaril@98
|
910 |
|
insilmaril@0
|
911 |
branchContextMenu->insertSeparator();
|
insilmaril@0
|
912 |
actionEditOpenURL->addTo ( branchContextMenu );
|
insilmaril@0
|
913 |
actionEditURL->addTo ( branchContextMenu );
|
insilmaril@0
|
914 |
actionEditHeading2URL->addTo ( branchContextMenu );
|
insilmaril@0
|
915 |
if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
|
insilmaril@0
|
916 |
actionEditBugzilla2URL->addTo( branchContextMenu );
|
insilmaril@98
|
917 |
|
insilmaril@0
|
918 |
branchContextMenu->insertSeparator();
|
insilmaril@0
|
919 |
actionEditOpenVymLink->addTo ( branchContextMenu );
|
insilmaril@0
|
920 |
actionEditVymLink->addTo ( branchContextMenu );
|
insilmaril@0
|
921 |
actionEditDeleteVymLink->addTo ( branchContextMenu );
|
insilmaril@98
|
922 |
|
insilmaril@0
|
923 |
branchContextMenu->insertSeparator();
|
insilmaril@0
|
924 |
actionGroupFormatFrameTypes->addTo( branchContextMenu );
|
insilmaril@0
|
925 |
|
insilmaril@89
|
926 |
// Context Menu for links in a branch menu
|
insilmaril@89
|
927 |
// This will be populated "on demand" in MapEditor::updateActions
|
insilmaril@89
|
928 |
branchContextMenu->insertSeparator();
|
insilmaril@89
|
929 |
branchLinksContextMenu =new QPopupMenu (this);
|
insilmaril@94
|
930 |
branchLinksContextMenuDup =new QPopupMenu (this);
|
insilmaril@95
|
931 |
branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
|
insilmaril@95
|
932 |
connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
|
insilmaril@89
|
933 |
|
insilmaril@105
|
934 |
branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
|
insilmaril@105
|
935 |
connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
|
insilmaril@105
|
936 |
|
insilmaril@0
|
937 |
// Context menu for floatimage
|
insilmaril@0
|
938 |
floatimageContextMenu =new QPopupMenu (this);
|
insilmaril@0
|
939 |
saveImageFormatMenu=new QPopupMenu (this);
|
insilmaril@0
|
940 |
exportImageFormatMenu=new QPopupMenu (this);
|
insilmaril@0
|
941 |
|
insilmaril@0
|
942 |
QStrList fmt = QImage::outputFormats();
|
insilmaril@0
|
943 |
for (const char* f = fmt.first(); f; f = fmt.next())
|
insilmaril@0
|
944 |
{
|
insilmaril@0
|
945 |
saveImageFormatMenu->insertItem( f );
|
insilmaril@0
|
946 |
exportImageFormatMenu->insertItem( f );
|
insilmaril@0
|
947 |
}
|
insilmaril@0
|
948 |
connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
|
insilmaril@0
|
949 |
connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
|
insilmaril@0
|
950 |
floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
|
insilmaril@0
|
951 |
|
insilmaril@0
|
952 |
floatimageContextMenu->insertSeparator();
|
insilmaril@0
|
953 |
actionEditCopy->addTo( floatimageContextMenu );
|
insilmaril@0
|
954 |
actionEditCut->addTo( floatimageContextMenu );
|
insilmaril@0
|
955 |
|
insilmaril@0
|
956 |
floatimageContextMenu->insertSeparator();
|
insilmaril@0
|
957 |
a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
|
insilmaril@0
|
958 |
a->setToggleAction(true);
|
insilmaril@0
|
959 |
connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
|
insilmaril@0
|
960 |
a->addTo( floatimageContextMenu);
|
insilmaril@0
|
961 |
actionEditToggleFloatExport=a;
|
insilmaril@0
|
962 |
|
insilmaril@0
|
963 |
|
insilmaril@0
|
964 |
|
insilmaril@0
|
965 |
// Context menu for exports
|
insilmaril@0
|
966 |
exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
|
insilmaril@0
|
967 |
|
insilmaril@0
|
968 |
a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
|
insilmaril@0
|
969 |
connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
|
insilmaril@143
|
970 |
a->addTo( exportMenu );
|
insilmaril@0
|
971 |
|
insilmaril@0
|
972 |
a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" );
|
insilmaril@0
|
973 |
connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
|
insilmaril@0
|
974 |
a->addTo( exportMenu );
|
insilmaril@0
|
975 |
|
insilmaril@0
|
976 |
if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
|
insilmaril@0
|
977 |
{
|
insilmaril@0
|
978 |
a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export HTML" ), 0, this, "exportHTML" );
|
insilmaril@0
|
979 |
connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
|
insilmaril@0
|
980 |
a->addTo( exportMenu );
|
insilmaril@0
|
981 |
}
|
insilmaril@0
|
982 |
|
insilmaril@0
|
983 |
a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" ), ALT + Key_X, this, "exportXHTML" );
|
insilmaril@0
|
984 |
connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
|
insilmaril@0
|
985 |
a->addTo( exportMenu );
|
insilmaril@0
|
986 |
|
insilmaril@0
|
987 |
|
insilmaril@0
|
988 |
// Context menu for canvas
|
insilmaril@0
|
989 |
canvasContextMenu =new QPopupMenu (this);
|
insilmaril@0
|
990 |
actionEditMapInfo->addTo( canvasContextMenu );
|
insilmaril@0
|
991 |
canvasContextMenu->insertSeparator();
|
insilmaril@0
|
992 |
actionGroupFormatLinkStyles->addTo( canvasContextMenu );
|
insilmaril@0
|
993 |
canvasContextMenu->insertSeparator();
|
insilmaril@0
|
994 |
actionFormatLinkColorHint->addTo( canvasContextMenu );
|
insilmaril@0
|
995 |
actionFormatLinkColor->addTo( canvasContextMenu );
|
insilmaril@0
|
996 |
actionFormatBackColor->addTo( canvasContextMenu );
|
insilmaril@0
|
997 |
|
insilmaril@0
|
998 |
// Menu for last opened files
|
insilmaril@0
|
999 |
// Read settings initially
|
insilmaril@0
|
1000 |
QString s;
|
insilmaril@0
|
1001 |
int j=settings.readNumEntry( "/vym/lastMaps/number",0);
|
insilmaril@0
|
1002 |
for (int i=1;i<=j;i++)
|
insilmaril@0
|
1003 |
{
|
insilmaril@0
|
1004 |
s=settings.readEntry(QString("/vym/lastMaps/map-%1").arg(i),"");
|
insilmaril@0
|
1005 |
if (!s.isEmpty() && j<=maxLastMaps)
|
insilmaril@0
|
1006 |
lastMaps.append(s);
|
insilmaril@0
|
1007 |
}
|
insilmaril@0
|
1008 |
setupLastMapsMenu();
|
insilmaril@0
|
1009 |
connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
|
insilmaril@0
|
1010 |
}
|
insilmaril@0
|
1011 |
|
insilmaril@0
|
1012 |
void Main::setupLastMapsMenu()
|
insilmaril@0
|
1013 |
{
|
insilmaril@0
|
1014 |
// Remove double entries
|
insilmaril@0
|
1015 |
QStringList::Iterator it=lastMaps.begin();
|
insilmaril@0
|
1016 |
QStringList::Iterator jt;
|
insilmaril@0
|
1017 |
while (it!=lastMaps.end() )
|
insilmaril@0
|
1018 |
{
|
insilmaril@0
|
1019 |
jt=it;
|
insilmaril@0
|
1020 |
++jt;
|
insilmaril@0
|
1021 |
while (jt!=lastMaps.end() )
|
insilmaril@0
|
1022 |
{
|
insilmaril@0
|
1023 |
if (*it == *jt)
|
insilmaril@0
|
1024 |
jt=lastMaps.remove(jt);
|
insilmaril@0
|
1025 |
else
|
insilmaril@0
|
1026 |
jt++;
|
insilmaril@0
|
1027 |
}
|
insilmaril@0
|
1028 |
it++;
|
insilmaril@0
|
1029 |
}
|
insilmaril@0
|
1030 |
|
insilmaril@0
|
1031 |
// Limit length of list to maxLastMaps
|
insilmaril@0
|
1032 |
while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
|
insilmaril@0
|
1033 |
|
insilmaril@0
|
1034 |
// build Menu from lastMaps string list
|
insilmaril@0
|
1035 |
lastMapsMenu->clear();
|
insilmaril@0
|
1036 |
for (it = lastMaps.begin(); it != lastMaps.end(); ++it )
|
insilmaril@0
|
1037 |
lastMapsMenu->insertItem (*it );
|
insilmaril@0
|
1038 |
|
insilmaril@0
|
1039 |
}
|
insilmaril@0
|
1040 |
|
insilmaril@0
|
1041 |
void Main::hideEvent (QHideEvent * )
|
insilmaril@0
|
1042 |
{
|
insilmaril@0
|
1043 |
if (!textEditor->isMinimized() ) textEditor->hide();
|
insilmaril@0
|
1044 |
}
|
insilmaril@0
|
1045 |
|
insilmaril@0
|
1046 |
void Main::showEvent (QShowEvent * )
|
insilmaril@0
|
1047 |
{
|
insilmaril@117
|
1048 |
if (textEditor->showWithMain()) textEditor->showNormal();
|
insilmaril@0
|
1049 |
}
|
insilmaril@0
|
1050 |
|
insilmaril@0
|
1051 |
bool Main::reallyWriteDirectory(const QString &dir)
|
insilmaril@0
|
1052 |
{
|
insilmaril@0
|
1053 |
QStringList eList = QDir(dir).entryList();
|
insilmaril@0
|
1054 |
if (eList.first() ==".") eList.pop_front(); // remove "."
|
insilmaril@0
|
1055 |
if (eList.first() =="..") eList.pop_front(); // remove "."
|
insilmaril@0
|
1056 |
if (!eList.isEmpty())
|
insilmaril@0
|
1057 |
{
|
insilmaril@0
|
1058 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1059 |
tr("The directory ") + dir +
|
insilmaril@0
|
1060 |
tr(" is not empty. Do you risk to overwrite its contents?"),
|
insilmaril@0
|
1061 |
QMessageBox::Warning,
|
insilmaril@0
|
1062 |
QMessageBox::Yes ,
|
insilmaril@0
|
1063 |
QMessageBox::Cancel | QMessageBox::Default,
|
insilmaril@0
|
1064 |
QMessageBox::QMessageBox::NoButton );
|
insilmaril@0
|
1065 |
|
insilmaril@0
|
1066 |
mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
|
insilmaril@0
|
1067 |
mb.setButtonText( QMessageBox::No, tr("Cancel"));
|
insilmaril@0
|
1068 |
switch( mb.exec() )
|
insilmaril@0
|
1069 |
{
|
insilmaril@0
|
1070 |
case QMessageBox::Yes:
|
insilmaril@0
|
1071 |
// save
|
insilmaril@0
|
1072 |
return true;
|
insilmaril@0
|
1073 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1074 |
// do nothing
|
insilmaril@0
|
1075 |
return false;
|
insilmaril@0
|
1076 |
}
|
insilmaril@0
|
1077 |
}
|
insilmaril@0
|
1078 |
return true;
|
insilmaril@0
|
1079 |
}
|
insilmaril@0
|
1080 |
|
insilmaril@0
|
1081 |
QString Main::browseDirectory (const QString &caption)
|
insilmaril@0
|
1082 |
{
|
insilmaril@0
|
1083 |
QFileDialog fd(this,caption);
|
insilmaril@0
|
1084 |
fd.setMode (QFileDialog::DirectoryOnly);
|
insilmaril@0
|
1085 |
fd.setCaption("VYM - "+caption);
|
insilmaril@0
|
1086 |
fd.show();
|
insilmaril@0
|
1087 |
|
insilmaril@0
|
1088 |
if ( fd.exec() == QDialog::Accepted )
|
insilmaril@0
|
1089 |
return fd.selectedFile();
|
insilmaril@0
|
1090 |
else
|
insilmaril@0
|
1091 |
return "";
|
insilmaril@0
|
1092 |
}
|
insilmaril@0
|
1093 |
|
insilmaril@0
|
1094 |
MapEditor* Main::currentMapEditor() const
|
insilmaril@0
|
1095 |
{
|
insilmaril@0
|
1096 |
if ( tabWidget->currentPage() &&
|
insilmaril@0
|
1097 |
tabWidget->currentPage()->inherits( "MapEditor" ) )
|
insilmaril@0
|
1098 |
return (MapEditor*)tabWidget->currentPage();
|
insilmaril@0
|
1099 |
return NULL;
|
insilmaril@0
|
1100 |
}
|
insilmaril@0
|
1101 |
|
insilmaril@0
|
1102 |
//TODO not used now, maybe use this for overview window later
|
insilmaril@0
|
1103 |
void Main::newView()
|
insilmaril@0
|
1104 |
{
|
insilmaril@0
|
1105 |
// Open a new view... have it delete when closed.
|
insilmaril@0
|
1106 |
Main *m = new Main(0, 0, WDestructiveClose);
|
insilmaril@0
|
1107 |
qApp->setMainWidget(m);
|
insilmaril@0
|
1108 |
m->show();
|
insilmaril@0
|
1109 |
qApp->setMainWidget(0);
|
insilmaril@0
|
1110 |
}
|
insilmaril@0
|
1111 |
|
insilmaril@0
|
1112 |
void Main::editorChanged(QWidget *)
|
insilmaril@0
|
1113 |
{
|
insilmaril@0
|
1114 |
// Unselect all possibly selected objects
|
insilmaril@0
|
1115 |
// (Important to update note editor)
|
insilmaril@0
|
1116 |
int i;
|
insilmaril@0
|
1117 |
MapEditor *me;
|
insilmaril@0
|
1118 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
1119 |
{
|
insilmaril@0
|
1120 |
|
insilmaril@0
|
1121 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1122 |
me->unselect();
|
insilmaril@0
|
1123 |
}
|
insilmaril@0
|
1124 |
currentMapEditor()->reselect();
|
insilmaril@0
|
1125 |
|
insilmaril@0
|
1126 |
// Update actions to in menus and toolbars according to editor
|
insilmaril@0
|
1127 |
currentMapEditor()->updateActions();
|
insilmaril@0
|
1128 |
}
|
insilmaril@0
|
1129 |
|
insilmaril@0
|
1130 |
void Main::fileNew()
|
insilmaril@0
|
1131 |
{
|
insilmaril@0
|
1132 |
QString fn="unnamed";
|
insilmaril@0
|
1133 |
MapEditor* medit = new MapEditor (tabWidget, true);
|
insilmaril@0
|
1134 |
tabWidget->addTab (medit,fn);
|
insilmaril@0
|
1135 |
tabWidget->showPage(medit);
|
insilmaril@0
|
1136 |
medit->viewport()->setFocus();
|
insilmaril@0
|
1137 |
medit->select("mc:");
|
insilmaril@0
|
1138 |
}
|
insilmaril@0
|
1139 |
|
insilmaril@0
|
1140 |
void Main::fileLoad(QString fn, const LoadMode &lmode)
|
insilmaril@0
|
1141 |
{
|
insilmaril@0
|
1142 |
// Error codes
|
insilmaril@0
|
1143 |
enum errorCode {success,aborted};
|
insilmaril@0
|
1144 |
errorCode err=success;
|
insilmaril@0
|
1145 |
|
insilmaril@0
|
1146 |
// fn is usually the archive, mapfile the file after uncompressing
|
insilmaril@0
|
1147 |
QString mapfile;
|
insilmaril@0
|
1148 |
|
insilmaril@0
|
1149 |
// Make fn absolute (needed for unzip)
|
insilmaril@0
|
1150 |
fn=QDir (fn).absPath();
|
insilmaril@0
|
1151 |
|
insilmaril@0
|
1152 |
MapEditor *me;
|
insilmaril@0
|
1153 |
|
insilmaril@0
|
1154 |
if (lmode==NewMap)
|
insilmaril@0
|
1155 |
{
|
insilmaril@0
|
1156 |
// Check, if map is already loaded
|
insilmaril@0
|
1157 |
int i=0;
|
insilmaril@0
|
1158 |
while (i<=tabWidget->count() -1)
|
insilmaril@0
|
1159 |
{
|
insilmaril@0
|
1160 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1161 |
if (me->getFilePath() == fn)
|
insilmaril@0
|
1162 |
{
|
insilmaril@0
|
1163 |
// Already there, ask for confirmation
|
insilmaril@0
|
1164 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1165 |
tr("The map ") + fn + tr ("\n is already opened."
|
insilmaril@0
|
1166 |
"Opening the same map in multiple editors may lead \n"
|
insilmaril@0
|
1167 |
"to confusion when finishing working with vym."
|
insilmaril@0
|
1168 |
"Do you want to"),
|
insilmaril@0
|
1169 |
QMessageBox::Warning,
|
insilmaril@0
|
1170 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1171 |
QMessageBox::Cancel | QMessageBox::Escape,
|
insilmaril@0
|
1172 |
QMessageBox::QMessageBox::NoButton);
|
insilmaril@0
|
1173 |
mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
|
insilmaril@0
|
1174 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
1175 |
switch( mb.exec() )
|
insilmaril@0
|
1176 |
{
|
insilmaril@0
|
1177 |
case QMessageBox::Yes:
|
insilmaril@0
|
1178 |
// load anyway
|
insilmaril@0
|
1179 |
i=tabWidget->count();
|
insilmaril@0
|
1180 |
break;
|
insilmaril@0
|
1181 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1182 |
// do nothing
|
insilmaril@0
|
1183 |
return;
|
insilmaril@0
|
1184 |
break;
|
insilmaril@0
|
1185 |
}
|
insilmaril@0
|
1186 |
}
|
insilmaril@0
|
1187 |
i++;
|
insilmaril@0
|
1188 |
}
|
insilmaril@0
|
1189 |
}
|
insilmaril@0
|
1190 |
|
insilmaril@0
|
1191 |
|
insilmaril@0
|
1192 |
// Try to load map
|
insilmaril@0
|
1193 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1194 |
{
|
insilmaril@0
|
1195 |
me = currentMapEditor();
|
insilmaril@0
|
1196 |
int tabIndex=tabWidget->currentPageIndex();
|
insilmaril@0
|
1197 |
// Check first, if mapeditor exists
|
insilmaril@0
|
1198 |
// If it is not default AND we want a new map,
|
insilmaril@0
|
1199 |
// create a new mapeditor in a new tab
|
insilmaril@0
|
1200 |
if ( lmode==NewMap && (!me || !me->isDefault() ) )
|
insilmaril@0
|
1201 |
{
|
insilmaril@0
|
1202 |
me = new MapEditor (tabWidget,true);
|
insilmaril@0
|
1203 |
tabWidget->addTab (me,fn);
|
insilmaril@0
|
1204 |
tabIndex=tabWidget->indexOf (me);
|
insilmaril@0
|
1205 |
tabWidget->setCurrentPage (tabIndex);
|
insilmaril@0
|
1206 |
}
|
insilmaril@0
|
1207 |
|
insilmaril@0
|
1208 |
// Check, if file exists (important for creating new files
|
insilmaril@0
|
1209 |
// from command line
|
insilmaril@0
|
1210 |
if (!QFile(fn).exists() )
|
insilmaril@0
|
1211 |
{
|
insilmaril@0
|
1212 |
QMessageBox mb( "VYM",
|
insilmaril@95
|
1213 |
tr("This map does not exist:\n ")+fn+tr("\nDo you want to create a new one?"),
|
insilmaril@0
|
1214 |
QMessageBox::Question,
|
insilmaril@0
|
1215 |
QMessageBox::Yes ,
|
insilmaril@0
|
1216 |
QMessageBox::Cancel | QMessageBox::Default,
|
insilmaril@0
|
1217 |
QMessageBox::QMessageBox::NoButton );
|
insilmaril@0
|
1218 |
|
insilmaril@0
|
1219 |
mb.setButtonText( QMessageBox::Yes, tr("Create"));
|
insilmaril@0
|
1220 |
mb.setButtonText( QMessageBox::No, tr("Cancel"));
|
insilmaril@0
|
1221 |
switch( mb.exec() )
|
insilmaril@0
|
1222 |
{
|
insilmaril@0
|
1223 |
case QMessageBox::Yes:
|
insilmaril@0
|
1224 |
// Create new map
|
insilmaril@0
|
1225 |
currentMapEditor()->setFilePath(fn);
|
insilmaril@0
|
1226 |
tabWidget->setTabLabel (currentMapEditor(),
|
insilmaril@0
|
1227 |
currentMapEditor()->getFileName() );
|
insilmaril@0
|
1228 |
statusBar()->message( "Created " + fn , statusbarTime );
|
insilmaril@0
|
1229 |
return;
|
insilmaril@0
|
1230 |
|
insilmaril@0
|
1231 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1232 |
// don't create new map
|
insilmaril@0
|
1233 |
statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
|
insilmaril@0
|
1234 |
fileCloseMap();
|
insilmaril@0
|
1235 |
return;
|
insilmaril@0
|
1236 |
}
|
insilmaril@0
|
1237 |
}
|
insilmaril@0
|
1238 |
|
insilmaril@0
|
1239 |
|
insilmaril@0
|
1240 |
//tabWidget->currentPage() won't be NULL here, because of above...
|
insilmaril@0
|
1241 |
tabWidget->showPage(me);
|
insilmaril@0
|
1242 |
me->viewport()->setFocus();
|
insilmaril@0
|
1243 |
|
insilmaril@0
|
1244 |
// Create temporary directory for packing
|
insilmaril@0
|
1245 |
char tmpdir1[]="/tmp/vym-XXXXXX";
|
insilmaril@0
|
1246 |
QString tmpMapDir=mkdtemp(tmpdir1);
|
insilmaril@0
|
1247 |
|
insilmaril@0
|
1248 |
// Try to unzip file
|
insilmaril@0
|
1249 |
Process *zipProc=new Process ();
|
insilmaril@0
|
1250 |
zipProc->clearArguments();
|
insilmaril@0
|
1251 |
zipProc->setWorkingDirectory (QDir(tmpMapDir));
|
insilmaril@0
|
1252 |
zipProc->addArgument ("unzip");
|
insilmaril@0
|
1253 |
zipProc->addArgument (fn );
|
insilmaril@0
|
1254 |
zipProc->addArgument ("-d");
|
insilmaril@0
|
1255 |
zipProc->addArgument (tmpMapDir);
|
insilmaril@0
|
1256 |
|
insilmaril@0
|
1257 |
if (!zipProc->start() )
|
insilmaril@0
|
1258 |
{
|
insilmaril@0
|
1259 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@0
|
1260 |
tr("Couldn't start unzip to decompress data."));
|
insilmaril@0
|
1261 |
err=aborted;
|
insilmaril@0
|
1262 |
|
insilmaril@0
|
1263 |
} else
|
insilmaril@0
|
1264 |
{
|
insilmaril@0
|
1265 |
zipProc->waitFinished();
|
insilmaril@0
|
1266 |
if (!zipProc->normalExit() )
|
insilmaril@0
|
1267 |
{
|
insilmaril@0
|
1268 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@0
|
1269 |
tr("unzip didn't exit normally") +
|
insilmaril@0
|
1270 |
zipProc->getErrout() );
|
insilmaril@0
|
1271 |
err=aborted;
|
insilmaril@0
|
1272 |
} else
|
insilmaril@0
|
1273 |
{
|
insilmaril@0
|
1274 |
if (zipProc->exitStatus()>0)
|
insilmaril@0
|
1275 |
{
|
insilmaril@0
|
1276 |
if (zipProc->exitStatus()==9)
|
insilmaril@0
|
1277 |
{
|
insilmaril@0
|
1278 |
// no zipped file, but maybe .xml or old version? Try again.
|
insilmaril@0
|
1279 |
mapfile=fn;
|
insilmaril@0
|
1280 |
me->setZipped(false);
|
insilmaril@0
|
1281 |
}
|
insilmaril@0
|
1282 |
else
|
insilmaril@0
|
1283 |
{
|
insilmaril@0
|
1284 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@0
|
1285 |
QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
|
insilmaril@0
|
1286 |
zipProc->getErrout() );
|
insilmaril@0
|
1287 |
err=aborted;
|
insilmaril@0
|
1288 |
}
|
insilmaril@0
|
1289 |
} else
|
insilmaril@0
|
1290 |
{ // Uncompressing was successfull,
|
insilmaril@0
|
1291 |
// load from uncompressed temporary directory
|
insilmaril@0
|
1292 |
|
insilmaril@0
|
1293 |
me->setZipped(true);
|
insilmaril@0
|
1294 |
|
insilmaril@0
|
1295 |
|
insilmaril@0
|
1296 |
// Look for mapname.xml
|
insilmaril@0
|
1297 |
mapfile= fn.left(fn.findRev(".",-1,true));
|
insilmaril@0
|
1298 |
mapfile=mapfile.section( '/', -1 );
|
insilmaril@0
|
1299 |
QFile file( tmpMapDir + "/" + mapfile + ".xml");
|
insilmaril@0
|
1300 |
if (!file.exists() )
|
insilmaril@0
|
1301 |
{
|
insilmaril@0
|
1302 |
// mapname.xml does not exist, well,
|
insilmaril@0
|
1303 |
// maybe some renamed the mapname.vym file...
|
insilmaril@0
|
1304 |
// Try to find any .xml in the toplevel
|
insilmaril@0
|
1305 |
// directory of the .vym file
|
insilmaril@0
|
1306 |
QStringList flist=QDir (tmpMapDir).entryList("*.xml");
|
insilmaril@0
|
1307 |
if (flist.count()==1)
|
insilmaril@0
|
1308 |
{
|
insilmaril@0
|
1309 |
// Only one entry, take this one
|
insilmaril@0
|
1310 |
mapfile=tmpMapDir + "/"+flist.first();
|
insilmaril@0
|
1311 |
} else
|
insilmaril@0
|
1312 |
{
|
insilmaril@0
|
1313 |
for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
|
insilmaril@0
|
1314 |
*it=tmpMapDir + "/" + *it;
|
insilmaril@106
|
1315 |
// FIXME Multiple entries, load all (but only the first one into this ME)
|
insilmaril@0
|
1316 |
//mainWindow->fileLoadFromTmp (flist);
|
insilmaril@0
|
1317 |
//returnCode=1; // Silently forget this attempt to load
|
insilmaril@0
|
1318 |
qWarning ("MainWindow::load (fn) multimap found...");
|
insilmaril@0
|
1319 |
}
|
insilmaril@0
|
1320 |
|
insilmaril@0
|
1321 |
if (flist.isEmpty() )
|
insilmaril@0
|
1322 |
{
|
insilmaril@0
|
1323 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@0
|
1324 |
tr("Couldn't find a map (*.xml) in .vym archive.\n"));
|
insilmaril@0
|
1325 |
err=aborted;
|
insilmaril@0
|
1326 |
}
|
insilmaril@0
|
1327 |
} //file doesn't exist
|
insilmaril@0
|
1328 |
else
|
insilmaril@0
|
1329 |
mapfile=file.name();
|
insilmaril@0
|
1330 |
} // Uncompressing successfull
|
insilmaril@0
|
1331 |
}
|
insilmaril@0
|
1332 |
}
|
insilmaril@0
|
1333 |
|
insilmaril@106
|
1334 |
|
insilmaril@106
|
1335 |
// Save existing filename
|
insilmaril@106
|
1336 |
QString fn_org=me->getFilePath();
|
insilmaril@106
|
1337 |
|
insilmaril@0
|
1338 |
// Finally load map into mapEditor
|
insilmaril@0
|
1339 |
me->setFilePath (mapfile,fn);
|
insilmaril@0
|
1340 |
if (me->load(mapfile,lmode))
|
insilmaril@0
|
1341 |
err=aborted;
|
insilmaril@0
|
1342 |
|
insilmaril@106
|
1343 |
// Restore old (maybe empty) filepath, if this is an import
|
insilmaril@106
|
1344 |
if (lmode!=NewMap)
|
insilmaril@106
|
1345 |
me->setFilePath (fn_org);
|
insilmaril@106
|
1346 |
|
insilmaril@0
|
1347 |
// Delete tmpDir
|
insilmaril@0
|
1348 |
system ( "rm -rf "+tmpMapDir);
|
insilmaril@0
|
1349 |
|
insilmaril@0
|
1350 |
// Check for errors
|
insilmaril@0
|
1351 |
if (err==success)
|
insilmaril@0
|
1352 |
{
|
insilmaril@0
|
1353 |
if (lmode==NewMap)
|
insilmaril@0
|
1354 |
{
|
insilmaril@0
|
1355 |
me->setFilePath (fn);
|
insilmaril@0
|
1356 |
tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
|
insilmaril@0
|
1357 |
lastMaps.prepend(me->getFilePath() );
|
insilmaril@0
|
1358 |
setupLastMapsMenu();
|
insilmaril@0
|
1359 |
actionFilePrint->setEnabled (true);
|
insilmaril@0
|
1360 |
}
|
insilmaril@0
|
1361 |
statusBar()->message( "Loaded " + fn, statusbarTime );
|
insilmaril@0
|
1362 |
return;
|
insilmaril@0
|
1363 |
} else
|
insilmaril@0
|
1364 |
{
|
insilmaril@0
|
1365 |
if (lmode==NewMap)
|
insilmaril@0
|
1366 |
fileCloseMap();
|
insilmaril@0
|
1367 |
}
|
insilmaril@0
|
1368 |
|
insilmaril@0
|
1369 |
|
insilmaril@0
|
1370 |
}
|
insilmaril@0
|
1371 |
statusBar()->message( "Could not load " + fn, statusbarTime );
|
insilmaril@0
|
1372 |
}
|
insilmaril@0
|
1373 |
|
insilmaril@0
|
1374 |
|
insilmaril@0
|
1375 |
void Main::fileLoad(const LoadMode &lmode)
|
insilmaril@0
|
1376 |
{
|
insilmaril@0
|
1377 |
QFileDialog *fd=new QFileDialog( this);
|
insilmaril@0
|
1378 |
if (!lastFileDir.isEmpty())
|
insilmaril@0
|
1379 |
fd->setDir (lastFileDir);
|
insilmaril@0
|
1380 |
fd->addFilter ("XML (*.xml)");
|
insilmaril@0
|
1381 |
fd->addFilter ("VYM map (*.vym *.vyp)");
|
insilmaril@0
|
1382 |
switch (lmode)
|
insilmaril@0
|
1383 |
{
|
insilmaril@0
|
1384 |
case NewMap:
|
insilmaril@0
|
1385 |
fd->setCaption(tr("Load vym map"));
|
insilmaril@0
|
1386 |
break;
|
insilmaril@0
|
1387 |
case ImportAdd:
|
insilmaril@0
|
1388 |
fd->setCaption(tr("Import: Add vym map to selection"));
|
insilmaril@0
|
1389 |
break;
|
insilmaril@0
|
1390 |
case ImportReplace:
|
insilmaril@0
|
1391 |
fd->setCaption(tr("Import: Replace selection with vym map"));
|
insilmaril@0
|
1392 |
break;
|
insilmaril@0
|
1393 |
}
|
insilmaril@0
|
1394 |
fd->show();
|
insilmaril@0
|
1395 |
|
insilmaril@0
|
1396 |
QString fn;
|
insilmaril@0
|
1397 |
if ( fd->exec() == QDialog::Accepted )
|
insilmaril@0
|
1398 |
{
|
insilmaril@0
|
1399 |
lastFileDir=fd->dirPath();
|
insilmaril@0
|
1400 |
fn = fd->selectedFile();
|
insilmaril@0
|
1401 |
fileLoad(fn, lmode);
|
insilmaril@0
|
1402 |
}
|
insilmaril@0
|
1403 |
}
|
insilmaril@0
|
1404 |
|
insilmaril@0
|
1405 |
void Main::fileLoad()
|
insilmaril@0
|
1406 |
{
|
insilmaril@0
|
1407 |
fileLoad (NewMap);
|
insilmaril@0
|
1408 |
}
|
insilmaril@0
|
1409 |
|
insilmaril@0
|
1410 |
void Main::fileLoadLast(int i)
|
insilmaril@0
|
1411 |
{
|
insilmaril@0
|
1412 |
fileLoad(*lastMaps.at(lastMapsMenu->indexOf (i) ),NewMap);
|
insilmaril@0
|
1413 |
}
|
insilmaril@0
|
1414 |
|
insilmaril@0
|
1415 |
void Main::fileSave(const SaveMode &savemode)
|
insilmaril@0
|
1416 |
{
|
insilmaril@0
|
1417 |
// tmp dir for zipping
|
insilmaril@0
|
1418 |
QString tmpMapDir;
|
insilmaril@0
|
1419 |
|
insilmaril@0
|
1420 |
// Error codes
|
insilmaril@0
|
1421 |
enum errorCode {success,aborted};
|
insilmaril@0
|
1422 |
errorCode err=success;
|
insilmaril@0
|
1423 |
|
insilmaril@0
|
1424 |
QString safeFilePath;
|
insilmaril@0
|
1425 |
|
insilmaril@0
|
1426 |
bool saveZipped=currentMapEditor()->saveZipped();
|
insilmaril@0
|
1427 |
|
insilmaril@0
|
1428 |
if (currentMapEditor())
|
insilmaril@0
|
1429 |
{
|
insilmaril@0
|
1430 |
QString fn=currentMapEditor()->getFilePath();
|
insilmaril@0
|
1431 |
// filename=unnamed, filepath="" in constructor...
|
insilmaril@0
|
1432 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1433 |
{
|
insilmaril@0
|
1434 |
// We have a filepath, go on saving
|
insilmaril@0
|
1435 |
// First remove existing file, we
|
insilmaril@0
|
1436 |
// don't want to add to old zip archives
|
insilmaril@0
|
1437 |
QFile f(fn);
|
insilmaril@0
|
1438 |
if (f.exists() )
|
insilmaril@0
|
1439 |
if (!f.remove())
|
insilmaril@0
|
1440 |
QMessageBox::warning( 0, tr( "Save Error" ),
|
insilmaril@0
|
1441 |
fn+ tr("\ncould not be removed before saving"));
|
insilmaril@0
|
1442 |
|
insilmaril@0
|
1443 |
// Look, if we should zip the data:
|
insilmaril@0
|
1444 |
if (!saveZipped)
|
insilmaril@0
|
1445 |
{
|
insilmaril@0
|
1446 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1447 |
tr("The map ") + fn +
|
insilmaril@0
|
1448 |
tr ("\ndid not use the compressed "
|
insilmaril@0
|
1449 |
"vym file format.\nWriting it uncompressed will also write images \n"
|
insilmaril@0
|
1450 |
"and flags and thus may overwrite files in the "
|
insilmaril@0
|
1451 |
"given directory\n\nDo you want to write the map"),
|
insilmaril@0
|
1452 |
QMessageBox::Warning,
|
insilmaril@0
|
1453 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1454 |
QMessageBox::No ,
|
insilmaril@0
|
1455 |
QMessageBox::Cancel | QMessageBox::Escape);
|
insilmaril@0
|
1456 |
mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
|
insilmaril@0
|
1457 |
mb.setButtonText( QMessageBox::No, tr("uncompressed") );
|
insilmaril@0
|
1458 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
1459 |
switch( mb.exec() )
|
insilmaril@0
|
1460 |
{
|
insilmaril@0
|
1461 |
case QMessageBox::Yes:
|
insilmaril@0
|
1462 |
// save compressed (default file format)
|
insilmaril@0
|
1463 |
saveZipped=true;
|
insilmaril@0
|
1464 |
break;
|
insilmaril@0
|
1465 |
case QMessageBox::No:
|
insilmaril@0
|
1466 |
// save uncompressed
|
insilmaril@0
|
1467 |
saveZipped=false;
|
insilmaril@0
|
1468 |
break;
|
insilmaril@0
|
1469 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1470 |
// do nothing
|
insilmaril@0
|
1471 |
return;
|
insilmaril@0
|
1472 |
break;
|
insilmaril@0
|
1473 |
}
|
insilmaril@0
|
1474 |
}
|
insilmaril@0
|
1475 |
|
insilmaril@0
|
1476 |
if (saveZipped)
|
insilmaril@0
|
1477 |
{
|
insilmaril@0
|
1478 |
char tmpdir1[]="/tmp/vym-XXXXXX";
|
insilmaril@0
|
1479 |
tmpMapDir=mkdtemp(tmpdir1);
|
insilmaril@0
|
1480 |
|
insilmaril@0
|
1481 |
safeFilePath=currentMapEditor()->getFilePath();
|
insilmaril@0
|
1482 |
currentMapEditor()->setFilePath (tmpMapDir+"/"+
|
insilmaril@0
|
1483 |
currentMapEditor()->getMapName()+ ".xml",
|
insilmaril@0
|
1484 |
safeFilePath);
|
insilmaril@0
|
1485 |
currentMapEditor()->save (savemode);
|
insilmaril@0
|
1486 |
currentMapEditor()->setFilePath (safeFilePath);
|
insilmaril@0
|
1487 |
|
insilmaril@0
|
1488 |
// zip the temporary directory
|
insilmaril@0
|
1489 |
Process *zipProc=new Process ();
|
insilmaril@0
|
1490 |
zipProc->clearArguments();
|
insilmaril@0
|
1491 |
zipProc->setWorkingDirectory (QDir(tmpMapDir));
|
insilmaril@0
|
1492 |
zipProc->addArgument ("zip");
|
insilmaril@0
|
1493 |
zipProc->addArgument ("-r");
|
insilmaril@0
|
1494 |
zipProc->addArgument (fn);
|
insilmaril@0
|
1495 |
zipProc->addArgument (".");
|
insilmaril@0
|
1496 |
|
insilmaril@0
|
1497 |
if (!zipProc->start() )
|
insilmaril@0
|
1498 |
{
|
insilmaril@0
|
1499 |
// zip could not be started
|
insilmaril@0
|
1500 |
QMessageBox::critical( 0, tr( "Critical Save Error" ),
|
insilmaril@0
|
1501 |
tr("Couldn't start zip to compress data."));
|
insilmaril@0
|
1502 |
err=aborted;
|
insilmaril@0
|
1503 |
} else
|
insilmaril@0
|
1504 |
{
|
insilmaril@0
|
1505 |
// zip could be started
|
insilmaril@0
|
1506 |
zipProc->waitFinished();
|
insilmaril@0
|
1507 |
if (!zipProc->normalExit() )
|
insilmaril@0
|
1508 |
{
|
insilmaril@0
|
1509 |
QMessageBox::critical( 0, tr( "Critical Save Error" ),
|
insilmaril@0
|
1510 |
tr("zip didn't exit normally")+
|
insilmaril@0
|
1511 |
"\n" + zipProc->getErrout());
|
insilmaril@0
|
1512 |
err=aborted;
|
insilmaril@0
|
1513 |
} else
|
insilmaril@0
|
1514 |
{
|
insilmaril@0
|
1515 |
if (zipProc->exitStatus()>0)
|
insilmaril@0
|
1516 |
{
|
insilmaril@0
|
1517 |
QMessageBox::critical( 0, tr( "Critical Save Error" ),
|
insilmaril@0
|
1518 |
QString("zip exit code: %1").arg(zipProc->exitStatus() )+
|
insilmaril@0
|
1519 |
"\n" + zipProc->getErrout() );
|
insilmaril@0
|
1520 |
err=aborted;
|
insilmaril@0
|
1521 |
}
|
insilmaril@0
|
1522 |
}
|
insilmaril@0
|
1523 |
} // zip could be started
|
insilmaril@0
|
1524 |
} // save zipped
|
insilmaril@0
|
1525 |
else
|
insilmaril@0
|
1526 |
{
|
insilmaril@0
|
1527 |
// Save unzipped.
|
insilmaril@0
|
1528 |
safeFilePath=currentMapEditor()->getFilePath();
|
insilmaril@0
|
1529 |
currentMapEditor()->setFilePath (fn, safeFilePath);
|
insilmaril@0
|
1530 |
currentMapEditor()->save (savemode);
|
insilmaril@0
|
1531 |
currentMapEditor()->setFilePath (safeFilePath);
|
insilmaril@0
|
1532 |
} // save zipped
|
insilmaril@0
|
1533 |
} // filepath available
|
insilmaril@0
|
1534 |
else
|
insilmaril@0
|
1535 |
{
|
insilmaril@0
|
1536 |
// We have no filepath yet,
|
insilmaril@0
|
1537 |
// call fileSaveAs() now, this will call fileSave()
|
insilmaril@0
|
1538 |
// again.
|
insilmaril@0
|
1539 |
fileSaveAs(savemode);
|
insilmaril@0
|
1540 |
}
|
insilmaril@0
|
1541 |
}
|
insilmaril@0
|
1542 |
|
insilmaril@0
|
1543 |
if (currentMapEditor()->saveZipped())
|
insilmaril@0
|
1544 |
{
|
insilmaril@0
|
1545 |
// Delete tmpDir
|
insilmaril@0
|
1546 |
system ( "rm -rf "+ tmpMapDir );
|
insilmaril@0
|
1547 |
}
|
insilmaril@0
|
1548 |
|
insilmaril@0
|
1549 |
if (err==success)
|
insilmaril@0
|
1550 |
statusBar()->message(
|
insilmaril@0
|
1551 |
tr("Saved")+" " + currentMapEditor()->getFilePath(),
|
insilmaril@0
|
1552 |
statusbarTime );
|
insilmaril@0
|
1553 |
else
|
insilmaril@0
|
1554 |
statusBar()->message(
|
insilmaril@0
|
1555 |
tr("Couldn't save")+" " + currentMapEditor()->getFilePath(),
|
insilmaril@0
|
1556 |
statusbarTime );
|
insilmaril@0
|
1557 |
}
|
insilmaril@0
|
1558 |
|
insilmaril@0
|
1559 |
void Main::fileSave()
|
insilmaril@0
|
1560 |
{
|
insilmaril@0
|
1561 |
fileSave (CompleteMap);
|
insilmaril@0
|
1562 |
}
|
insilmaril@0
|
1563 |
|
insilmaril@0
|
1564 |
void Main::fileSaveAs(const SaveMode& savemode)
|
insilmaril@0
|
1565 |
{
|
insilmaril@0
|
1566 |
QString tmpMapDir;
|
insilmaril@0
|
1567 |
QString fn;
|
insilmaril@0
|
1568 |
|
insilmaril@0
|
1569 |
if (currentMapEditor())
|
insilmaril@0
|
1570 |
{
|
insilmaril@0
|
1571 |
if (savemode==CompleteMap)
|
insilmaril@0
|
1572 |
fn = QFileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
|
insilmaril@0
|
1573 |
else
|
insilmaril@0
|
1574 |
fn = QFileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
|
insilmaril@0
|
1575 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1576 |
{
|
insilmaril@0
|
1577 |
// Check for existing file
|
insilmaril@0
|
1578 |
if (QFile (fn).exists())
|
insilmaril@0
|
1579 |
{
|
insilmaril@0
|
1580 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1581 |
tr("The file ") + fn + tr ("\nexists already. Do you want to"),
|
insilmaril@0
|
1582 |
QMessageBox::Warning,
|
insilmaril@0
|
1583 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1584 |
QMessageBox::Cancel | QMessageBox::Escape,
|
insilmaril@0
|
1585 |
QMessageBox::QMessageBox::NoButton);
|
insilmaril@0
|
1586 |
mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
|
insilmaril@0
|
1587 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
1588 |
switch( mb.exec() )
|
insilmaril@0
|
1589 |
{
|
insilmaril@0
|
1590 |
case QMessageBox::Yes:
|
insilmaril@0
|
1591 |
// save
|
insilmaril@0
|
1592 |
break;
|
insilmaril@0
|
1593 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1594 |
// do nothing
|
insilmaril@0
|
1595 |
return;
|
insilmaril@0
|
1596 |
break;
|
insilmaril@0
|
1597 |
}
|
insilmaril@0
|
1598 |
} else
|
insilmaril@0
|
1599 |
{
|
insilmaril@0
|
1600 |
// New file, add extension to filename, if missing
|
insilmaril@0
|
1601 |
// This is always .vym or .vyp, depending on savemode
|
insilmaril@0
|
1602 |
if (savemode==CompleteMap)
|
insilmaril@0
|
1603 |
{
|
insilmaril@0
|
1604 |
if (!fn.contains (".vym") && !fn.contains (".xml"))
|
insilmaril@0
|
1605 |
fn +=".vym";
|
insilmaril@0
|
1606 |
} else
|
insilmaril@0
|
1607 |
{
|
insilmaril@0
|
1608 |
if (!fn.contains (".vyp") && !fn.contains (".xml"))
|
insilmaril@0
|
1609 |
fn +=".vyp";
|
insilmaril@0
|
1610 |
}
|
insilmaril@0
|
1611 |
}
|
insilmaril@0
|
1612 |
|
insilmaril@0
|
1613 |
|
insilmaril@0
|
1614 |
|
insilmaril@0
|
1615 |
|
insilmaril@0
|
1616 |
// Save now
|
insilmaril@0
|
1617 |
currentMapEditor()->setFilePath(fn);
|
insilmaril@0
|
1618 |
fileSave(savemode);
|
insilmaril@0
|
1619 |
|
insilmaril@0
|
1620 |
// Set name of tab
|
insilmaril@94
|
1621 |
if (savemode==CompleteMap)
|
insilmaril@94
|
1622 |
tabWidget->setTabLabel (currentMapEditor(),
|
insilmaril@94
|
1623 |
currentMapEditor()->getFileName() );
|
insilmaril@0
|
1624 |
return;
|
insilmaril@0
|
1625 |
}
|
insilmaril@0
|
1626 |
}
|
insilmaril@0
|
1627 |
}
|
insilmaril@0
|
1628 |
|
insilmaril@0
|
1629 |
void Main::fileSaveAs()
|
insilmaril@0
|
1630 |
{
|
insilmaril@0
|
1631 |
fileSaveAs (CompleteMap);
|
insilmaril@0
|
1632 |
}
|
insilmaril@0
|
1633 |
|
insilmaril@0
|
1634 |
void Main::fileImportDir()
|
insilmaril@0
|
1635 |
{
|
insilmaril@0
|
1636 |
if (currentMapEditor())
|
insilmaril@0
|
1637 |
currentMapEditor()->importDir();
|
insilmaril@0
|
1638 |
}
|
insilmaril@0
|
1639 |
|
insilmaril@0
|
1640 |
void Main::fileExportXML()
|
insilmaril@0
|
1641 |
{
|
insilmaril@0
|
1642 |
if (currentMapEditor())
|
insilmaril@0
|
1643 |
{
|
insilmaril@0
|
1644 |
QString dir=browseDirectory(tr("Export XML to directory"));
|
insilmaril@0
|
1645 |
if (dir !="" && reallyWriteDirectory(dir) )
|
insilmaril@0
|
1646 |
currentMapEditor()->exportXML(dir);
|
insilmaril@0
|
1647 |
}
|
insilmaril@0
|
1648 |
}
|
insilmaril@0
|
1649 |
|
insilmaril@0
|
1650 |
void Main::fileExportHTML()
|
insilmaril@0
|
1651 |
{
|
insilmaril@0
|
1652 |
if (currentMapEditor())
|
insilmaril@0
|
1653 |
{
|
insilmaril@0
|
1654 |
ExportHTMLDialog dia(this);
|
insilmaril@0
|
1655 |
|
insilmaril@0
|
1656 |
if (dia.exec()==QDialog::Accepted)
|
insilmaril@0
|
1657 |
{
|
insilmaril@0
|
1658 |
QString dir=dia.getDir();
|
insilmaril@0
|
1659 |
if (reallyWriteDirectory(dir) )
|
insilmaril@0
|
1660 |
{
|
insilmaril@0
|
1661 |
currentMapEditor()->exportXML (dia.getDir() );
|
insilmaril@0
|
1662 |
dia.doExport(currentMapEditor()->getMapName() );
|
insilmaril@0
|
1663 |
}
|
insilmaril@0
|
1664 |
}
|
insilmaril@0
|
1665 |
}
|
insilmaril@0
|
1666 |
}
|
insilmaril@0
|
1667 |
|
insilmaril@0
|
1668 |
void Main::fileExportXHTML()
|
insilmaril@0
|
1669 |
{
|
insilmaril@0
|
1670 |
QString dir;
|
insilmaril@0
|
1671 |
if (currentMapEditor())
|
insilmaril@0
|
1672 |
{
|
insilmaril@0
|
1673 |
ExportXHTMLDialog dia(this);
|
insilmaril@0
|
1674 |
dia.setFilePath (currentMapEditor()->getFilePath() );
|
insilmaril@0
|
1675 |
dia.setMapName (currentMapEditor()->getMapName() );
|
insilmaril@0
|
1676 |
dia.readSettings();
|
insilmaril@0
|
1677 |
|
insilmaril@0
|
1678 |
if (dia.exec()==QDialog::Accepted)
|
insilmaril@0
|
1679 |
{
|
insilmaril@0
|
1680 |
QString dir=dia.getDir();
|
insilmaril@0
|
1681 |
// Check, if warnings should be used before overwriting
|
insilmaril@0
|
1682 |
// the output directory
|
insilmaril@0
|
1683 |
bool ok;
|
insilmaril@0
|
1684 |
if (dia.warnings())
|
insilmaril@0
|
1685 |
ok=reallyWriteDirectory(dir);
|
insilmaril@0
|
1686 |
else
|
insilmaril@0
|
1687 |
ok=true;
|
insilmaril@0
|
1688 |
|
insilmaril@0
|
1689 |
if (ok)
|
insilmaril@0
|
1690 |
{
|
insilmaril@0
|
1691 |
currentMapEditor()->exportXML (dia.getDir() );
|
insilmaril@0
|
1692 |
dia.doExport(currentMapEditor()->getMapName() );
|
insilmaril@0
|
1693 |
if (dia.hasChanged())
|
insilmaril@0
|
1694 |
currentMapEditor()->setChanged();
|
insilmaril@0
|
1695 |
}
|
insilmaril@0
|
1696 |
}
|
insilmaril@0
|
1697 |
}
|
insilmaril@0
|
1698 |
}
|
insilmaril@0
|
1699 |
|
insilmaril@0
|
1700 |
void Main::fileExportImage(int item)
|
insilmaril@0
|
1701 |
{
|
insilmaril@0
|
1702 |
if (currentMapEditor())
|
insilmaril@0
|
1703 |
{
|
insilmaril@0
|
1704 |
QString fn = QFileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
|
insilmaril@0
|
1705 |
this );
|
insilmaril@0
|
1706 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1707 |
{
|
insilmaril@0
|
1708 |
currentMapEditor()->exportImage(fn,item);
|
insilmaril@0
|
1709 |
} else {
|
insilmaril@0
|
1710 |
statusBar()->message( tr("Couldn't save") + fn, statusbarTime );
|
insilmaril@0
|
1711 |
}
|
insilmaril@0
|
1712 |
}
|
insilmaril@0
|
1713 |
}
|
insilmaril@0
|
1714 |
|
insilmaril@0
|
1715 |
void Main::fileExportASCII()
|
insilmaril@0
|
1716 |
{
|
insilmaril@0
|
1717 |
if (currentMapEditor())
|
insilmaril@0
|
1718 |
currentMapEditor()->exportASCII();
|
insilmaril@0
|
1719 |
}
|
insilmaril@0
|
1720 |
|
insilmaril@0
|
1721 |
void Main::fileCloseMap()
|
insilmaril@0
|
1722 |
{
|
insilmaril@0
|
1723 |
if (currentMapEditor())
|
insilmaril@0
|
1724 |
{
|
insilmaril@0
|
1725 |
if (currentMapEditor()->hasChanged())
|
insilmaril@0
|
1726 |
{
|
insilmaril@0
|
1727 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1728 |
tr("The map ") + currentMapEditor()->getFileName() +
|
insilmaril@0
|
1729 |
tr(" has been modified but not saved yet. Do you want to"),
|
insilmaril@0
|
1730 |
QMessageBox::Warning,
|
insilmaril@0
|
1731 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1732 |
QMessageBox::No,
|
insilmaril@0
|
1733 |
QMessageBox::Cancel | QMessageBox::Escape );
|
insilmaril@0
|
1734 |
mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
|
insilmaril@0
|
1735 |
mb.setButtonText( QMessageBox::No, tr("Discard changes"));
|
insilmaril@0
|
1736 |
switch( mb.exec() )
|
insilmaril@0
|
1737 |
{
|
insilmaril@0
|
1738 |
case QMessageBox::Yes:
|
insilmaril@0
|
1739 |
// save and close
|
insilmaril@0
|
1740 |
fileSave(CompleteMap);
|
insilmaril@0
|
1741 |
break;
|
insilmaril@0
|
1742 |
case QMessageBox::No:
|
insilmaril@0
|
1743 |
// close without saving
|
insilmaril@0
|
1744 |
break;
|
insilmaril@0
|
1745 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1746 |
// do nothing
|
insilmaril@0
|
1747 |
return;
|
insilmaril@0
|
1748 |
}
|
insilmaril@0
|
1749 |
}
|
insilmaril@0
|
1750 |
currentMapEditor()->closeMap();
|
insilmaril@0
|
1751 |
tabWidget->removePage(currentMapEditor());
|
insilmaril@0
|
1752 |
if (tabWidget->count()==0)
|
insilmaril@0
|
1753 |
actionFilePrint->setEnabled (false);
|
insilmaril@0
|
1754 |
}
|
insilmaril@0
|
1755 |
}
|
insilmaril@0
|
1756 |
|
insilmaril@0
|
1757 |
void Main::filePrint()
|
insilmaril@0
|
1758 |
{
|
insilmaril@0
|
1759 |
if (currentMapEditor())
|
insilmaril@0
|
1760 |
currentMapEditor()->print();
|
insilmaril@0
|
1761 |
}
|
insilmaril@0
|
1762 |
|
insilmaril@0
|
1763 |
void Main::fileExitVYM()
|
insilmaril@0
|
1764 |
{
|
insilmaril@0
|
1765 |
// Check if one or more editors have changed
|
insilmaril@0
|
1766 |
MapEditor *me;
|
insilmaril@0
|
1767 |
int i;
|
insilmaril@0
|
1768 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
1769 |
{
|
insilmaril@0
|
1770 |
|
insilmaril@0
|
1771 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1772 |
|
insilmaril@0
|
1773 |
// If something changed, ask what to do
|
insilmaril@0
|
1774 |
if (me->isUnsaved())
|
insilmaril@0
|
1775 |
{
|
insilmaril@0
|
1776 |
tabWidget->setCurrentPage(i);
|
insilmaril@0
|
1777 |
QMessageBox mb( "VYM",
|
insilmaril@0
|
1778 |
tr("This map is not saved yet. Do you want to"),
|
insilmaril@0
|
1779 |
QMessageBox::Warning,
|
insilmaril@0
|
1780 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1781 |
QMessageBox::No,
|
insilmaril@0
|
1782 |
QMessageBox::Cancel | QMessageBox::Escape );
|
insilmaril@0
|
1783 |
mb.setButtonText( QMessageBox::Yes, tr("Save map") );
|
insilmaril@0
|
1784 |
mb.setButtonText( QMessageBox::No, tr("Discard changes") );
|
insilmaril@0
|
1785 |
mb.show();
|
insilmaril@0
|
1786 |
// Call undocumented function: setActiveWindow is only
|
insilmaril@0
|
1787 |
// possible, if widget is visible. This depends on
|
insilmaril@0
|
1788 |
// windowmanager...
|
insilmaril@0
|
1789 |
#if defined(Q_OS_LINUX)
|
insilmaril@0
|
1790 |
qt_wait_for_window_manager( this);
|
insilmaril@0
|
1791 |
#endif
|
insilmaril@0
|
1792 |
mb.setActiveWindow();
|
insilmaril@0
|
1793 |
switch( mb.exec() ) {
|
insilmaril@0
|
1794 |
case QMessageBox::Yes:
|
insilmaril@0
|
1795 |
// save (the changed editors) and exit
|
insilmaril@0
|
1796 |
fileSave(CompleteMap);
|
insilmaril@0
|
1797 |
break;
|
insilmaril@0
|
1798 |
case QMessageBox::No:
|
insilmaril@0
|
1799 |
// exit without saving
|
insilmaril@0
|
1800 |
break;
|
insilmaril@0
|
1801 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1802 |
// don't save and don't exit
|
insilmaril@0
|
1803 |
return;
|
insilmaril@0
|
1804 |
}
|
insilmaril@0
|
1805 |
}
|
insilmaril@0
|
1806 |
} // loop over all MEs
|
insilmaril@0
|
1807 |
qApp->quit();
|
insilmaril@0
|
1808 |
}
|
insilmaril@0
|
1809 |
|
insilmaril@0
|
1810 |
void Main::editUndo()
|
insilmaril@0
|
1811 |
{
|
insilmaril@0
|
1812 |
if (currentMapEditor())
|
insilmaril@0
|
1813 |
currentMapEditor()->undo();
|
insilmaril@0
|
1814 |
}
|
insilmaril@0
|
1815 |
|
insilmaril@0
|
1816 |
void Main::editRedo() // TODO
|
insilmaril@0
|
1817 |
{
|
insilmaril@0
|
1818 |
}
|
insilmaril@0
|
1819 |
|
insilmaril@0
|
1820 |
void Main::editCopy()
|
insilmaril@0
|
1821 |
{
|
insilmaril@0
|
1822 |
if (currentMapEditor())
|
insilmaril@0
|
1823 |
currentMapEditor()->copy();
|
insilmaril@0
|
1824 |
}
|
insilmaril@0
|
1825 |
|
insilmaril@0
|
1826 |
void Main::editPaste()
|
insilmaril@0
|
1827 |
{
|
insilmaril@0
|
1828 |
if (currentMapEditor())
|
insilmaril@0
|
1829 |
currentMapEditor()->paste();
|
insilmaril@0
|
1830 |
}
|
insilmaril@0
|
1831 |
|
insilmaril@0
|
1832 |
void Main::editCut()
|
insilmaril@0
|
1833 |
{
|
insilmaril@0
|
1834 |
if (currentMapEditor())
|
insilmaril@0
|
1835 |
currentMapEditor()->cut();
|
insilmaril@0
|
1836 |
}
|
insilmaril@0
|
1837 |
|
insilmaril@0
|
1838 |
void Main::editOpenFindWindow()
|
insilmaril@0
|
1839 |
{
|
insilmaril@0
|
1840 |
findWindow->popup();
|
insilmaril@0
|
1841 |
findWindow->raise();
|
insilmaril@0
|
1842 |
|
insilmaril@0
|
1843 |
// Call undocumented function: setActiveWindow is only
|
insilmaril@0
|
1844 |
// possible, if widget is visible. This depends on
|
insilmaril@0
|
1845 |
// windowmanager...
|
insilmaril@0
|
1846 |
#if defined(Q_OS_LINUX)
|
insilmaril@0
|
1847 |
qt_wait_for_window_manager( this);
|
insilmaril@0
|
1848 |
#endif
|
insilmaril@0
|
1849 |
findWindow->setActiveWindow();
|
insilmaril@0
|
1850 |
}
|
insilmaril@0
|
1851 |
|
insilmaril@0
|
1852 |
void Main::editFind(QString s)
|
insilmaril@0
|
1853 |
{
|
insilmaril@0
|
1854 |
bool cs=false;
|
insilmaril@0
|
1855 |
BranchObj *bo=currentMapEditor()->findText(s, cs);
|
insilmaril@0
|
1856 |
if (bo)
|
insilmaril@0
|
1857 |
{
|
insilmaril@0
|
1858 |
statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
|
insilmaril@0
|
1859 |
} else
|
insilmaril@0
|
1860 |
{
|
insilmaril@0
|
1861 |
QMessageBox::information( findWindow, tr( "VYM -Information:" ),
|
insilmaril@0
|
1862 |
tr("No matches found for ")+
|
insilmaril@129
|
1863 |
"<b>"+s+"</b>");
|
insilmaril@0
|
1864 |
}
|
insilmaril@0
|
1865 |
}
|
insilmaril@0
|
1866 |
|
insilmaril@0
|
1867 |
void Main::editFindChanged()
|
insilmaril@0
|
1868 |
{ // Notify editor, to abort the current find process
|
insilmaril@0
|
1869 |
currentMapEditor()->findReset();
|
insilmaril@0
|
1870 |
}
|
insilmaril@0
|
1871 |
|
insilmaril@0
|
1872 |
void Main::editOpenURL()
|
insilmaril@0
|
1873 |
{
|
insilmaril@0
|
1874 |
if (currentMapEditor())
|
insilmaril@0
|
1875 |
currentMapEditor()->openURL();
|
insilmaril@0
|
1876 |
}
|
insilmaril@0
|
1877 |
|
insilmaril@0
|
1878 |
void Main::editURL()
|
insilmaril@0
|
1879 |
{
|
insilmaril@0
|
1880 |
if (currentMapEditor())
|
insilmaril@0
|
1881 |
currentMapEditor()->editURL();
|
insilmaril@0
|
1882 |
}
|
insilmaril@0
|
1883 |
|
insilmaril@0
|
1884 |
void Main::editHeading2URL()
|
insilmaril@0
|
1885 |
{
|
insilmaril@0
|
1886 |
if (currentMapEditor())
|
insilmaril@0
|
1887 |
currentMapEditor()->editHeading2URL();
|
insilmaril@0
|
1888 |
}
|
insilmaril@0
|
1889 |
|
insilmaril@0
|
1890 |
void Main::editBugzilla2URL()
|
insilmaril@0
|
1891 |
{
|
insilmaril@0
|
1892 |
if (currentMapEditor())
|
insilmaril@0
|
1893 |
currentMapEditor()->editBugzilla2URL();
|
insilmaril@0
|
1894 |
}
|
insilmaril@0
|
1895 |
|
insilmaril@0
|
1896 |
void Main::editOpenVymLink()
|
insilmaril@0
|
1897 |
{
|
insilmaril@0
|
1898 |
// Get current path to map
|
insilmaril@0
|
1899 |
QString currentVymLink;
|
insilmaril@0
|
1900 |
if (currentMapEditor())
|
insilmaril@0
|
1901 |
{
|
insilmaril@0
|
1902 |
currentVymLink=currentMapEditor()->getVymLink();
|
insilmaril@0
|
1903 |
// compare path with already loaded maps
|
insilmaril@0
|
1904 |
int index=-1;
|
insilmaril@0
|
1905 |
int i;
|
insilmaril@0
|
1906 |
MapEditor *me;
|
insilmaril@0
|
1907 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
1908 |
{
|
insilmaril@0
|
1909 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1910 |
if (currentVymLink==me->getFilePath() )
|
insilmaril@0
|
1911 |
{
|
insilmaril@0
|
1912 |
index=i;
|
insilmaril@0
|
1913 |
break;
|
insilmaril@0
|
1914 |
}
|
insilmaril@0
|
1915 |
}
|
insilmaril@0
|
1916 |
if (index<0)
|
insilmaril@0
|
1917 |
// Load map
|
insilmaril@0
|
1918 |
{
|
insilmaril@0
|
1919 |
if (!QFile(currentVymLink).exists() )
|
insilmaril@0
|
1920 |
QMessageBox::critical( 0, tr( "Critical Error" ),
|
insilmaril@0
|
1921 |
tr("Couldn't open map " +currentVymLink)+".");
|
insilmaril@0
|
1922 |
else
|
insilmaril@0
|
1923 |
{
|
insilmaril@0
|
1924 |
fileLoad (currentVymLink, NewMap);
|
insilmaril@0
|
1925 |
tabWidget->setCurrentPage (tabWidget->count()-1);
|
insilmaril@0
|
1926 |
}
|
insilmaril@0
|
1927 |
} else
|
insilmaril@0
|
1928 |
// Go to tab containing the map
|
insilmaril@0
|
1929 |
tabWidget->setCurrentPage (index);
|
insilmaril@0
|
1930 |
}
|
insilmaril@0
|
1931 |
}
|
insilmaril@0
|
1932 |
|
insilmaril@0
|
1933 |
void Main::editVymLink()
|
insilmaril@0
|
1934 |
{
|
insilmaril@0
|
1935 |
if (currentMapEditor())
|
insilmaril@0
|
1936 |
currentMapEditor()->editVymLink();
|
insilmaril@0
|
1937 |
}
|
insilmaril@0
|
1938 |
|
insilmaril@0
|
1939 |
void Main::editDeleteVymLink()
|
insilmaril@0
|
1940 |
{
|
insilmaril@0
|
1941 |
if (currentMapEditor())
|
insilmaril@0
|
1942 |
currentMapEditor()->deleteVymLink();
|
insilmaril@0
|
1943 |
}
|
insilmaril@0
|
1944 |
|
insilmaril@0
|
1945 |
void Main::editMapInfo()
|
insilmaril@0
|
1946 |
{
|
insilmaril@0
|
1947 |
if (currentMapEditor())
|
insilmaril@0
|
1948 |
currentMapEditor()->editMapInfo();
|
insilmaril@0
|
1949 |
}
|
insilmaril@0
|
1950 |
|
insilmaril@0
|
1951 |
void Main::editMoveUp()
|
insilmaril@0
|
1952 |
{
|
insilmaril@0
|
1953 |
if (currentMapEditor())
|
insilmaril@0
|
1954 |
currentMapEditor()->moveBranchUp();
|
insilmaril@0
|
1955 |
}
|
insilmaril@0
|
1956 |
|
insilmaril@0
|
1957 |
void Main::editMoveDown()
|
insilmaril@0
|
1958 |
{
|
insilmaril@0
|
1959 |
if (currentMapEditor())
|
insilmaril@0
|
1960 |
currentMapEditor()->moveBranchDown();
|
insilmaril@0
|
1961 |
}
|
insilmaril@0
|
1962 |
|
insilmaril@0
|
1963 |
void Main::editToggleScroll()
|
insilmaril@0
|
1964 |
{
|
insilmaril@0
|
1965 |
if (currentMapEditor())
|
insilmaril@0
|
1966 |
{
|
insilmaril@0
|
1967 |
currentMapEditor()->toggleScroll();
|
insilmaril@0
|
1968 |
}
|
insilmaril@0
|
1969 |
}
|
insilmaril@0
|
1970 |
|
insilmaril@0
|
1971 |
void Main::editUnScrollAll()
|
insilmaril@0
|
1972 |
{
|
insilmaril@0
|
1973 |
if (currentMapEditor())
|
insilmaril@0
|
1974 |
{
|
insilmaril@0
|
1975 |
currentMapEditor()->unScrollAll();
|
insilmaril@0
|
1976 |
}
|
insilmaril@0
|
1977 |
}
|
insilmaril@0
|
1978 |
|
insilmaril@0
|
1979 |
void Main::editHeading()
|
insilmaril@0
|
1980 |
{
|
insilmaril@0
|
1981 |
if (currentMapEditor())
|
insilmaril@0
|
1982 |
currentMapEditor()->editHeading();
|
insilmaril@0
|
1983 |
}
|
insilmaril@0
|
1984 |
|
insilmaril@0
|
1985 |
void Main::editNewBranch()
|
insilmaril@0
|
1986 |
{
|
insilmaril@0
|
1987 |
if (currentMapEditor())
|
insilmaril@0
|
1988 |
currentMapEditor()->addNewBranch(0);
|
insilmaril@0
|
1989 |
}
|
insilmaril@0
|
1990 |
|
insilmaril@98
|
1991 |
void Main::editNewBranchHere()
|
insilmaril@98
|
1992 |
{
|
insilmaril@98
|
1993 |
if (currentMapEditor())
|
insilmaril@98
|
1994 |
currentMapEditor()->addNewBranchHere();
|
insilmaril@98
|
1995 |
}
|
insilmaril@98
|
1996 |
|
insilmaril@0
|
1997 |
void Main::editNewBranchAbove()
|
insilmaril@0
|
1998 |
{
|
insilmaril@0
|
1999 |
if (currentMapEditor())
|
insilmaril@0
|
2000 |
currentMapEditor()->addNewBranch(-1);
|
insilmaril@0
|
2001 |
}
|
insilmaril@0
|
2002 |
|
insilmaril@0
|
2003 |
void Main::editNewBranchBelow()
|
insilmaril@0
|
2004 |
{
|
insilmaril@0
|
2005 |
if (currentMapEditor())
|
insilmaril@0
|
2006 |
currentMapEditor()->addNewBranch(1);
|
insilmaril@0
|
2007 |
}
|
insilmaril@0
|
2008 |
|
insilmaril@0
|
2009 |
void Main::editImportAdd()
|
insilmaril@0
|
2010 |
{
|
insilmaril@0
|
2011 |
fileLoad (ImportAdd);
|
insilmaril@0
|
2012 |
}
|
insilmaril@0
|
2013 |
|
insilmaril@0
|
2014 |
void Main::editImportReplace()
|
insilmaril@0
|
2015 |
{
|
insilmaril@0
|
2016 |
fileLoad (ImportReplace);
|
insilmaril@0
|
2017 |
}
|
insilmaril@0
|
2018 |
|
insilmaril@0
|
2019 |
void Main::editSaveBranch()
|
insilmaril@0
|
2020 |
{
|
insilmaril@0
|
2021 |
fileSaveAs (PartOfMap);
|
insilmaril@0
|
2022 |
}
|
insilmaril@0
|
2023 |
|
insilmaril@98
|
2024 |
void Main::editRemoveBranchHere()
|
insilmaril@98
|
2025 |
{
|
insilmaril@98
|
2026 |
if (currentMapEditor())
|
insilmaril@98
|
2027 |
currentMapEditor()->removeBranchHere();
|
insilmaril@98
|
2028 |
}
|
insilmaril@98
|
2029 |
|
insilmaril@98
|
2030 |
void Main::editRemoveChilds()
|
insilmaril@98
|
2031 |
{
|
insilmaril@98
|
2032 |
if (currentMapEditor())
|
insilmaril@98
|
2033 |
currentMapEditor()->removeChilds();
|
insilmaril@98
|
2034 |
}
|
insilmaril@98
|
2035 |
|
insilmaril@0
|
2036 |
void Main::editDeleteSelection()
|
insilmaril@0
|
2037 |
{
|
insilmaril@0
|
2038 |
if (currentMapEditor())
|
insilmaril@0
|
2039 |
currentMapEditor()->deleteSelection();
|
insilmaril@0
|
2040 |
}
|
insilmaril@0
|
2041 |
|
insilmaril@0
|
2042 |
void Main::editUpperBranch()
|
insilmaril@0
|
2043 |
{
|
insilmaril@0
|
2044 |
if (currentMapEditor())
|
insilmaril@0
|
2045 |
currentMapEditor()->selectUpperBranch();
|
insilmaril@0
|
2046 |
}
|
insilmaril@0
|
2047 |
|
insilmaril@0
|
2048 |
void Main::editLowerBranch()
|
insilmaril@0
|
2049 |
{
|
insilmaril@0
|
2050 |
if (currentMapEditor())
|
insilmaril@0
|
2051 |
currentMapEditor()->selectLowerBranch();
|
insilmaril@0
|
2052 |
}
|
insilmaril@0
|
2053 |
|
insilmaril@0
|
2054 |
void Main::editLeftBranch()
|
insilmaril@0
|
2055 |
{
|
insilmaril@0
|
2056 |
if (currentMapEditor())
|
insilmaril@0
|
2057 |
currentMapEditor()->selectLeftBranch();
|
insilmaril@0
|
2058 |
}
|
insilmaril@0
|
2059 |
|
insilmaril@0
|
2060 |
void Main::editRightBranch()
|
insilmaril@0
|
2061 |
{
|
insilmaril@0
|
2062 |
if (currentMapEditor())
|
insilmaril@0
|
2063 |
currentMapEditor()->selectRightBranch();
|
insilmaril@0
|
2064 |
}
|
insilmaril@0
|
2065 |
|
insilmaril@0
|
2066 |
void Main::editFirstBranch()
|
insilmaril@0
|
2067 |
{
|
insilmaril@0
|
2068 |
if (currentMapEditor())
|
insilmaril@0
|
2069 |
currentMapEditor()->selectFirstBranch();
|
insilmaril@0
|
2070 |
}
|
insilmaril@0
|
2071 |
|
insilmaril@0
|
2072 |
void Main::editLastBranch()
|
insilmaril@0
|
2073 |
{
|
insilmaril@0
|
2074 |
if (currentMapEditor())
|
insilmaril@0
|
2075 |
currentMapEditor()->selectLastBranch();
|
insilmaril@0
|
2076 |
}
|
insilmaril@0
|
2077 |
|
insilmaril@0
|
2078 |
void Main::editLoadImage()
|
insilmaril@0
|
2079 |
{
|
insilmaril@0
|
2080 |
if (currentMapEditor())
|
insilmaril@0
|
2081 |
currentMapEditor()->loadFloatImage();
|
insilmaril@0
|
2082 |
}
|
insilmaril@0
|
2083 |
|
insilmaril@0
|
2084 |
void Main::editSaveImage(int item)
|
insilmaril@0
|
2085 |
{
|
insilmaril@0
|
2086 |
if (currentMapEditor())
|
insilmaril@0
|
2087 |
currentMapEditor()->saveFloatImage(item);
|
insilmaril@0
|
2088 |
}
|
insilmaril@0
|
2089 |
|
insilmaril@0
|
2090 |
void Main::editToggleFloatExport()
|
insilmaril@0
|
2091 |
{
|
insilmaril@0
|
2092 |
if (currentMapEditor())
|
insilmaril@0
|
2093 |
currentMapEditor()->toggleFloatExport();
|
insilmaril@0
|
2094 |
}
|
insilmaril@0
|
2095 |
|
insilmaril@95
|
2096 |
void Main::editFollowXLink(int item)
|
insilmaril@89
|
2097 |
{
|
insilmaril@89
|
2098 |
if (currentMapEditor())
|
insilmaril@95
|
2099 |
currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
|
insilmaril@89
|
2100 |
}
|
insilmaril@89
|
2101 |
|
insilmaril@95
|
2102 |
void Main::editEditXLink(int item)
|
insilmaril@94
|
2103 |
{
|
insilmaril@94
|
2104 |
if (currentMapEditor())
|
insilmaril@95
|
2105 |
currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
|
insilmaril@94
|
2106 |
}
|
insilmaril@94
|
2107 |
|
insilmaril@0
|
2108 |
void Main::formatSelectColor()
|
insilmaril@0
|
2109 |
{
|
insilmaril@0
|
2110 |
if (currentMapEditor())
|
insilmaril@0
|
2111 |
{
|
insilmaril@0
|
2112 |
QColor col = QColorDialog::getColor( currentMapEditor()->color(), this );
|
insilmaril@0
|
2113 |
if ( !col.isValid() ) return;
|
insilmaril@0
|
2114 |
currentMapEditor()->setColor( col );
|
insilmaril@0
|
2115 |
colorChanged( col );
|
insilmaril@0
|
2116 |
}
|
insilmaril@0
|
2117 |
}
|
insilmaril@0
|
2118 |
|
insilmaril@0
|
2119 |
void Main::formatPickColor()
|
insilmaril@0
|
2120 |
{
|
insilmaril@0
|
2121 |
if (currentMapEditor())
|
insilmaril@0
|
2122 |
colorChanged( currentMapEditor()->pickColor() );
|
insilmaril@0
|
2123 |
}
|
insilmaril@0
|
2124 |
|
insilmaril@0
|
2125 |
void Main::colorChanged(QColor c)
|
insilmaril@0
|
2126 |
{
|
insilmaril@0
|
2127 |
QPixmap pix( 16, 16 );
|
insilmaril@0
|
2128 |
pix.fill( c );
|
insilmaril@0
|
2129 |
actionFormatColor->setIconSet( pix );
|
insilmaril@0
|
2130 |
}
|
insilmaril@0
|
2131 |
|
insilmaril@0
|
2132 |
void Main::formatColorItem()
|
insilmaril@0
|
2133 |
{
|
insilmaril@0
|
2134 |
if (currentMapEditor())
|
insilmaril@0
|
2135 |
currentMapEditor()->colorItem();
|
insilmaril@0
|
2136 |
}
|
insilmaril@0
|
2137 |
|
insilmaril@0
|
2138 |
void Main::formatColorBranch()
|
insilmaril@0
|
2139 |
{
|
insilmaril@0
|
2140 |
if (currentMapEditor())
|
insilmaril@0
|
2141 |
currentMapEditor()->colorBranch();
|
insilmaril@0
|
2142 |
}
|
insilmaril@0
|
2143 |
|
insilmaril@0
|
2144 |
void Main::formatLinkStyleLine()
|
insilmaril@0
|
2145 |
{
|
insilmaril@0
|
2146 |
if (currentMapEditor())
|
insilmaril@0
|
2147 |
currentMapEditor()->setLinkStyle(StyleLine);
|
insilmaril@0
|
2148 |
}
|
insilmaril@0
|
2149 |
|
insilmaril@0
|
2150 |
void Main::formatLinkStyleParabel()
|
insilmaril@0
|
2151 |
{
|
insilmaril@0
|
2152 |
if (currentMapEditor())
|
insilmaril@0
|
2153 |
currentMapEditor()->setLinkStyle(StyleParabel);
|
insilmaril@0
|
2154 |
}
|
insilmaril@0
|
2155 |
|
insilmaril@0
|
2156 |
void Main::formatLinkStylePolyLine()
|
insilmaril@0
|
2157 |
{
|
insilmaril@0
|
2158 |
if (currentMapEditor())
|
insilmaril@0
|
2159 |
currentMapEditor()->setLinkStyle(StylePolyLine);
|
insilmaril@0
|
2160 |
}
|
insilmaril@0
|
2161 |
|
insilmaril@0
|
2162 |
void Main::formatLinkStylePolyParabel()
|
insilmaril@0
|
2163 |
{
|
insilmaril@0
|
2164 |
if (currentMapEditor())
|
insilmaril@0
|
2165 |
currentMapEditor()->setLinkStyle(StylePolyParabel);
|
insilmaril@0
|
2166 |
}
|
insilmaril@0
|
2167 |
|
insilmaril@0
|
2168 |
void Main::formatSelectBackColor()
|
insilmaril@0
|
2169 |
{
|
insilmaril@0
|
2170 |
if (currentMapEditor())
|
insilmaril@0
|
2171 |
currentMapEditor()->selectBackgroundColor();
|
insilmaril@0
|
2172 |
}
|
insilmaril@0
|
2173 |
|
insilmaril@0
|
2174 |
void Main::formatSelectLinkColor()
|
insilmaril@0
|
2175 |
{
|
insilmaril@0
|
2176 |
if (currentMapEditor())
|
insilmaril@0
|
2177 |
currentMapEditor()->selectLinkColor();
|
insilmaril@0
|
2178 |
}
|
insilmaril@0
|
2179 |
|
insilmaril@0
|
2180 |
void Main::formatToggleLinkColorHint()
|
insilmaril@0
|
2181 |
{
|
insilmaril@0
|
2182 |
currentMapEditor()->toggleLinkColorHint();
|
insilmaril@0
|
2183 |
}
|
insilmaril@0
|
2184 |
|
insilmaril@0
|
2185 |
void Main::formatFrameNone()
|
insilmaril@0
|
2186 |
{
|
insilmaril@0
|
2187 |
if (currentMapEditor())
|
insilmaril@0
|
2188 |
currentMapEditor()->setFrame(NoFrame);
|
insilmaril@0
|
2189 |
}
|
insilmaril@0
|
2190 |
|
insilmaril@0
|
2191 |
void Main::formatFrameRectangle()
|
insilmaril@0
|
2192 |
{
|
insilmaril@0
|
2193 |
if (currentMapEditor())
|
insilmaril@0
|
2194 |
currentMapEditor()->setFrame(Rectangle);
|
insilmaril@0
|
2195 |
}
|
insilmaril@0
|
2196 |
|
insilmaril@0
|
2197 |
void Main::viewZoomReset()
|
insilmaril@0
|
2198 |
{
|
insilmaril@0
|
2199 |
if (currentMapEditor())
|
insilmaril@0
|
2200 |
{
|
insilmaril@0
|
2201 |
QWMatrix m;
|
insilmaril@0
|
2202 |
m.reset();
|
insilmaril@0
|
2203 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
2204 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
2205 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
2206 |
}
|
insilmaril@0
|
2207 |
}
|
insilmaril@0
|
2208 |
|
insilmaril@0
|
2209 |
void Main::viewZoomIn()
|
insilmaril@0
|
2210 |
{
|
insilmaril@0
|
2211 |
if (currentMapEditor())
|
insilmaril@0
|
2212 |
{
|
insilmaril@0
|
2213 |
QWMatrix m = currentMapEditor()->worldMatrix();
|
insilmaril@0
|
2214 |
m.scale( 1.25, 1.25 );
|
insilmaril@0
|
2215 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
2216 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
2217 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
2218 |
}
|
insilmaril@0
|
2219 |
}
|
insilmaril@0
|
2220 |
|
insilmaril@0
|
2221 |
void Main::viewZoomOut()
|
insilmaril@0
|
2222 |
{
|
insilmaril@0
|
2223 |
if (currentMapEditor())
|
insilmaril@0
|
2224 |
{
|
insilmaril@0
|
2225 |
QWMatrix m = currentMapEditor()->worldMatrix();
|
insilmaril@0
|
2226 |
m.scale( 0.8, 0.8 );
|
insilmaril@0
|
2227 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
2228 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
2229 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
2230 |
}
|
insilmaril@0
|
2231 |
}
|
insilmaril@89
|
2232 |
|
insilmaril@89
|
2233 |
void Main::modModeColor()
|
insilmaril@89
|
2234 |
{
|
insilmaril@89
|
2235 |
}
|
insilmaril@89
|
2236 |
|
insilmaril@89
|
2237 |
void Main::modModeLink()
|
insilmaril@89
|
2238 |
{
|
insilmaril@89
|
2239 |
}
|
insilmaril@89
|
2240 |
|
insilmaril@0
|
2241 |
bool Main::settingsPDF()
|
insilmaril@0
|
2242 |
{
|
insilmaril@0
|
2243 |
// Default browser is set in constructor
|
insilmaril@0
|
2244 |
bool ok;
|
insilmaril@0
|
2245 |
QString text = QInputDialog::getText(
|
insilmaril@0
|
2246 |
"VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
|
insilmaril@0
|
2247 |
settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
|
insilmaril@0
|
2248 |
if (ok)
|
insilmaril@0
|
2249 |
settings.writeEntry ("/vym/mainwindow/readerPDF",text);
|
insilmaril@0
|
2250 |
return ok;
|
insilmaril@0
|
2251 |
}
|
insilmaril@0
|
2252 |
|
insilmaril@0
|
2253 |
|
insilmaril@0
|
2254 |
bool Main::settingsURL()
|
insilmaril@0
|
2255 |
{
|
insilmaril@0
|
2256 |
// Default browser is set in constructor
|
insilmaril@0
|
2257 |
bool ok;
|
insilmaril@0
|
2258 |
QString text = QInputDialog::getText(
|
insilmaril@0
|
2259 |
"VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
|
insilmaril@0
|
2260 |
settings.readEntry("/vym/mainwindow/readerURL")
|
insilmaril@0
|
2261 |
, &ok, this );
|
insilmaril@0
|
2262 |
if (ok)
|
insilmaril@0
|
2263 |
settings.writeEntry ("/vym/mainwindow/readerURL",text);
|
insilmaril@0
|
2264 |
return ok;
|
insilmaril@0
|
2265 |
}
|
insilmaril@0
|
2266 |
|
insilmaril@0
|
2267 |
void Main::windowToggleNoteEditor()
|
insilmaril@0
|
2268 |
{
|
insilmaril@0
|
2269 |
if (textEditor->showWithMain() )
|
insilmaril@0
|
2270 |
windowHideNoteEditor();
|
insilmaril@0
|
2271 |
else
|
insilmaril@0
|
2272 |
windowShowNoteEditor();
|
insilmaril@0
|
2273 |
}
|
insilmaril@0
|
2274 |
|
insilmaril@0
|
2275 |
void Main::windowShowNoteEditor()
|
insilmaril@0
|
2276 |
{
|
insilmaril@0
|
2277 |
textEditor->setShowWithMain(true);
|
insilmaril@0
|
2278 |
textEditor->show();
|
insilmaril@0
|
2279 |
actionViewToggleNoteEditor->setOn (true);
|
insilmaril@0
|
2280 |
}
|
insilmaril@0
|
2281 |
|
insilmaril@0
|
2282 |
void Main::windowHideNoteEditor()
|
insilmaril@0
|
2283 |
{
|
insilmaril@0
|
2284 |
textEditor->setShowWithMain(false);
|
insilmaril@0
|
2285 |
textEditor->hide();
|
insilmaril@0
|
2286 |
actionViewToggleNoteEditor->setOn (false);
|
insilmaril@0
|
2287 |
}
|
insilmaril@0
|
2288 |
|
insilmaril@0
|
2289 |
void Main::windowNextEditor()
|
insilmaril@0
|
2290 |
{
|
insilmaril@0
|
2291 |
if (tabWidget->currentPageIndex() < tabWidget->count())
|
insilmaril@0
|
2292 |
tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
|
insilmaril@0
|
2293 |
}
|
insilmaril@0
|
2294 |
|
insilmaril@0
|
2295 |
void Main::windowPreviousEditor()
|
insilmaril@0
|
2296 |
{
|
insilmaril@0
|
2297 |
if (tabWidget->currentPageIndex() >0)
|
insilmaril@0
|
2298 |
tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
|
insilmaril@0
|
2299 |
}
|
insilmaril@0
|
2300 |
|
insilmaril@0
|
2301 |
void Main::standardFlagChanged()
|
insilmaril@0
|
2302 |
{
|
insilmaril@0
|
2303 |
currentMapEditor()->toggleStandardFlag(sender()->name());
|
insilmaril@0
|
2304 |
}
|
insilmaril@0
|
2305 |
|
insilmaril@0
|
2306 |
void Main::testFunction()
|
insilmaril@0
|
2307 |
{
|
insilmaril@0
|
2308 |
//textEditor->stackUnder(this);
|
insilmaril@0
|
2309 |
currentMapEditor()->testFunction();
|
insilmaril@0
|
2310 |
}
|
insilmaril@0
|
2311 |
|
insilmaril@0
|
2312 |
void Main::testShowClipboard()
|
insilmaril@0
|
2313 |
{
|
insilmaril@0
|
2314 |
clipboardME->show();
|
insilmaril@0
|
2315 |
}
|
insilmaril@0
|
2316 |
|
insilmaril@0
|
2317 |
void Main::helpDoc()
|
insilmaril@0
|
2318 |
{
|
insilmaril@0
|
2319 |
QString docpath;
|
insilmaril@103
|
2320 |
#if defined(Q_OS_MACX)
|
insilmaril@103
|
2321 |
docpath="./vym.app/Contents/vym.pdf";
|
insilmaril@103
|
2322 |
#else
|
insilmaril@103
|
2323 |
// default path in SUSE LINUX
|
insilmaril@103
|
2324 |
docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
|
insilmaril@103
|
2325 |
#endif
|
insilmaril@0
|
2326 |
|
insilmaril@0
|
2327 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
2328 |
{
|
insilmaril@0
|
2329 |
// relative path for easy testing in tarball
|
insilmaril@0
|
2330 |
docpath="doc/vym.pdf";
|
insilmaril@0
|
2331 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
2332 |
{
|
insilmaril@0
|
2333 |
// relative path for testing while still writing vym.tex
|
insilmaril@0
|
2334 |
docpath="doc/tex/vym.pdf";
|
insilmaril@0
|
2335 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
2336 |
{
|
insilmaril@0
|
2337 |
QMessageBox::critical(0,
|
insilmaril@0
|
2338 |
tr("Critcal error"),
|
insilmaril@0
|
2339 |
tr("Couldn't find the documentation\n"
|
insilmaril@0
|
2340 |
"vym.pdf in various places."));
|
insilmaril@0
|
2341 |
return;
|
insilmaril@0
|
2342 |
}
|
insilmaril@0
|
2343 |
}
|
insilmaril@0
|
2344 |
}
|
insilmaril@0
|
2345 |
|
insilmaril@0
|
2346 |
Process *pdfProc = new Process();
|
insilmaril@0
|
2347 |
pdfProc->clearArguments();
|
insilmaril@0
|
2348 |
pdfProc->addArgument( settings.readEntry("/vym/mainwindow/readerPDF"));
|
insilmaril@0
|
2349 |
pdfProc->addArgument( docpath);
|
insilmaril@0
|
2350 |
|
insilmaril@0
|
2351 |
if ( !pdfProc->start() )
|
insilmaril@0
|
2352 |
{
|
insilmaril@0
|
2353 |
// error handling
|
insilmaril@0
|
2354 |
QMessageBox::critical(0,
|
insilmaril@0
|
2355 |
tr("Critcal error"),
|
insilmaril@0
|
2356 |
tr("Couldn't find a viewer to read vym.pdf.\n"
|
insilmaril@0
|
2357 |
"Please use Settings->")+tr("Set application to open pdf files"));
|
insilmaril@0
|
2358 |
return;
|
insilmaril@0
|
2359 |
}
|
insilmaril@0
|
2360 |
}
|
insilmaril@0
|
2361 |
|
insilmaril@0
|
2362 |
|
insilmaril@0
|
2363 |
void Main::helpAbout()
|
insilmaril@0
|
2364 |
{
|
insilmaril@0
|
2365 |
static QMessageBox* about = new QMessageBox( "VYM",
|
insilmaril@0
|
2366 |
"<h3>VYM - View Your Mind </h3>"
|
insilmaril@0
|
2367 |
"<p> A tool to put the things you have got in your mind into a map.</p>"
|
insilmaril@0
|
2368 |
"<ul>"
|
insilmaril@0
|
2369 |
"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
|
insilmaril@0
|
2370 |
"<li> vym is released under the GPL (Gnu General Public License)"
|
insilmaril@0
|
2371 |
", with one exception (see the file \"LICENSE\"which "
|
insilmaril@0
|
2372 |
"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
|
insilmaril@0
|
2373 |
"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
|
insilmaril@0
|
2374 |
"http:/www.InSilmaril.de/vym</a></li>"
|
insilmaril@0
|
2375 |
"<li> Credits "
|
insilmaril@0
|
2376 |
"<ul>"
|
insilmaril@125
|
2377 |
"<li>Jakob Hilmer for image drag and drop patch </li>"
|
insilmaril@0
|
2378 |
"<li>Thomas Schraitle for the stylesheet used for XHTML-export </li>"
|
insilmaril@0
|
2379 |
"<li>Clemens Kraus for stylesheets and script used for HTML-export "
|
insilmaril@0
|
2380 |
"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
|
insilmaril@0
|
2381 |
"<li>Alexander Johannesen for providing stylesheets from his xsiteable project "
|
insilmaril@0
|
2382 |
"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
|
insilmaril@0
|
2383 |
"<li>Ken Wimer and Olaf Hering for Mac support</li>"
|
insilmaril@0
|
2384 |
"</ul>"
|
insilmaril@0
|
2385 |
"</li>"
|
insilmaril@0
|
2386 |
"<li> Version " __VYM_VERSION__ "</li>"
|
insilmaril@0
|
2387 |
"<li> Build date " __BUILD_DATE__"</li>"
|
insilmaril@0
|
2388 |
"</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
|
insilmaril@0
|
2389 |
about->setButtonText( 1, "Dismiss" );
|
insilmaril@0
|
2390 |
about->setMinimumSize(QSize(300,300));
|
insilmaril@0
|
2391 |
about->setIconPixmap (QPixmap(vym_logo_xpm));
|
insilmaril@0
|
2392 |
about->show();
|
insilmaril@0
|
2393 |
}
|
insilmaril@0
|
2394 |
|
insilmaril@0
|
2395 |
void Main::helpAboutQT()
|
insilmaril@0
|
2396 |
{
|
insilmaril@0
|
2397 |
QMessageBox::aboutQt( this, "Qt Application Example" );
|
insilmaril@0
|
2398 |
}
|
insilmaril@0
|
2399 |
|