insilmaril@0
|
1 |
#include "mainwindow.h"
|
insilmaril@0
|
2 |
|
insilmaril@366
|
3 |
#include <QtGui>
|
insilmaril@390
|
4 |
|
insilmaril@366
|
5 |
#include <q3filedialog.h>
|
insilmaril@366
|
6 |
#include <Q3StrList>
|
insilmaril@366
|
7 |
#include <Q3PtrList>
|
insilmaril@0
|
8 |
|
insilmaril@0
|
9 |
#include <iostream>
|
insilmaril@95
|
10 |
#include <cstdlib>
|
insilmaril@0
|
11 |
#include <typeinfo>
|
insilmaril@0
|
12 |
|
insilmaril@205
|
13 |
#include "aboutdialog.h"
|
insilmaril@205
|
14 |
#include "exportoofiledialog.h"
|
insilmaril@228
|
15 |
#include "exports.h"
|
insilmaril@205
|
16 |
#include "exportxhtmldialog.h"
|
insilmaril@205
|
17 |
#include "file.h"
|
insilmaril@0
|
18 |
#include "flagrowobj.h"
|
insilmaril@377
|
19 |
#include "historywindow.h"
|
insilmaril@205
|
20 |
#include "imports.h"
|
insilmaril@0
|
21 |
#include "mapeditor.h"
|
insilmaril@205
|
22 |
#include "misc.h"
|
insilmaril@205
|
23 |
#include "options.h"
|
insilmaril@0
|
24 |
#include "process.h"
|
insilmaril@0
|
25 |
#include "settings.h"
|
insilmaril@205
|
26 |
#include "texteditor.h"
|
insilmaril@205
|
27 |
#include "version.h"
|
insilmaril@0
|
28 |
|
insilmaril@0
|
29 |
extern TextEditor *textEditor;
|
insilmaril@0
|
30 |
extern Main *mainWindow;
|
insilmaril@164
|
31 |
extern QString tmpVymDir;
|
insilmaril@166
|
32 |
extern QString clipboardDir;
|
insilmaril@166
|
33 |
extern bool clipboardEmpty;
|
insilmaril@0
|
34 |
extern int statusbarTime;
|
insilmaril@0
|
35 |
extern FlagRowObj* standardFlagsDefault;
|
insilmaril@166
|
36 |
extern FlagRowObj* systemFlagsDefault;
|
insilmaril@0
|
37 |
|
insilmaril@390
|
38 |
QMenu* branchContextMenu;
|
insilmaril@390
|
39 |
QMenu* branchAddContextMenu;
|
insilmaril@390
|
40 |
QMenu* branchRemoveContextMenu;
|
insilmaril@390
|
41 |
QMenu* branchLinksContextMenu;
|
insilmaril@390
|
42 |
QMenu* branchXLinksContextMenuEdit;
|
insilmaril@390
|
43 |
QMenu* branchXLinksContextMenuFollow;
|
insilmaril@390
|
44 |
QMenu* floatimageContextMenu;
|
insilmaril@390
|
45 |
QMenu* canvasContextMenu;
|
insilmaril@390
|
46 |
QMenu* fileLastMapsMenu;
|
insilmaril@390
|
47 |
QMenu* fileImportMenu;
|
insilmaril@390
|
48 |
QMenu* fileExportMenu;
|
insilmaril@0
|
49 |
|
insilmaril@0
|
50 |
|
insilmaril@0
|
51 |
extern Settings settings;
|
insilmaril@0
|
52 |
extern Options options;
|
insilmaril@366
|
53 |
extern ImageIO imageIO;
|
insilmaril@366
|
54 |
|
insilmaril@269
|
55 |
extern QDir vymBaseDir;
|
insilmaril@366
|
56 |
extern QDir lastImageDir;
|
insilmaril@366
|
57 |
extern QDir lastFileDir;
|
insilmaril@269
|
58 |
extern QString iconPath;
|
insilmaril@269
|
59 |
extern QString flagsPath;
|
insilmaril@0
|
60 |
|
insilmaril@366
|
61 |
Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
|
insilmaril@0
|
62 |
QMainWindow(parent,name,f)
|
insilmaril@0
|
63 |
{
|
insilmaril@0
|
64 |
mainWindow=this;
|
insilmaril@0
|
65 |
|
insilmaril@0
|
66 |
setCaption ("VYM - View Your Mind");
|
insilmaril@0
|
67 |
|
insilmaril@0
|
68 |
// Load window settings
|
insilmaril@366
|
69 |
resize (settings.value( "/mainwindow/geometry/size",QSize (800,600)).toSize());
|
insilmaril@366
|
70 |
move (settings.value( "/mainwindow/geometry/pos", QPoint(300,100)).toPoint());
|
insilmaril@0
|
71 |
|
insilmaril@0
|
72 |
|
insilmaril@164
|
73 |
// Create unique temporary directory
|
insilmaril@366
|
74 |
bool ok;
|
insilmaril@366
|
75 |
tmpVymDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
|
insilmaril@366
|
76 |
if (!ok)
|
insilmaril@366
|
77 |
{
|
insilmaril@366
|
78 |
qWarning ("Mainwindow: Could not create temporary directory, failed to start vym");
|
insilmaril@366
|
79 |
exit (1);
|
insilmaril@366
|
80 |
}
|
insilmaril@164
|
81 |
|
insilmaril@166
|
82 |
// Create direcctory for clipboard
|
insilmaril@166
|
83 |
clipboardDir=tmpVymDir+"/clipboard";
|
insilmaril@166
|
84 |
QDir d(clipboardDir);
|
insilmaril@166
|
85 |
d.mkdir (clipboardDir,true);
|
insilmaril@166
|
86 |
makeSubDirs (clipboardDir);
|
insilmaril@166
|
87 |
clipboardEmpty=true;
|
insilmaril@164
|
88 |
|
insilmaril@266
|
89 |
procBrowser=NULL;
|
insilmaril@266
|
90 |
|
insilmaril@166
|
91 |
// FIXME not used currently
|
insilmaril@93
|
92 |
// Set random seed (random used for object IDs)
|
insilmaril@166
|
93 |
// QTime t = QTime::currentTime(); // set random seed
|
insilmaril@166
|
94 |
// srand( t.hour()*12+t.minute()*60+t.second()*60 );
|
insilmaril@93
|
95 |
|
insilmaril@93
|
96 |
|
insilmaril@0
|
97 |
// Initialize some settings, which are platform dependant
|
insilmaril@0
|
98 |
QString p,s;
|
insilmaril@0
|
99 |
|
insilmaril@0
|
100 |
// application to open URLs
|
insilmaril@366
|
101 |
p="/mainwindow/readerURL";
|
insilmaril@0
|
102 |
#if defined(Q_OS_LINUX)
|
insilmaril@366
|
103 |
s=settings.value (p,"konqueror").toString();
|
insilmaril@0
|
104 |
#else
|
insilmaril@0
|
105 |
#if defined(Q_OS_MACX)
|
insilmaril@366
|
106 |
s=settings.value (p,"/usr/bin/open").toString();
|
insilmaril@0
|
107 |
#else
|
insilmaril@366
|
108 |
s=settings.value (p,"mozilla");
|
insilmaril@0
|
109 |
#endif
|
insilmaril@0
|
110 |
#endif
|
insilmaril@366
|
111 |
settings.setValue( p,s);
|
insilmaril@0
|
112 |
|
insilmaril@0
|
113 |
// application to open PDFs
|
insilmaril@366
|
114 |
p="/mainwindow/readerPDF";
|
insilmaril@0
|
115 |
#if defined(Q_OS_LINUX)
|
insilmaril@366
|
116 |
s=settings.value (p,"acroread").toString();
|
insilmaril@0
|
117 |
#else
|
insilmaril@0
|
118 |
#if defined(Q_OS_MACX)
|
insilmaril@366
|
119 |
s=settings.value (p,"/usr/bin/open").toString();
|
insilmaril@0
|
120 |
#else
|
insilmaril@366
|
121 |
s=settings.value (p,"acroread").toString();
|
insilmaril@0
|
122 |
#endif
|
insilmaril@0
|
123 |
#endif
|
insilmaril@366
|
124 |
settings.setValue( p,s);
|
insilmaril@0
|
125 |
|
insilmaril@0
|
126 |
|
insilmaril@0
|
127 |
maxLastMaps=9;
|
insilmaril@0
|
128 |
|
insilmaril@0
|
129 |
// Create tab widget which holds the maps
|
insilmaril@0
|
130 |
tabWidget= new QTabWidget (this);
|
insilmaril@0
|
131 |
connect( tabWidget, SIGNAL( currentChanged( QWidget * ) ),
|
insilmaril@0
|
132 |
this, SLOT( editorChanged( QWidget * ) ) );
|
insilmaril@0
|
133 |
|
insilmaril@366
|
134 |
lineedit=new QLineEdit (this);
|
insilmaril@366
|
135 |
lineedit->hide();
|
insilmaril@366
|
136 |
|
insilmaril@0
|
137 |
setCentralWidget(tabWidget);
|
insilmaril@0
|
138 |
|
insilmaril@0
|
139 |
setupFileActions();
|
insilmaril@0
|
140 |
setupEditActions();
|
insilmaril@0
|
141 |
setupFormatActions();
|
insilmaril@0
|
142 |
setupViewActions();
|
insilmaril@89
|
143 |
setupModeActions();
|
insilmaril@0
|
144 |
setupFlagActions();
|
insilmaril@0
|
145 |
setupSettingsActions();
|
insilmaril@0
|
146 |
setupContextMenus();
|
insilmaril@366
|
147 |
if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
|
insilmaril@0
|
148 |
setupHelpActions();
|
insilmaril@0
|
149 |
|
insilmaril@0
|
150 |
statusBar();
|
insilmaril@0
|
151 |
|
insilmaril@366
|
152 |
restoreState (settings.value("/mainwindow/state",0).toByteArray());
|
insilmaril@0
|
153 |
|
insilmaril@0
|
154 |
// Initialize Find window
|
insilmaril@374
|
155 |
findWindow=new FindWindow(NULL);
|
insilmaril@374
|
156 |
findWindow->move (x(),y()+70);
|
insilmaril@0
|
157 |
connect (findWindow, SIGNAL( findButton(QString) ),
|
insilmaril@0
|
158 |
this, SLOT(editFind(QString) ) );
|
insilmaril@0
|
159 |
connect (findWindow, SIGNAL( somethingChanged() ),
|
insilmaril@0
|
160 |
this, SLOT(editFindChanged() ) );
|
insilmaril@0
|
161 |
|
insilmaril@160
|
162 |
// Connect TextEditor, so that we can update flags if text changes
|
insilmaril@160
|
163 |
connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
|
insilmaril@390
|
164 |
connect (textEditor, SIGNAL (textClosed() ), this, SLOT (updateActions()));
|
insilmaril@160
|
165 |
|
insilmaril@0
|
166 |
updateGeometry();
|
insilmaril@0
|
167 |
}
|
insilmaril@0
|
168 |
|
insilmaril@0
|
169 |
Main::~Main()
|
insilmaril@0
|
170 |
{
|
insilmaril@0
|
171 |
// Save Settings
|
insilmaril@366
|
172 |
settings.setValue ( "/mainwindow/geometry/size", size() );
|
insilmaril@366
|
173 |
settings.setValue ( "/mainwindow/geometry/pos", pos() );
|
insilmaril@366
|
174 |
|
insilmaril@366
|
175 |
settings.setValue ("/mainwindow/state",saveState(0));
|
insilmaril@366
|
176 |
|
insilmaril@366
|
177 |
settings.setValue( "/version/version", __VYM_VERSION );
|
insilmaril@366
|
178 |
settings.setValue( "/version/builddate", __BUILD_DATE );
|
insilmaril@366
|
179 |
|
insilmaril@390
|
180 |
settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
|
insilmaril@390
|
181 |
settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
|
insilmaril@390
|
182 |
settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
|
insilmaril@366
|
183 |
settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
|
insilmaril@366
|
184 |
settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
|
insilmaril@366
|
185 |
settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
|
insilmaril@0
|
186 |
|
insilmaril@0
|
187 |
QString s;
|
insilmaril@0
|
188 |
int maps=lastMaps.count();
|
insilmaril@366
|
189 |
settings.setValue( "/lastMaps/number",maps );
|
insilmaril@0
|
190 |
for (int i=1;i<=maps;i++)
|
insilmaril@0
|
191 |
{
|
insilmaril@366
|
192 |
s=QString("/lastMaps/map-%1").arg(i);
|
insilmaril@0
|
193 |
if (!s.isEmpty() && i<=maxLastMaps)
|
insilmaril@366
|
194 |
settings.setValue (s, lastMaps.at(i-1));
|
insilmaril@0
|
195 |
}
|
insilmaril@0
|
196 |
|
insilmaril@0
|
197 |
|
insilmaril@0
|
198 |
// To make the texteditor save its settings, call the destructor
|
insilmaril@0
|
199 |
delete (textEditor);
|
insilmaril@164
|
200 |
|
insilmaril@164
|
201 |
// Remove temporary directory
|
insilmaril@164
|
202 |
removeDir (QDir(tmpVymDir));
|
insilmaril@0
|
203 |
}
|
insilmaril@0
|
204 |
|
insilmaril@0
|
205 |
void Main::loadCmdLine()
|
insilmaril@0
|
206 |
{
|
insilmaril@0
|
207 |
/* TODO draw some kind of splashscreen while loading...
|
insilmaril@0
|
208 |
if (qApp->argc()>1)
|
insilmaril@0
|
209 |
{
|
insilmaril@0
|
210 |
}
|
insilmaril@0
|
211 |
*/
|
insilmaril@0
|
212 |
|
insilmaril@0
|
213 |
QStringList flist=options.getFileList();
|
insilmaril@0
|
214 |
QStringList::Iterator it=flist.begin();
|
insilmaril@0
|
215 |
|
insilmaril@0
|
216 |
while (it !=flist.end() )
|
insilmaril@0
|
217 |
{
|
insilmaril@0
|
218 |
fileLoad (*it, NewMap);
|
insilmaril@0
|
219 |
*it++;
|
insilmaril@0
|
220 |
}
|
insilmaril@0
|
221 |
}
|
insilmaril@0
|
222 |
|
insilmaril@0
|
223 |
|
insilmaril@0
|
224 |
void Main::statusMessage(const QString &s)
|
insilmaril@0
|
225 |
{
|
insilmaril@0
|
226 |
statusBar()->message (s);
|
insilmaril@0
|
227 |
}
|
insilmaril@0
|
228 |
|
insilmaril@0
|
229 |
void Main::closeEvent (QCloseEvent* )
|
insilmaril@0
|
230 |
{
|
insilmaril@0
|
231 |
fileExitVYM();
|
insilmaril@0
|
232 |
}
|
insilmaril@0
|
233 |
|
insilmaril@0
|
234 |
// File Actions
|
insilmaril@0
|
235 |
void Main::setupFileActions()
|
insilmaril@0
|
236 |
{
|
insilmaril@366
|
237 |
QMenu *fileMenu = menuBar()->addMenu ( tr ("&Map") );
|
insilmaril@366
|
238 |
QToolBar *tb = addToolBar( tr ("&Map") );
|
insilmaril@366
|
239 |
tb->setObjectName ("mapTB");
|
insilmaril@0
|
240 |
|
insilmaril@0
|
241 |
QAction *a;
|
insilmaril@366
|
242 |
a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
|
insilmaril@366
|
243 |
a->setStatusTip ( tr( "New map","File menu" ) );
|
insilmaril@366
|
244 |
a->setShortcut ( Qt::CTRL + Qt::Key_N );
|
insilmaril@0
|
245 |
a->addTo( tb );
|
insilmaril@366
|
246 |
fileMenu->addAction (a);
|
insilmaril@366
|
247 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
|
insilmaril@0
|
248 |
|
insilmaril@366
|
249 |
a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
|
insilmaril@366
|
250 |
a->setStatusTip (tr( "Open","File menu" ) );
|
insilmaril@366
|
251 |
a->setShortcut ( Qt::CTRL + Qt::Key_O );
|
insilmaril@0
|
252 |
a->addTo( tb );
|
insilmaril@366
|
253 |
fileMenu->addAction (a);
|
insilmaril@366
|
254 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileLoad() ) );
|
insilmaril@0
|
255 |
|
insilmaril@366
|
256 |
fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent"));
|
insilmaril@366
|
257 |
fileMenu->addSeparator();
|
insilmaril@0
|
258 |
|
insilmaril@366
|
259 |
a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
|
insilmaril@366
|
260 |
a->setStatusTip ( tr( "Save" ));
|
insilmaril@366
|
261 |
a->setShortcut (Qt::CTRL + Qt::Key_S );
|
insilmaril@0
|
262 |
a->addTo( tb );
|
insilmaril@366
|
263 |
fileMenu->addAction (a);
|
insilmaril@366
|
264 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
|
insilmaril@0
|
265 |
actionFileSave=a;
|
insilmaril@0
|
266 |
|
insilmaril@366
|
267 |
a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
|
insilmaril@366
|
268 |
a->setStatusTip (tr( "Save &As" ) );
|
insilmaril@366
|
269 |
fileMenu->addAction (a);
|
insilmaril@366
|
270 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileSaveAs() ) );
|
insilmaril@366
|
271 |
|
insilmaril@366
|
272 |
fileMenu->addSeparator();
|
insilmaril@366
|
273 |
|
insilmaril@366
|
274 |
fileImportMenu = fileMenu->addMenu (tr("Import"));
|
insilmaril@366
|
275 |
|
insilmaril@366
|
276 |
a = new QAction(tr("KDE Bookmarks"), this);
|
insilmaril@366
|
277 |
a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
|
insilmaril@366
|
278 |
a->addTo (fileImportMenu);
|
insilmaril@366
|
279 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileImportKDEBookmarks() ) );
|
insilmaril@366
|
280 |
|
insilmaril@366
|
281 |
if (settings.value( "/mainwindow/showTestMenu",false).toBool())
|
insilmaril@331
|
282 |
{
|
insilmaril@366
|
283 |
a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
|
insilmaril@366
|
284 |
a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
|
insilmaril@366
|
285 |
a->addTo (fileImportMenu);
|
insilmaril@366
|
286 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileImportFirefoxBookmarks() ) );
|
insilmaril@331
|
287 |
}
|
insilmaril@314
|
288 |
|
insilmaril@366
|
289 |
a = new QAction("Mind Manager...",this);
|
insilmaril@366
|
290 |
a->setStatusTip ( tr( "Import")+" Mind Manager" );
|
insilmaril@366
|
291 |
fileImportMenu->addAction (a);
|
insilmaril@366
|
292 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileImportMM() ) );
|
insilmaril@366
|
293 |
|
insilmaril@366
|
294 |
a = new QAction( tr( "Import Dir"+QString("...") ), this);
|
insilmaril@366
|
295 |
a->setStatusTip (tr( "Import directory structure (experimental)" ) );
|
insilmaril@366
|
296 |
fileImportMenu->addAction (a);
|
insilmaril@366
|
297 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileImportDir() ) );
|
insilmaril@366
|
298 |
|
insilmaril@366
|
299 |
fileExportMenu = fileMenu->addMenu (tr("Export"));
|
insilmaril@366
|
300 |
|
insilmaril@366
|
301 |
a = new QAction( tr("Image")+QString("..."), this);
|
insilmaril@366
|
302 |
a->setStatusTip( tr( "Export map as image" ));
|
insilmaril@366
|
303 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportImage() ) );
|
insilmaril@366
|
304 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
305 |
|
insilmaril@366
|
306 |
a = new QAction( "Open Office"+QString("..."), this);
|
insilmaril@366
|
307 |
a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
|
insilmaril@366
|
308 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportOOPresentation() ) );
|
insilmaril@366
|
309 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
310 |
|
insilmaril@366
|
311 |
a = new QAction( "Webpage (XHTML)...",this );
|
insilmaril@366
|
312 |
a->setShortcut (Qt::ALT + Qt::Key_X);
|
insilmaril@366
|
313 |
a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
|
insilmaril@366
|
314 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXHTML() ) );
|
insilmaril@366
|
315 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
316 |
|
insilmaril@366
|
317 |
a = new QAction( "Text (ASCII)...", this);
|
insilmaril@366
|
318 |
a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
|
insilmaril@366
|
319 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportASCII() ) );
|
insilmaril@366
|
320 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
321 |
|
insilmaril@366
|
322 |
a = new QAction( tr("KDE Bookmarks"), this);
|
insilmaril@366
|
323 |
a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
|
insilmaril@366
|
324 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportKDEBookmarks() ) );
|
insilmaril@366
|
325 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
326 |
|
insilmaril@366
|
327 |
a = new QAction( "Taskjuggler...", this );
|
insilmaril@366
|
328 |
a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
|
insilmaril@366
|
329 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportTaskjuggler() ) );
|
insilmaril@366
|
330 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
331 |
|
insilmaril@366
|
332 |
a = new QAction( "LaTeX...", this);
|
insilmaril@366
|
333 |
a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
|
insilmaril@366
|
334 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportLaTeX() ) );
|
insilmaril@366
|
335 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
336 |
|
insilmaril@366
|
337 |
a = new QAction( "XML..." , this );
|
insilmaril@366
|
338 |
a->setStatusTip (tr( "Export as")+" XML");
|
insilmaril@366
|
339 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExportXML() ) );
|
insilmaril@366
|
340 |
fileExportMenu->addAction (a);
|
insilmaril@366
|
341 |
|
insilmaril@366
|
342 |
fileMenu->addSeparator();
|
insilmaril@366
|
343 |
|
insilmaril@366
|
344 |
a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
|
insilmaril@366
|
345 |
a->setStatusTip ( tr( "Print" ) );
|
insilmaril@366
|
346 |
a->setShortcut (Qt::CTRL + Qt::Key_P );
|
insilmaril@0
|
347 |
a->addTo( tb );
|
insilmaril@366
|
348 |
fileMenu->addAction (a);
|
insilmaril@366
|
349 |
connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
|
insilmaril@0
|
350 |
actionFilePrint=a;
|
insilmaril@0
|
351 |
|
insilmaril@366
|
352 |
a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
|
insilmaril@366
|
353 |
a->setStatusTip (tr( "Close Map" ) );
|
insilmaril@366
|
354 |
a->setShortcut (Qt::ALT + Qt::Key_C );
|
insilmaril@366
|
355 |
fileMenu->addAction (a);
|
insilmaril@366
|
356 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) );
|
insilmaril@366
|
357 |
|
insilmaril@366
|
358 |
a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
|
insilmaril@366
|
359 |
a->setStatusTip ( tr( "Exit")+" "+__VYM );
|
insilmaril@366
|
360 |
a->setShortcut (Qt::CTRL + Qt::Key_Q );
|
insilmaril@366
|
361 |
fileMenu->addAction (a);
|
insilmaril@366
|
362 |
connect( a, SIGNAL( triggered() ), this, SLOT( fileExitVYM() ) );
|
insilmaril@0
|
363 |
}
|
insilmaril@0
|
364 |
|
insilmaril@0
|
365 |
|
insilmaril@0
|
366 |
//Edit Actions
|
insilmaril@0
|
367 |
void Main::setupEditActions()
|
insilmaril@0
|
368 |
{
|
insilmaril@366
|
369 |
QToolBar *tb = addToolBar( tr ("&Actions") );
|
insilmaril@0
|
370 |
tb->setLabel( "Edit Actions" );
|
insilmaril@366
|
371 |
tb->setObjectName ("actionsTB");
|
insilmaril@366
|
372 |
QMenu *editMenu = menuBar()->addMenu( tr("&Edit") );
|
insilmaril@0
|
373 |
|
insilmaril@0
|
374 |
QAction *a;
|
insilmaril@102
|
375 |
QAction *alt;
|
insilmaril@366
|
376 |
a = new QAction( QPixmap( iconPath+"undo.png"), tr( "&Undo" ),this);
|
insilmaril@366
|
377 |
connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
|
insilmaril@366
|
378 |
a->setStatusTip (tr( "Undo" ) );
|
insilmaril@366
|
379 |
a->setShortcut ( Qt::CTRL + Qt::Key_Z );
|
insilmaril@0
|
380 |
a->setEnabled (false);
|
insilmaril@366
|
381 |
tb->addAction (a);
|
insilmaril@366
|
382 |
editMenu->addAction (a);
|
insilmaril@0
|
383 |
actionEditUndo=a;
|
insilmaril@163
|
384 |
|
insilmaril@366
|
385 |
a = new QAction( QPixmap( iconPath+"redo.png"), tr( "&Redo" ), this);
|
insilmaril@366
|
386 |
a->setStatusTip (tr( "Redo" ));
|
insilmaril@366
|
387 |
a->setShortcut (Qt::CTRL + Qt::Key_Y );
|
insilmaril@366
|
388 |
tb->addAction (a);
|
insilmaril@366
|
389 |
editMenu->addAction (a);
|
insilmaril@366
|
390 |
connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
|
insilmaril@366
|
391 |
actionEditRedo=a;
|
insilmaril@163
|
392 |
|
insilmaril@366
|
393 |
editMenu->addSeparator();
|
insilmaril@366
|
394 |
a = new QAction(QPixmap( iconPath+"editcopy.png"), tr( "&Copy" ), this);
|
insilmaril@366
|
395 |
a->setStatusTip ( tr( "Copy" ) );
|
insilmaril@366
|
396 |
a->setShortcut (Qt::CTRL + Qt::Key_C );
|
insilmaril@0
|
397 |
a->setEnabled (false);
|
insilmaril@366
|
398 |
tb->addAction (a);
|
insilmaril@366
|
399 |
editMenu->addAction (a);
|
insilmaril@366
|
400 |
connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
|
insilmaril@0
|
401 |
actionEditCopy=a;
|
insilmaril@366
|
402 |
|
insilmaril@366
|
403 |
a = new QAction(QPixmap( iconPath+"editcut.png" ), tr( "Cu&t" ), this);
|
insilmaril@366
|
404 |
a->setStatusTip ( tr( "Cut" ) );
|
insilmaril@366
|
405 |
a->setShortcut (Qt::CTRL + Qt::Key_X );
|
insilmaril@0
|
406 |
a->setEnabled (false);
|
insilmaril@366
|
407 |
tb->addAction (a);
|
insilmaril@366
|
408 |
editMenu->addAction (a);
|
insilmaril@0
|
409 |
actionEditCut=a;
|
insilmaril@366
|
410 |
connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
|
insilmaril@366
|
411 |
|
insilmaril@366
|
412 |
a = new QAction(QPixmap( iconPath+"editpaste.png"), tr( "&Paste" ),this);
|
insilmaril@366
|
413 |
connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
|
insilmaril@366
|
414 |
a->setStatusTip ( tr( "Paste" ) );
|
insilmaril@366
|
415 |
a->setShortcut ( Qt::CTRL + Qt::Key_V );
|
insilmaril@0
|
416 |
a->setEnabled (false);
|
insilmaril@366
|
417 |
tb->addAction (a);
|
insilmaril@366
|
418 |
editMenu->addAction (a);
|
insilmaril@0
|
419 |
actionEditPaste=a;
|
insilmaril@98
|
420 |
|
insilmaril@351
|
421 |
// Shortcuts to modify heading:
|
insilmaril@366
|
422 |
a = new QAction(tr( "Edit heading" ),this);
|
insilmaril@366
|
423 |
a->setStatusTip ( tr( "edit Heading" ));
|
insilmaril@366
|
424 |
a->setShortcut ( Qt::Key_Enter);
|
insilmaril@366
|
425 |
// a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
426 |
addAction (a);
|
insilmaril@366
|
427 |
connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
|
insilmaril@351
|
428 |
actionListBranches.append(a);
|
insilmaril@366
|
429 |
a = new QAction( tr( "Edit heading" ), this);
|
insilmaril@366
|
430 |
a->setStatusTip (tr( "edit Heading" ));
|
insilmaril@366
|
431 |
a->setShortcut (Qt::Key_Return );
|
insilmaril@366
|
432 |
//a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
433 |
addAction (a);
|
insilmaril@366
|
434 |
connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
|
insilmaril@351
|
435 |
actionListBranches.append(a);
|
insilmaril@366
|
436 |
editMenu->addAction (a);
|
insilmaril@351
|
437 |
actionEditHeading=a;
|
insilmaril@366
|
438 |
a = new QAction( tr( "Edit heading" ), this);
|
insilmaril@366
|
439 |
a->setStatusTip (tr( "edit Heading" ));
|
insilmaril@366
|
440 |
a->setShortcut ( Qt::Key_F2 );
|
insilmaril@366
|
441 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
442 |
addAction (a);
|
insilmaril@366
|
443 |
connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
|
insilmaril@351
|
444 |
actionListBranches.append(a);
|
insilmaril@351
|
445 |
|
insilmaril@351
|
446 |
// Shortcut to delete selection
|
insilmaril@366
|
447 |
a = new QAction( tr( "Delete Selection" ),this);
|
insilmaril@366
|
448 |
a->setStatusTip (tr( "Delete Selection" ));
|
insilmaril@366
|
449 |
a->setShortcut ( Qt::Key_Delete);
|
insilmaril@366
|
450 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
451 |
addAction (a);
|
insilmaril@366
|
452 |
connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
|
insilmaril@351
|
453 |
actionEditDelete=a;
|
insilmaril@351
|
454 |
|
insilmaril@351
|
455 |
// Shortcut to add branch
|
insilmaril@366
|
456 |
alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
|
insilmaril@366
|
457 |
alt->setStatusTip ( tr( "Add a branch as child of selection" ));
|
insilmaril@366
|
458 |
alt->setShortcut (Qt::Key_A);
|
insilmaril@366
|
459 |
alt->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
460 |
addAction (alt);
|
insilmaril@366
|
461 |
connect( alt, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
|
insilmaril@366
|
462 |
a = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child" ), this);
|
insilmaril@366
|
463 |
a->setStatusTip ( tr( "Add a branch as child of selection" ));
|
insilmaril@366
|
464 |
a->setShortcut (Qt::Key_Insert);
|
insilmaril@366
|
465 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranch() ) );
|
insilmaril@351
|
466 |
actionListBranches.append(a);
|
insilmaril@351
|
467 |
#if defined (Q_OS_MACX)
|
insilmaril@366
|
468 |
// In OSX show different shortcut in menues, the keys work indepently always
|
insilmaril@351
|
469 |
actionEditAddBranch=alt;
|
insilmaril@351
|
470 |
#else
|
insilmaril@351
|
471 |
actionEditAddBranch=a;
|
insilmaril@351
|
472 |
#endif
|
insilmaril@366
|
473 |
editMenu->addAction (actionEditAddBranch);
|
insilmaril@366
|
474 |
tb->addAction (actionEditAddBranch);
|
insilmaril@366
|
475 |
|
insilmaril@351
|
476 |
|
insilmaril@351
|
477 |
// Add branch by inserting it at selection
|
insilmaril@366
|
478 |
a = new QAction(tr( "Add branch (insert)" ), this);
|
insilmaril@366
|
479 |
a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
|
insilmaril@366
|
480 |
a->setShortcut (Qt::ALT + Qt::Key_Insert );
|
insilmaril@366
|
481 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
482 |
addAction (a);
|
insilmaril@366
|
483 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
|
insilmaril@351
|
484 |
a->setEnabled (false);
|
insilmaril@351
|
485 |
actionListBranches.append(a);
|
insilmaril@351
|
486 |
actionEditAddBranchHere=a;
|
insilmaril@366
|
487 |
a = new QAction(tr( "Add branch (insert)" ),this);
|
insilmaril@366
|
488 |
a->setStatusTip ( tr( "Add a branch by inserting and making selection its child" ));
|
insilmaril@366
|
489 |
a->setShortcut ( Qt::ALT + Qt::Key_A );
|
insilmaril@366
|
490 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
491 |
addAction (a);
|
insilmaril@366
|
492 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchHere() ) );
|
insilmaril@351
|
493 |
actionListBranches.append(a);
|
insilmaril@351
|
494 |
|
insilmaril@351
|
495 |
// Add branch above
|
insilmaril@366
|
496 |
a = new QAction(tr( "Add branch above" ), this);
|
insilmaril@366
|
497 |
a->setStatusTip ( tr( "Add a branch above selection" ));
|
insilmaril@366
|
498 |
a->setShortcut (Qt::SHIFT+Qt::Key_Insert );
|
insilmaril@366
|
499 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
500 |
addAction (a);
|
insilmaril@366
|
501 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
|
insilmaril@351
|
502 |
a->setEnabled (false);
|
insilmaril@351
|
503 |
actionListBranches.append(a);
|
insilmaril@351
|
504 |
actionEditAddBranchAbove=a;
|
insilmaril@366
|
505 |
a = new QAction(tr( "Add branch above" ), this);
|
insilmaril@366
|
506 |
a->setStatusTip ( tr( "Add a branch above selection" ));
|
insilmaril@366
|
507 |
a->setShortcut (Qt::SHIFT+Qt::Key_A );
|
insilmaril@366
|
508 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
509 |
addAction (a);
|
insilmaril@366
|
510 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchAbove() ) );
|
insilmaril@351
|
511 |
actionListBranches.append(a);
|
insilmaril@351
|
512 |
|
insilmaril@351
|
513 |
// Add branch below
|
insilmaril@366
|
514 |
a = new QAction(tr( "Add branch below" ), this);
|
insilmaril@366
|
515 |
a->setStatusTip ( tr( "Add a branch below selection" ));
|
insilmaril@366
|
516 |
a->setShortcut (Qt::CTRL +Qt::Key_Insert );
|
insilmaril@366
|
517 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
518 |
addAction (a);
|
insilmaril@366
|
519 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
|
insilmaril@351
|
520 |
a->setEnabled (false);
|
insilmaril@351
|
521 |
actionListBranches.append(a);
|
insilmaril@351
|
522 |
actionEditAddBranchBelow=a;
|
insilmaril@366
|
523 |
a = new QAction(tr( "Add branch below" ), this);
|
insilmaril@366
|
524 |
a->setStatusTip ( tr( "Add a branch below selection" ));
|
insilmaril@366
|
525 |
a->setShortcut (Qt::CTRL +Qt::Key_A );
|
insilmaril@366
|
526 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
527 |
addAction (a);
|
insilmaril@366
|
528 |
connect( a, SIGNAL( triggered() ), this, SLOT( editNewBranchBelow() ) );
|
insilmaril@351
|
529 |
actionListBranches.append(a);
|
insilmaril@351
|
530 |
|
insilmaril@366
|
531 |
a = new QAction(QPixmap(iconPath+"up.png" ), tr( "Move up" ), this);
|
insilmaril@366
|
532 |
a->setStatusTip ( tr( "Move branch up" ) );
|
insilmaril@366
|
533 |
a->setShortcut (Qt::Key_PageUp );
|
insilmaril@0
|
534 |
a->setEnabled (false);
|
insilmaril@366
|
535 |
tb->addAction (a);
|
insilmaril@366
|
536 |
editMenu->addAction (a);
|
insilmaril@366
|
537 |
connect( a, SIGNAL( triggered() ), this, SLOT( editMoveUp() ) );
|
insilmaril@0
|
538 |
actionEditMoveUp=a;
|
insilmaril@98
|
539 |
|
insilmaril@366
|
540 |
a = new QAction( QPixmap( iconPath+"down.png"), tr( "Move down" ),this);
|
insilmaril@366
|
541 |
connect( a, SIGNAL( triggered() ), this, SLOT( editMoveDown() ) );
|
insilmaril@366
|
542 |
a->setStatusTip (tr( "Move branch down" ) );
|
insilmaril@366
|
543 |
a->setShortcut ( Qt::Key_PageDown );
|
insilmaril@0
|
544 |
a->setEnabled (false);
|
insilmaril@366
|
545 |
tb->addAction (a);
|
insilmaril@366
|
546 |
editMenu->addAction (a);
|
insilmaril@0
|
547 |
actionEditMoveDown=a;
|
insilmaril@98
|
548 |
|
insilmaril@0
|
549 |
|
insilmaril@366
|
550 |
a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ),this);
|
insilmaril@366
|
551 |
a->setShortcut ( Qt::Key_ScrollLock );
|
insilmaril@366
|
552 |
a->setStatusTip (tr( "Scroll branch" ) );
|
insilmaril@366
|
553 |
connect( a, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
|
insilmaril@375
|
554 |
|
insilmaril@366
|
555 |
alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch" ), this);
|
insilmaril@366
|
556 |
alt->setShortcut ( Qt::Key_S );
|
insilmaril@366
|
557 |
alt->setStatusTip (tr( "Scroll branch" ));
|
insilmaril@366
|
558 |
connect( alt, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) );
|
insilmaril@102
|
559 |
#if defined(Q_OS_MACX)
|
insilmaril@102
|
560 |
actionEditToggleScroll=alt;
|
insilmaril@102
|
561 |
#else
|
insilmaril@102
|
562 |
actionEditToggleScroll=a;
|
insilmaril@102
|
563 |
#endif
|
insilmaril@102
|
564 |
actionEditToggleScroll->setEnabled (false);
|
insilmaril@250
|
565 |
actionEditToggleScroll->setToggleAction(true);
|
insilmaril@366
|
566 |
tb->addAction (actionEditToggleScroll);
|
insilmaril@366
|
567 |
editMenu->addAction ( actionEditToggleScroll);
|
insilmaril@366
|
568 |
editMenu->addAction (actionEditToggleScroll);
|
insilmaril@375
|
569 |
addAction (a);
|
insilmaril@375
|
570 |
addAction (alt);
|
insilmaril@102
|
571 |
actionListBranches.append(actionEditToggleScroll);
|
insilmaril@0
|
572 |
|
insilmaril@366
|
573 |
a = new QAction( tr( "Unscroll all scrolled branches" ), this);
|
insilmaril@366
|
574 |
a->setStatusTip (tr( "Unscroll all" ));
|
insilmaril@366
|
575 |
editMenu->addAction (a);
|
insilmaril@366
|
576 |
connect( a, SIGNAL( triggered() ), this, SLOT( editUnScrollAll() ) );
|
insilmaril@0
|
577 |
|
insilmaril@366
|
578 |
editMenu->addSeparator();
|
insilmaril@366
|
579 |
|
insilmaril@366
|
580 |
a = new QAction( QPixmap(iconPath+"find.png"), tr( "Find"+QString("...") ), this);
|
insilmaril@366
|
581 |
a->setStatusTip (tr( "Find" ) );
|
insilmaril@366
|
582 |
a->setShortcut (Qt::CTRL + Qt::Key_F );
|
insilmaril@366
|
583 |
editMenu->addAction (a);
|
insilmaril@366
|
584 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenFindWindow() ) );
|
insilmaril@0
|
585 |
|
insilmaril@366
|
586 |
editMenu->addSeparator();
|
insilmaril@366
|
587 |
|
insilmaril@366
|
588 |
a = new QAction( QPixmap(flagsPath+"flag-url.png"), tr( "Open URL" ), this);
|
insilmaril@366
|
589 |
a->setShortcut (Qt::CTRL + Qt::Key_U );
|
insilmaril@366
|
590 |
a->setShortcut (tr( "Open URL" ));
|
insilmaril@366
|
591 |
tb->addAction (a);
|
insilmaril@366
|
592 |
addAction(a);
|
insilmaril@366
|
593 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURL() ) );
|
insilmaril@0
|
594 |
actionEditOpenURL=a;
|
insilmaril@0
|
595 |
|
insilmaril@366
|
596 |
a = new QAction( tr( "Open URL in new tab" ), this);
|
insilmaril@366
|
597 |
a->setStatusTip (tr( "Open URL in new tab" ));
|
insilmaril@366
|
598 |
a->setShortcut (Qt::CTRL+Qt::Key_U );
|
insilmaril@366
|
599 |
addAction(a);
|
insilmaril@366
|
600 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
|
insilmaril@266
|
601 |
actionEditOpenURLTab=a;
|
insilmaril@266
|
602 |
|
insilmaril@366
|
603 |
a = new QAction( tr( "Open all URLs in subtree" ), this);
|
insilmaril@366
|
604 |
a->setStatusTip (tr( "Open all URLs in subtree" ));
|
insilmaril@366
|
605 |
addAction(a);
|
insilmaril@366
|
606 |
actionListBranches.append(a);
|
insilmaril@366
|
607 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
|
insilmaril@366
|
608 |
actionEditOpenMultipleURLTabs=a;
|
insilmaril@366
|
609 |
|
insilmaril@366
|
610 |
a = new QAction(QPixmap(), tr( "Edit URL"+QString("...") ), this);
|
insilmaril@366
|
611 |
a->setStatusTip ( tr( "Edit URL" ) );
|
insilmaril@366
|
612 |
a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
|
insilmaril@366
|
613 |
//a->setShortcut ( Qt::Key_U );
|
insilmaril@366
|
614 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
615 |
actionListBranches.append(a);
|
insilmaril@366
|
616 |
addAction(a);
|
insilmaril@366
|
617 |
connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) );
|
insilmaril@366
|
618 |
actionEditURL=a;
|
insilmaril@366
|
619 |
|
insilmaril@366
|
620 |
a = new QAction( tr( "Use heading for URL" ), this);
|
insilmaril@366
|
621 |
a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
|
insilmaril@0
|
622 |
a->setEnabled (false);
|
insilmaril@98
|
623 |
actionListBranches.append(a);
|
insilmaril@366
|
624 |
connect( a, SIGNAL( triggered() ), this, SLOT( editHeading2URL() ) );
|
insilmaril@366
|
625 |
actionEditHeading2URL=a;
|
insilmaril@366
|
626 |
|
insilmaril@366
|
627 |
a = new QAction(tr( "Create URL to Bugzilla" ), this);
|
insilmaril@366
|
628 |
a->setStatusTip ( tr( "Create URL to Bugzilla" ));
|
insilmaril@0
|
629 |
a->setEnabled (false);
|
insilmaril@98
|
630 |
actionListBranches.append(a);
|
insilmaril@366
|
631 |
connect( a, SIGNAL( triggered() ), this, SLOT( editBugzilla2URL() ) );
|
insilmaril@366
|
632 |
actionEditBugzilla2URL=a;
|
insilmaril@0
|
633 |
|
insilmaril@366
|
634 |
a = new QAction(tr( "Create URL to FATE" ), this);
|
insilmaril@366
|
635 |
a->setStatusTip ( tr( "Create URL to FATE" ));
|
insilmaril@0
|
636 |
a->setEnabled (false);
|
insilmaril@98
|
637 |
actionListBranches.append(a);
|
insilmaril@366
|
638 |
connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
|
insilmaril@366
|
639 |
actionEditFATE2URL=a;
|
insilmaril@366
|
640 |
|
insilmaril@366
|
641 |
a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this);
|
insilmaril@366
|
642 |
a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
|
insilmaril@366
|
643 |
tb->addAction (a);
|
insilmaril@366
|
644 |
a->setEnabled (false);
|
insilmaril@366
|
645 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
|
insilmaril@366
|
646 |
actionEditOpenVymLink=a;
|
insilmaril@366
|
647 |
|
insilmaril@366
|
648 |
a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this);
|
insilmaril@366
|
649 |
a->setStatusTip ( tr( "Open all vym links in subtree" ));
|
insilmaril@175
|
650 |
a->setEnabled (false);
|
insilmaril@175
|
651 |
actionListBranches.append(a);
|
insilmaril@366
|
652 |
connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
|
insilmaril@366
|
653 |
actionEditOpenMultipleVymLinks=a;
|
insilmaril@0
|
654 |
|
insilmaril@366
|
655 |
|
insilmaril@366
|
656 |
a = new QAction(tr( "Edit vym link"+QString("...") ), this);
|
insilmaril@0
|
657 |
a->setEnabled (false);
|
insilmaril@366
|
658 |
a->setStatusTip ( tr( "Edit link to another vym map" ));
|
insilmaril@366
|
659 |
connect( a, SIGNAL( triggered() ), this, SLOT( editVymLink() ) );
|
insilmaril@98
|
660 |
actionListBranches.append(a);
|
insilmaril@0
|
661 |
actionEditVymLink=a;
|
insilmaril@0
|
662 |
|
insilmaril@366
|
663 |
a = new QAction(tr( "Delete vym link" ),this);
|
insilmaril@366
|
664 |
a->setStatusTip ( tr( "Delete link to another vym map" ));
|
insilmaril@0
|
665 |
a->setEnabled (false);
|
insilmaril@366
|
666 |
connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteVymLink() ) );
|
insilmaril@0
|
667 |
actionEditDeleteVymLink=a;
|
insilmaril@0
|
668 |
|
insilmaril@366
|
669 |
a = new QAction(QPixmap(flagsPath+"flag-hideexport.png"), tr( "Hide in exports" ), this);
|
insilmaril@366
|
670 |
a->setStatusTip ( tr( "Hide object in exports" ) );
|
insilmaril@366
|
671 |
a->setShortcut (Qt::Key_H );
|
insilmaril@243
|
672 |
a->setToggleAction(true);
|
insilmaril@366
|
673 |
tb->addAction (a);
|
insilmaril@243
|
674 |
a->setEnabled (false);
|
insilmaril@366
|
675 |
connect( a, SIGNAL( triggered() ), this, SLOT( editToggleHideExport() ) );
|
insilmaril@243
|
676 |
actionEditToggleHideExport=a;
|
insilmaril@243
|
677 |
|
insilmaril@366
|
678 |
a = new QAction(tr( "Edit Map Info"+QString("...") ),this);
|
insilmaril@366
|
679 |
a->setStatusTip ( tr( "Edit Map Info" ));
|
insilmaril@0
|
680 |
a->setEnabled (true);
|
insilmaril@366
|
681 |
connect( a, SIGNAL( triggered() ), this, SLOT( editMapInfo() ) );
|
insilmaril@0
|
682 |
actionEditMapInfo=a;
|
insilmaril@0
|
683 |
|
insilmaril@366
|
684 |
editMenu->addSeparator();
|
insilmaril@0
|
685 |
|
insilmaril@0
|
686 |
// Import at selection (adding to selection)
|
insilmaril@366
|
687 |
a = new QAction( tr( "Add map (insert)" ),this);
|
insilmaril@366
|
688 |
a->setStatusTip (tr( "Add map at selection" ));
|
insilmaril@366
|
689 |
connect( a, SIGNAL( triggered() ), this, SLOT( editImportAdd() ) );
|
insilmaril@0
|
690 |
a->setEnabled (false);
|
insilmaril@98
|
691 |
actionListBranches.append(a);
|
insilmaril@0
|
692 |
actionEditImportAdd=a;
|
insilmaril@0
|
693 |
|
insilmaril@0
|
694 |
// Import at selection (replacing selection)
|
insilmaril@366
|
695 |
a = new QAction( tr( "Add map (replace)" ), this);
|
insilmaril@366
|
696 |
a->setStatusTip (tr( "Replace selection with map" ));
|
insilmaril@366
|
697 |
connect( a, SIGNAL( triggered() ), this, SLOT( editImportReplace() ) );
|
insilmaril@0
|
698 |
a->setEnabled (false);
|
insilmaril@98
|
699 |
actionListBranches.append(a);
|
insilmaril@0
|
700 |
actionEditImportReplace=a;
|
insilmaril@0
|
701 |
|
insilmaril@0
|
702 |
// Save selection
|
insilmaril@366
|
703 |
a = new QAction( tr( "Save selection" ), this);
|
insilmaril@366
|
704 |
a->setStatusTip (tr( "Save selection" ));
|
insilmaril@366
|
705 |
connect( a, SIGNAL( triggered() ), this, SLOT( editSaveBranch() ) );
|
insilmaril@0
|
706 |
a->setEnabled (false);
|
insilmaril@98
|
707 |
actionListBranches.append(a);
|
insilmaril@0
|
708 |
actionEditSaveBranch=a;
|
insilmaril@0
|
709 |
|
insilmaril@98
|
710 |
// Only remove branch, not its childs
|
insilmaril@366
|
711 |
a = new QAction(tr( "Remove only branch " ), this);
|
insilmaril@366
|
712 |
a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
|
insilmaril@366
|
713 |
a->setShortcut (Qt::ALT + Qt::Key_Delete );
|
insilmaril@366
|
714 |
connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveBranchKeepChilds() ) );
|
insilmaril@98
|
715 |
a->setEnabled (false);
|
insilmaril@375
|
716 |
addAction (a);
|
insilmaril@98
|
717 |
actionListBranches.append(a);
|
insilmaril@294
|
718 |
actionEditRemoveBranchKeepChilds=a;
|
insilmaril@98
|
719 |
|
insilmaril@98
|
720 |
// Only remove childs of a branch
|
insilmaril@366
|
721 |
a = new QAction( tr( "Remove childs" ), this);
|
insilmaril@366
|
722 |
a->setStatusTip (tr( "Remove childs of branch" ));
|
insilmaril@366
|
723 |
a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
|
insilmaril@366
|
724 |
connect( a, SIGNAL( triggered() ), this, SLOT( editRemoveChilds() ) );
|
insilmaril@98
|
725 |
a->setEnabled (false);
|
insilmaril@98
|
726 |
actionListBranches.append(a);
|
insilmaril@98
|
727 |
actionEditRemoveChilds=a;
|
insilmaril@98
|
728 |
|
insilmaril@0
|
729 |
// Shortcuts for navigating with cursor:
|
insilmaril@366
|
730 |
a = new QAction(tr( "Select upper branch" ), this);
|
insilmaril@366
|
731 |
a->setStatusTip ( tr( "Select upper branch" ));
|
insilmaril@366
|
732 |
a->setShortcut (Qt::Key_Up );
|
insilmaril@366
|
733 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
734 |
addAction (a);
|
insilmaril@366
|
735 |
connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) );
|
insilmaril@366
|
736 |
a = new QAction( tr( "Select lower branch" ),this);
|
insilmaril@366
|
737 |
a->setStatusTip (tr( "Select lower branch" ));
|
insilmaril@366
|
738 |
a->setShortcut ( Qt::Key_Down );
|
insilmaril@366
|
739 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
740 |
addAction (a);
|
insilmaril@366
|
741 |
connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) );
|
insilmaril@366
|
742 |
a = new QAction(tr( "Select left branch" ), this);
|
insilmaril@366
|
743 |
a->setStatusTip ( tr( "Select left branch" ));
|
insilmaril@366
|
744 |
a->setShortcut (Qt::Key_Left );
|
insilmaril@366
|
745 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
746 |
addAction (a);
|
insilmaril@366
|
747 |
connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) );
|
insilmaril@366
|
748 |
a = new QAction( tr( "Select child branch" ), this);
|
insilmaril@366
|
749 |
a->setStatusTip (tr( "Select right branch" ));
|
insilmaril@366
|
750 |
a->setShortcut (Qt::Key_Right);
|
insilmaril@366
|
751 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
752 |
addAction (a);
|
insilmaril@366
|
753 |
connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) );
|
insilmaril@366
|
754 |
a = new QAction( tr( "Select first branch" ), this);
|
insilmaril@366
|
755 |
a->setStatusTip (tr( "Select first branch" ));
|
insilmaril@366
|
756 |
a->setShortcut (Qt::Key_Home );
|
insilmaril@366
|
757 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
758 |
addAction (a);
|
insilmaril@0
|
759 |
a->setEnabled (false);
|
insilmaril@366
|
760 |
editMenu->addAction (a);
|
insilmaril@98
|
761 |
actionListBranches.append(a);
|
insilmaril@0
|
762 |
actionEditSelectFirst=a;
|
insilmaril@366
|
763 |
connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) );
|
insilmaril@366
|
764 |
a = new QAction( tr( "Select last branch" ),this);
|
insilmaril@366
|
765 |
a->setStatusTip (tr( "Select last branch" ));
|
insilmaril@366
|
766 |
a->setShortcut ( Qt::Key_End );
|
insilmaril@366
|
767 |
a->setShortcutContext (Qt::WindowShortcut);
|
insilmaril@366
|
768 |
addAction (a);
|
insilmaril@366
|
769 |
connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) );
|
insilmaril@0
|
770 |
a->setEnabled (false);
|
insilmaril@366
|
771 |
editMenu->addAction (a);
|
insilmaril@98
|
772 |
actionListBranches.append(a);
|
insilmaril@0
|
773 |
actionEditSelectLast=a;
|
insilmaril@0
|
774 |
|
insilmaril@366
|
775 |
a = new QAction( tr( "Add Image" )+QString("..."), this);
|
insilmaril@366
|
776 |
a->setStatusTip (tr( "Add Image" ));
|
insilmaril@366
|
777 |
connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
|
insilmaril@0
|
778 |
actionEditLoadImage=a;
|
insilmaril@89
|
779 |
|
insilmaril@0
|
780 |
}
|
insilmaril@0
|
781 |
|
insilmaril@0
|
782 |
// Format Actions
|
insilmaril@0
|
783 |
void Main::setupFormatActions()
|
insilmaril@0
|
784 |
{
|
insilmaril@366
|
785 |
QMenu *formatMenu = menuBar()->addMenu (tr ("F&ormat"));
|
insilmaril@366
|
786 |
|
insilmaril@366
|
787 |
QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
|
insilmaril@366
|
788 |
tb->setObjectName ("formatTB");
|
insilmaril@0
|
789 |
QAction *a;
|
insilmaril@0
|
790 |
QPixmap pix( 16,16);
|
insilmaril@366
|
791 |
pix.fill (Qt::black);
|
insilmaril@366
|
792 |
a= new QAction(pix, tr( "Set &Color" )+QString("..."), this);
|
insilmaril@366
|
793 |
a->setStatusTip ( tr( "Set Color" ));
|
insilmaril@366
|
794 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectColor() ) );
|
insilmaril@366
|
795 |
a->addTo( tb );
|
insilmaril@366
|
796 |
formatMenu->addAction (a);
|
insilmaril@366
|
797 |
actionFormatColor=a;
|
insilmaril@366
|
798 |
a= new QAction( QPixmap(iconPath+"formatcolorpicker.png"), tr( "Pic&k color" ), this);
|
insilmaril@366
|
799 |
a->setStatusTip (tr( "Pick color\nHint: You can pick a color from another branch and color using CTRL+Left Button" ) );
|
insilmaril@366
|
800 |
a->setShortcut (Qt::CTRL + Qt::Key_K );
|
insilmaril@366
|
801 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatPickColor() ) );
|
insilmaril@0
|
802 |
a->setEnabled (false);
|
insilmaril@0
|
803 |
a->addTo( tb );
|
insilmaril@366
|
804 |
formatMenu->addAction (a);
|
insilmaril@98
|
805 |
actionListBranches.append(a);
|
insilmaril@0
|
806 |
actionFormatPickColor=a;
|
insilmaril@366
|
807 |
|
insilmaril@366
|
808 |
a= new QAction(QPixmap(iconPath+"formatcoloritem.png"), tr( "Color &branch" ), this);
|
insilmaril@366
|
809 |
a->setStatusTip ( tr( "Color branch" ) );
|
insilmaril@366
|
810 |
a->setShortcut (Qt::CTRL + Qt::Key_I);
|
insilmaril@366
|
811 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatColorItem() ) );
|
insilmaril@0
|
812 |
a->setEnabled (false);
|
insilmaril@0
|
813 |
a->addTo( tb );
|
insilmaril@366
|
814 |
formatMenu->addAction (a);
|
insilmaril@98
|
815 |
actionListBranches.append(a);
|
insilmaril@0
|
816 |
actionFormatColorBranch=a;
|
insilmaril@366
|
817 |
|
insilmaril@366
|
818 |
a= new QAction(QPixmap(iconPath+"formatcolorbranch.png"), tr( "Color sub&tree" ), this);
|
insilmaril@366
|
819 |
a->setStatusTip ( tr( "Color Subtree" ));
|
insilmaril@366
|
820 |
a->setShortcut (Qt::CTRL + Qt::Key_T);
|
insilmaril@366
|
821 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatColorBranch() ) );
|
insilmaril@0
|
822 |
a->setEnabled (false);
|
insilmaril@366
|
823 |
formatMenu->addAction (a);
|
insilmaril@0
|
824 |
a->addTo( tb );
|
insilmaril@98
|
825 |
actionListBranches.append(a);
|
insilmaril@0
|
826 |
actionFormatColorSubtree=a;
|
insilmaril@0
|
827 |
|
insilmaril@366
|
828 |
formatMenu->addSeparator();
|
insilmaril@366
|
829 |
actionGroupFormatLinkStyles=new QActionGroup ( this);
|
insilmaril@0
|
830 |
actionGroupFormatLinkStyles->setExclusive (true);
|
insilmaril@366
|
831 |
a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
|
insilmaril@366
|
832 |
a->setStatusTip (tr( "Line" ));
|
insilmaril@0
|
833 |
a->setToggleAction(true);
|
insilmaril@366
|
834 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleLine() ) );
|
insilmaril@366
|
835 |
formatMenu->addAction (a);
|
insilmaril@0
|
836 |
actionFormatLinkStyleLine=a;
|
insilmaril@366
|
837 |
a= new QAction( tr( "Linkstyle Parabel" ), actionGroupFormatLinkStyles);
|
insilmaril@366
|
838 |
a->setStatusTip (tr( "Line" ));
|
insilmaril@0
|
839 |
a->setToggleAction(true);
|
insilmaril@366
|
840 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStyleParabel() ) );
|
insilmaril@366
|
841 |
formatMenu->addAction (a);
|
insilmaril@0
|
842 |
actionFormatLinkStyleParabel=a;
|
insilmaril@366
|
843 |
a= new QAction( tr( "Linkstyle Thick Line" ), actionGroupFormatLinkStyles );
|
insilmaril@366
|
844 |
a->setStatusTip (tr( "PolyLine" ));
|
insilmaril@0
|
845 |
a->setToggleAction(true);
|
insilmaril@366
|
846 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyLine() ) );
|
insilmaril@366
|
847 |
formatMenu->addAction (a);
|
insilmaril@0
|
848 |
actionFormatLinkStylePolyLine=a;
|
insilmaril@366
|
849 |
a= new QAction( tr( "Linkstyle Thick Parabel" ), actionGroupFormatLinkStyles);
|
insilmaril@366
|
850 |
a->setStatusTip (tr( "PolyParabel" ) );
|
insilmaril@0
|
851 |
a->setToggleAction(true);
|
insilmaril@366
|
852 |
a->setChecked (true);
|
insilmaril@366
|
853 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatLinkStylePolyParabel() ) );
|
insilmaril@366
|
854 |
formatMenu->addAction (a);
|
insilmaril@0
|
855 |
actionFormatLinkStylePolyParabel=a;
|
insilmaril@0
|
856 |
|
insilmaril@366
|
857 |
actionGroupFormatFrameTypes=new QActionGroup ( this);
|
insilmaril@0
|
858 |
actionGroupFormatFrameTypes->setExclusive (true);
|
insilmaril@366
|
859 |
a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
|
insilmaril@366
|
860 |
a->setStatusTip (tr("No Frame"));
|
insilmaril@0
|
861 |
a->setToggleAction(true);
|
insilmaril@366
|
862 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) );
|
insilmaril@0
|
863 |
actionFormatFrameNone=a;
|
insilmaril@366
|
864 |
a = new QAction( tr( "Rectangle" ), actionGroupFormatFrameTypes);
|
insilmaril@366
|
865 |
a->setStatusTip (tr( "Rectangle" ));
|
insilmaril@0
|
866 |
a->setToggleAction(true);
|
insilmaril@366
|
867 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
|
insilmaril@0
|
868 |
actionFormatFrameRectangle=a;
|
insilmaril@0
|
869 |
|
insilmaril@390
|
870 |
a = new QAction( tr( "Include images vertically" ), this);
|
insilmaril@366
|
871 |
a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
|
insilmaril@175
|
872 |
a->setToggleAction(true);
|
insilmaril@366
|
873 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
|
insilmaril@175
|
874 |
actionFormatIncludeImagesVer=a;
|
insilmaril@175
|
875 |
|
insilmaril@390
|
876 |
a = new QAction( tr( "Include images horizontally" ), this);
|
insilmaril@366
|
877 |
a->setStatusTip ( tr ("Include left and right position of images into branch"));
|
insilmaril@175
|
878 |
a->setToggleAction(true);
|
insilmaril@366
|
879 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
|
insilmaril@175
|
880 |
actionFormatIncludeImagesHor=a;
|
insilmaril@175
|
881 |
|
insilmaril@390
|
882 |
a = new QAction( tr( "Hide link if object is not selected" ), this);
|
insilmaril@366
|
883 |
a->setStatusTip (tr( "Hide link" ));
|
insilmaril@160
|
884 |
a->setToggleAction(true);
|
insilmaril@366
|
885 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
|
insilmaril@160
|
886 |
actionFormatHideLinkUnselected=a;
|
insilmaril@160
|
887 |
|
insilmaril@366
|
888 |
formatMenu->addSeparator();
|
insilmaril@366
|
889 |
a= new QAction( tr( "&Use color of heading for link" ), this);
|
insilmaril@366
|
890 |
a->setStatusTip (tr( "Use same color for links and headings" ));
|
insilmaril@0
|
891 |
a->setToggleAction(true);
|
insilmaril@366
|
892 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatToggleLinkColorHint() ) );
|
insilmaril@366
|
893 |
formatMenu->addAction (a);
|
insilmaril@0
|
894 |
actionFormatLinkColorHint=a;
|
insilmaril@366
|
895 |
|
insilmaril@366
|
896 |
pix.fill (Qt::white);
|
insilmaril@366
|
897 |
a= new QAction( pix, tr( "Set &Link Color"+QString("...") ), this );
|
insilmaril@366
|
898 |
a->setStatusTip (tr( "Set Link Color" ));
|
insilmaril@366
|
899 |
formatMenu->addAction (a);
|
insilmaril@366
|
900 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectLinkColor() ) );
|
insilmaril@366
|
901 |
actionFormatLinkColor=a;
|
insilmaril@366
|
902 |
|
insilmaril@366
|
903 |
a= new QAction( pix, tr( "Set &Background Color" )+QString("..."), this );
|
insilmaril@366
|
904 |
a->setStatusTip (tr( "Set Background Color" ));
|
insilmaril@366
|
905 |
formatMenu->addAction (a);
|
insilmaril@366
|
906 |
connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) );
|
insilmaril@366
|
907 |
actionFormatBackColor=a;
|
insilmaril@0
|
908 |
}
|
insilmaril@0
|
909 |
|
insilmaril@0
|
910 |
// View Actions
|
insilmaril@0
|
911 |
void Main::setupViewActions()
|
insilmaril@0
|
912 |
{
|
insilmaril@366
|
913 |
QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
|
insilmaril@0
|
914 |
tb->setLabel( "View Actions" );
|
insilmaril@366
|
915 |
tb->setObjectName ("viewTB");
|
insilmaril@366
|
916 |
QMenu *viewMenu = menuBar()->addMenu ( tr( "&View" ));
|
insilmaril@0
|
917 |
|
insilmaril@0
|
918 |
QAction *a;
|
insilmaril@366
|
919 |
a = new QAction(QPixmap(iconPath+"viewmag-reset.png"), tr( "reset Zoom" ), this);
|
insilmaril@366
|
920 |
a->setStatusTip ( tr( "Zoom reset" ) );
|
insilmaril@366
|
921 |
a->setShortcut (Qt::CTRL + Qt::Key_0 );
|
insilmaril@0
|
922 |
a->addTo( tb );
|
insilmaril@366
|
923 |
viewMenu->addAction (a);
|
insilmaril@366
|
924 |
connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomReset() ) );
|
insilmaril@366
|
925 |
|
insilmaril@366
|
926 |
a = new QAction( QPixmap(iconPath+"viewmag+.png"), tr( "Zoom in" ), this);
|
insilmaril@366
|
927 |
a->setStatusTip (tr( "Zoom in" ));
|
insilmaril@366
|
928 |
a->setShortcut (Qt::CTRL + Qt::Key_Plus);
|
insilmaril@0
|
929 |
a->addTo( tb );
|
insilmaril@366
|
930 |
viewMenu->addAction (a);
|
insilmaril@366
|
931 |
connect( a, SIGNAL( triggered() ), this, SLOT(viewZoomIn() ) );
|
insilmaril@366
|
932 |
|
insilmaril@366
|
933 |
a = new QAction( QPixmap(iconPath+"viewmag-.png"), tr( "Zoom out" ), this);
|
insilmaril@366
|
934 |
a->setStatusTip (tr( "Zoom out" ));
|
insilmaril@366
|
935 |
a->setShortcut (Qt::CTRL + Qt::Key_Minus );
|
insilmaril@0
|
936 |
a->addTo( tb );
|
insilmaril@366
|
937 |
viewMenu->addAction (a);
|
insilmaril@366
|
938 |
connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
|
insilmaril@366
|
939 |
|
insilmaril@366
|
940 |
|
insilmaril@366
|
941 |
a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor" ),this);
|
insilmaril@366
|
942 |
a->setStatusTip ( tr( "Show Note Editor" ));
|
insilmaril@366
|
943 |
a->setShortcut ( Qt::CTRL + Qt::Key_E );
|
insilmaril@0
|
944 |
a->setToggleAction(true);
|
insilmaril@0
|
945 |
if (textEditor->showWithMain())
|
insilmaril@0
|
946 |
a->setOn(true);
|
insilmaril@0
|
947 |
else
|
insilmaril@0
|
948 |
a->setOn(false);
|
insilmaril@0
|
949 |
a->addTo( tb );
|
insilmaril@366
|
950 |
viewMenu->addAction (a);
|
insilmaril@366
|
951 |
connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
|
insilmaril@0
|
952 |
actionViewToggleNoteEditor=a;
|
insilmaril@294
|
953 |
|
insilmaril@366
|
954 |
a = new QAction( tr( "Show history window" ),this );
|
insilmaril@366
|
955 |
a->setStatusTip ( tr( "Show history window" ));
|
insilmaril@366
|
956 |
a->setShortcut ( Qt::CTRL + Qt::Key_H );
|
insilmaril@294
|
957 |
a->setToggleAction(false);
|
insilmaril@366
|
958 |
viewMenu->addAction (a);
|
insilmaril@366
|
959 |
connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
|
insilmaril@294
|
960 |
actionViewToggleHistoryWindow=a;
|
insilmaril@294
|
961 |
|
insilmaril@366
|
962 |
a = new QAction(tr( "Next Window" ), this);
|
insilmaril@366
|
963 |
a->setStatusTip ( tr( "&Next Window" ) );
|
insilmaril@366
|
964 |
a->setShortcut (Qt::ALT + Qt::Key_N );
|
insilmaril@366
|
965 |
viewMenu->addAction (a);
|
insilmaril@366
|
966 |
connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
|
insilmaril@366
|
967 |
|
insilmaril@366
|
968 |
a = new QAction (tr( "Previous Window" ), this );
|
insilmaril@366
|
969 |
a->setStatusTip (tr( "&Previous Window" ));
|
insilmaril@366
|
970 |
a->setShortcut (Qt::ALT + Qt::Key_P );
|
insilmaril@366
|
971 |
viewMenu->addAction (a);
|
insilmaril@366
|
972 |
connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
|
insilmaril@0
|
973 |
}
|
insilmaril@0
|
974 |
|
insilmaril@89
|
975 |
// Mode Actions
|
insilmaril@89
|
976 |
void Main::setupModeActions()
|
insilmaril@89
|
977 |
{
|
insilmaril@89
|
978 |
//QPopupMenu *menu = new QPopupMenu( this );
|
insilmaril@89
|
979 |
//menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
|
insilmaril@89
|
980 |
|
insilmaril@366
|
981 |
QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
|
insilmaril@366
|
982 |
tb->setObjectName ("modesTB");
|
insilmaril@89
|
983 |
QAction *a;
|
insilmaril@366
|
984 |
actionGroupModModes=new QActionGroup ( this);
|
insilmaril@89
|
985 |
actionGroupModModes->setExclusive (true);
|
insilmaril@366
|
986 |
a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
|
insilmaril@366
|
987 |
a->setShortcut (Qt::Key_J);
|
insilmaril@366
|
988 |
a->setStatusTip ( tr( "Use modifier to color branches" ));
|
insilmaril@89
|
989 |
a->setToggleAction(true);
|
insilmaril@89
|
990 |
a->addTo (tb);
|
insilmaril@89
|
991 |
a->setOn(true);
|
insilmaril@89
|
992 |
actionModModeColor=a;
|
insilmaril@104
|
993 |
|
insilmaril@366
|
994 |
a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy" ), actionGroupModModes );
|
insilmaril@366
|
995 |
a->setShortcut( Qt::Key_K);
|
insilmaril@366
|
996 |
a->setStatusTip( tr( "Use modifier to copy" ));
|
insilmaril@104
|
997 |
a->setToggleAction(true);
|
insilmaril@104
|
998 |
a->addTo (tb);
|
insilmaril@104
|
999 |
actionModModeCopy=a;
|
insilmaril@104
|
1000 |
|
insilmaril@366
|
1001 |
a= new QAction(QPixmap(iconPath+"modelink.png"), tr( "Use modifier to draw xLinks" ), actionGroupModModes );
|
insilmaril@366
|
1002 |
a->setShortcut (Qt::Key_L);
|
insilmaril@366
|
1003 |
a->setStatusTip( tr( "Use modifier to draw xLinks" ));
|
insilmaril@89
|
1004 |
a->setToggleAction(true);
|
insilmaril@89
|
1005 |
a->addTo (tb);
|
insilmaril@390
|
1006 |
actionModModeXLink=a;
|
insilmaril@89
|
1007 |
}
|
insilmaril@89
|
1008 |
|
insilmaril@0
|
1009 |
// Flag Actions
|
insilmaril@0
|
1010 |
void Main::setupFlagActions()
|
insilmaril@0
|
1011 |
{
|
insilmaril@166
|
1012 |
// Create System Flags
|
insilmaril@166
|
1013 |
systemFlagsDefault = new FlagRowObj ();
|
insilmaril@166
|
1014 |
systemFlagsDefault->setVisibility (false);
|
insilmaril@166
|
1015 |
systemFlagsDefault->setName ("systemFlagsDef");
|
insilmaril@166
|
1016 |
|
insilmaril@166
|
1017 |
FlagObj *fo = new FlagObj ();
|
insilmaril@269
|
1018 |
fo->load(QPixmap(flagsPath+"flag-note.png"));
|
insilmaril@166
|
1019 |
fo->setName("note");
|
insilmaril@166
|
1020 |
fo->setToolTip(tr("Note","Systemflag"));
|
insilmaril@166
|
1021 |
systemFlagsDefault->addFlag (fo); // makes deep copy
|
insilmaril@166
|
1022 |
|
insilmaril@269
|
1023 |
fo->load(QPixmap(flagsPath+"flag-url.png"));
|
insilmaril@166
|
1024 |
fo->setName("url");
|
insilmaril@166
|
1025 |
fo->setToolTip(tr("WWW Document (external)","Systemflag"));
|
insilmaril@166
|
1026 |
systemFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1027 |
|
insilmaril@269
|
1028 |
fo->load(QPixmap(flagsPath+"flag-vymlink.png"));
|
insilmaril@166
|
1029 |
fo->setName("vymLink");
|
insilmaril@166
|
1030 |
fo->setToolTip(tr("Link to another vym map","Systemflag"));
|
insilmaril@166
|
1031 |
systemFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1032 |
|
insilmaril@269
|
1033 |
fo->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
|
insilmaril@166
|
1034 |
fo->setName("scrolledright");
|
insilmaril@166
|
1035 |
fo->setToolTip(tr("subtree is scrolled","Systemflag"));
|
insilmaril@166
|
1036 |
systemFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1037 |
|
insilmaril@269
|
1038 |
fo->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
|
insilmaril@166
|
1039 |
fo->setName("tmpUnscrolledright");
|
insilmaril@166
|
1040 |
fo->setToolTip(tr("subtree is temporary scrolled","Systemflag"));
|
insilmaril@166
|
1041 |
systemFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1042 |
|
insilmaril@269
|
1043 |
fo->load(QPixmap(flagsPath+"flag-hideexport.png"));
|
insilmaril@243
|
1044 |
fo->setName("hideInExport");
|
insilmaril@243
|
1045 |
fo->setToolTip(tr("Hide object in exported maps","Systemflag"));
|
insilmaril@243
|
1046 |
systemFlagsDefault->addFlag (fo);
|
insilmaril@243
|
1047 |
|
insilmaril@166
|
1048 |
// Create Standard Flags
|
insilmaril@366
|
1049 |
QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
|
insilmaril@366
|
1050 |
tb->setObjectName ("standardFlagTB");
|
insilmaril@366
|
1051 |
|
insilmaril@166
|
1052 |
standardFlagsDefault = new FlagRowObj ();
|
insilmaril@166
|
1053 |
standardFlagsDefault->setVisibility (false);
|
insilmaril@166
|
1054 |
standardFlagsDefault->setName ("standardFlagsDef");
|
insilmaril@366
|
1055 |
standardFlagsDefault->setToolBar (tb);
|
insilmaril@166
|
1056 |
|
insilmaril@269
|
1057 |
fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
|
insilmaril@166
|
1058 |
fo->setName ("exclamationmark");
|
insilmaril@166
|
1059 |
fo->setGroup("standard-mark");
|
insilmaril@366
|
1060 |
QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1061 |
tb->addAction (a);
|
insilmaril@366
|
1062 |
fo->setAction (a);
|
insilmaril@366
|
1063 |
a->setCheckable(true);
|
insilmaril@366
|
1064 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1065 |
a->setToolTip(tr("Take care!","Standardflag"));
|
insilmaril@366
|
1066 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1067 |
standardFlagsDefault->addFlag (fo); // makes deep copy
|
insilmaril@166
|
1068 |
|
insilmaril@269
|
1069 |
fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
|
insilmaril@166
|
1070 |
fo->setName("questionmark");
|
insilmaril@166
|
1071 |
fo->setGroup("standard-mark");
|
insilmaril@366
|
1072 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1073 |
tb->addAction (a);
|
insilmaril@366
|
1074 |
fo->setAction (a);
|
insilmaril@366
|
1075 |
a->setCheckable(true);
|
insilmaril@366
|
1076 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1077 |
a->setToolTip(tr("Really?","Standardflag"));
|
insilmaril@366
|
1078 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1079 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1080 |
|
insilmaril@269
|
1081 |
fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
|
insilmaril@166
|
1082 |
fo->setName("hook-green");
|
insilmaril@166
|
1083 |
fo->setGroup("standard-hook");
|
insilmaril@366
|
1084 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1085 |
tb->addAction (a);
|
insilmaril@366
|
1086 |
fo->setAction (a);
|
insilmaril@366
|
1087 |
a->setCheckable(true);
|
insilmaril@366
|
1088 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1089 |
a->setToolTip(tr("ok!","Standardflag"));
|
insilmaril@366
|
1090 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1091 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1092 |
|
insilmaril@269
|
1093 |
fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
|
insilmaril@166
|
1094 |
fo->setName("cross-red");
|
insilmaril@166
|
1095 |
fo->setGroup("standard-hook");
|
insilmaril@366
|
1096 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1097 |
tb->addAction (a);
|
insilmaril@366
|
1098 |
fo->setAction (a);
|
insilmaril@366
|
1099 |
a->setCheckable(true);
|
insilmaril@366
|
1100 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1101 |
a->setToolTip(tr("Not ok!","Standardflag"));
|
insilmaril@366
|
1102 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1103 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1104 |
|
insilmaril@269
|
1105 |
fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
|
insilmaril@166
|
1106 |
fo->setName("stopsign");
|
insilmaril@366
|
1107 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1108 |
tb->addAction (a);
|
insilmaril@366
|
1109 |
fo->setAction (a);
|
insilmaril@366
|
1110 |
a->setCheckable(true);
|
insilmaril@366
|
1111 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1112 |
a->setToolTip(tr("This won't work!","Standardflag"));
|
insilmaril@366
|
1113 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1114 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1115 |
|
insilmaril@269
|
1116 |
fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
|
insilmaril@166
|
1117 |
fo->setName("smiley-good");
|
insilmaril@166
|
1118 |
fo->setGroup("standard-smiley");
|
insilmaril@366
|
1119 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1120 |
tb->addAction (a);
|
insilmaril@366
|
1121 |
fo->setAction (a);
|
insilmaril@366
|
1122 |
a->setCheckable(true);
|
insilmaril@366
|
1123 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1124 |
a->setToolTip(tr("Good","Standardflag"));
|
insilmaril@366
|
1125 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1126 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1127 |
|
insilmaril@269
|
1128 |
fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
|
insilmaril@166
|
1129 |
fo->setName("smiley-sad");
|
insilmaril@166
|
1130 |
fo->setGroup("standard-smiley");
|
insilmaril@366
|
1131 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1132 |
tb->addAction (a);
|
insilmaril@366
|
1133 |
fo->setAction (a);
|
insilmaril@366
|
1134 |
a->setCheckable(true);
|
insilmaril@366
|
1135 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1136 |
a->setToolTip(tr("Bad","Standardflag"));
|
insilmaril@366
|
1137 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1138 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1139 |
|
insilmaril@269
|
1140 |
fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
|
insilmaril@269
|
1141 |
// Original omg.png (in KDE emoticons)
|
insilmaril@269
|
1142 |
fo->setName("smiley-omg");
|
insilmaril@269
|
1143 |
fo->setGroup("standard-smiley");
|
insilmaril@366
|
1144 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1145 |
tb->addAction (a);
|
insilmaril@366
|
1146 |
fo->setAction (a);
|
insilmaril@366
|
1147 |
a->setCheckable(true);
|
insilmaril@366
|
1148 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1149 |
a->setToolTip(tr("Oh no!","Standardflag"));
|
insilmaril@366
|
1150 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1151 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1152 |
|
insilmaril@269
|
1153 |
fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
|
insilmaril@166
|
1154 |
fo->setName("clock");
|
insilmaril@366
|
1155 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1156 |
tb->addAction (a);
|
insilmaril@366
|
1157 |
fo->setAction (a);
|
insilmaril@366
|
1158 |
a->setCheckable(true);
|
insilmaril@366
|
1159 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1160 |
a->setToolTip(tr("Time critical","Standardflag"));
|
insilmaril@366
|
1161 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1162 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1163 |
|
insilmaril@269
|
1164 |
fo->load(QPixmap(flagsPath+"flag-phone.png"));
|
insilmaril@269
|
1165 |
fo->setName("phone");
|
insilmaril@366
|
1166 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1167 |
tb->addAction (a);
|
insilmaril@366
|
1168 |
fo->setAction (a);
|
insilmaril@366
|
1169 |
a->setCheckable(true);
|
insilmaril@366
|
1170 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1171 |
a->setToolTip(tr("Call...","Standardflag"));
|
insilmaril@366
|
1172 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1173 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1174 |
|
insilmaril@269
|
1175 |
fo->load(QPixmap(flagsPath+"flag-lamp.png"));
|
insilmaril@166
|
1176 |
fo->setName("lamp");
|
insilmaril@366
|
1177 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1178 |
tb->addAction (a);
|
insilmaril@366
|
1179 |
fo->setAction (a);
|
insilmaril@366
|
1180 |
a->setCheckable(true);
|
insilmaril@366
|
1181 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1182 |
a->setToolTip(tr("Idea!","Standardflag"));
|
insilmaril@366
|
1183 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1184 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1185 |
|
insilmaril@269
|
1186 |
fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
|
insilmaril@166
|
1187 |
fo->setName("arrow-up");
|
insilmaril@166
|
1188 |
fo->setGroup("standard-arrow");
|
insilmaril@366
|
1189 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1190 |
tb->addAction (a);
|
insilmaril@366
|
1191 |
fo->setAction (a);
|
insilmaril@366
|
1192 |
a->setCheckable(true);
|
insilmaril@366
|
1193 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1194 |
a->setToolTip(tr("Important","Standardflag"));
|
insilmaril@366
|
1195 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1196 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1197 |
|
insilmaril@269
|
1198 |
fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
|
insilmaril@166
|
1199 |
fo->setName("arrow-down");
|
insilmaril@166
|
1200 |
fo->setGroup("standard-arrow");
|
insilmaril@366
|
1201 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1202 |
tb->addAction (a);
|
insilmaril@366
|
1203 |
fo->setAction (a);
|
insilmaril@366
|
1204 |
a->setCheckable(true);
|
insilmaril@366
|
1205 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1206 |
a->setToolTip(tr("Unimportant","Standardflag"));
|
insilmaril@366
|
1207 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1208 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1209 |
|
insilmaril@269
|
1210 |
fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
|
insilmaril@269
|
1211 |
fo->setName("2arrow-up");
|
insilmaril@269
|
1212 |
fo->setGroup("standard-arrow");
|
insilmaril@366
|
1213 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1214 |
tb->addAction (a);
|
insilmaril@366
|
1215 |
fo->setAction (a);
|
insilmaril@366
|
1216 |
a->setCheckable(true);
|
insilmaril@366
|
1217 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1218 |
a->setToolTip(tr("Very important!","Standardflag"));
|
insilmaril@366
|
1219 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1220 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1221 |
|
insilmaril@269
|
1222 |
fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
|
insilmaril@269
|
1223 |
fo->setName("2arrow-down");
|
insilmaril@269
|
1224 |
fo->setGroup("standard-arrow");
|
insilmaril@366
|
1225 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1226 |
tb->addAction (a);
|
insilmaril@366
|
1227 |
fo->setAction (a);
|
insilmaril@366
|
1228 |
a->setCheckable(true);
|
insilmaril@366
|
1229 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1230 |
a->setToolTip(tr("Very unimportant!","Standardflag"));
|
insilmaril@366
|
1231 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1232 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1233 |
|
insilmaril@269
|
1234 |
fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
|
insilmaril@166
|
1235 |
fo->setName("thumb-up");
|
insilmaril@166
|
1236 |
fo->setGroup("standard-thumb");
|
insilmaril@366
|
1237 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1238 |
tb->addAction (a);
|
insilmaril@366
|
1239 |
fo->setAction (a);
|
insilmaril@366
|
1240 |
a->setCheckable(true);
|
insilmaril@366
|
1241 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1242 |
a->setToolTip(tr("I like this","Standardflag"));
|
insilmaril@366
|
1243 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1244 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1245 |
|
insilmaril@269
|
1246 |
fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
|
insilmaril@166
|
1247 |
fo->setName("thumb-down");
|
insilmaril@166
|
1248 |
fo->setGroup("standard-thumb");
|
insilmaril@366
|
1249 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1250 |
tb->addAction (a);
|
insilmaril@366
|
1251 |
fo->setAction (a);
|
insilmaril@366
|
1252 |
a->setCheckable(true);
|
insilmaril@366
|
1253 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1254 |
a->setToolTip(tr("I do not like this","Standardflag"));
|
insilmaril@366
|
1255 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1256 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1257 |
|
insilmaril@269
|
1258 |
fo->load(QPixmap(flagsPath+"flag-rose.png"));
|
insilmaril@269
|
1259 |
fo->setName("rose");
|
insilmaril@366
|
1260 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1261 |
tb->addAction (a);
|
insilmaril@366
|
1262 |
fo->setAction (a);
|
insilmaril@366
|
1263 |
a->setCheckable(true);
|
insilmaril@366
|
1264 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1265 |
a->setToolTip(tr("Rose","Standardflag"));
|
insilmaril@366
|
1266 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1267 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1268 |
|
insilmaril@269
|
1269 |
fo->load(QPixmap(flagsPath+"flag-heart.png"));
|
insilmaril@166
|
1270 |
fo->setName("heart");
|
insilmaril@366
|
1271 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1272 |
tb->addAction (a);
|
insilmaril@366
|
1273 |
a->setCheckable(true);
|
insilmaril@366
|
1274 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1275 |
a->setToolTip(tr("I just love... ","Standardflag"));
|
insilmaril@366
|
1276 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1277 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1278 |
|
insilmaril@269
|
1279 |
fo->load(QPixmap(flagsPath+"flag-present.png"));
|
insilmaril@269
|
1280 |
fo->setName("present");
|
insilmaril@366
|
1281 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1282 |
tb->addAction (a);
|
insilmaril@366
|
1283 |
fo->setAction (a);
|
insilmaril@366
|
1284 |
a->setCheckable(true);
|
insilmaril@366
|
1285 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1286 |
a->setToolTip(tr("Surprise!","Standardflag"));
|
insilmaril@366
|
1287 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1288 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1289 |
|
insilmaril@269
|
1290 |
fo->load(QPixmap(flagsPath+"flag-flash.png"));
|
insilmaril@166
|
1291 |
fo->setName("flash");
|
insilmaril@366
|
1292 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1293 |
tb->addAction (a);
|
insilmaril@366
|
1294 |
fo->setAction (a);
|
insilmaril@366
|
1295 |
a->setCheckable(true);
|
insilmaril@366
|
1296 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1297 |
a->setToolTip(tr("Dangerous","Standardflag"));
|
insilmaril@366
|
1298 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1299 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@166
|
1300 |
|
insilmaril@269
|
1301 |
fo->load(QPixmap(flagsPath+"flag-info.png"));
|
insilmaril@269
|
1302 |
// Original: xsldbg_output.png
|
insilmaril@269
|
1303 |
fo->setName("info");
|
insilmaril@366
|
1304 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1305 |
tb->addAction (a);
|
insilmaril@366
|
1306 |
fo->setAction (a);
|
insilmaril@366
|
1307 |
a->setCheckable(true);
|
insilmaril@366
|
1308 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1309 |
a->setToolTip(tr("Info","Standardflag"));
|
insilmaril@366
|
1310 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@269
|
1311 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@269
|
1312 |
|
insilmaril@269
|
1313 |
fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
|
insilmaril@269
|
1314 |
// Original khelpcenter.png
|
insilmaril@166
|
1315 |
fo->setName("lifebelt");
|
insilmaril@366
|
1316 |
a=new QAction (fo->getPixmap(),fo->getName(),this);
|
insilmaril@366
|
1317 |
tb->addAction (a);
|
insilmaril@366
|
1318 |
fo->setAction (a);
|
insilmaril@366
|
1319 |
a->setCheckable(true);
|
insilmaril@366
|
1320 |
a->setObjectName(fo->getName());
|
insilmaril@366
|
1321 |
a->setToolTip(tr("This will help","Standardflag"));
|
insilmaril@366
|
1322 |
connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
|
insilmaril@166
|
1323 |
standardFlagsDefault->addFlag (fo);
|
insilmaril@243
|
1324 |
|
insilmaril@166
|
1325 |
delete (fo);
|
insilmaril@0
|
1326 |
}
|
insilmaril@0
|
1327 |
|
insilmaril@0
|
1328 |
// Settings Actions
|
insilmaril@0
|
1329 |
void Main::setupSettingsActions()
|
insilmaril@0
|
1330 |
{
|
insilmaril@366
|
1331 |
QMenu *settingsMenu = menuBar()->addMenu( tr( "&Settings" ));
|
insilmaril@0
|
1332 |
|
insilmaril@0
|
1333 |
QAction *a;
|
insilmaril@0
|
1334 |
|
insilmaril@366
|
1335 |
a = new QAction( tr( "Set application to open pdf files"), this);
|
insilmaril@366
|
1336 |
a->setStatusTip ( tr( "Set application to open pdf files"));
|
insilmaril@366
|
1337 |
connect( a, SIGNAL( triggered() ), this, SLOT( settingsPDF() ) );
|
insilmaril@366
|
1338 |
settingsMenu->addAction (a);
|
insilmaril@366
|
1339 |
|
insilmaril@366
|
1340 |
a = new QAction( tr( "Set application to open external links"), this);
|
insilmaril@366
|
1341 |
a->setStatusTip( tr( "Set application to open external links"));
|
insilmaril@366
|
1342 |
connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) );
|
insilmaril@366
|
1343 |
settingsMenu->addAction (a);
|
insilmaril@366
|
1344 |
|
insilmaril@366
|
1345 |
settingsMenu->addSeparator();
|
insilmaril@366
|
1346 |
a = new QAction( tr( "Edit branch after adding it" ), this );
|
insilmaril@366
|
1347 |
a->setStatusTip( tr( "Edit branch after adding it" ));
|
insilmaril@0
|
1348 |
a->setToggleAction(true);
|
insilmaril@366
|
1349 |
a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
|
insilmaril@366
|
1350 |
settingsMenu->addAction (a);
|
insilmaril@390
|
1351 |
actionSettingsAutoEdit=a;
|
insilmaril@0
|
1352 |
|
insilmaril@366
|
1353 |
a= new QAction( tr( "Select branch after adding it" ), this );
|
insilmaril@366
|
1354 |
a->setStatusTip( tr( "Select branch after adding it" ));
|
insilmaril@0
|
1355 |
a->setToggleAction(true);
|
insilmaril@366
|
1356 |
a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
|
insilmaril@366
|
1357 |
settingsMenu->addAction (a);
|
insilmaril@390
|
1358 |
actionSettingsAutoSelectHeading=a;
|
insilmaril@0
|
1359 |
|
insilmaril@366
|
1360 |
a= new QAction(tr( "Select existing heading" ), this);
|
insilmaril@366
|
1361 |
a->setStatusTip( tr( "Select heading before editing" ));
|
insilmaril@0
|
1362 |
a->setToggleAction(true);
|
insilmaril@366
|
1363 |
a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
|
insilmaril@366
|
1364 |
settingsMenu->addAction (a);
|
insilmaril@390
|
1365 |
actionSettingsAutoSelectText=a;
|
insilmaril@0
|
1366 |
|
insilmaril@366
|
1367 |
a= new QAction( tr( "Delete key" ), this);
|
insilmaril@366
|
1368 |
a->setStatusTip( tr( "Delete key for deleting branches" ));
|
insilmaril@0
|
1369 |
a->setToggleAction(true);
|
insilmaril@366
|
1370 |
a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",false).toBool() );
|
insilmaril@366
|
1371 |
settingsMenu->addAction (a);
|
insilmaril@366
|
1372 |
connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
|
insilmaril@366
|
1373 |
actionSettingsUseDelKey=a;
|
insilmaril@366
|
1374 |
|
insilmaril@366
|
1375 |
a= new QAction( tr( "Exclusive flags" ), this);
|
insilmaril@366
|
1376 |
a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
|
insilmaril@0
|
1377 |
a->setToggleAction(true);
|
insilmaril@366
|
1378 |
a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
|
insilmaril@366
|
1379 |
settingsMenu->addAction (a);
|
insilmaril@103
|
1380 |
actionSettingsUseFlagGroups=a;
|
insilmaril@260
|
1381 |
|
insilmaril@366
|
1382 |
a= new QAction( tr( "Use hide flags" ), this);
|
insilmaril@366
|
1383 |
a->setStatusTip( tr( "Use hide flag during exports " ));
|
insilmaril@260
|
1384 |
a->setToggleAction(true);
|
insilmaril@366
|
1385 |
a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
|
insilmaril@366
|
1386 |
settingsMenu->addAction (a);
|
insilmaril@260
|
1387 |
actionSettingsUseHideExport=a;
|
insilmaril@0
|
1388 |
}
|
insilmaril@0
|
1389 |
|
insilmaril@0
|
1390 |
// Test Actions
|
insilmaril@0
|
1391 |
void Main::setupTestActions()
|
insilmaril@0
|
1392 |
{
|
insilmaril@366
|
1393 |
QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
|
insilmaril@0
|
1394 |
|
insilmaril@0
|
1395 |
QAction *a;
|
insilmaril@366
|
1396 |
a = new QAction( tr( "test flag" ), this);
|
insilmaril@366
|
1397 |
a->setStatusTip( tr( "Call test function" ));
|
insilmaril@366
|
1398 |
connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
|
insilmaril@366
|
1399 |
testMenu->addAction (a);
|
insilmaril@0
|
1400 |
}
|
insilmaril@0
|
1401 |
|
insilmaril@0
|
1402 |
// Help Actions
|
insilmaril@0
|
1403 |
void Main::setupHelpActions()
|
insilmaril@0
|
1404 |
{
|
insilmaril@366
|
1405 |
QMenu *helpMenu = menuBar()->addMenu ( tr( "&Help" ));
|
insilmaril@0
|
1406 |
|
insilmaril@0
|
1407 |
QAction *a;
|
insilmaril@366
|
1408 |
a = new QAction( tr( "Open VYM Documentation (pdf) " ), this );
|
insilmaril@366
|
1409 |
a->setStatusTip( tr( "Open VYM Documentation (pdf)" ));
|
insilmaril@366
|
1410 |
connect( a, SIGNAL( triggered() ), this, SLOT( helpDoc() ) );
|
insilmaril@366
|
1411 |
helpMenu->addAction (a);
|
insilmaril@366
|
1412 |
|
insilmaril@366
|
1413 |
a = new QAction( tr( "About VYM" ), this);
|
insilmaril@366
|
1414 |
a->setStatusTip( tr( "About VYM")+" "__VYM);
|
insilmaril@366
|
1415 |
connect( a, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
|
insilmaril@366
|
1416 |
helpMenu->addAction (a);
|
insilmaril@366
|
1417 |
|
insilmaril@366
|
1418 |
a = new QAction( tr( "About QT" ), this);
|
insilmaril@366
|
1419 |
a->setStatusTip( tr( "Information about QT toolkit" ));
|
insilmaril@366
|
1420 |
connect( a, SIGNAL( triggered() ), this, SLOT( helpAboutQT() ) );
|
insilmaril@366
|
1421 |
helpMenu->addAction (a);
|
insilmaril@0
|
1422 |
}
|
insilmaril@0
|
1423 |
|
insilmaril@0
|
1424 |
// Context Menus
|
insilmaril@0
|
1425 |
void Main::setupContextMenus()
|
insilmaril@0
|
1426 |
{
|
insilmaril@0
|
1427 |
QAction*a;
|
insilmaril@0
|
1428 |
|
insilmaril@0
|
1429 |
// Context Menu for branch or mapcenter
|
insilmaril@366
|
1430 |
branchContextMenu =new QMenu (this);
|
insilmaril@98
|
1431 |
|
insilmaril@98
|
1432 |
// Submenu "Add"
|
insilmaril@366
|
1433 |
branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
|
insilmaril@366
|
1434 |
branchAddContextMenu->addAction (actionEditPaste );
|
insilmaril@366
|
1435 |
branchAddContextMenu->addAction ( actionEditAddBranch );
|
insilmaril@366
|
1436 |
branchAddContextMenu->addAction ( actionEditAddBranchHere );
|
insilmaril@366
|
1437 |
branchAddContextMenu->addAction ( actionEditAddBranchAbove);
|
insilmaril@366
|
1438 |
branchAddContextMenu->addAction ( actionEditAddBranchBelow );
|
insilmaril@366
|
1439 |
branchAddContextMenu->addSeparator();
|
insilmaril@366
|
1440 |
branchAddContextMenu->addAction ( actionEditLoadImage);
|
insilmaril@366
|
1441 |
branchAddContextMenu->addSeparator();
|
insilmaril@366
|
1442 |
branchAddContextMenu->addAction ( actionEditImportAdd );
|
insilmaril@366
|
1443 |
branchAddContextMenu->addAction ( actionEditImportReplace );
|
insilmaril@98
|
1444 |
|
insilmaril@98
|
1445 |
// Submenu "Remove"
|
insilmaril@366
|
1446 |
branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove"));
|
insilmaril@366
|
1447 |
branchRemoveContextMenu->addAction (actionEditCut);
|
insilmaril@366
|
1448 |
branchRemoveContextMenu->addAction ( actionEditDelete );
|
insilmaril@366
|
1449 |
branchRemoveContextMenu->addAction ( actionEditRemoveBranchKeepChilds );
|
insilmaril@366
|
1450 |
branchRemoveContextMenu->addAction ( actionEditRemoveChilds );
|
insilmaril@98
|
1451 |
|
insilmaril@98
|
1452 |
|
insilmaril@0
|
1453 |
actionEditSaveBranch->addTo( branchContextMenu );
|
insilmaril@98
|
1454 |
|
insilmaril@366
|
1455 |
branchContextMenu->addSeparator();
|
insilmaril@366
|
1456 |
branchContextMenu->addAction ( actionFormatFrameNone );
|
insilmaril@366
|
1457 |
branchContextMenu->addAction ( actionFormatFrameRectangle);
|
insilmaril@366
|
1458 |
|
insilmaril@366
|
1459 |
branchContextMenu->addSeparator();
|
insilmaril@366
|
1460 |
branchContextMenu->addAction ( actionFormatIncludeImagesVer );
|
insilmaril@366
|
1461 |
branchContextMenu->addAction ( actionFormatIncludeImagesHor );
|
insilmaril@366
|
1462 |
branchContextMenu->addAction ( actionFormatHideLinkUnselected );
|
insilmaril@366
|
1463 |
|
insilmaril@366
|
1464 |
// Submenu for Links (URLs, vymLinks)
|
insilmaril@366
|
1465 |
branchLinksContextMenu =new QMenu (this);
|
insilmaril@366
|
1466 |
|
insilmaril@366
|
1467 |
branchContextMenu->addSeparator();
|
insilmaril@366
|
1468 |
branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks"));
|
insilmaril@366
|
1469 |
branchLinksContextMenu->addAction ( actionEditOpenURL );
|
insilmaril@366
|
1470 |
branchLinksContextMenu->addAction ( actionEditOpenURLTab );
|
insilmaril@366
|
1471 |
branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
|
insilmaril@366
|
1472 |
branchLinksContextMenu->addAction ( actionEditURL );
|
insilmaril@366
|
1473 |
branchLinksContextMenu->addAction ( actionEditHeading2URL );
|
insilmaril@366
|
1474 |
branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
|
insilmaril@366
|
1475 |
if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
|
insilmaril@366
|
1476 |
{
|
insilmaril@366
|
1477 |
branchLinksContextMenu->addAction ( actionEditFATE2URL );
|
insilmaril@366
|
1478 |
}
|
insilmaril@366
|
1479 |
branchLinksContextMenu->addSeparator();
|
insilmaril@366
|
1480 |
branchLinksContextMenu->addAction ( actionEditOpenVymLink );
|
insilmaril@366
|
1481 |
branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks );
|
insilmaril@366
|
1482 |
branchLinksContextMenu->addAction ( actionEditVymLink );
|
insilmaril@366
|
1483 |
branchLinksContextMenu->addAction ( actionEditDeleteVymLink );
|
insilmaril@366
|
1484 |
|
insilmaril@366
|
1485 |
|
insilmaril@366
|
1486 |
// Context Menu for XLinks in a branch menu
|
insilmaril@89
|
1487 |
// This will be populated "on demand" in MapEditor::updateActions
|
insilmaril@366
|
1488 |
branchContextMenu->addSeparator();
|
insilmaril@366
|
1489 |
branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
|
insilmaril@366
|
1490 |
branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
|
insilmaril@366
|
1491 |
connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
|
insilmaril@366
|
1492 |
connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
|
insilmaril@366
|
1493 |
|
insilmaril@105
|
1494 |
|
insilmaril@0
|
1495 |
// Context menu for floatimage
|
insilmaril@366
|
1496 |
floatimageContextMenu =new QMenu (this);
|
insilmaril@366
|
1497 |
a= new QAction (tr ("Save image"),this);
|
insilmaril@366
|
1498 |
connect (a, SIGNAL (triggered()), this, SLOT (editSaveImage()));
|
insilmaril@366
|
1499 |
floatimageContextMenu->addAction (a);
|
insilmaril@366
|
1500 |
|
insilmaril@366
|
1501 |
floatimageContextMenu->addSeparator();
|
insilmaril@0
|
1502 |
actionEditCopy->addTo( floatimageContextMenu );
|
insilmaril@0
|
1503 |
actionEditCut->addTo( floatimageContextMenu );
|
insilmaril@0
|
1504 |
|
insilmaril@366
|
1505 |
floatimageContextMenu->addSeparator();
|
insilmaril@366
|
1506 |
floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
|
insilmaril@366
|
1507 |
|
insilmaril@0
|
1508 |
|
insilmaril@0
|
1509 |
// Context menu for canvas
|
insilmaril@366
|
1510 |
canvasContextMenu =new QMenu (this);
|
insilmaril@0
|
1511 |
actionEditMapInfo->addTo( canvasContextMenu );
|
insilmaril@0
|
1512 |
canvasContextMenu->insertSeparator();
|
insilmaril@0
|
1513 |
actionGroupFormatLinkStyles->addTo( canvasContextMenu );
|
insilmaril@0
|
1514 |
canvasContextMenu->insertSeparator();
|
insilmaril@0
|
1515 |
actionFormatLinkColorHint->addTo( canvasContextMenu );
|
insilmaril@0
|
1516 |
actionFormatLinkColor->addTo( canvasContextMenu );
|
insilmaril@0
|
1517 |
actionFormatBackColor->addTo( canvasContextMenu );
|
insilmaril@0
|
1518 |
|
insilmaril@0
|
1519 |
// Menu for last opened files
|
insilmaril@0
|
1520 |
// Read settings initially
|
insilmaril@0
|
1521 |
QString s;
|
insilmaril@366
|
1522 |
int j=settings.readNumEntry( "/lastMaps/number",0);
|
insilmaril@0
|
1523 |
for (int i=1;i<=j;i++)
|
insilmaril@0
|
1524 |
{
|
insilmaril@366
|
1525 |
s=settings.value(QString("/lastMaps/map-%1").arg(i),"").toString();
|
insilmaril@0
|
1526 |
if (!s.isEmpty() && j<=maxLastMaps)
|
insilmaril@0
|
1527 |
lastMaps.append(s);
|
insilmaril@0
|
1528 |
}
|
insilmaril@0
|
1529 |
setupLastMapsMenu();
|
insilmaril@366
|
1530 |
connect( fileLastMapsMenu, SIGNAL( triggered(QAction *) ), this, SLOT( fileLoadLast(QAction*) ) );
|
insilmaril@0
|
1531 |
}
|
insilmaril@0
|
1532 |
|
insilmaril@0
|
1533 |
void Main::setupLastMapsMenu()
|
insilmaril@0
|
1534 |
{
|
insilmaril@0
|
1535 |
// Remove double entries
|
insilmaril@0
|
1536 |
QStringList::Iterator it=lastMaps.begin();
|
insilmaril@0
|
1537 |
QStringList::Iterator jt;
|
insilmaril@0
|
1538 |
while (it!=lastMaps.end() )
|
insilmaril@0
|
1539 |
{
|
insilmaril@0
|
1540 |
jt=it;
|
insilmaril@0
|
1541 |
++jt;
|
insilmaril@0
|
1542 |
while (jt!=lastMaps.end() )
|
insilmaril@0
|
1543 |
{
|
insilmaril@0
|
1544 |
if (*it == *jt)
|
insilmaril@0
|
1545 |
jt=lastMaps.remove(jt);
|
insilmaril@0
|
1546 |
else
|
insilmaril@0
|
1547 |
jt++;
|
insilmaril@0
|
1548 |
}
|
insilmaril@0
|
1549 |
it++;
|
insilmaril@0
|
1550 |
}
|
insilmaril@0
|
1551 |
|
insilmaril@0
|
1552 |
// Limit length of list to maxLastMaps
|
insilmaril@0
|
1553 |
while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
|
insilmaril@0
|
1554 |
|
insilmaril@0
|
1555 |
// build Menu from lastMaps string list
|
insilmaril@366
|
1556 |
fileLastMapsMenu->clear();
|
insilmaril@0
|
1557 |
for (it = lastMaps.begin(); it != lastMaps.end(); ++it )
|
insilmaril@366
|
1558 |
fileLastMapsMenu->addAction (*it );
|
insilmaril@0
|
1559 |
}
|
insilmaril@0
|
1560 |
|
insilmaril@0
|
1561 |
void Main::hideEvent (QHideEvent * )
|
insilmaril@0
|
1562 |
{
|
insilmaril@0
|
1563 |
if (!textEditor->isMinimized() ) textEditor->hide();
|
insilmaril@0
|
1564 |
}
|
insilmaril@0
|
1565 |
|
insilmaril@0
|
1566 |
void Main::showEvent (QShowEvent * )
|
insilmaril@0
|
1567 |
{
|
insilmaril@117
|
1568 |
if (textEditor->showWithMain()) textEditor->showNormal();
|
insilmaril@0
|
1569 |
}
|
insilmaril@0
|
1570 |
|
insilmaril@0
|
1571 |
bool Main::reallyWriteDirectory(const QString &dir)
|
insilmaril@0
|
1572 |
{
|
insilmaril@0
|
1573 |
QStringList eList = QDir(dir).entryList();
|
insilmaril@0
|
1574 |
if (eList.first() ==".") eList.pop_front(); // remove "."
|
insilmaril@0
|
1575 |
if (eList.first() =="..") eList.pop_front(); // remove "."
|
insilmaril@0
|
1576 |
if (!eList.isEmpty())
|
insilmaril@0
|
1577 |
{
|
insilmaril@185
|
1578 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
1579 |
tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
|
insilmaril@0
|
1580 |
QMessageBox::Warning,
|
insilmaril@0
|
1581 |
QMessageBox::Yes ,
|
insilmaril@0
|
1582 |
QMessageBox::Cancel | QMessageBox::Default,
|
insilmaril@0
|
1583 |
QMessageBox::QMessageBox::NoButton );
|
insilmaril@0
|
1584 |
|
insilmaril@0
|
1585 |
mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
|
insilmaril@0
|
1586 |
mb.setButtonText( QMessageBox::No, tr("Cancel"));
|
insilmaril@0
|
1587 |
switch( mb.exec() )
|
insilmaril@0
|
1588 |
{
|
insilmaril@0
|
1589 |
case QMessageBox::Yes:
|
insilmaril@0
|
1590 |
// save
|
insilmaril@0
|
1591 |
return true;
|
insilmaril@0
|
1592 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1593 |
// do nothing
|
insilmaril@0
|
1594 |
return false;
|
insilmaril@0
|
1595 |
}
|
insilmaril@0
|
1596 |
}
|
insilmaril@0
|
1597 |
return true;
|
insilmaril@0
|
1598 |
}
|
insilmaril@0
|
1599 |
|
insilmaril@0
|
1600 |
QString Main::browseDirectory (const QString &caption)
|
insilmaril@0
|
1601 |
{
|
insilmaril@366
|
1602 |
Q3FileDialog fd(this,caption);
|
insilmaril@366
|
1603 |
fd.setMode (Q3FileDialog::DirectoryOnly);
|
insilmaril@185
|
1604 |
fd.setCaption(__VYM " - "+caption);
|
insilmaril@0
|
1605 |
fd.show();
|
insilmaril@0
|
1606 |
|
insilmaril@0
|
1607 |
if ( fd.exec() == QDialog::Accepted )
|
insilmaril@0
|
1608 |
return fd.selectedFile();
|
insilmaril@0
|
1609 |
else
|
insilmaril@0
|
1610 |
return "";
|
insilmaril@0
|
1611 |
}
|
insilmaril@0
|
1612 |
|
insilmaril@0
|
1613 |
MapEditor* Main::currentMapEditor() const
|
insilmaril@0
|
1614 |
{
|
insilmaril@0
|
1615 |
if ( tabWidget->currentPage() &&
|
insilmaril@0
|
1616 |
tabWidget->currentPage()->inherits( "MapEditor" ) )
|
insilmaril@0
|
1617 |
return (MapEditor*)tabWidget->currentPage();
|
insilmaril@0
|
1618 |
return NULL;
|
insilmaril@0
|
1619 |
}
|
insilmaril@0
|
1620 |
|
insilmaril@0
|
1621 |
//TODO not used now, maybe use this for overview window later
|
insilmaril@0
|
1622 |
void Main::newView()
|
insilmaril@0
|
1623 |
{
|
insilmaril@0
|
1624 |
// Open a new view... have it delete when closed.
|
insilmaril@366
|
1625 |
Main *m = new Main(0, 0, Qt::WDestructiveClose);
|
insilmaril@0
|
1626 |
qApp->setMainWidget(m);
|
insilmaril@0
|
1627 |
m->show();
|
insilmaril@0
|
1628 |
qApp->setMainWidget(0);
|
insilmaril@0
|
1629 |
}
|
insilmaril@0
|
1630 |
|
insilmaril@0
|
1631 |
void Main::editorChanged(QWidget *)
|
insilmaril@0
|
1632 |
{
|
insilmaril@0
|
1633 |
// Unselect all possibly selected objects
|
insilmaril@0
|
1634 |
// (Important to update note editor)
|
insilmaril@0
|
1635 |
int i;
|
insilmaril@0
|
1636 |
MapEditor *me;
|
insilmaril@0
|
1637 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
1638 |
{
|
insilmaril@0
|
1639 |
|
insilmaril@0
|
1640 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1641 |
me->unselect();
|
insilmaril@0
|
1642 |
}
|
insilmaril@0
|
1643 |
currentMapEditor()->reselect();
|
insilmaril@0
|
1644 |
|
insilmaril@0
|
1645 |
// Update actions to in menus and toolbars according to editor
|
insilmaril@0
|
1646 |
currentMapEditor()->updateActions();
|
insilmaril@0
|
1647 |
}
|
insilmaril@0
|
1648 |
|
insilmaril@0
|
1649 |
void Main::fileNew()
|
insilmaril@0
|
1650 |
{
|
insilmaril@0
|
1651 |
QString fn="unnamed";
|
insilmaril@390
|
1652 |
MapEditor* medit = new MapEditor ( NULL);
|
insilmaril@0
|
1653 |
tabWidget->addTab (medit,fn);
|
insilmaril@0
|
1654 |
tabWidget->showPage(medit);
|
insilmaril@0
|
1655 |
medit->viewport()->setFocus();
|
insilmaril@366
|
1656 |
// For the very first map we do not have flagrows yet...
|
insilmaril@366
|
1657 |
medit->select("mc:");
|
insilmaril@0
|
1658 |
}
|
insilmaril@0
|
1659 |
|
insilmaril@205
|
1660 |
ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
|
insilmaril@0
|
1661 |
{
|
insilmaril@205
|
1662 |
ErrorCode err=success;
|
insilmaril@0
|
1663 |
|
insilmaril@0
|
1664 |
// fn is usually the archive, mapfile the file after uncompressing
|
insilmaril@0
|
1665 |
QString mapfile;
|
insilmaril@0
|
1666 |
|
insilmaril@0
|
1667 |
// Make fn absolute (needed for unzip)
|
insilmaril@0
|
1668 |
fn=QDir (fn).absPath();
|
insilmaril@0
|
1669 |
|
insilmaril@0
|
1670 |
MapEditor *me;
|
insilmaril@0
|
1671 |
|
insilmaril@0
|
1672 |
if (lmode==NewMap)
|
insilmaril@0
|
1673 |
{
|
insilmaril@0
|
1674 |
// Check, if map is already loaded
|
insilmaril@0
|
1675 |
int i=0;
|
insilmaril@0
|
1676 |
while (i<=tabWidget->count() -1)
|
insilmaril@0
|
1677 |
{
|
insilmaril@0
|
1678 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
1679 |
if (me->getFilePath() == fn)
|
insilmaril@0
|
1680 |
{
|
insilmaril@0
|
1681 |
// Already there, ask for confirmation
|
insilmaril@185
|
1682 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
1683 |
tr("The map %1\nis already opened."
|
insilmaril@0
|
1684 |
"Opening the same map in multiple editors may lead \n"
|
insilmaril@0
|
1685 |
"to confusion when finishing working with vym."
|
insilmaril@159
|
1686 |
"Do you want to").arg(fn),
|
insilmaril@0
|
1687 |
QMessageBox::Warning,
|
insilmaril@0
|
1688 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1689 |
QMessageBox::Cancel | QMessageBox::Escape,
|
insilmaril@366
|
1690 |
QMessageBox::NoButton);
|
insilmaril@0
|
1691 |
mb.setButtonText( QMessageBox::Yes, tr("Open anyway") );
|
insilmaril@0
|
1692 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
1693 |
switch( mb.exec() )
|
insilmaril@0
|
1694 |
{
|
insilmaril@0
|
1695 |
case QMessageBox::Yes:
|
insilmaril@0
|
1696 |
// load anyway
|
insilmaril@0
|
1697 |
i=tabWidget->count();
|
insilmaril@0
|
1698 |
break;
|
insilmaril@0
|
1699 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1700 |
// do nothing
|
insilmaril@205
|
1701 |
return aborted;
|
insilmaril@0
|
1702 |
break;
|
insilmaril@0
|
1703 |
}
|
insilmaril@0
|
1704 |
}
|
insilmaril@0
|
1705 |
i++;
|
insilmaril@0
|
1706 |
}
|
insilmaril@0
|
1707 |
}
|
insilmaril@0
|
1708 |
|
insilmaril@0
|
1709 |
|
insilmaril@0
|
1710 |
// Try to load map
|
insilmaril@0
|
1711 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1712 |
{
|
insilmaril@0
|
1713 |
me = currentMapEditor();
|
insilmaril@0
|
1714 |
int tabIndex=tabWidget->currentPageIndex();
|
insilmaril@0
|
1715 |
// Check first, if mapeditor exists
|
insilmaril@0
|
1716 |
// If it is not default AND we want a new map,
|
insilmaril@0
|
1717 |
// create a new mapeditor in a new tab
|
insilmaril@0
|
1718 |
if ( lmode==NewMap && (!me || !me->isDefault() ) )
|
insilmaril@0
|
1719 |
{
|
insilmaril@390
|
1720 |
me= new MapEditor ( NULL);
|
insilmaril@0
|
1721 |
tabWidget->addTab (me,fn);
|
insilmaril@0
|
1722 |
tabIndex=tabWidget->indexOf (me);
|
insilmaril@0
|
1723 |
tabWidget->setCurrentPage (tabIndex);
|
insilmaril@0
|
1724 |
}
|
insilmaril@0
|
1725 |
|
insilmaril@0
|
1726 |
// Check, if file exists (important for creating new files
|
insilmaril@0
|
1727 |
// from command line
|
insilmaril@0
|
1728 |
if (!QFile(fn).exists() )
|
insilmaril@0
|
1729 |
{
|
insilmaril@185
|
1730 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
1731 |
tr("This map does not exist:\n %1\nDo you want to create a new one?").arg(fn),
|
insilmaril@0
|
1732 |
QMessageBox::Question,
|
insilmaril@0
|
1733 |
QMessageBox::Yes ,
|
insilmaril@0
|
1734 |
QMessageBox::Cancel | QMessageBox::Default,
|
insilmaril@366
|
1735 |
QMessageBox::NoButton );
|
insilmaril@0
|
1736 |
|
insilmaril@0
|
1737 |
mb.setButtonText( QMessageBox::Yes, tr("Create"));
|
insilmaril@0
|
1738 |
mb.setButtonText( QMessageBox::No, tr("Cancel"));
|
insilmaril@0
|
1739 |
switch( mb.exec() )
|
insilmaril@0
|
1740 |
{
|
insilmaril@0
|
1741 |
case QMessageBox::Yes:
|
insilmaril@0
|
1742 |
// Create new map
|
insilmaril@0
|
1743 |
currentMapEditor()->setFilePath(fn);
|
insilmaril@0
|
1744 |
tabWidget->setTabLabel (currentMapEditor(),
|
insilmaril@0
|
1745 |
currentMapEditor()->getFileName() );
|
insilmaril@0
|
1746 |
statusBar()->message( "Created " + fn , statusbarTime );
|
insilmaril@205
|
1747 |
return success;
|
insilmaril@0
|
1748 |
|
insilmaril@0
|
1749 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1750 |
// don't create new map
|
insilmaril@0
|
1751 |
statusBar()->message( "Loading " + fn + " failed!", statusbarTime );
|
insilmaril@0
|
1752 |
fileCloseMap();
|
insilmaril@205
|
1753 |
return aborted;
|
insilmaril@0
|
1754 |
}
|
insilmaril@0
|
1755 |
}
|
insilmaril@0
|
1756 |
|
insilmaril@0
|
1757 |
|
insilmaril@0
|
1758 |
//tabWidget->currentPage() won't be NULL here, because of above...
|
insilmaril@0
|
1759 |
tabWidget->showPage(me);
|
insilmaril@0
|
1760 |
me->viewport()->setFocus();
|
insilmaril@0
|
1761 |
|
insilmaril@0
|
1762 |
// Create temporary directory for packing
|
insilmaril@377
|
1763 |
bool ok;
|
insilmaril@377
|
1764 |
QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
|
insilmaril@377
|
1765 |
if (!ok)
|
insilmaril@377
|
1766 |
{
|
insilmaril@377
|
1767 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@377
|
1768 |
tr("Couldn't create temporary directory before load\n"));
|
insilmaril@377
|
1769 |
return aborted;
|
insilmaril@377
|
1770 |
}
|
insilmaril@0
|
1771 |
|
insilmaril@0
|
1772 |
// Try to unzip file
|
insilmaril@185
|
1773 |
err=unzipDir (tmpMapDir,fn);
|
insilmaril@185
|
1774 |
if (err==nozip)
|
insilmaril@0
|
1775 |
{
|
insilmaril@185
|
1776 |
mapfile=fn;
|
insilmaril@185
|
1777 |
me->setZipped(false);
|
insilmaril@0
|
1778 |
} else
|
insilmaril@0
|
1779 |
{
|
insilmaril@185
|
1780 |
me->setZipped(true);
|
insilmaril@185
|
1781 |
|
insilmaril@185
|
1782 |
// Look for mapname.xml
|
insilmaril@185
|
1783 |
mapfile= fn.left(fn.findRev(".",-1,true));
|
insilmaril@185
|
1784 |
mapfile=mapfile.section( '/', -1 );
|
insilmaril@185
|
1785 |
QFile file( tmpMapDir + "/" + mapfile + ".xml");
|
insilmaril@185
|
1786 |
if (!file.exists() )
|
insilmaril@0
|
1787 |
{
|
insilmaril@185
|
1788 |
// mapname.xml does not exist, well,
|
insilmaril@185
|
1789 |
// maybe some renamed the mapname.vym file...
|
insilmaril@185
|
1790 |
// Try to find any .xml in the toplevel
|
insilmaril@185
|
1791 |
// directory of the .vym file
|
insilmaril@185
|
1792 |
QStringList flist=QDir (tmpMapDir).entryList("*.xml");
|
insilmaril@185
|
1793 |
if (flist.count()==1)
|
insilmaril@0
|
1794 |
{
|
insilmaril@185
|
1795 |
// Only one entry, take this one
|
insilmaril@185
|
1796 |
mapfile=tmpMapDir + "/"+flist.first();
|
insilmaril@0
|
1797 |
} else
|
insilmaril@185
|
1798 |
{
|
insilmaril@185
|
1799 |
for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it )
|
insilmaril@185
|
1800 |
*it=tmpMapDir + "/" + *it;
|
insilmaril@185
|
1801 |
// TODO Multiple entries, load all (but only the first one into this ME)
|
insilmaril@185
|
1802 |
//mainWindow->fileLoadFromTmp (flist);
|
insilmaril@185
|
1803 |
//returnCode=1; // Silently forget this attempt to load
|
insilmaril@185
|
1804 |
qWarning ("MainWindow::load (fn) multimap found...");
|
insilmaril@185
|
1805 |
}
|
insilmaril@0
|
1806 |
|
insilmaril@185
|
1807 |
if (flist.isEmpty() )
|
insilmaril@185
|
1808 |
{
|
insilmaril@185
|
1809 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@185
|
1810 |
tr("Couldn't find a map (*.xml) in .vym archive.\n"));
|
insilmaril@185
|
1811 |
err=aborted;
|
insilmaril@185
|
1812 |
}
|
insilmaril@185
|
1813 |
} //file doesn't exist
|
insilmaril@185
|
1814 |
else
|
insilmaril@185
|
1815 |
mapfile=file.name();
|
insilmaril@0
|
1816 |
}
|
insilmaril@0
|
1817 |
|
insilmaril@185
|
1818 |
if (err!=aborted)
|
insilmaril@185
|
1819 |
{
|
insilmaril@185
|
1820 |
// Save existing filename in case we import
|
insilmaril@185
|
1821 |
QString fn_org=me->getFilePath();
|
insilmaril@106
|
1822 |
|
insilmaril@185
|
1823 |
// Finally load map into mapEditor
|
insilmaril@185
|
1824 |
me->setFilePath (mapfile,fn);
|
insilmaril@205
|
1825 |
err=me->load(mapfile,lmode);
|
insilmaril@106
|
1826 |
|
insilmaril@185
|
1827 |
// Restore old (maybe empty) filepath, if this is an import
|
insilmaril@185
|
1828 |
if (lmode!=NewMap)
|
insilmaril@185
|
1829 |
me->setFilePath (fn_org);
|
insilmaril@185
|
1830 |
}
|
insilmaril@0
|
1831 |
|
insilmaril@185
|
1832 |
// Finally check for errors and go home
|
insilmaril@185
|
1833 |
if (err==aborted)
|
insilmaril@185
|
1834 |
{
|
insilmaril@185
|
1835 |
if (lmode==NewMap) fileCloseMap();
|
insilmaril@185
|
1836 |
statusBar()->message( "Could not load " + fn, statusbarTime );
|
insilmaril@185
|
1837 |
} else
|
insilmaril@0
|
1838 |
{
|
insilmaril@0
|
1839 |
if (lmode==NewMap)
|
insilmaril@0
|
1840 |
{
|
insilmaril@0
|
1841 |
me->setFilePath (fn);
|
insilmaril@0
|
1842 |
tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
|
insilmaril@205
|
1843 |
if (fn.left(9)!="/tmp/vym-")
|
insilmaril@205
|
1844 |
{
|
insilmaril@205
|
1845 |
// Only append to lastMaps if not loaded from a tmpDir
|
insilmaril@205
|
1846 |
// e.g. imported bookmarks are in a tmpDir
|
insilmaril@205
|
1847 |
lastMaps.prepend(me->getFilePath() );
|
insilmaril@205
|
1848 |
setupLastMapsMenu();
|
insilmaril@205
|
1849 |
}
|
insilmaril@0
|
1850 |
actionFilePrint->setEnabled (true);
|
insilmaril@0
|
1851 |
}
|
insilmaril@0
|
1852 |
statusBar()->message( "Loaded " + fn, statusbarTime );
|
insilmaril@0
|
1853 |
}
|
insilmaril@0
|
1854 |
|
insilmaril@185
|
1855 |
// Delete tmpDir
|
insilmaril@185
|
1856 |
removeDir (QDir(tmpMapDir));
|
insilmaril@0
|
1857 |
}
|
insilmaril@205
|
1858 |
return err;
|
insilmaril@0
|
1859 |
}
|
insilmaril@0
|
1860 |
|
insilmaril@0
|
1861 |
|
insilmaril@0
|
1862 |
void Main::fileLoad(const LoadMode &lmode)
|
insilmaril@0
|
1863 |
{
|
insilmaril@377
|
1864 |
QStringList filters;
|
insilmaril@389
|
1865 |
filters <<"VYM map (*.vym *.vyp)"<<"XML (*.xml)";
|
insilmaril@377
|
1866 |
QFileDialog *fd=new QFileDialog( this);
|
insilmaril@366
|
1867 |
fd->setDir (lastFileDir);
|
insilmaril@377
|
1868 |
fd->setFileMode (QFileDialog::ExistingFiles);
|
insilmaril@377
|
1869 |
fd->setFilters (filters);
|
insilmaril@0
|
1870 |
switch (lmode)
|
insilmaril@0
|
1871 |
{
|
insilmaril@0
|
1872 |
case NewMap:
|
insilmaril@377
|
1873 |
fd->setCaption(__VYM " - " +tr("Load vym map"));
|
insilmaril@0
|
1874 |
break;
|
insilmaril@0
|
1875 |
case ImportAdd:
|
insilmaril@377
|
1876 |
fd->setCaption(__VYM " - " +tr("Import: Add vym map to selection"));
|
insilmaril@0
|
1877 |
break;
|
insilmaril@0
|
1878 |
case ImportReplace:
|
insilmaril@377
|
1879 |
fd->setCaption(__VYM " - " +tr("Import: Replace selection with vym map"));
|
insilmaril@0
|
1880 |
break;
|
insilmaril@0
|
1881 |
}
|
insilmaril@0
|
1882 |
fd->show();
|
insilmaril@0
|
1883 |
|
insilmaril@0
|
1884 |
QString fn;
|
insilmaril@0
|
1885 |
if ( fd->exec() == QDialog::Accepted )
|
insilmaril@0
|
1886 |
{
|
insilmaril@377
|
1887 |
lastFileDir=fd->directory().path();
|
insilmaril@185
|
1888 |
QStringList flist = fd->selectedFiles();
|
insilmaril@185
|
1889 |
QStringList::Iterator it = flist.begin();
|
insilmaril@185
|
1890 |
while( it != flist.end() )
|
insilmaril@185
|
1891 |
{
|
insilmaril@185
|
1892 |
fn = *it;
|
insilmaril@185
|
1893 |
fileLoad(*it, lmode);
|
insilmaril@185
|
1894 |
++it;
|
insilmaril@185
|
1895 |
}
|
insilmaril@0
|
1896 |
}
|
insilmaril@185
|
1897 |
delete (fd);
|
insilmaril@0
|
1898 |
}
|
insilmaril@0
|
1899 |
|
insilmaril@0
|
1900 |
void Main::fileLoad()
|
insilmaril@0
|
1901 |
{
|
insilmaril@0
|
1902 |
fileLoad (NewMap);
|
insilmaril@0
|
1903 |
}
|
insilmaril@0
|
1904 |
|
insilmaril@366
|
1905 |
void Main::fileLoadLast(QAction *a)
|
insilmaril@0
|
1906 |
{
|
insilmaril@366
|
1907 |
fileLoad(lastMaps.at(fileLastMapsMenu->actions().indexOf(a)) ,NewMap);
|
insilmaril@0
|
1908 |
}
|
insilmaril@0
|
1909 |
|
insilmaril@0
|
1910 |
void Main::fileSave(const SaveMode &savemode)
|
insilmaril@0
|
1911 |
{
|
insilmaril@0
|
1912 |
// tmp dir for zipping
|
insilmaril@0
|
1913 |
QString tmpMapDir;
|
insilmaril@0
|
1914 |
|
insilmaril@0
|
1915 |
// Error codes
|
insilmaril@205
|
1916 |
ErrorCode err=success;
|
insilmaril@0
|
1917 |
|
insilmaril@0
|
1918 |
QString safeFilePath;
|
insilmaril@0
|
1919 |
|
insilmaril@0
|
1920 |
bool saveZipped=currentMapEditor()->saveZipped();
|
insilmaril@0
|
1921 |
|
insilmaril@151
|
1922 |
MapEditor * me=currentMapEditor();
|
insilmaril@151
|
1923 |
if (me)
|
insilmaril@0
|
1924 |
{
|
insilmaril@151
|
1925 |
QString fn=me->getFilePath();
|
insilmaril@0
|
1926 |
// filename=unnamed, filepath="" in constructor...
|
insilmaril@0
|
1927 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
1928 |
{
|
insilmaril@0
|
1929 |
// We have a filepath, go on saving
|
insilmaril@0
|
1930 |
// First remove existing file, we
|
insilmaril@0
|
1931 |
// don't want to add to old zip archives
|
insilmaril@0
|
1932 |
QFile f(fn);
|
insilmaril@0
|
1933 |
if (f.exists() )
|
insilmaril@0
|
1934 |
if (!f.remove())
|
insilmaril@0
|
1935 |
QMessageBox::warning( 0, tr( "Save Error" ),
|
insilmaril@0
|
1936 |
fn+ tr("\ncould not be removed before saving"));
|
insilmaril@0
|
1937 |
|
insilmaril@0
|
1938 |
// Look, if we should zip the data:
|
insilmaril@0
|
1939 |
if (!saveZipped)
|
insilmaril@0
|
1940 |
{
|
insilmaril@185
|
1941 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
1942 |
tr("The map %1\ndid not use the compressed "
|
insilmaril@0
|
1943 |
"vym file format.\nWriting it uncompressed will also write images \n"
|
insilmaril@0
|
1944 |
"and flags and thus may overwrite files in the "
|
insilmaril@159
|
1945 |
"given directory\n\nDo you want to write the map").arg(fn),
|
insilmaril@0
|
1946 |
QMessageBox::Warning,
|
insilmaril@0
|
1947 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
1948 |
QMessageBox::No ,
|
insilmaril@0
|
1949 |
QMessageBox::Cancel | QMessageBox::Escape);
|
insilmaril@0
|
1950 |
mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
|
insilmaril@0
|
1951 |
mb.setButtonText( QMessageBox::No, tr("uncompressed") );
|
insilmaril@0
|
1952 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
1953 |
switch( mb.exec() )
|
insilmaril@0
|
1954 |
{
|
insilmaril@0
|
1955 |
case QMessageBox::Yes:
|
insilmaril@0
|
1956 |
// save compressed (default file format)
|
insilmaril@0
|
1957 |
saveZipped=true;
|
insilmaril@0
|
1958 |
break;
|
insilmaril@0
|
1959 |
case QMessageBox::No:
|
insilmaril@0
|
1960 |
// save uncompressed
|
insilmaril@0
|
1961 |
saveZipped=false;
|
insilmaril@0
|
1962 |
break;
|
insilmaril@0
|
1963 |
case QMessageBox::Cancel:
|
insilmaril@0
|
1964 |
// do nothing
|
insilmaril@0
|
1965 |
return;
|
insilmaril@0
|
1966 |
break;
|
insilmaril@0
|
1967 |
}
|
insilmaril@0
|
1968 |
}
|
insilmaril@0
|
1969 |
|
insilmaril@0
|
1970 |
if (saveZipped)
|
insilmaril@0
|
1971 |
{
|
insilmaril@377
|
1972 |
// Create temporary directory for packing
|
insilmaril@377
|
1973 |
bool ok;
|
insilmaril@377
|
1974 |
QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX");
|
insilmaril@377
|
1975 |
if (!ok)
|
insilmaril@377
|
1976 |
{
|
insilmaril@377
|
1977 |
QMessageBox::critical( 0, tr( "Critical Load Error" ),
|
insilmaril@377
|
1978 |
tr("Couldn't create temporary directory before save\n"));
|
insilmaril@377
|
1979 |
return;
|
insilmaril@377
|
1980 |
}
|
insilmaril@377
|
1981 |
|
insilmaril@151
|
1982 |
safeFilePath=me->getFilePath();
|
insilmaril@151
|
1983 |
me->setFilePath (tmpMapDir+"/"+
|
insilmaril@151
|
1984 |
me->getMapName()+ ".xml",
|
insilmaril@0
|
1985 |
safeFilePath);
|
insilmaril@151
|
1986 |
me->save (savemode);
|
insilmaril@151
|
1987 |
me->setFilePath (safeFilePath);
|
insilmaril@0
|
1988 |
|
insilmaril@175
|
1989 |
zipDir (tmpMapDir,fn);
|
insilmaril@0
|
1990 |
} // save zipped
|
insilmaril@0
|
1991 |
else
|
insilmaril@0
|
1992 |
{
|
insilmaril@0
|
1993 |
// Save unzipped.
|
insilmaril@151
|
1994 |
safeFilePath=me->getFilePath();
|
insilmaril@151
|
1995 |
me->setFilePath (fn, safeFilePath);
|
insilmaril@151
|
1996 |
me->save (savemode);
|
insilmaril@151
|
1997 |
me->setFilePath (safeFilePath);
|
insilmaril@0
|
1998 |
} // save zipped
|
insilmaril@0
|
1999 |
} // filepath available
|
insilmaril@0
|
2000 |
else
|
insilmaril@0
|
2001 |
{
|
insilmaril@0
|
2002 |
// We have no filepath yet,
|
insilmaril@0
|
2003 |
// call fileSaveAs() now, this will call fileSave()
|
insilmaril@0
|
2004 |
// again.
|
insilmaril@0
|
2005 |
fileSaveAs(savemode);
|
insilmaril@0
|
2006 |
}
|
insilmaril@0
|
2007 |
}
|
insilmaril@0
|
2008 |
|
insilmaril@250
|
2009 |
if (saveZipped && !tmpMapDir.isEmpty())
|
insilmaril@0
|
2010 |
// Delete tmpDir
|
insilmaril@175
|
2011 |
removeDir (QDir(tmpMapDir));
|
insilmaril@0
|
2012 |
|
insilmaril@0
|
2013 |
if (err==success)
|
insilmaril@151
|
2014 |
{
|
insilmaril@0
|
2015 |
statusBar()->message(
|
insilmaril@159
|
2016 |
tr("Saved %1").arg(me->getFilePath()),
|
insilmaril@0
|
2017 |
statusbarTime );
|
insilmaril@151
|
2018 |
lastMaps.prepend(me->getFilePath() );
|
insilmaril@151
|
2019 |
setupLastMapsMenu();
|
insilmaril@151
|
2020 |
} else
|
insilmaril@0
|
2021 |
statusBar()->message(
|
insilmaril@159
|
2022 |
tr("Couldn't save ").arg(me->getFilePath()),
|
insilmaril@0
|
2023 |
statusbarTime );
|
insilmaril@0
|
2024 |
}
|
insilmaril@0
|
2025 |
|
insilmaril@0
|
2026 |
void Main::fileSave()
|
insilmaril@0
|
2027 |
{
|
insilmaril@0
|
2028 |
fileSave (CompleteMap);
|
insilmaril@0
|
2029 |
}
|
insilmaril@0
|
2030 |
|
insilmaril@0
|
2031 |
void Main::fileSaveAs(const SaveMode& savemode)
|
insilmaril@0
|
2032 |
{
|
insilmaril@0
|
2033 |
QString fn;
|
insilmaril@0
|
2034 |
|
insilmaril@0
|
2035 |
if (currentMapEditor())
|
insilmaril@0
|
2036 |
{
|
insilmaril@0
|
2037 |
if (savemode==CompleteMap)
|
insilmaril@366
|
2038 |
fn = Q3FileDialog::getSaveFileName( QString::null, "VYM map (*.vym)", this );
|
insilmaril@0
|
2039 |
else
|
insilmaril@366
|
2040 |
fn = Q3FileDialog::getSaveFileName( QString::null, "VYM part of map (*.vyp)", this );
|
insilmaril@0
|
2041 |
if ( !fn.isEmpty() )
|
insilmaril@0
|
2042 |
{
|
insilmaril@0
|
2043 |
// Check for existing file
|
insilmaril@0
|
2044 |
if (QFile (fn).exists())
|
insilmaril@0
|
2045 |
{
|
insilmaril@185
|
2046 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
2047 |
tr("The file %1\nexists already. Do you want to").arg(fn),
|
insilmaril@0
|
2048 |
QMessageBox::Warning,
|
insilmaril@0
|
2049 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
2050 |
QMessageBox::Cancel | QMessageBox::Escape,
|
insilmaril@366
|
2051 |
QMessageBox::NoButton);
|
insilmaril@0
|
2052 |
mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
|
insilmaril@0
|
2053 |
mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
|
insilmaril@0
|
2054 |
switch( mb.exec() )
|
insilmaril@0
|
2055 |
{
|
insilmaril@0
|
2056 |
case QMessageBox::Yes:
|
insilmaril@0
|
2057 |
// save
|
insilmaril@0
|
2058 |
break;
|
insilmaril@0
|
2059 |
case QMessageBox::Cancel:
|
insilmaril@0
|
2060 |
// do nothing
|
insilmaril@0
|
2061 |
return;
|
insilmaril@0
|
2062 |
break;
|
insilmaril@0
|
2063 |
}
|
insilmaril@0
|
2064 |
} else
|
insilmaril@0
|
2065 |
{
|
insilmaril@0
|
2066 |
// New file, add extension to filename, if missing
|
insilmaril@0
|
2067 |
// This is always .vym or .vyp, depending on savemode
|
insilmaril@0
|
2068 |
if (savemode==CompleteMap)
|
insilmaril@0
|
2069 |
{
|
insilmaril@0
|
2070 |
if (!fn.contains (".vym") && !fn.contains (".xml"))
|
insilmaril@0
|
2071 |
fn +=".vym";
|
insilmaril@0
|
2072 |
} else
|
insilmaril@0
|
2073 |
{
|
insilmaril@0
|
2074 |
if (!fn.contains (".vyp") && !fn.contains (".xml"))
|
insilmaril@0
|
2075 |
fn +=".vyp";
|
insilmaril@0
|
2076 |
}
|
insilmaril@0
|
2077 |
}
|
insilmaril@0
|
2078 |
|
insilmaril@0
|
2079 |
|
insilmaril@0
|
2080 |
|
insilmaril@0
|
2081 |
|
insilmaril@0
|
2082 |
// Save now
|
insilmaril@0
|
2083 |
currentMapEditor()->setFilePath(fn);
|
insilmaril@0
|
2084 |
fileSave(savemode);
|
insilmaril@0
|
2085 |
|
insilmaril@0
|
2086 |
// Set name of tab
|
insilmaril@94
|
2087 |
if (savemode==CompleteMap)
|
insilmaril@94
|
2088 |
tabWidget->setTabLabel (currentMapEditor(),
|
insilmaril@94
|
2089 |
currentMapEditor()->getFileName() );
|
insilmaril@0
|
2090 |
return;
|
insilmaril@0
|
2091 |
}
|
insilmaril@0
|
2092 |
}
|
insilmaril@0
|
2093 |
}
|
insilmaril@0
|
2094 |
|
insilmaril@0
|
2095 |
void Main::fileSaveAs()
|
insilmaril@0
|
2096 |
{
|
insilmaril@0
|
2097 |
fileSaveAs (CompleteMap);
|
insilmaril@0
|
2098 |
}
|
insilmaril@0
|
2099 |
|
insilmaril@205
|
2100 |
void Main::fileImportKDEBookmarks()
|
insilmaril@205
|
2101 |
{
|
insilmaril@205
|
2102 |
ImportKDEBookmarks im;
|
insilmaril@205
|
2103 |
im.transform();
|
insilmaril@205
|
2104 |
if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
|
insilmaril@205
|
2105 |
currentMapEditor()->setFilePath ("");
|
insilmaril@205
|
2106 |
}
|
insilmaril@205
|
2107 |
|
insilmaril@314
|
2108 |
void Main::fileImportFirefoxBookmarks()
|
insilmaril@314
|
2109 |
{
|
insilmaril@366
|
2110 |
Q3FileDialog *fd=new Q3FileDialog( this);
|
insilmaril@327
|
2111 |
fd->setDir (vymBaseDir.homeDirPath()+"/.mozilla/firefox");
|
insilmaril@366
|
2112 |
fd->setMode (Q3FileDialog::ExistingFiles);
|
insilmaril@327
|
2113 |
fd->addFilter ("Firefox "+tr("Bookmarks")+" (*.html)");
|
insilmaril@327
|
2114 |
fd->setCaption(tr("Import")+" "+"Firefox "+tr("Bookmarks"));
|
insilmaril@327
|
2115 |
fd->show();
|
insilmaril@327
|
2116 |
|
insilmaril@327
|
2117 |
if ( fd->exec() == QDialog::Accepted )
|
insilmaril@327
|
2118 |
{
|
insilmaril@327
|
2119 |
ImportFirefoxBookmarks im;
|
insilmaril@327
|
2120 |
QStringList flist = fd->selectedFiles();
|
insilmaril@327
|
2121 |
QStringList::Iterator it = flist.begin();
|
insilmaril@327
|
2122 |
while( it != flist.end() )
|
insilmaril@327
|
2123 |
{
|
insilmaril@327
|
2124 |
im.setFile (*it);
|
insilmaril@327
|
2125 |
if (im.transform() &&
|
insilmaril@327
|
2126 |
success==fileLoad (im.getTransformedFile(),NewMap) &&
|
insilmaril@327
|
2127 |
currentMapEditor() )
|
insilmaril@327
|
2128 |
currentMapEditor()->setFilePath ("");
|
insilmaril@327
|
2129 |
++it;
|
insilmaril@327
|
2130 |
}
|
insilmaril@327
|
2131 |
}
|
insilmaril@327
|
2132 |
delete (fd);
|
insilmaril@314
|
2133 |
}
|
insilmaril@314
|
2134 |
|
insilmaril@215
|
2135 |
void Main::fileImportMM()
|
insilmaril@215
|
2136 |
{
|
insilmaril@215
|
2137 |
ImportMM im;
|
insilmaril@215
|
2138 |
|
insilmaril@366
|
2139 |
Q3FileDialog *fd=new Q3FileDialog( this);
|
insilmaril@366
|
2140 |
fd->setDir (lastFileDir);
|
insilmaril@366
|
2141 |
fd->setMode (Q3FileDialog::ExistingFiles);
|
insilmaril@215
|
2142 |
fd->addFilter ("Mind Manager (*.mmap)");
|
insilmaril@215
|
2143 |
fd->setCaption(tr("Import")+" "+"Mind Manager");
|
insilmaril@215
|
2144 |
fd->show();
|
insilmaril@215
|
2145 |
|
insilmaril@215
|
2146 |
if ( fd->exec() == QDialog::Accepted )
|
insilmaril@215
|
2147 |
{
|
insilmaril@215
|
2148 |
lastFileDir=fd->dirPath();
|
insilmaril@215
|
2149 |
QStringList flist = fd->selectedFiles();
|
insilmaril@215
|
2150 |
QStringList::Iterator it = flist.begin();
|
insilmaril@215
|
2151 |
while( it != flist.end() )
|
insilmaril@215
|
2152 |
{
|
insilmaril@215
|
2153 |
im.setFile (*it);
|
insilmaril@215
|
2154 |
if (im.transform() &&
|
insilmaril@215
|
2155 |
success==fileLoad (im.getTransformedFile(),NewMap) &&
|
insilmaril@215
|
2156 |
currentMapEditor() )
|
insilmaril@215
|
2157 |
currentMapEditor()->setFilePath ("");
|
insilmaril@215
|
2158 |
|
insilmaril@215
|
2159 |
++it;
|
insilmaril@215
|
2160 |
}
|
insilmaril@215
|
2161 |
}
|
insilmaril@215
|
2162 |
delete (fd);
|
insilmaril@215
|
2163 |
|
insilmaril@215
|
2164 |
}
|
insilmaril@215
|
2165 |
|
insilmaril@215
|
2166 |
void Main::fileImportDir()
|
insilmaril@215
|
2167 |
{
|
insilmaril@215
|
2168 |
if (currentMapEditor())
|
insilmaril@215
|
2169 |
currentMapEditor()->importDir();
|
insilmaril@215
|
2170 |
}
|
insilmaril@215
|
2171 |
|
insilmaril@0
|
2172 |
void Main::fileExportXML()
|
insilmaril@0
|
2173 |
{
|
insilmaril@0
|
2174 |
if (currentMapEditor())
|
insilmaril@0
|
2175 |
{
|
insilmaril@0
|
2176 |
QString dir=browseDirectory(tr("Export XML to directory"));
|
insilmaril@0
|
2177 |
if (dir !="" && reallyWriteDirectory(dir) )
|
insilmaril@0
|
2178 |
currentMapEditor()->exportXML(dir);
|
insilmaril@0
|
2179 |
}
|
insilmaril@0
|
2180 |
}
|
insilmaril@0
|
2181 |
|
insilmaril@0
|
2182 |
|
insilmaril@0
|
2183 |
void Main::fileExportXHTML()
|
insilmaril@0
|
2184 |
{
|
insilmaril@260
|
2185 |
MapEditor *me=currentMapEditor();
|
insilmaril@0
|
2186 |
QString dir;
|
insilmaril@260
|
2187 |
if (me)
|
insilmaril@0
|
2188 |
{
|
insilmaril@0
|
2189 |
ExportXHTMLDialog dia(this);
|
insilmaril@260
|
2190 |
dia.setFilePath (me->getFilePath() );
|
insilmaril@260
|
2191 |
dia.setMapName (me->getMapName() );
|
insilmaril@0
|
2192 |
dia.readSettings();
|
insilmaril@0
|
2193 |
|
insilmaril@0
|
2194 |
if (dia.exec()==QDialog::Accepted)
|
insilmaril@0
|
2195 |
{
|
insilmaril@0
|
2196 |
QString dir=dia.getDir();
|
insilmaril@0
|
2197 |
// Check, if warnings should be used before overwriting
|
insilmaril@0
|
2198 |
// the output directory
|
insilmaril@0
|
2199 |
bool ok;
|
insilmaril@0
|
2200 |
if (dia.warnings())
|
insilmaril@0
|
2201 |
ok=reallyWriteDirectory(dir);
|
insilmaril@0
|
2202 |
else
|
insilmaril@0
|
2203 |
ok=true;
|
insilmaril@0
|
2204 |
|
insilmaril@0
|
2205 |
if (ok)
|
insilmaril@0
|
2206 |
{
|
insilmaril@260
|
2207 |
me->exportXML (dia.getDir() );
|
insilmaril@260
|
2208 |
dia.doExport(me->getMapName() );
|
insilmaril@0
|
2209 |
if (dia.hasChanged())
|
insilmaril@260
|
2210 |
me->setChanged();
|
insilmaril@0
|
2211 |
}
|
insilmaril@0
|
2212 |
}
|
insilmaril@0
|
2213 |
}
|
insilmaril@0
|
2214 |
}
|
insilmaril@0
|
2215 |
|
insilmaril@366
|
2216 |
void Main::fileExportImage()
|
insilmaril@0
|
2217 |
{
|
insilmaril@260
|
2218 |
MapEditor *me=currentMapEditor();
|
insilmaril@260
|
2219 |
if (me)
|
insilmaril@0
|
2220 |
{
|
insilmaril@366
|
2221 |
QStringList fl;
|
insilmaril@366
|
2222 |
QFileDialog *fd=new QFileDialog (this);
|
insilmaril@366
|
2223 |
fd->setCaption (tr("Export map as image"));
|
insilmaril@366
|
2224 |
fd->setFileMode(QFileDialog::AnyFile);
|
insilmaril@366
|
2225 |
fd->setFilters (imageIO.getFilters() );
|
insilmaril@366
|
2226 |
fd->setDirectory (lastImageDir);
|
insilmaril@366
|
2227 |
if (fd->exec())
|
insilmaril@366
|
2228 |
{
|
insilmaril@366
|
2229 |
fl=fd->selectedFiles();
|
insilmaril@366
|
2230 |
qWarning ("Selected "+fl.first()+" filter: "+fd->selectedFilter());
|
insilmaril@366
|
2231 |
me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) );
|
insilmaril@366
|
2232 |
}
|
insilmaril@0
|
2233 |
}
|
insilmaril@0
|
2234 |
}
|
insilmaril@0
|
2235 |
|
insilmaril@0
|
2236 |
void Main::fileExportASCII()
|
insilmaril@0
|
2237 |
{
|
insilmaril@260
|
2238 |
MapEditor *me=currentMapEditor();
|
insilmaril@260
|
2239 |
if (me)
|
insilmaril@228
|
2240 |
{
|
insilmaril@228
|
2241 |
ExportASCII ex;
|
insilmaril@260
|
2242 |
ex.setMapCenter(me->getMapCenter());
|
insilmaril@228
|
2243 |
ex.addFilter ("TXT (*.txt)");
|
insilmaril@228
|
2244 |
ex.setCaption(__VYM " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
|
insilmaril@260
|
2245 |
if (ex.execDialog() )
|
insilmaril@260
|
2246 |
{
|
insilmaril@260
|
2247 |
me->setExportMode(true);
|
insilmaril@260
|
2248 |
ex.doExport();
|
insilmaril@260
|
2249 |
me->setExportMode(false);
|
insilmaril@260
|
2250 |
}
|
insilmaril@228
|
2251 |
}
|
insilmaril@0
|
2252 |
}
|
insilmaril@0
|
2253 |
|
insilmaril@163
|
2254 |
void Main::fileExportLaTeX()
|
insilmaril@163
|
2255 |
{
|
insilmaril@260
|
2256 |
MapEditor *me=currentMapEditor();
|
insilmaril@260
|
2257 |
if (me)
|
insilmaril@228
|
2258 |
{
|
insilmaril@228
|
2259 |
ExportLaTeX ex;
|
insilmaril@260
|
2260 |
ex.setMapCenter(me->getMapCenter());
|
insilmaril@228
|
2261 |
ex.addFilter ("Tex (*.tex)");
|
insilmaril@228
|
2262 |
ex.setCaption(__VYM " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
|
insilmaril@260
|
2263 |
if (ex.execDialog() )
|
insilmaril@260
|
2264 |
{
|
insilmaril@260
|
2265 |
me->setExportMode(true);
|
insilmaril@260
|
2266 |
ex.doExport();
|
insilmaril@260
|
2267 |
me->setExportMode(false);
|
insilmaril@260
|
2268 |
}
|
insilmaril@228
|
2269 |
}
|
insilmaril@228
|
2270 |
}
|
insilmaril@228
|
2271 |
|
insilmaril@243
|
2272 |
void Main::fileExportKDEBookmarks()
|
insilmaril@243
|
2273 |
{
|
insilmaril@243
|
2274 |
ExportKDEBookmarks ex;
|
insilmaril@260
|
2275 |
MapEditor *me=currentMapEditor();
|
insilmaril@260
|
2276 |
if (me)
|
insilmaril@243
|
2277 |
{
|
insilmaril@260
|
2278 |
ex.setMapCenter (me->getMapCenter() );
|
insilmaril@243
|
2279 |
ex.doExport();
|
insilmaril@243
|
2280 |
}
|
insilmaril@243
|
2281 |
}
|
insilmaril@243
|
2282 |
|
insilmaril@228
|
2283 |
void Main::fileExportTaskjuggler()
|
insilmaril@228
|
2284 |
{
|
insilmaril@228
|
2285 |
ExportTaskjuggler ex;
|
insilmaril@260
|
2286 |
MapEditor *me=currentMapEditor();
|
insilmaril@260
|
2287 |
if (me)
|
insilmaril@228
|
2288 |
{
|
insilmaril@260
|
2289 |
ex.setMapCenter (me->getMapCenter() );
|
insilmaril@228
|
2290 |
ex.setCaption ( __VYM " - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
|
insilmaril@243
|
2291 |
ex.addFilter ("Taskjuggler (*.tjp)");
|
insilmaril@260
|
2292 |
if (ex.execDialog() )
|
insilmaril@260
|
2293 |
{
|
insilmaril@260
|
2294 |
me->setExportMode(true);
|
insilmaril@260
|
2295 |
ex.doExport();
|
insilmaril@260
|
2296 |
me->setExportMode(false);
|
insilmaril@260
|
2297 |
}
|
insilmaril@228
|
2298 |
}
|
insilmaril@163
|
2299 |
}
|
insilmaril@163
|
2300 |
|
insilmaril@163
|
2301 |
void Main::fileExportOOPresentation()
|
insilmaril@163
|
2302 |
{
|
insilmaril@228
|
2303 |
ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to")+" Open Office");
|
insilmaril@366
|
2304 |
// TODO add preview in dialog
|
insilmaril@185
|
2305 |
//ImagePreview *p =new ImagePreview (fd);
|
insilmaril@185
|
2306 |
//fd->setContentsPreviewEnabled( TRUE );
|
insilmaril@185
|
2307 |
//fd->setContentsPreview( p, p );
|
insilmaril@185
|
2308 |
//fd->setPreviewMode( QFileDialog::Contents );
|
insilmaril@228
|
2309 |
fd->setCaption(__VYM " - " +tr("Export to")+" Open Office");
|
insilmaril@366
|
2310 |
fd->setDir (QDir().current());
|
insilmaril@357
|
2311 |
if (fd->foundConfig())
|
insilmaril@357
|
2312 |
{
|
insilmaril@357
|
2313 |
fd->show();
|
insilmaril@185
|
2314 |
|
insilmaril@357
|
2315 |
if ( fd->exec() == QDialog::Accepted )
|
insilmaril@357
|
2316 |
{
|
insilmaril@357
|
2317 |
QString fn=fd->selectedFile();
|
insilmaril@366
|
2318 |
if (!fn.contains (".odp"))
|
insilmaril@366
|
2319 |
fn +=".odp";
|
insilmaril@366
|
2320 |
|
insilmaril@357
|
2321 |
//lastImageDir=fn.left(fn.findRev ("/"));
|
insilmaril@357
|
2322 |
if (currentMapEditor())
|
insilmaril@357
|
2323 |
currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());
|
insilmaril@357
|
2324 |
}
|
insilmaril@357
|
2325 |
} else
|
insilmaril@185
|
2326 |
{
|
insilmaril@357
|
2327 |
QMessageBox::warning(0,
|
insilmaril@366
|
2328 |
tr("Warning"),
|
insilmaril@366
|
2329 |
tr("Couldn't find configuration for export to Open Office\n"));
|
insilmaril@185
|
2330 |
}
|
insilmaril@163
|
2331 |
}
|
insilmaril@163
|
2332 |
|
insilmaril@0
|
2333 |
void Main::fileCloseMap()
|
insilmaril@0
|
2334 |
{
|
insilmaril@0
|
2335 |
if (currentMapEditor())
|
insilmaril@0
|
2336 |
{
|
insilmaril@0
|
2337 |
if (currentMapEditor()->hasChanged())
|
insilmaril@0
|
2338 |
{
|
insilmaril@185
|
2339 |
QMessageBox mb( __VYM,
|
insilmaril@159
|
2340 |
tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
|
insilmaril@0
|
2341 |
QMessageBox::Warning,
|
insilmaril@0
|
2342 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
2343 |
QMessageBox::No,
|
insilmaril@0
|
2344 |
QMessageBox::Cancel | QMessageBox::Escape );
|
insilmaril@0
|
2345 |
mb.setButtonText( QMessageBox::Yes, tr("Save modified map before closing it") );
|
insilmaril@0
|
2346 |
mb.setButtonText( QMessageBox::No, tr("Discard changes"));
|
insilmaril@0
|
2347 |
switch( mb.exec() )
|
insilmaril@0
|
2348 |
{
|
insilmaril@0
|
2349 |
case QMessageBox::Yes:
|
insilmaril@0
|
2350 |
// save and close
|
insilmaril@0
|
2351 |
fileSave(CompleteMap);
|
insilmaril@0
|
2352 |
break;
|
insilmaril@0
|
2353 |
case QMessageBox::No:
|
insilmaril@0
|
2354 |
// close without saving
|
insilmaril@0
|
2355 |
break;
|
insilmaril@0
|
2356 |
case QMessageBox::Cancel:
|
insilmaril@0
|
2357 |
// do nothing
|
insilmaril@0
|
2358 |
return;
|
insilmaril@0
|
2359 |
}
|
insilmaril@0
|
2360 |
}
|
insilmaril@0
|
2361 |
currentMapEditor()->closeMap();
|
insilmaril@0
|
2362 |
tabWidget->removePage(currentMapEditor());
|
insilmaril@0
|
2363 |
if (tabWidget->count()==0)
|
insilmaril@0
|
2364 |
actionFilePrint->setEnabled (false);
|
insilmaril@0
|
2365 |
}
|
insilmaril@0
|
2366 |
}
|
insilmaril@0
|
2367 |
|
insilmaril@0
|
2368 |
void Main::filePrint()
|
insilmaril@0
|
2369 |
{
|
insilmaril@0
|
2370 |
if (currentMapEditor())
|
insilmaril@0
|
2371 |
currentMapEditor()->print();
|
insilmaril@0
|
2372 |
}
|
insilmaril@0
|
2373 |
|
insilmaril@0
|
2374 |
void Main::fileExitVYM()
|
insilmaril@0
|
2375 |
{
|
insilmaril@0
|
2376 |
// Check if one or more editors have changed
|
insilmaril@0
|
2377 |
MapEditor *me;
|
insilmaril@0
|
2378 |
int i;
|
insilmaril@0
|
2379 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
2380 |
{
|
insilmaril@0
|
2381 |
|
insilmaril@0
|
2382 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@0
|
2383 |
|
insilmaril@0
|
2384 |
// If something changed, ask what to do
|
insilmaril@0
|
2385 |
if (me->isUnsaved())
|
insilmaril@0
|
2386 |
{
|
insilmaril@0
|
2387 |
tabWidget->setCurrentPage(i);
|
insilmaril@185
|
2388 |
QMessageBox mb( __VYM,
|
insilmaril@0
|
2389 |
tr("This map is not saved yet. Do you want to"),
|
insilmaril@0
|
2390 |
QMessageBox::Warning,
|
insilmaril@0
|
2391 |
QMessageBox::Yes | QMessageBox::Default,
|
insilmaril@0
|
2392 |
QMessageBox::No,
|
insilmaril@0
|
2393 |
QMessageBox::Cancel | QMessageBox::Escape );
|
insilmaril@0
|
2394 |
mb.setButtonText( QMessageBox::Yes, tr("Save map") );
|
insilmaril@0
|
2395 |
mb.setButtonText( QMessageBox::No, tr("Discard changes") );
|
insilmaril@366
|
2396 |
mb.setModal (true);
|
insilmaril@0
|
2397 |
mb.show();
|
insilmaril@0
|
2398 |
mb.setActiveWindow();
|
insilmaril@0
|
2399 |
switch( mb.exec() ) {
|
insilmaril@0
|
2400 |
case QMessageBox::Yes:
|
insilmaril@0
|
2401 |
// save (the changed editors) and exit
|
insilmaril@0
|
2402 |
fileSave(CompleteMap);
|
insilmaril@0
|
2403 |
break;
|
insilmaril@0
|
2404 |
case QMessageBox::No:
|
insilmaril@0
|
2405 |
// exit without saving
|
insilmaril@0
|
2406 |
break;
|
insilmaril@0
|
2407 |
case QMessageBox::Cancel:
|
insilmaril@0
|
2408 |
// don't save and don't exit
|
insilmaril@0
|
2409 |
return;
|
insilmaril@0
|
2410 |
}
|
insilmaril@0
|
2411 |
}
|
insilmaril@0
|
2412 |
} // loop over all MEs
|
insilmaril@0
|
2413 |
qApp->quit();
|
insilmaril@0
|
2414 |
}
|
insilmaril@0
|
2415 |
|
insilmaril@0
|
2416 |
void Main::editUndo()
|
insilmaril@0
|
2417 |
{
|
insilmaril@0
|
2418 |
if (currentMapEditor())
|
insilmaril@0
|
2419 |
currentMapEditor()->undo();
|
insilmaril@0
|
2420 |
}
|
insilmaril@0
|
2421 |
|
insilmaril@163
|
2422 |
void Main::editRedo()
|
insilmaril@0
|
2423 |
{
|
insilmaril@163
|
2424 |
if (currentMapEditor())
|
insilmaril@163
|
2425 |
currentMapEditor()->redo();
|
insilmaril@0
|
2426 |
}
|
insilmaril@0
|
2427 |
|
insilmaril@0
|
2428 |
void Main::editCopy()
|
insilmaril@0
|
2429 |
{
|
insilmaril@0
|
2430 |
if (currentMapEditor())
|
insilmaril@0
|
2431 |
currentMapEditor()->copy();
|
insilmaril@0
|
2432 |
}
|
insilmaril@0
|
2433 |
|
insilmaril@0
|
2434 |
void Main::editPaste()
|
insilmaril@0
|
2435 |
{
|
insilmaril@0
|
2436 |
if (currentMapEditor())
|
insilmaril@0
|
2437 |
currentMapEditor()->paste();
|
insilmaril@0
|
2438 |
}
|
insilmaril@0
|
2439 |
|
insilmaril@0
|
2440 |
void Main::editCut()
|
insilmaril@0
|
2441 |
{
|
insilmaril@0
|
2442 |
if (currentMapEditor())
|
insilmaril@0
|
2443 |
currentMapEditor()->cut();
|
insilmaril@0
|
2444 |
}
|
insilmaril@0
|
2445 |
|
insilmaril@0
|
2446 |
void Main::editOpenFindWindow()
|
insilmaril@0
|
2447 |
{
|
insilmaril@0
|
2448 |
findWindow->popup();
|
insilmaril@0
|
2449 |
findWindow->raise();
|
insilmaril@0
|
2450 |
findWindow->setActiveWindow();
|
insilmaril@0
|
2451 |
}
|
insilmaril@0
|
2452 |
|
insilmaril@0
|
2453 |
void Main::editFind(QString s)
|
insilmaril@0
|
2454 |
{
|
insilmaril@0
|
2455 |
bool cs=false;
|
insilmaril@0
|
2456 |
BranchObj *bo=currentMapEditor()->findText(s, cs);
|
insilmaril@0
|
2457 |
if (bo)
|
insilmaril@0
|
2458 |
{
|
insilmaril@0
|
2459 |
statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
|
insilmaril@0
|
2460 |
} else
|
insilmaril@0
|
2461 |
{
|
insilmaril@0
|
2462 |
QMessageBox::information( findWindow, tr( "VYM -Information:" ),
|
insilmaril@349
|
2463 |
tr("No matches found for \"%1\"").arg(s));
|
insilmaril@0
|
2464 |
}
|
insilmaril@0
|
2465 |
}
|
insilmaril@0
|
2466 |
|
insilmaril@0
|
2467 |
void Main::editFindChanged()
|
insilmaril@0
|
2468 |
{ // Notify editor, to abort the current find process
|
insilmaril@0
|
2469 |
currentMapEditor()->findReset();
|
insilmaril@0
|
2470 |
}
|
insilmaril@0
|
2471 |
|
insilmaril@366
|
2472 |
void Main::openTabs(QStringList urls)
|
insilmaril@366
|
2473 |
{
|
insilmaril@366
|
2474 |
if (!urls.isEmpty())
|
insilmaril@366
|
2475 |
{
|
insilmaril@366
|
2476 |
bool success=true;
|
insilmaril@366
|
2477 |
QStringList args;
|
insilmaril@366
|
2478 |
QString browser=settings.value("/mainwindow/readerURL" ).toString();
|
insilmaril@366
|
2479 |
QProcess *p;
|
insilmaril@366
|
2480 |
if (!procBrowser || procBrowser->state()!=QProcess::Running)
|
insilmaril@366
|
2481 |
{
|
insilmaril@366
|
2482 |
QString u=urls.takeFirst();
|
insilmaril@366
|
2483 |
procBrowser = new QProcess( this );
|
insilmaril@366
|
2484 |
args<<u;
|
insilmaril@366
|
2485 |
procBrowser->start(browser,args);
|
insilmaril@366
|
2486 |
if ( !procBrowser->waitForStarted())
|
insilmaril@366
|
2487 |
{
|
insilmaril@366
|
2488 |
// try to set path to browser
|
insilmaril@366
|
2489 |
QMessageBox::warning(0,
|
insilmaril@366
|
2490 |
tr("Warning"),
|
insilmaril@366
|
2491 |
tr("Couldn't find a viewer to open %1.\n").arg(u)+
|
insilmaril@366
|
2492 |
tr("Please use Settings->")+tr("Set application to open an URL"));
|
insilmaril@366
|
2493 |
return;
|
insilmaril@366
|
2494 |
}
|
insilmaril@366
|
2495 |
sleep (3);
|
insilmaril@366
|
2496 |
}
|
insilmaril@366
|
2497 |
if (browser.contains("konqueror"))
|
insilmaril@366
|
2498 |
{
|
insilmaril@366
|
2499 |
for (int i=0; i<urls.size(); i++)
|
insilmaril@366
|
2500 |
{
|
insilmaril@366
|
2501 |
// Open new browser
|
insilmaril@366
|
2502 |
// Try to open new tab in existing konqueror started previously by vym
|
insilmaril@366
|
2503 |
p=new QProcess (this);
|
insilmaril@366
|
2504 |
args.clear();
|
insilmaril@366
|
2505 |
args<< QString("konqueror-%1").arg(procBrowser->pid())<<
|
insilmaril@366
|
2506 |
"konqueror-mainwindow#1"<<
|
insilmaril@366
|
2507 |
"newTab" <<
|
insilmaril@366
|
2508 |
urls.at(i);
|
insilmaril@366
|
2509 |
p->start ("dcop",args);
|
insilmaril@366
|
2510 |
if ( !p->waitForStarted() ) success=false;
|
insilmaril@366
|
2511 |
}
|
insilmaril@366
|
2512 |
if (!success)
|
insilmaril@366
|
2513 |
QMessageBox::warning(0,
|
insilmaril@366
|
2514 |
tr("Warning"),
|
insilmaril@366
|
2515 |
tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
|
insilmaril@366
|
2516 |
return;
|
insilmaril@366
|
2517 |
} else if (browser.contains ("firefox") || browser.contains ("mozilla") )
|
insilmaril@366
|
2518 |
{
|
insilmaril@366
|
2519 |
for (int i=0; i<urls.size(); i++)
|
insilmaril@366
|
2520 |
{
|
insilmaril@366
|
2521 |
// Try to open new tab in firefox
|
insilmaril@366
|
2522 |
p=new QProcess (this);
|
insilmaril@366
|
2523 |
args<< "-remote"<< QString("openurl(%1,new-tab)").arg(urls.at(i));
|
insilmaril@366
|
2524 |
p->start (browser,args);
|
insilmaril@366
|
2525 |
if ( !p->waitForStarted() ) success=false;
|
insilmaril@366
|
2526 |
}
|
insilmaril@366
|
2527 |
if (!success)
|
insilmaril@366
|
2528 |
QMessageBox::warning(0,
|
insilmaril@366
|
2529 |
tr("Warning"),
|
insilmaril@366
|
2530 |
tr("Couldn't start %1 to open a new tab").arg(browser));
|
insilmaril@366
|
2531 |
return;
|
insilmaril@366
|
2532 |
}
|
insilmaril@366
|
2533 |
QMessageBox::warning(0,
|
insilmaril@366
|
2534 |
tr("Warning"),
|
insilmaril@366
|
2535 |
tr("Sorry, currently only Konqueror and Mozilla support tabbed browsing."));
|
insilmaril@366
|
2536 |
}
|
insilmaril@366
|
2537 |
}
|
insilmaril@366
|
2538 |
|
insilmaril@0
|
2539 |
void Main::editOpenURL()
|
insilmaril@0
|
2540 |
{
|
insilmaril@266
|
2541 |
// Open new browser
|
insilmaril@0
|
2542 |
if (currentMapEditor())
|
insilmaril@266
|
2543 |
{
|
insilmaril@266
|
2544 |
QString url=currentMapEditor()->getURL();
|
insilmaril@366
|
2545 |
QStringList args;
|
insilmaril@266
|
2546 |
if (url=="") return;
|
insilmaril@366
|
2547 |
QString browser=settings.value("/mainwindow/readerURL" ).toString();
|
insilmaril@266
|
2548 |
procBrowser = new QProcess( this );
|
insilmaril@366
|
2549 |
args<<url;
|
insilmaril@366
|
2550 |
procBrowser->start(browser,args);
|
insilmaril@366
|
2551 |
if ( !procBrowser->waitForStarted())
|
insilmaril@266
|
2552 |
{
|
insilmaril@266
|
2553 |
// try to set path to browser
|
insilmaril@266
|
2554 |
QMessageBox::warning(0,
|
insilmaril@266
|
2555 |
tr("Warning"),
|
insilmaril@266
|
2556 |
tr("Couldn't find a viewer to open %1.\n").arg(url)+
|
insilmaril@266
|
2557 |
tr("Please use Settings->")+tr("Set application to open an URL"));
|
insilmaril@266
|
2558 |
settingsURL() ;
|
insilmaril@266
|
2559 |
}
|
insilmaril@266
|
2560 |
}
|
insilmaril@266
|
2561 |
}
|
insilmaril@266
|
2562 |
void Main::editOpenURLTab()
|
insilmaril@266
|
2563 |
{
|
insilmaril@266
|
2564 |
if (currentMapEditor())
|
insilmaril@266
|
2565 |
{
|
insilmaril@366
|
2566 |
QStringList urls;
|
insilmaril@366
|
2567 |
urls.append(currentMapEditor()->getURL());
|
insilmaril@366
|
2568 |
openTabs (urls);
|
insilmaril@266
|
2569 |
}
|
insilmaril@0
|
2570 |
}
|
insilmaril@366
|
2571 |
void Main::editOpenMultipleURLTabs()
|
insilmaril@366
|
2572 |
{
|
insilmaril@366
|
2573 |
if (currentMapEditor())
|
insilmaril@366
|
2574 |
{
|
insilmaril@366
|
2575 |
QStringList urls;
|
insilmaril@366
|
2576 |
urls=currentMapEditor()->getURLs();
|
insilmaril@366
|
2577 |
openTabs (urls);
|
insilmaril@366
|
2578 |
}
|
insilmaril@366
|
2579 |
}
|
insilmaril@366
|
2580 |
|
insilmaril@0
|
2581 |
|
insilmaril@0
|
2582 |
void Main::editURL()
|
insilmaril@0
|
2583 |
{
|
insilmaril@0
|
2584 |
if (currentMapEditor())
|
insilmaril@0
|
2585 |
currentMapEditor()->editURL();
|
insilmaril@0
|
2586 |
}
|
insilmaril@0
|
2587 |
|
insilmaril@0
|
2588 |
void Main::editHeading2URL()
|
insilmaril@0
|
2589 |
{
|
insilmaril@0
|
2590 |
if (currentMapEditor())
|
insilmaril@0
|
2591 |
currentMapEditor()->editHeading2URL();
|
insilmaril@0
|
2592 |
}
|
insilmaril@0
|
2593 |
|
insilmaril@0
|
2594 |
void Main::editBugzilla2URL()
|
insilmaril@0
|
2595 |
{
|
insilmaril@0
|
2596 |
if (currentMapEditor())
|
insilmaril@0
|
2597 |
currentMapEditor()->editBugzilla2URL();
|
insilmaril@0
|
2598 |
}
|
insilmaril@0
|
2599 |
|
insilmaril@175
|
2600 |
void Main::editFATE2URL()
|
insilmaril@175
|
2601 |
{
|
insilmaril@175
|
2602 |
if (currentMapEditor())
|
insilmaril@175
|
2603 |
currentMapEditor()->editFATE2URL();
|
insilmaril@175
|
2604 |
}
|
insilmaril@175
|
2605 |
|
insilmaril@366
|
2606 |
void Main::editHeading()
|
insilmaril@0
|
2607 |
{
|
insilmaril@366
|
2608 |
if (lineedit->isVisible())
|
insilmaril@0
|
2609 |
{
|
insilmaril@366
|
2610 |
if (currentMapEditor())
|
insilmaril@366
|
2611 |
{
|
insilmaril@366
|
2612 |
MapEditor *me=currentMapEditor();
|
insilmaril@366
|
2613 |
QString oldSel=me->getSelectString();
|
insilmaril@366
|
2614 |
if (me->select (editSel))
|
insilmaril@366
|
2615 |
me->setHeading(lineedit->text());
|
insilmaril@366
|
2616 |
me->select (oldSel);
|
insilmaril@366
|
2617 |
}
|
insilmaril@366
|
2618 |
lineedit->releaseKeyboard();
|
insilmaril@366
|
2619 |
lineedit->hide();
|
insilmaril@366
|
2620 |
setFocus();
|
insilmaril@366
|
2621 |
} else
|
insilmaril@366
|
2622 |
{
|
insilmaril@366
|
2623 |
if (currentMapEditor())
|
insilmaril@366
|
2624 |
{
|
insilmaril@366
|
2625 |
bool ok;
|
insilmaril@366
|
2626 |
QPoint p;
|
insilmaril@366
|
2627 |
QString s=currentMapEditor()->getHeading(ok,p);
|
insilmaril@366
|
2628 |
|
insilmaril@366
|
2629 |
if (ok)
|
insilmaril@366
|
2630 |
{
|
insilmaril@366
|
2631 |
#if defined(Q_OS_MACX)
|
insilmaril@366
|
2632 |
p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p));
|
insilmaril@366
|
2633 |
QDialog *d =new QDialog(NULL);
|
insilmaril@366
|
2634 |
QLineEdit *le=new QLineEdit (d);
|
insilmaril@366
|
2635 |
d->setWindowFlags (Qt::FramelessWindowHint);
|
insilmaril@366
|
2636 |
d->setGeometry(p.x(),p.y(),200,25);
|
insilmaril@366
|
2637 |
le->resize (d->size());
|
insilmaril@366
|
2638 |
le->setText (s);
|
insilmaril@366
|
2639 |
le->selectAll();
|
insilmaril@366
|
2640 |
connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
|
insilmaril@366
|
2641 |
d->activateWindow();
|
insilmaril@366
|
2642 |
d->exec();
|
insilmaril@366
|
2643 |
currentMapEditor()->setHeading (le->text());
|
insilmaril@366
|
2644 |
#else
|
insilmaril@366
|
2645 |
p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p));
|
insilmaril@366
|
2646 |
lineedit->setGeometry(p.x(),p.y(),200,25);
|
insilmaril@366
|
2647 |
lineedit->setText(s);
|
insilmaril@366
|
2648 |
lineedit->setCursorPosition(1);
|
insilmaril@366
|
2649 |
lineedit->selectAll();
|
insilmaril@366
|
2650 |
lineedit->show();
|
insilmaril@366
|
2651 |
lineedit->grabKeyboard();
|
insilmaril@366
|
2652 |
lineedit->setFocus();
|
insilmaril@366
|
2653 |
|
insilmaril@366
|
2654 |
editSel=currentMapEditor()->getSelectString();
|
insilmaril@366
|
2655 |
#endif
|
insilmaril@366
|
2656 |
|
insilmaril@366
|
2657 |
}
|
insilmaril@366
|
2658 |
}
|
insilmaril@366
|
2659 |
}
|
insilmaril@366
|
2660 |
}
|
insilmaril@366
|
2661 |
|
insilmaril@366
|
2662 |
void Main::openVymLinks(const QStringList &vl)
|
insilmaril@366
|
2663 |
{
|
insilmaril@366
|
2664 |
for (int j=0; j<vl.size(); j++)
|
insilmaril@366
|
2665 |
{
|
insilmaril@0
|
2666 |
// compare path with already loaded maps
|
insilmaril@0
|
2667 |
int index=-1;
|
insilmaril@0
|
2668 |
int i;
|
insilmaril@0
|
2669 |
MapEditor *me;
|
insilmaril@0
|
2670 |
for (i=0;i<=tabWidget->count() -1;i++)
|
insilmaril@0
|
2671 |
{
|
insilmaril@0
|
2672 |
me=(MapEditor*)tabWidget->page(i);
|
insilmaril@366
|
2673 |
if (vl.at(j)==me->getFilePath() )
|
insilmaril@0
|
2674 |
{
|
insilmaril@0
|
2675 |
index=i;
|
insilmaril@0
|
2676 |
break;
|
insilmaril@0
|
2677 |
}
|
insilmaril@0
|
2678 |
}
|
insilmaril@0
|
2679 |
if (index<0)
|
insilmaril@0
|
2680 |
// Load map
|
insilmaril@0
|
2681 |
{
|
insilmaril@366
|
2682 |
if (!QFile(vl.at(j)).exists() )
|
insilmaril@0
|
2683 |
QMessageBox::critical( 0, tr( "Critical Error" ),
|
insilmaril@366
|
2684 |
tr("Couldn't open map %1").arg(vl.at(j)));
|
insilmaril@0
|
2685 |
else
|
insilmaril@0
|
2686 |
{
|
insilmaril@366
|
2687 |
fileLoad (vl.at(j), NewMap);
|
insilmaril@0
|
2688 |
tabWidget->setCurrentPage (tabWidget->count()-1);
|
insilmaril@0
|
2689 |
}
|
insilmaril@0
|
2690 |
} else
|
insilmaril@0
|
2691 |
// Go to tab containing the map
|
insilmaril@0
|
2692 |
tabWidget->setCurrentPage (index);
|
insilmaril@0
|
2693 |
}
|
insilmaril@0
|
2694 |
}
|
insilmaril@0
|
2695 |
|
insilmaril@366
|
2696 |
void Main::editOpenVymLink()
|
insilmaril@366
|
2697 |
{
|
insilmaril@366
|
2698 |
if (currentMapEditor())
|
insilmaril@366
|
2699 |
{
|
insilmaril@366
|
2700 |
QStringList vl;
|
insilmaril@366
|
2701 |
vl.append(currentMapEditor()->getVymLink());
|
insilmaril@366
|
2702 |
openVymLinks (vl);
|
insilmaril@366
|
2703 |
}
|
insilmaril@366
|
2704 |
}
|
insilmaril@366
|
2705 |
|
insilmaril@366
|
2706 |
void Main::editOpenMultipleVymLinks()
|
insilmaril@366
|
2707 |
{
|
insilmaril@366
|
2708 |
QString currentVymLink;
|
insilmaril@366
|
2709 |
if (currentMapEditor())
|
insilmaril@366
|
2710 |
{
|
insilmaril@366
|
2711 |
QStringList vl=currentMapEditor()->getVymLinks();
|
insilmaril@366
|
2712 |
openVymLinks (vl);
|
insilmaril@366
|
2713 |
}
|
insilmaril@366
|
2714 |
}
|
insilmaril@366
|
2715 |
|
insilmaril@0
|
2716 |
void Main::editVymLink()
|
insilmaril@0
|
2717 |
{
|
insilmaril@0
|
2718 |
if (currentMapEditor())
|
insilmaril@0
|
2719 |
currentMapEditor()->editVymLink();
|
insilmaril@0
|
2720 |
}
|
insilmaril@0
|
2721 |
|
insilmaril@0
|
2722 |
void Main::editDeleteVymLink()
|
insilmaril@0
|
2723 |
{
|
insilmaril@0
|
2724 |
if (currentMapEditor())
|
insilmaril@0
|
2725 |
currentMapEditor()->deleteVymLink();
|
insilmaril@0
|
2726 |
}
|
insilmaril@0
|
2727 |
|
insilmaril@243
|
2728 |
void Main::editToggleHideExport()
|
insilmaril@243
|
2729 |
{
|
insilmaril@243
|
2730 |
if (currentMapEditor())
|
insilmaril@294
|
2731 |
currentMapEditor()->toggleHideExport();
|
insilmaril@243
|
2732 |
}
|
insilmaril@243
|
2733 |
|
insilmaril@0
|
2734 |
void Main::editMapInfo()
|
insilmaril@0
|
2735 |
{
|
insilmaril@0
|
2736 |
if (currentMapEditor())
|
insilmaril@0
|
2737 |
currentMapEditor()->editMapInfo();
|
insilmaril@0
|
2738 |
}
|
insilmaril@0
|
2739 |
|
insilmaril@0
|
2740 |
void Main::editMoveUp()
|
insilmaril@0
|
2741 |
{
|
insilmaril@0
|
2742 |
if (currentMapEditor())
|
insilmaril@0
|
2743 |
currentMapEditor()->moveBranchUp();
|
insilmaril@0
|
2744 |
}
|
insilmaril@0
|
2745 |
|
insilmaril@0
|
2746 |
void Main::editMoveDown()
|
insilmaril@0
|
2747 |
{
|
insilmaril@0
|
2748 |
if (currentMapEditor())
|
insilmaril@0
|
2749 |
currentMapEditor()->moveBranchDown();
|
insilmaril@0
|
2750 |
}
|
insilmaril@0
|
2751 |
|
insilmaril@0
|
2752 |
void Main::editToggleScroll()
|
insilmaril@0
|
2753 |
{
|
insilmaril@0
|
2754 |
if (currentMapEditor())
|
insilmaril@0
|
2755 |
{
|
insilmaril@0
|
2756 |
currentMapEditor()->toggleScroll();
|
insilmaril@0
|
2757 |
}
|
insilmaril@0
|
2758 |
}
|
insilmaril@0
|
2759 |
|
insilmaril@0
|
2760 |
void Main::editUnScrollAll()
|
insilmaril@0
|
2761 |
{
|
insilmaril@0
|
2762 |
if (currentMapEditor())
|
insilmaril@0
|
2763 |
{
|
insilmaril@0
|
2764 |
currentMapEditor()->unScrollAll();
|
insilmaril@0
|
2765 |
}
|
insilmaril@0
|
2766 |
}
|
insilmaril@0
|
2767 |
|
insilmaril@0
|
2768 |
void Main::editNewBranch()
|
insilmaril@0
|
2769 |
{
|
insilmaril@366
|
2770 |
|
insilmaril@366
|
2771 |
if (!lineedit->isVisible() && currentMapEditor())
|
insilmaril@0
|
2772 |
currentMapEditor()->addNewBranch(0);
|
insilmaril@0
|
2773 |
}
|
insilmaril@0
|
2774 |
|
insilmaril@98
|
2775 |
void Main::editNewBranchHere()
|
insilmaril@98
|
2776 |
{
|
insilmaril@98
|
2777 |
if (currentMapEditor())
|
insilmaril@98
|
2778 |
currentMapEditor()->addNewBranchHere();
|
insilmaril@98
|
2779 |
}
|
insilmaril@98
|
2780 |
|
insilmaril@0
|
2781 |
void Main::editNewBranchAbove()
|
insilmaril@0
|
2782 |
{
|
insilmaril@0
|
2783 |
if (currentMapEditor())
|
insilmaril@0
|
2784 |
currentMapEditor()->addNewBranch(-1);
|
insilmaril@0
|
2785 |
}
|
insilmaril@0
|
2786 |
|
insilmaril@0
|
2787 |
void Main::editNewBranchBelow()
|
insilmaril@0
|
2788 |
{
|
insilmaril@0
|
2789 |
if (currentMapEditor())
|
insilmaril@0
|
2790 |
currentMapEditor()->addNewBranch(1);
|
insilmaril@0
|
2791 |
}
|
insilmaril@0
|
2792 |
|
insilmaril@0
|
2793 |
void Main::editImportAdd()
|
insilmaril@0
|
2794 |
{
|
insilmaril@0
|
2795 |
fileLoad (ImportAdd);
|
insilmaril@0
|
2796 |
}
|
insilmaril@0
|
2797 |
|
insilmaril@0
|
2798 |
void Main::editImportReplace()
|
insilmaril@0
|
2799 |
{
|
insilmaril@0
|
2800 |
fileLoad (ImportReplace);
|
insilmaril@0
|
2801 |
}
|
insilmaril@0
|
2802 |
|
insilmaril@0
|
2803 |
void Main::editSaveBranch()
|
insilmaril@0
|
2804 |
{
|
insilmaril@0
|
2805 |
fileSaveAs (PartOfMap);
|
insilmaril@0
|
2806 |
}
|
insilmaril@0
|
2807 |
|
insilmaril@294
|
2808 |
void Main::editRemoveBranchKeepChilds()
|
insilmaril@98
|
2809 |
{
|
insilmaril@98
|
2810 |
if (currentMapEditor())
|
insilmaril@294
|
2811 |
currentMapEditor()->removeBranchKeepChilds();
|
insilmaril@98
|
2812 |
}
|
insilmaril@98
|
2813 |
|
insilmaril@98
|
2814 |
void Main::editRemoveChilds()
|
insilmaril@98
|
2815 |
{
|
insilmaril@98
|
2816 |
if (currentMapEditor())
|
insilmaril@98
|
2817 |
currentMapEditor()->removeChilds();
|
insilmaril@98
|
2818 |
}
|
insilmaril@98
|
2819 |
|
insilmaril@0
|
2820 |
void Main::editDeleteSelection()
|
insilmaril@0
|
2821 |
{
|
insilmaril@151
|
2822 |
if (currentMapEditor() && actionSettingsUseDelKey->isOn())
|
insilmaril@0
|
2823 |
currentMapEditor()->deleteSelection();
|
insilmaril@0
|
2824 |
}
|
insilmaril@0
|
2825 |
|
insilmaril@0
|
2826 |
void Main::editUpperBranch()
|
insilmaril@0
|
2827 |
{
|
insilmaril@0
|
2828 |
if (currentMapEditor())
|
insilmaril@0
|
2829 |
currentMapEditor()->selectUpperBranch();
|
insilmaril@0
|
2830 |
}
|
insilmaril@0
|
2831 |
|
insilmaril@0
|
2832 |
void Main::editLowerBranch()
|
insilmaril@0
|
2833 |
{
|
insilmaril@0
|
2834 |
if (currentMapEditor())
|
insilmaril@0
|
2835 |
currentMapEditor()->selectLowerBranch();
|
insilmaril@0
|
2836 |
}
|
insilmaril@0
|
2837 |
|
insilmaril@0
|
2838 |
void Main::editLeftBranch()
|
insilmaril@0
|
2839 |
{
|
insilmaril@0
|
2840 |
if (currentMapEditor())
|
insilmaril@0
|
2841 |
currentMapEditor()->selectLeftBranch();
|
insilmaril@0
|
2842 |
}
|
insilmaril@0
|
2843 |
|
insilmaril@0
|
2844 |
void Main::editRightBranch()
|
insilmaril@0
|
2845 |
{
|
insilmaril@0
|
2846 |
if (currentMapEditor())
|
insilmaril@0
|
2847 |
currentMapEditor()->selectRightBranch();
|
insilmaril@0
|
2848 |
}
|
insilmaril@0
|
2849 |
|
insilmaril@0
|
2850 |
void Main::editFirstBranch()
|
insilmaril@0
|
2851 |
{
|
insilmaril@0
|
2852 |
if (currentMapEditor())
|
insilmaril@0
|
2853 |
currentMapEditor()->selectFirstBranch();
|
insilmaril@0
|
2854 |
}
|
insilmaril@0
|
2855 |
|
insilmaril@0
|
2856 |
void Main::editLastBranch()
|
insilmaril@0
|
2857 |
{
|
insilmaril@0
|
2858 |
if (currentMapEditor())
|
insilmaril@0
|
2859 |
currentMapEditor()->selectLastBranch();
|
insilmaril@0
|
2860 |
}
|
insilmaril@0
|
2861 |
|
insilmaril@0
|
2862 |
void Main::editLoadImage()
|
insilmaril@0
|
2863 |
{
|
insilmaril@0
|
2864 |
if (currentMapEditor())
|
insilmaril@0
|
2865 |
currentMapEditor()->loadFloatImage();
|
insilmaril@0
|
2866 |
}
|
insilmaril@0
|
2867 |
|
insilmaril@366
|
2868 |
void Main::editSaveImage()
|
insilmaril@0
|
2869 |
{
|
insilmaril@0
|
2870 |
if (currentMapEditor())
|
insilmaril@366
|
2871 |
currentMapEditor()->saveFloatImage();
|
insilmaril@0
|
2872 |
}
|
insilmaril@0
|
2873 |
|
insilmaril@366
|
2874 |
void Main::editFollowXLink(QAction *a)
|
insilmaril@366
|
2875 |
{
|
insilmaril@366
|
2876 |
|
insilmaril@366
|
2877 |
if (currentMapEditor())
|
insilmaril@366
|
2878 |
currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
|
insilmaril@366
|
2879 |
}
|
insilmaril@366
|
2880 |
|
insilmaril@366
|
2881 |
void Main::editEditXLink(QAction *a)
|
insilmaril@89
|
2882 |
{
|
insilmaril@89
|
2883 |
if (currentMapEditor())
|
insilmaril@366
|
2884 |
currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
|
insilmaril@94
|
2885 |
}
|
insilmaril@94
|
2886 |
|
insilmaril@0
|
2887 |
void Main::formatSelectColor()
|
insilmaril@0
|
2888 |
{
|
insilmaril@0
|
2889 |
if (currentMapEditor())
|
insilmaril@0
|
2890 |
{
|
insilmaril@390
|
2891 |
QColor col = QColorDialog::getColor( currentMapEditor()->getColor(), this );
|
insilmaril@0
|
2892 |
if ( !col.isValid() ) return;
|
insilmaril@0
|
2893 |
currentMapEditor()->setColor( col );
|
insilmaril@0
|
2894 |
colorChanged( col );
|
insilmaril@0
|
2895 |
}
|
insilmaril@0
|
2896 |
}
|
insilmaril@0
|
2897 |
|
insilmaril@0
|
2898 |
void Main::formatPickColor()
|
insilmaril@0
|
2899 |
{
|
insilmaril@0
|
2900 |
if (currentMapEditor())
|
insilmaril@0
|
2901 |
colorChanged( currentMapEditor()->pickColor() );
|
insilmaril@0
|
2902 |
}
|
insilmaril@0
|
2903 |
|
insilmaril@0
|
2904 |
void Main::colorChanged(QColor c)
|
insilmaril@0
|
2905 |
{
|
insilmaril@0
|
2906 |
QPixmap pix( 16, 16 );
|
insilmaril@0
|
2907 |
pix.fill( c );
|
insilmaril@0
|
2908 |
actionFormatColor->setIconSet( pix );
|
insilmaril@0
|
2909 |
}
|
insilmaril@0
|
2910 |
|
insilmaril@0
|
2911 |
void Main::formatColorItem()
|
insilmaril@0
|
2912 |
{
|
insilmaril@0
|
2913 |
if (currentMapEditor())
|
insilmaril@0
|
2914 |
currentMapEditor()->colorItem();
|
insilmaril@0
|
2915 |
}
|
insilmaril@0
|
2916 |
|
insilmaril@0
|
2917 |
void Main::formatColorBranch()
|
insilmaril@0
|
2918 |
{
|
insilmaril@0
|
2919 |
if (currentMapEditor())
|
insilmaril@0
|
2920 |
currentMapEditor()->colorBranch();
|
insilmaril@0
|
2921 |
}
|
insilmaril@0
|
2922 |
|
insilmaril@0
|
2923 |
void Main::formatLinkStyleLine()
|
insilmaril@0
|
2924 |
{
|
insilmaril@0
|
2925 |
if (currentMapEditor())
|
insilmaril@0
|
2926 |
currentMapEditor()->setLinkStyle(StyleLine);
|
insilmaril@0
|
2927 |
}
|
insilmaril@0
|
2928 |
|
insilmaril@0
|
2929 |
void Main::formatLinkStyleParabel()
|
insilmaril@0
|
2930 |
{
|
insilmaril@0
|
2931 |
if (currentMapEditor())
|
insilmaril@0
|
2932 |
currentMapEditor()->setLinkStyle(StyleParabel);
|
insilmaril@0
|
2933 |
}
|
insilmaril@0
|
2934 |
|
insilmaril@0
|
2935 |
void Main::formatLinkStylePolyLine()
|
insilmaril@0
|
2936 |
{
|
insilmaril@0
|
2937 |
if (currentMapEditor())
|
insilmaril@0
|
2938 |
currentMapEditor()->setLinkStyle(StylePolyLine);
|
insilmaril@0
|
2939 |
}
|
insilmaril@0
|
2940 |
|
insilmaril@0
|
2941 |
void Main::formatLinkStylePolyParabel()
|
insilmaril@0
|
2942 |
{
|
insilmaril@0
|
2943 |
if (currentMapEditor())
|
insilmaril@0
|
2944 |
currentMapEditor()->setLinkStyle(StylePolyParabel);
|
insilmaril@0
|
2945 |
}
|
insilmaril@0
|
2946 |
|
insilmaril@0
|
2947 |
void Main::formatSelectBackColor()
|
insilmaril@0
|
2948 |
{
|
insilmaril@0
|
2949 |
if (currentMapEditor())
|
insilmaril@0
|
2950 |
currentMapEditor()->selectBackgroundColor();
|
insilmaril@0
|
2951 |
}
|
insilmaril@0
|
2952 |
|
insilmaril@0
|
2953 |
void Main::formatSelectLinkColor()
|
insilmaril@0
|
2954 |
{
|
insilmaril@0
|
2955 |
if (currentMapEditor())
|
insilmaril@0
|
2956 |
currentMapEditor()->selectLinkColor();
|
insilmaril@0
|
2957 |
}
|
insilmaril@0
|
2958 |
|
insilmaril@0
|
2959 |
void Main::formatToggleLinkColorHint()
|
insilmaril@0
|
2960 |
{
|
insilmaril@0
|
2961 |
currentMapEditor()->toggleLinkColorHint();
|
insilmaril@0
|
2962 |
}
|
insilmaril@0
|
2963 |
|
insilmaril@0
|
2964 |
void Main::formatFrameNone()
|
insilmaril@0
|
2965 |
{
|
insilmaril@0
|
2966 |
if (currentMapEditor())
|
insilmaril@0
|
2967 |
currentMapEditor()->setFrame(NoFrame);
|
insilmaril@0
|
2968 |
}
|
insilmaril@0
|
2969 |
|
insilmaril@0
|
2970 |
void Main::formatFrameRectangle()
|
insilmaril@0
|
2971 |
{
|
insilmaril@0
|
2972 |
if (currentMapEditor())
|
insilmaril@0
|
2973 |
currentMapEditor()->setFrame(Rectangle);
|
insilmaril@0
|
2974 |
}
|
insilmaril@0
|
2975 |
|
insilmaril@175
|
2976 |
void Main::formatIncludeImagesVer()
|
insilmaril@175
|
2977 |
{
|
insilmaril@175
|
2978 |
if (currentMapEditor())
|
insilmaril@175
|
2979 |
currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
|
insilmaril@175
|
2980 |
}
|
insilmaril@175
|
2981 |
|
insilmaril@175
|
2982 |
void Main::formatIncludeImagesHor()
|
insilmaril@175
|
2983 |
{
|
insilmaril@175
|
2984 |
if (currentMapEditor())
|
insilmaril@175
|
2985 |
currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
|
insilmaril@175
|
2986 |
}
|
insilmaril@175
|
2987 |
|
insilmaril@160
|
2988 |
void Main::formatHideLinkUnselected()
|
insilmaril@160
|
2989 |
{
|
insilmaril@160
|
2990 |
if (currentMapEditor())
|
insilmaril@160
|
2991 |
currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
|
insilmaril@160
|
2992 |
}
|
insilmaril@160
|
2993 |
|
insilmaril@0
|
2994 |
void Main::viewZoomReset()
|
insilmaril@0
|
2995 |
{
|
insilmaril@0
|
2996 |
if (currentMapEditor())
|
insilmaril@0
|
2997 |
{
|
insilmaril@366
|
2998 |
QMatrix m;
|
insilmaril@0
|
2999 |
m.reset();
|
insilmaril@0
|
3000 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
3001 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
3002 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
3003 |
}
|
insilmaril@0
|
3004 |
}
|
insilmaril@0
|
3005 |
|
insilmaril@0
|
3006 |
void Main::viewZoomIn()
|
insilmaril@0
|
3007 |
{
|
insilmaril@0
|
3008 |
if (currentMapEditor())
|
insilmaril@0
|
3009 |
{
|
insilmaril@366
|
3010 |
QMatrix m = currentMapEditor()->worldMatrix();
|
insilmaril@0
|
3011 |
m.scale( 1.25, 1.25 );
|
insilmaril@0
|
3012 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
3013 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
3014 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
3015 |
}
|
insilmaril@0
|
3016 |
}
|
insilmaril@0
|
3017 |
|
insilmaril@0
|
3018 |
void Main::viewZoomOut()
|
insilmaril@0
|
3019 |
{
|
insilmaril@0
|
3020 |
if (currentMapEditor())
|
insilmaril@0
|
3021 |
{
|
insilmaril@366
|
3022 |
QMatrix m = currentMapEditor()->worldMatrix();
|
insilmaril@0
|
3023 |
m.scale( 0.8, 0.8 );
|
insilmaril@0
|
3024 |
currentMapEditor()->setWorldMatrix( m );
|
insilmaril@0
|
3025 |
currentMapEditor()->setViewCenter();
|
insilmaril@0
|
3026 |
currentMapEditor()->adjustCanvasSize();
|
insilmaril@0
|
3027 |
}
|
insilmaril@0
|
3028 |
}
|
insilmaril@89
|
3029 |
|
insilmaril@0
|
3030 |
bool Main::settingsPDF()
|
insilmaril@0
|
3031 |
{
|
insilmaril@0
|
3032 |
// Default browser is set in constructor
|
insilmaril@0
|
3033 |
bool ok;
|
insilmaril@0
|
3034 |
QString text = QInputDialog::getText(
|
insilmaril@266
|
3035 |
"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
|
insilmaril@366
|
3036 |
settings.value("/mainwindow/readerPDF").toString(), &ok, this );
|
insilmaril@0
|
3037 |
if (ok)
|
insilmaril@366
|
3038 |
settings.setValue ("/mainwindow/readerPDF",text);
|
insilmaril@0
|
3039 |
return ok;
|
insilmaril@0
|
3040 |
}
|
insilmaril@0
|
3041 |
|
insilmaril@0
|
3042 |
|
insilmaril@0
|
3043 |
bool Main::settingsURL()
|
insilmaril@0
|
3044 |
{
|
insilmaril@0
|
3045 |
// Default browser is set in constructor
|
insilmaril@0
|
3046 |
bool ok;
|
insilmaril@0
|
3047 |
QString text = QInputDialog::getText(
|
insilmaril@266
|
3048 |
"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
|
insilmaril@366
|
3049 |
settings.value("/mainwindow/readerURL").toString()
|
insilmaril@0
|
3050 |
, &ok, this );
|
insilmaril@0
|
3051 |
if (ok)
|
insilmaril@366
|
3052 |
settings.setValue ("/mainwindow/readerURL",text);
|
insilmaril@0
|
3053 |
return ok;
|
insilmaril@0
|
3054 |
}
|
insilmaril@0
|
3055 |
|
insilmaril@327
|
3056 |
void Main::settingsToggleDelKey()
|
insilmaril@327
|
3057 |
{
|
insilmaril@327
|
3058 |
if (actionSettingsUseDelKey->isOn())
|
insilmaril@327
|
3059 |
{
|
insilmaril@366
|
3060 |
actionEditDelete->setAccel (QKeySequence (Qt::Key_Delete));
|
insilmaril@327
|
3061 |
} else
|
insilmaril@327
|
3062 |
{
|
insilmaril@327
|
3063 |
actionEditDelete->setAccel (QKeySequence (""));
|
insilmaril@327
|
3064 |
}
|
insilmaril@327
|
3065 |
}
|
insilmaril@327
|
3066 |
|
insilmaril@0
|
3067 |
void Main::windowToggleNoteEditor()
|
insilmaril@0
|
3068 |
{
|
insilmaril@0
|
3069 |
if (textEditor->showWithMain() )
|
insilmaril@0
|
3070 |
windowHideNoteEditor();
|
insilmaril@0
|
3071 |
else
|
insilmaril@0
|
3072 |
windowShowNoteEditor();
|
insilmaril@0
|
3073 |
}
|
insilmaril@0
|
3074 |
|
insilmaril@294
|
3075 |
void Main::windowToggleHistory()
|
insilmaril@294
|
3076 |
{
|
insilmaril@294
|
3077 |
if (currentMapEditor())
|
insilmaril@294
|
3078 |
currentMapEditor()->toggleHistoryWindow();
|
insilmaril@294
|
3079 |
}
|
insilmaril@294
|
3080 |
|
insilmaril@160
|
3081 |
void Main::updateNoteFlag()
|
insilmaril@160
|
3082 |
{
|
insilmaril@160
|
3083 |
if (currentMapEditor())
|
insilmaril@160
|
3084 |
currentMapEditor()->updateNoteFlag();
|
insilmaril@160
|
3085 |
}
|
insilmaril@160
|
3086 |
|
insilmaril@390
|
3087 |
void Main::updateActions()
|
insilmaril@390
|
3088 |
{
|
insilmaril@390
|
3089 |
MapEditor *me=currentMapEditor();
|
insilmaril@390
|
3090 |
if (!me) return;
|
insilmaril@390
|
3091 |
|
insilmaril@390
|
3092 |
// updateActions is also called when NoteEditor is closed
|
insilmaril@390
|
3093 |
actionViewToggleNoteEditor->setOn (textEditor->isVisible());
|
insilmaril@390
|
3094 |
|
insilmaril@390
|
3095 |
QAction *a;
|
insilmaril@390
|
3096 |
if (me->getLinkColorHint()==HeadingColor)
|
insilmaril@390
|
3097 |
actionFormatLinkColorHint->setOn(true);
|
insilmaril@390
|
3098 |
else
|
insilmaril@390
|
3099 |
actionFormatLinkColorHint->setOn(false);
|
insilmaril@390
|
3100 |
|
insilmaril@390
|
3101 |
switch (me->getLinkStyle())
|
insilmaril@390
|
3102 |
{
|
insilmaril@390
|
3103 |
case StyleLine:
|
insilmaril@390
|
3104 |
actionFormatLinkStyleLine->setOn(true);
|
insilmaril@390
|
3105 |
break;
|
insilmaril@390
|
3106 |
case StyleParabel:
|
insilmaril@390
|
3107 |
actionFormatLinkStyleParabel->setOn(true);
|
insilmaril@390
|
3108 |
break;
|
insilmaril@390
|
3109 |
case StylePolyLine:
|
insilmaril@390
|
3110 |
actionFormatLinkStylePolyLine->setOn(true);
|
insilmaril@390
|
3111 |
break;
|
insilmaril@390
|
3112 |
case StylePolyParabel:
|
insilmaril@390
|
3113 |
actionFormatLinkStylePolyParabel->setOn(true);
|
insilmaril@390
|
3114 |
break;
|
insilmaril@390
|
3115 |
default:
|
insilmaril@390
|
3116 |
break;
|
insilmaril@390
|
3117 |
}
|
insilmaril@390
|
3118 |
|
insilmaril@390
|
3119 |
QPixmap pix( 16, 16 );
|
insilmaril@390
|
3120 |
pix.fill( me->getBackgroundColor() );
|
insilmaril@390
|
3121 |
actionFormatBackColor->setIconSet( pix );
|
insilmaril@390
|
3122 |
pix.fill( me->getDefLinkColor() );
|
insilmaril@390
|
3123 |
actionFormatLinkColor->setIconSet( pix );
|
insilmaril@390
|
3124 |
|
insilmaril@390
|
3125 |
actionFileSave->setEnabled( me->isUnsaved() );
|
insilmaril@390
|
3126 |
if (me->isUndoAvailable())
|
insilmaril@390
|
3127 |
actionEditUndo->setEnabled( true);
|
insilmaril@390
|
3128 |
else
|
insilmaril@390
|
3129 |
actionEditUndo->setEnabled( false);
|
insilmaril@390
|
3130 |
|
insilmaril@390
|
3131 |
if (me->isRedoAvailable())
|
insilmaril@390
|
3132 |
actionEditRedo->setEnabled( true);
|
insilmaril@390
|
3133 |
else
|
insilmaril@390
|
3134 |
actionEditRedo->setEnabled( false);
|
insilmaril@390
|
3135 |
|
insilmaril@390
|
3136 |
LinkableMapObj *selection=me->getSelection();
|
insilmaril@390
|
3137 |
if (selection)
|
insilmaril@390
|
3138 |
{
|
insilmaril@390
|
3139 |
if ( (typeid(*selection) == typeid(BranchObj)) ||
|
insilmaril@390
|
3140 |
(typeid(*selection) == typeid(MapCenterObj)) )
|
insilmaril@390
|
3141 |
{
|
insilmaril@390
|
3142 |
BranchObj *bo=(BranchObj*)selection;
|
insilmaril@390
|
3143 |
// Take care of links
|
insilmaril@390
|
3144 |
if (bo->countXLinks()==0)
|
insilmaril@390
|
3145 |
{
|
insilmaril@390
|
3146 |
branchXLinksContextMenuEdit->clear();
|
insilmaril@390
|
3147 |
branchXLinksContextMenuFollow->clear();
|
insilmaril@390
|
3148 |
} else
|
insilmaril@390
|
3149 |
{
|
insilmaril@390
|
3150 |
BranchObj *bot;
|
insilmaril@390
|
3151 |
QString s;
|
insilmaril@390
|
3152 |
branchXLinksContextMenuEdit->clear();
|
insilmaril@390
|
3153 |
branchXLinksContextMenuFollow->clear();
|
insilmaril@390
|
3154 |
for (int i=0; i<=bo->countXLinks();i++)
|
insilmaril@390
|
3155 |
{
|
insilmaril@390
|
3156 |
bot=bo->XLinkTargetAt(i);
|
insilmaril@390
|
3157 |
if (bot)
|
insilmaril@390
|
3158 |
{
|
insilmaril@390
|
3159 |
s=bot->getHeading();
|
insilmaril@390
|
3160 |
if (s.length()>25)
|
insilmaril@390
|
3161 |
s=s.left(25)+"...";
|
insilmaril@390
|
3162 |
branchXLinksContextMenuFollow->addAction (s);
|
insilmaril@390
|
3163 |
branchXLinksContextMenuEdit->addAction (s);
|
insilmaril@390
|
3164 |
}
|
insilmaril@390
|
3165 |
}
|
insilmaril@390
|
3166 |
}
|
insilmaril@390
|
3167 |
|
insilmaril@390
|
3168 |
standardFlagsDefault->setEnabled (true);
|
insilmaril@390
|
3169 |
|
insilmaril@390
|
3170 |
actionEditToggleScroll->setEnabled (true);
|
insilmaril@390
|
3171 |
if ( bo->isScrolled() )
|
insilmaril@390
|
3172 |
actionEditToggleScroll->setOn(true);
|
insilmaril@390
|
3173 |
else
|
insilmaril@390
|
3174 |
actionEditToggleScroll->setOn(false);
|
insilmaril@390
|
3175 |
|
insilmaril@390
|
3176 |
if ( bo->getURL().isEmpty() )
|
insilmaril@390
|
3177 |
{
|
insilmaril@390
|
3178 |
actionEditOpenURL->setEnabled (false);
|
insilmaril@390
|
3179 |
actionEditOpenURLTab->setEnabled (false);
|
insilmaril@390
|
3180 |
}
|
insilmaril@390
|
3181 |
else
|
insilmaril@390
|
3182 |
{
|
insilmaril@390
|
3183 |
actionEditOpenURL->setEnabled (true);
|
insilmaril@390
|
3184 |
actionEditOpenURLTab->setEnabled (true);
|
insilmaril@390
|
3185 |
}
|
insilmaril@390
|
3186 |
if ( bo->getVymLink().isEmpty() )
|
insilmaril@390
|
3187 |
{
|
insilmaril@390
|
3188 |
actionEditOpenVymLink->setEnabled (false);
|
insilmaril@390
|
3189 |
actionEditDeleteVymLink->setEnabled (false);
|
insilmaril@390
|
3190 |
} else
|
insilmaril@390
|
3191 |
{
|
insilmaril@390
|
3192 |
actionEditOpenVymLink->setEnabled (true);
|
insilmaril@390
|
3193 |
actionEditDeleteVymLink->setEnabled (true);
|
insilmaril@390
|
3194 |
}
|
insilmaril@390
|
3195 |
|
insilmaril@390
|
3196 |
if (bo->canMoveBranchUp())
|
insilmaril@390
|
3197 |
actionEditMoveUp->setEnabled (true);
|
insilmaril@390
|
3198 |
else
|
insilmaril@390
|
3199 |
actionEditMoveUp->setEnabled (false);
|
insilmaril@390
|
3200 |
if (bo->canMoveBranchDown())
|
insilmaril@390
|
3201 |
actionEditMoveDown->setEnabled (true);
|
insilmaril@390
|
3202 |
else
|
insilmaril@390
|
3203 |
actionEditMoveDown->setEnabled (false);
|
insilmaril@390
|
3204 |
|
insilmaril@390
|
3205 |
|
insilmaril@390
|
3206 |
actionEditToggleHideExport->setEnabled (true);
|
insilmaril@390
|
3207 |
actionEditToggleHideExport->setOn (bo->hideInExport() );
|
insilmaril@390
|
3208 |
|
insilmaril@390
|
3209 |
actionEditCopy->setEnabled (true);
|
insilmaril@390
|
3210 |
actionEditCut->setEnabled (true);
|
insilmaril@390
|
3211 |
if (!clipboardEmpty)
|
insilmaril@390
|
3212 |
actionEditPaste->setEnabled (true);
|
insilmaril@390
|
3213 |
else
|
insilmaril@390
|
3214 |
actionEditPaste->setEnabled (false);
|
insilmaril@390
|
3215 |
for (a=actionListBranches.first();a;a=actionListBranches.next())
|
insilmaril@390
|
3216 |
a->setEnabled(true);
|
insilmaril@390
|
3217 |
actionEditDelete->setEnabled (true);
|
insilmaril@390
|
3218 |
switch (selection->getFrameType())
|
insilmaril@390
|
3219 |
{
|
insilmaril@390
|
3220 |
case NoFrame:
|
insilmaril@390
|
3221 |
actionFormatFrameNone->setOn(true);
|
insilmaril@390
|
3222 |
break;
|
insilmaril@390
|
3223 |
case Rectangle:
|
insilmaril@390
|
3224 |
actionFormatFrameRectangle->setOn(true);
|
insilmaril@390
|
3225 |
break;
|
insilmaril@390
|
3226 |
default:
|
insilmaril@390
|
3227 |
break;
|
insilmaril@390
|
3228 |
}
|
insilmaril@390
|
3229 |
actionFormatIncludeImagesVer->setOn
|
insilmaril@390
|
3230 |
( ((BranchObj*)selection)->getIncludeImagesVer());
|
insilmaril@390
|
3231 |
actionFormatIncludeImagesHor->setOn
|
insilmaril@390
|
3232 |
( ((BranchObj*)selection)->getIncludeImagesHor());
|
insilmaril@390
|
3233 |
actionFormatHideLinkUnselected->setOn
|
insilmaril@390
|
3234 |
(selection->getHideLinkUnselected());
|
insilmaril@390
|
3235 |
}
|
insilmaril@390
|
3236 |
if ( (typeid(*selection) == typeid(FloatImageObj)) )
|
insilmaril@390
|
3237 |
{
|
insilmaril@390
|
3238 |
FloatObj *fo=(FloatImageObj*)selection;
|
insilmaril@390
|
3239 |
//FIXME do this in mainwindow standardFlagsDefault->setEnabled (false);
|
insilmaril@390
|
3240 |
|
insilmaril@390
|
3241 |
actionEditOpenURL->setEnabled (false);
|
insilmaril@390
|
3242 |
actionEditOpenVymLink->setEnabled (false);
|
insilmaril@390
|
3243 |
actionEditDeleteVymLink->setEnabled (false);
|
insilmaril@390
|
3244 |
actionEditToggleHideExport->setEnabled (true);
|
insilmaril@390
|
3245 |
actionEditToggleHideExport->setOn (fo->hideInExport() );
|
insilmaril@390
|
3246 |
|
insilmaril@390
|
3247 |
|
insilmaril@390
|
3248 |
actionEditCopy->setEnabled (true);
|
insilmaril@390
|
3249 |
actionEditCut->setEnabled (true);
|
insilmaril@390
|
3250 |
actionEditPaste->setEnabled (false);
|
insilmaril@390
|
3251 |
for (a=actionListBranches.first();a;a=actionListBranches.next())
|
insilmaril@390
|
3252 |
a->setEnabled(false);
|
insilmaril@390
|
3253 |
actionEditDelete->setEnabled (true);
|
insilmaril@390
|
3254 |
actionFormatHideLinkUnselected->setOn
|
insilmaril@390
|
3255 |
( selection->getHideLinkUnselected());
|
insilmaril@390
|
3256 |
actionEditMoveUp->setEnabled (false);
|
insilmaril@390
|
3257 |
actionEditMoveDown->setEnabled (false);
|
insilmaril@390
|
3258 |
}
|
insilmaril@390
|
3259 |
|
insilmaril@390
|
3260 |
} else
|
insilmaril@390
|
3261 |
{
|
insilmaril@390
|
3262 |
actionEditCopy->setEnabled (false);
|
insilmaril@390
|
3263 |
actionEditCut->setEnabled (false);
|
insilmaril@390
|
3264 |
actionEditPaste->setEnabled (false);
|
insilmaril@390
|
3265 |
for (a=actionListBranches.first();a;a=actionListBranches.next())
|
insilmaril@390
|
3266 |
a->setEnabled(false);
|
insilmaril@390
|
3267 |
|
insilmaril@390
|
3268 |
actionEditToggleScroll->setEnabled (false);
|
insilmaril@390
|
3269 |
actionEditOpenURL->setEnabled (false);
|
insilmaril@390
|
3270 |
actionEditOpenVymLink->setEnabled (false);
|
insilmaril@390
|
3271 |
actionEditDeleteVymLink->setEnabled (false);
|
insilmaril@390
|
3272 |
actionEditHeading2URL->setEnabled (false);
|
insilmaril@390
|
3273 |
actionEditDelete->setEnabled (false);
|
insilmaril@390
|
3274 |
actionEditMoveUp->setEnabled (false);
|
insilmaril@390
|
3275 |
actionEditMoveDown->setEnabled (false);
|
insilmaril@390
|
3276 |
actionEditToggleHideExport->setEnabled (false);
|
insilmaril@390
|
3277 |
}
|
insilmaril@390
|
3278 |
}
|
insilmaril@390
|
3279 |
|
insilmaril@390
|
3280 |
ModMode Main::getModMode()
|
insilmaril@390
|
3281 |
{
|
insilmaril@390
|
3282 |
if (actionModModeColor->isOn()) return ModModeColor;
|
insilmaril@390
|
3283 |
if (actionModModeCopy->isOn()) return ModModeCopy;
|
insilmaril@390
|
3284 |
if (actionModModeXLink->isOn()) return ModModeXLink;
|
insilmaril@390
|
3285 |
return ModModeNone;
|
insilmaril@390
|
3286 |
}
|
insilmaril@390
|
3287 |
|
insilmaril@390
|
3288 |
bool Main::autoEdit()
|
insilmaril@390
|
3289 |
{
|
insilmaril@390
|
3290 |
return actionSettingsAutoEdit->isOn();
|
insilmaril@390
|
3291 |
}
|
insilmaril@390
|
3292 |
|
insilmaril@390
|
3293 |
bool Main::autoSelectHeading()
|
insilmaril@390
|
3294 |
{
|
insilmaril@390
|
3295 |
return actionSettingsAutoSelectHeading->isOn();
|
insilmaril@390
|
3296 |
}
|
insilmaril@390
|
3297 |
|
insilmaril@390
|
3298 |
bool Main::useFlagGroups()
|
insilmaril@390
|
3299 |
{
|
insilmaril@390
|
3300 |
return actionSettingsUseFlagGroups->isOn();
|
insilmaril@390
|
3301 |
}
|
insilmaril@390
|
3302 |
|
insilmaril@0
|
3303 |
void Main::windowShowNoteEditor()
|
insilmaril@0
|
3304 |
{
|
insilmaril@0
|
3305 |
textEditor->setShowWithMain(true);
|
insilmaril@0
|
3306 |
textEditor->show();
|
insilmaril@0
|
3307 |
actionViewToggleNoteEditor->setOn (true);
|
insilmaril@0
|
3308 |
}
|
insilmaril@0
|
3309 |
|
insilmaril@0
|
3310 |
void Main::windowHideNoteEditor()
|
insilmaril@0
|
3311 |
{
|
insilmaril@0
|
3312 |
textEditor->setShowWithMain(false);
|
insilmaril@0
|
3313 |
textEditor->hide();
|
insilmaril@0
|
3314 |
actionViewToggleNoteEditor->setOn (false);
|
insilmaril@0
|
3315 |
}
|
insilmaril@0
|
3316 |
|
insilmaril@0
|
3317 |
void Main::windowNextEditor()
|
insilmaril@0
|
3318 |
{
|
insilmaril@0
|
3319 |
if (tabWidget->currentPageIndex() < tabWidget->count())
|
insilmaril@0
|
3320 |
tabWidget->setCurrentPage (tabWidget->currentPageIndex() +1);
|
insilmaril@0
|
3321 |
}
|
insilmaril@0
|
3322 |
|
insilmaril@0
|
3323 |
void Main::windowPreviousEditor()
|
insilmaril@0
|
3324 |
{
|
insilmaril@0
|
3325 |
if (tabWidget->currentPageIndex() >0)
|
insilmaril@0
|
3326 |
tabWidget->setCurrentPage (tabWidget->currentPageIndex() -1);
|
insilmaril@0
|
3327 |
}
|
insilmaril@0
|
3328 |
|
insilmaril@0
|
3329 |
void Main::standardFlagChanged()
|
insilmaril@0
|
3330 |
{
|
insilmaril@0
|
3331 |
currentMapEditor()->toggleStandardFlag(sender()->name());
|
insilmaril@0
|
3332 |
}
|
insilmaril@0
|
3333 |
|
insilmaril@0
|
3334 |
void Main::testFunction()
|
insilmaril@0
|
3335 |
{
|
insilmaril@388
|
3336 |
currentMapEditor()->testFunction();
|
insilmaril@0
|
3337 |
}
|
insilmaril@0
|
3338 |
|
insilmaril@0
|
3339 |
void Main::helpDoc()
|
insilmaril@0
|
3340 |
{
|
insilmaril@0
|
3341 |
QString docpath;
|
insilmaril@103
|
3342 |
#if defined(Q_OS_MACX)
|
insilmaril@103
|
3343 |
docpath="./vym.app/Contents/vym.pdf";
|
insilmaril@103
|
3344 |
#else
|
insilmaril@103
|
3345 |
// default path in SUSE LINUX
|
insilmaril@103
|
3346 |
docpath="/usr/share/doc/packages/vym/doc/vym.pdf";
|
insilmaril@103
|
3347 |
#endif
|
insilmaril@0
|
3348 |
|
insilmaril@0
|
3349 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
3350 |
{
|
insilmaril@0
|
3351 |
// relative path for easy testing in tarball
|
insilmaril@0
|
3352 |
docpath="doc/vym.pdf";
|
insilmaril@0
|
3353 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
3354 |
{
|
insilmaril@0
|
3355 |
// relative path for testing while still writing vym.tex
|
insilmaril@0
|
3356 |
docpath="doc/tex/vym.pdf";
|
insilmaril@0
|
3357 |
if (!QFile (docpath).exists() )
|
insilmaril@0
|
3358 |
{
|
insilmaril@175
|
3359 |
// Try yet another one for Knoppix
|
insilmaril@175
|
3360 |
docpath="/usr/share/doc/packages/vym/vym.pdf";
|
insilmaril@175
|
3361 |
if (!QFile (docpath).exists() )
|
insilmaril@175
|
3362 |
{
|
insilmaril@175
|
3363 |
QMessageBox::critical(0,
|
insilmaril@175
|
3364 |
tr("Critcal error"),
|
insilmaril@175
|
3365 |
tr("Couldn't find the documentation\n"
|
insilmaril@175
|
3366 |
"vym.pdf in various places."));
|
insilmaril@175
|
3367 |
return;
|
insilmaril@175
|
3368 |
}
|
insilmaril@0
|
3369 |
}
|
insilmaril@0
|
3370 |
}
|
insilmaril@0
|
3371 |
}
|
insilmaril@0
|
3372 |
|
insilmaril@0
|
3373 |
Process *pdfProc = new Process();
|
insilmaril@0
|
3374 |
pdfProc->clearArguments();
|
insilmaril@366
|
3375 |
pdfProc->addArgument( settings.value("/mainwindow/readerPDF").toString());
|
insilmaril@0
|
3376 |
pdfProc->addArgument( docpath);
|
insilmaril@0
|
3377 |
|
insilmaril@0
|
3378 |
if ( !pdfProc->start() )
|
insilmaril@0
|
3379 |
{
|
insilmaril@0
|
3380 |
// error handling
|
insilmaril@266
|
3381 |
QMessageBox::warning(0,
|
insilmaril@266
|
3382 |
tr("Warning"),
|
insilmaril@266
|
3383 |
tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
|
insilmaril@266
|
3384 |
tr("Please use Settings->")+tr("Set application to open PDF files"));
|
insilmaril@266
|
3385 |
settingsPDF();
|
insilmaril@0
|
3386 |
return;
|
insilmaril@0
|
3387 |
}
|
insilmaril@0
|
3388 |
}
|
insilmaril@0
|
3389 |
|
insilmaril@0
|
3390 |
|
insilmaril@0
|
3391 |
void Main::helpAbout()
|
insilmaril@0
|
3392 |
{
|
insilmaril@148
|
3393 |
AboutDialog ad;
|
insilmaril@150
|
3394 |
ad.setName ("aboutwindow");
|
insilmaril@148
|
3395 |
ad.setMinimumSize(500,500);
|
insilmaril@148
|
3396 |
ad.resize (QSize (500,500));
|
insilmaril@148
|
3397 |
ad.exec();
|
insilmaril@0
|
3398 |
}
|
insilmaril@0
|
3399 |
|
insilmaril@0
|
3400 |
void Main::helpAboutQT()
|
insilmaril@0
|
3401 |
{
|
insilmaril@0
|
3402 |
QMessageBox::aboutQt( this, "Qt Application Example" );
|
insilmaril@0
|
3403 |
}
|
insilmaril@0
|
3404 |
|