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