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