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