1.1 --- a/file.cpp Tue Jun 13 08:49:12 2006 +0000
1.2 +++ b/file.cpp Tue Jun 13 13:54:53 2006 +0000
1.3 @@ -303,3 +303,38 @@
1.4 }
1.5 }
1.6
1.7 +ImageIO::ImageIO ()
1.8 +{
1.9 + // Create list with supported image types
1.10 + // foreach (QByteArray format, QImageWriter::supportedImageFormats())
1.11 + // imageTypes.append( tr("%1...").arg(QString(format).toUpper()));
1.12 + imageFilters.append ("Images (*.png *.jpg *.jpeg *.bmp *.bmp *.ppm *.xpm *.xbm)");
1.13 + imageTypes.append ("PNG");
1.14 + imageFilters.append ("Portable Network Graphics (*.png)");
1.15 + imageTypes.append ("PNG");
1.16 + imageFilters.append ("Joint Photographic Experts Group (*.jpg)");
1.17 + imageTypes.append ("JPG");
1.18 + imageFilters.append ("Joint Photographic Experts Group (*.jpeg)");
1.19 + imageTypes.append ("JPG");
1.20 + imageFilters.append ("Windows Bitmap (*.bmp)");
1.21 + imageTypes.append ("BMP");
1.22 + imageFilters.append ("Portable Pixmap (*.ppm)");
1.23 + imageTypes.append ("PPM");
1.24 + imageFilters.append ("X11 Bitmap (*.xpm)");
1.25 + imageTypes.append ("XPM");
1.26 + imageFilters.append ("X11 Bitmap (*.xbm)");
1.27 + imageTypes.append ("XBM");
1.28 +}
1.29 +
1.30 +QStringList ImageIO::getFilters()
1.31 +{
1.32 + return imageFilters;
1.33 +}
1.34 +
1.35 +QString ImageIO::getType(QString filter)
1.36 +{
1.37 + for (int i=0;i<imageFilters.count()+1;i++)
1.38 + if (imageFilters.at(i)==filter) return imageTypes.at(i);
1.39 +}
1.40 +
1.41 +
2.1 --- a/file.h Tue Jun 13 08:49:12 2006 +0000
2.2 +++ b/file.h Tue Jun 13 13:54:53 2006 +0000
2.3 @@ -33,4 +33,18 @@
2.4 Q3FileDialog *fdia;
2.5 };
2.6
2.7 +
2.8 +
2.9 +class ImageIO
2.10 +{
2.11 +public:
2.12 + ImageIO ();
2.13 + QStringList getFilters();
2.14 + QString getType ( QString );
2.15 +
2.16 +private:
2.17 + QStringList imageFilters;
2.18 + QStringList imageTypes;
2.19 +};
2.20 +
2.21 #endif
3.1 --- a/main.cpp Tue Jun 13 08:49:12 2006 +0000
3.2 +++ b/main.cpp Tue Jun 13 13:54:53 2006 +0000
3.3 @@ -24,6 +24,7 @@
3.4 QString tmpVymDir; // All temp files go there, created in mainwindow
3.5 QString clipboardDir; // Clipboard used in all mapEditors
3.6 QDir vymBaseDir; // Containing all styles, scripts, images, ...
3.7 +QDir lastImageDir;
3.8 QString iconPath; // Pointing to icons used for toolbars
3.9 QString flagsPath; // Pointing to flags
3.10 bool clipboardEmpty;
3.11 @@ -108,22 +109,23 @@
3.12 QAction *actionSettingsUseFlagGroups;
3.13 QAction *actionSettingsUseHideExport;
3.14
3.15 -Q3PopupMenu *branchContextMenu;
3.16 -Q3PopupMenu *branchAddContextMenu;
3.17 -Q3PopupMenu *branchRemoveContextMenu;
3.18 -Q3PopupMenu *branchLinksContextMenu;
3.19 -Q3PopupMenu *branchLinksContextMenuDup;
3.20 -Q3PopupMenu *floatimageContextMenu;
3.21 -Q3PopupMenu *saveImageFormatMenu;
3.22 -Q3PopupMenu *canvasContextMenu;
3.23 -Q3PopupMenu *lastMapsMenu;
3.24 -Q3PopupMenu *importMenu;
3.25 -Q3PopupMenu *exportMenu;
3.26 -Q3PopupMenu *exportImageFormatMenu;
3.27 +
3.28 +QMenu* branchContextMenu;
3.29 +QMenu* branchAddContextMenu;
3.30 +QMenu* branchRemoveContextMenu;
3.31 +QMenu* branchLinksContextMenu;
3.32 +QMenu* branchLinksContextMenuDup;
3.33 +QMenu* floatimageContextMenu;
3.34 +QMenu* saveImageFormatMenu;
3.35 +QMenu* canvasContextMenu;
3.36 +QMenu* fileLastMapsMenu;
3.37 +QMenu* fileImportMenu;
3.38 +QMenu* fileExportMenu;
3.39
3.40
3.41 Settings settings ("vym","vym"); // Organization, Application name
3.42 Options options;
3.43 +ImageIO imageIO;
3.44
3.45 int statusbarTime=3500;
3.46
3.47 @@ -185,16 +187,19 @@
3.48 iconPath=vymBaseDir.path()+"/icons/";
3.49 flagsPath=vymBaseDir.path()+"/flags/";
3.50
3.51 + // Some directories
3.52 + lastImageDir=QDir().home();
3.53 +
3.54 if (options.isOn ("help"))
3.55 {
3.56 -//FIXME QT3 cout << options.getHelpText()<<endl;
3.57 + cout << options.getHelpText().ascii()<<endl;
3.58 return 0;
3.59 }
3.60
3.61 if (options.isOn ("test"))
3.62 {
3.63 // FIXME testing string option only
3.64 -//FIXME QT3 cout << "Testing: "<<options.getArg("test")<< endl;
3.65 + cout << "Testing: "<<options.getArg("test").ascii()<< endl;
3.66 }
3.67
3.68
4.1 --- a/mainwindow.cpp Tue Jun 13 08:49:12 2006 +0000
4.2 +++ b/mainwindow.cpp Tue Jun 13 13:54:53 2006 +0000
4.3 @@ -25,7 +25,6 @@
4.4 #include <Q3PtrList>
4.5 //#include <qdatetime.h> // for random seed
4.6
4.7 -
4.8 #include <iostream>
4.9 #include <cstdlib>
4.10 #include <typeinfo>
4.11 @@ -131,23 +130,25 @@
4.12 extern QAction* actionSettingsUseFlagGroups;
4.13 extern QAction* actionSettingsUseHideExport;
4.14
4.15 -extern Q3PopupMenu* branchContextMenu;
4.16 -extern Q3PopupMenu* branchAddContextMenu;
4.17 -extern Q3PopupMenu* branchRemoveContextMenu;
4.18 -extern Q3PopupMenu* branchLinksContextMenu;
4.19 -extern Q3PopupMenu* branchLinksContextMenuDup;
4.20 -extern Q3PopupMenu* floatimageContextMenu;
4.21 -extern Q3PopupMenu* saveImageFormatMenu;
4.22 -extern Q3PopupMenu* canvasContextMenu;
4.23 -extern Q3PopupMenu* lastMapsMenu;
4.24 -extern Q3PopupMenu* importMenu;
4.25 -extern Q3PopupMenu* exportMenu;
4.26 -extern Q3PopupMenu* exportImageFormatMenu;
4.27 +extern QMenu* branchContextMenu;
4.28 +extern QMenu* branchAddContextMenu;
4.29 +extern QMenu* branchRemoveContextMenu;
4.30 +extern QMenu* branchLinksContextMenu;
4.31 +extern QMenu* branchLinksContextMenuDup;
4.32 +extern QMenu* floatimageContextMenu;
4.33 +extern QMenu* saveImageFormatMenu;
4.34 +extern QMenu* canvasContextMenu;
4.35 +extern QMenu* fileLastMapsMenu;
4.36 +extern QMenu* fileImportMenu;
4.37 +extern QMenu* fileExportMenu;
4.38
4.39
4.40 extern Settings settings;
4.41 extern Options options;
4.42 +extern ImageIO imageIO;
4.43 +
4.44 extern QDir vymBaseDir;
4.45 +extern QDir lastImageDir;
4.46 extern QString iconPath;
4.47 extern QString flagsPath;
4.48
4.49 @@ -234,7 +235,7 @@
4.50 setupHelpActions();
4.51
4.52 // After menu is created, we can enable some actions
4.53 - actionFilePrint->setEnabled (true);
4.54 +//FIXME testing actionFilePrint->setEnabled (true);
4.55
4.56 statusBar();
4.57
4.58 @@ -321,97 +322,130 @@
4.59 // File Actions
4.60 void Main::setupFileActions()
4.61 {
4.62 + QMenu *fileMenu = menuBar()->addMenu ( tr ("&File") );
4.63 QToolBar *tb = addToolBar( tr ("&File") );
4.64 - Q3PopupMenu *menu = new Q3PopupMenu( this );
4.65 - menuBar()->insertItem( tr( "&File" ), menu );
4.66 -
4.67 - // Keycodes: /usr/lib64/qt3/include/qnamespace.h
4.68
4.69 QAction *a;
4.70 a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New..." ),this);
4.71 a->setStatusTip ( tr( "New map","File menu" ) );
4.72 a->setShortcut ( Qt::CTRL + Qt::Key_N );
4.73 a->addTo( tb );
4.74 - a->addTo( menu );
4.75 + fileMenu->addAction (a);
4.76 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
4.77
4.78 a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ),this);
4.79 a->setStatusTip (tr( "Open","File menu" ) );
4.80 a->setShortcut ( Qt::CTRL + Qt::Key_O );
4.81 a->addTo( tb );
4.82 - a->addTo( menu );
4.83 + fileMenu->addAction (a);
4.84 connect( a, SIGNAL( activated() ), this, SLOT( fileLoad() ) );
4.85
4.86 - lastMapsMenu = new Q3PopupMenu (this);
4.87 -
4.88 - menu->insertItem (tr("Open Recent"),lastMapsMenu );
4.89 - menu->insertSeparator();
4.90 + fileLastMapsMenu = fileMenu->addMenu (tr("Open Recent"));
4.91 + fileMenu->addSeparator();
4.92
4.93 a = new QAction( QPixmap( iconPath+"filesave.png"), tr( "&Save..." ), this);
4.94 a->setStatusTip ( tr( "Save" ));
4.95 a->setShortcut (Qt::CTRL + Qt::Key_S );
4.96 a->addTo( tb );
4.97 - a->addTo( menu );
4.98 + fileMenu->addAction (a);
4.99 connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
4.100 actionFileSave=a;
4.101
4.102 a = new QAction( QPixmap(iconPath+"filesaveas.png"), tr( "Save &As..." ), this);
4.103 a->setStatusTip (tr( "Save &As" ) );
4.104 - a->addTo( menu );
4.105 + fileMenu->addAction (a);
4.106 connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
4.107
4.108 - menu->insertSeparator();
4.109 -
4.110 - importMenu = new Q3PopupMenu (this);
4.111 - menu->insertItem (tr("Import"),importMenu );
4.112 + fileMenu->addSeparator();
4.113 +
4.114 + fileImportMenu = fileMenu->addMenu (tr("Import"));
4.115
4.116 a = new QAction(tr("KDE Bookmarks"), this);
4.117 a->setStatusTip ( tr( "Import")+" "+tr("KDE Bookmarks" ));
4.118 - a->addTo (importMenu);
4.119 + a->addTo (fileImportMenu);
4.120 connect( a, SIGNAL( activated() ), this, SLOT( fileImportKDEBookmarks() ) );
4.121
4.122 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
4.123 {
4.124 a = new QAction( QPixmap(), tr("Firefox Bookmarks"),this);
4.125 a->setStatusTip (tr( "Import")+" "+tr("Firefox Bookmarks" ) );
4.126 - a->addTo (importMenu);
4.127 + a->addTo (fileImportMenu);
4.128 connect( a, SIGNAL( activated() ), this, SLOT( fileImportFirefoxBookmarks() ) );
4.129 }
4.130
4.131 a = new QAction("Mind Manager...",this);
4.132 a->setStatusTip ( tr( "Import")+" Mind Manager" );
4.133 - a->addTo (importMenu);
4.134 + fileImportMenu->addAction (a);
4.135 connect( a, SIGNAL( activated() ), this, SLOT( fileImportMM() ) );
4.136
4.137 a = new QAction( tr( "Import Dir"+QString("...") ), this);
4.138 a->setStatusTip (tr( "Import directory structure (experimental)" ) );
4.139 - a->addTo( importMenu);
4.140 + fileImportMenu->addAction (a);
4.141 connect( a, SIGNAL( activated() ), this, SLOT( fileImportDir() ) );
4.142
4.143 - exportMenu = new Q3PopupMenu (this);
4.144 - menu->insertItem (tr("Export"),exportMenu );
4.145 -
4.146 - menu->insertSeparator();
4.147 -
4.148 + fileExportMenu = fileMenu->addMenu (tr("Export"));
4.149 +
4.150 + a = new QAction( tr("Image")+QString("..."), this);
4.151 + a->setStatusTip( tr( "Export map as image" ));
4.152 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportImage() ) );
4.153 + fileExportMenu->addAction (a);
4.154 +
4.155 + a = new QAction( "Open Office"+QString("..."), this);
4.156 + a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
4.157 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
4.158 + fileExportMenu->addAction (a);
4.159 +
4.160 + a = new QAction( "Webpage (XHTML)...",this );
4.161 + a->setShortcut (Qt::ALT + Qt::Key_X);
4.162 + a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
4.163 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
4.164 + fileExportMenu->addAction (a);
4.165 +
4.166 + a = new QAction( "Text (ASCII)...", this);
4.167 + a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
4.168 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
4.169 + fileExportMenu->addAction (a);
4.170 +
4.171 + a = new QAction( tr("KDE Bookmarks"), this);
4.172 + a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
4.173 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
4.174 + fileExportMenu->addAction (a);
4.175 +
4.176 + a = new QAction( "Taskjuggler...", this );
4.177 + a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
4.178 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
4.179 + fileExportMenu->addAction (a);
4.180 +
4.181 + a = new QAction( "LaTeX...", this);
4.182 + a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
4.183 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
4.184 + fileExportMenu->addAction (a);
4.185 +
4.186 + a = new QAction( "XML..." , this );
4.187 + a->setStatusTip (tr( "Export as")+" XML");
4.188 + connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
4.189 + fileExportMenu->addAction (a);
4.190 +
4.191 + fileMenu->addSeparator();
4.192
4.193 a = new QAction(QPixmap( iconPath+"fileprint.png"), tr( "&Print")+QString("..."), this);
4.194 a->setStatusTip ( tr( "Print" ) );
4.195 a->setShortcut (Qt::CTRL + Qt::Key_P );
4.196 a->addTo( tb );
4.197 - a->addTo( menu );
4.198 + fileMenu->addAction (a);
4.199 connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
4.200 actionFilePrint=a;
4.201
4.202 a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map" ), this);
4.203 a->setStatusTip (tr( "Close Map" ) );
4.204 a->setShortcut (Qt::ALT + Qt::Key_C );
4.205 - a->addTo( menu );
4.206 + fileMenu->addAction (a);
4.207 connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
4.208
4.209 a = new QAction(QPixmap(iconPath+"exit.png"), tr( "E&xit")+" "+__VYM, this);
4.210 a->setStatusTip ( tr( "Exit")+" "+__VYM );
4.211 a->setShortcut (Qt::CTRL + Qt::Key_Q );
4.212 - a->addTo( menu );
4.213 + fileMenu->addAction (a);
4.214 connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
4.215 }
4.216
4.217 @@ -1435,34 +1469,34 @@
4.218 QAction*a;
4.219
4.220 // Context Menu for branch or mapcenter
4.221 - branchContextMenu =new Q3PopupMenu (this);
4.222 + branchContextMenu =new QMenu (this);
4.223
4.224 // Submenu "Add"
4.225 - branchAddContextMenu =new Q3PopupMenu (this);
4.226 - actionEditPaste->addTo ( branchAddContextMenu );
4.227 - actionEditAddBranch->addTo ( branchAddContextMenu );
4.228 - actionEditAddBranchHere->addTo ( branchAddContextMenu );
4.229 - actionEditAddBranchAbove->addTo ( branchAddContextMenu );
4.230 - actionEditAddBranchBelow->addTo ( branchAddContextMenu );
4.231 - branchAddContextMenu->insertSeparator();
4.232 - actionEditLoadImage->addTo( branchAddContextMenu );
4.233 - branchAddContextMenu->insertSeparator();
4.234 - actionEditImportAdd->addTo ( branchAddContextMenu );
4.235 - actionEditImportReplace->addTo ( branchAddContextMenu );
4.236 + branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
4.237 + branchAddContextMenu->addAction (actionEditPaste );
4.238 + branchAddContextMenu->addAction ( actionEditAddBranch );
4.239 + branchAddContextMenu->addAction ( actionEditAddBranchHere );
4.240 + branchAddContextMenu->addAction ( actionEditAddBranchAbove);
4.241 + branchAddContextMenu->addAction ( actionEditAddBranchBelow );
4.242 + branchAddContextMenu->addSeparator();
4.243 + branchAddContextMenu->addAction ( actionEditLoadImage);
4.244 + branchAddContextMenu->addSeparator();
4.245 + branchAddContextMenu->addAction ( actionEditLoadImage);
4.246 + branchAddContextMenu->addAction ( actionEditImportAdd );
4.247 + branchAddContextMenu->addAction ( actionEditImportReplace );
4.248
4.249 // Submenu "Remove"
4.250 - branchRemoveContextMenu =new Q3PopupMenu (this);
4.251 - actionEditCut->addTo ( branchRemoveContextMenu );
4.252 - actionEditDelete->addTo ( branchRemoveContextMenu );
4.253 - actionEditRemoveBranchKeepChilds->addTo( branchRemoveContextMenu );
4.254 - actionEditRemoveChilds->addTo( branchRemoveContextMenu );
4.255 + branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove"));
4.256 + branchRemoveContextMenu->addAction (actionEditCut);
4.257 + branchRemoveContextMenu->addAction ( actionEditDelete );
4.258 + branchRemoveContextMenu->addAction ( actionEditRemoveBranchKeepChilds );
4.259 + branchRemoveContextMenu->addAction ( actionEditRemoveChilds );
4.260
4.261 - branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
4.262 - branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
4.263
4.264 actionEditSaveBranch->addTo( branchContextMenu );
4.265
4.266 - branchContextMenu->insertSeparator();
4.267 +/*
4.268 + branchContextMenu->addSeparator();
4.269 actionEditOpenURL->addTo ( branchContextMenu );
4.270 actionEditOpenURLTab->addTo ( branchContextMenu );
4.271 actionEditURL->addTo ( branchContextMenu );
4.272 @@ -1496,19 +1530,17 @@
4.273 branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
4.274 connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
4.275
4.276 +*/
4.277 // Context menu for floatimage
4.278 - floatimageContextMenu =new Q3PopupMenu (this);
4.279 - saveImageFormatMenu=new Q3PopupMenu (this);
4.280 - exportImageFormatMenu=new Q3PopupMenu (this);
4.281 -
4.282 -/* FIXME strange error
4.283 + floatimageContextMenu =new QMenu (this);
4.284 + saveImageFormatMenu=floatimageContextMenu->addMenu (tr("Save image"));
4.285 +
4.286 foreach (QByteArray format, QImageWriter::supportedImageFormats())
4.287 {
4.288 QString text = tr("%1...").arg(QString(format).toUpper());
4.289 - saveImageFormatMenu->insertItem( text );
4.290 - exportImageFormatMenu->insertItem( text );
4.291 + a= new QAction (text,this);
4.292 + saveImageFormatMenu->addAction ( a );
4.293 }
4.294 -*/
4.295
4.296 /* FIXME not needed any longer
4.297 Q3StrList fmt = QImageWriter::supportedImageFormats();
4.298 @@ -1518,57 +1550,19 @@
4.299 exportImageFormatMenu->insertItem( f );
4.300 }
4.301 */
4.302 - connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
4.303 - connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
4.304 - floatimageContextMenu->insertItem( tr("Save image"),saveImageFormatMenu );
4.305 +// connect( saveImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( editSaveImage(int ) ) );
4.306 +// connect( exportImageFormatMenu, SIGNAL( activated(int) ), this, SLOT( fileExportImage(int ) ) );
4.307
4.308 - floatimageContextMenu->insertSeparator();
4.309 + floatimageContextMenu->addSeparator();
4.310 actionEditCopy->addTo( floatimageContextMenu );
4.311 actionEditCut->addTo( floatimageContextMenu );
4.312
4.313 - floatimageContextMenu->insertSeparator();
4.314 - actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
4.315 -
4.316 - exportMenu->insertItem ( tr("Export as")+" Image",exportImageFormatMenu);
4.317 -
4.318 - a = new QAction( "Open Office"+QString("..."), this);
4.319 - a->setStatusTip( tr( "Export in Open Document Format used e.g. in Open Office " ));
4.320 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
4.321 - a->addTo (exportMenu);
4.322 -
4.323 - a = new QAction( "Webpage (XHTML)...",this );
4.324 - a->setShortcut (Qt::ALT + Qt::Key_X);
4.325 - a->setStatusTip ( tr( "Export as")+" webpage (XHTML)");
4.326 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
4.327 - a->addTo( exportMenu );
4.328 -
4.329 - a = new QAction( "Text (ASCII)...", this);
4.330 - a->setStatusTip ( tr( "Export as")+" ASCII"+" "+tr("(still experimental)" ));
4.331 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
4.332 - a->addTo( exportMenu );
4.333 -
4.334 - a = new QAction( tr("KDE Bookmarks"), this);
4.335 - a->setStatusTip( tr( "Export as")+" "+tr("KDE Bookmarks" ));
4.336 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportKDEBookmarks() ) );
4.337 - a->addTo (exportMenu);
4.338 -
4.339 - a = new QAction( "Taskjuggler...", this );
4.340 - a->setStatusTip( tr( "Export as")+" Taskjuggler"+" "+tr("(still experimental)" ));
4.341 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportTaskjuggler() ) );
4.342 - a->addTo( exportMenu );
4.343 -
4.344 - a = new QAction( "LaTeX...", this);
4.345 - a->setStatusTip( tr( "Export as")+" LaTeX"+" "+tr("(still experimental)" ));
4.346 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
4.347 - a->addTo( exportMenu );
4.348 -
4.349 - a = new QAction( "XML..." , this );
4.350 - a->setStatusTip (tr( "Export as")+" XML");
4.351 - connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
4.352 - a->addTo( exportMenu );
4.353 + floatimageContextMenu->addSeparator();
4.354 + floatimageContextMenu->addAction ( actionFormatHideLinkUnselected );
4.355 +
4.356
4.357 // Context menu for canvas
4.358 - canvasContextMenu =new Q3PopupMenu (this);
4.359 + canvasContextMenu =new QMenu (this);
4.360 actionEditMapInfo->addTo( canvasContextMenu );
4.361 canvasContextMenu->insertSeparator();
4.362 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
4.363 @@ -1588,7 +1582,7 @@
4.364 lastMaps.append(s);
4.365 }
4.366 setupLastMapsMenu();
4.367 - connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
4.368 +// connect( lastMapsMenu, SIGNAL( activated(int) ), this, SLOT( fileLoadLast(int ) ) );
4.369 }
4.370
4.371 void Main::setupLastMapsMenu()
4.372 @@ -1614,9 +1608,11 @@
4.373 while ((int)(lastMaps.count()) > maxLastMaps) lastMaps.pop_back();
4.374
4.375 // build Menu from lastMaps string list
4.376 - lastMapsMenu->clear();
4.377 + fileLastMapsMenu->clear();
4.378 + /* FIXME add actions instead of strings in QT4
4.379 for (it = lastMaps.begin(); it != lastMaps.end(); ++it )
4.380 - lastMapsMenu->insertItem (*it );
4.381 + fileLastMapsMenu->addAction (*it );
4.382 + */
4.383
4.384 }
4.385
4.386 @@ -1960,7 +1956,7 @@
4.387
4.388 void Main::fileLoadLast(int i)
4.389 {
4.390 - fileLoad(QString(*lastMaps.at(lastMapsMenu->indexOf (i)) ),NewMap);
4.391 + fileLoad(QString(*lastMaps.at(fileLastMapsMenu->indexOf (i)) ),NewMap);
4.392 }
4.393
4.394 void Main::fileSave(const SaveMode &savemode)
4.395 @@ -2263,18 +2259,23 @@
4.396 }
4.397 }
4.398
4.399 -void Main::fileExportImage(int item)
4.400 +void Main::fileExportImage()
4.401 {
4.402 MapEditor *me=currentMapEditor();
4.403 if (me)
4.404 {
4.405 - QString fn = Q3FileDialog::getSaveFileName( QString::null, "Image (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *xbm *.xpm)",
4.406 - this );
4.407 - if ( !fn.isEmpty() )
4.408 - me->exportImage(fn,item);
4.409 - else
4.410 - statusBar()->message( tr("Couldn't save %1").arg(fn), statusbarTime );
4.411 -
4.412 + QStringList fl;
4.413 + QFileDialog *fd=new QFileDialog (this);
4.414 + fd->setCaption (tr("Export map as image"));
4.415 + fd->setFileMode(QFileDialog::AnyFile);
4.416 + fd->setFilters (imageIO.getFilters() );
4.417 + fd->setDirectory (lastImageDir);
4.418 + if (fd->exec())
4.419 + {
4.420 + fl=fd->selectedFiles();
4.421 + qWarning ("Selected "+fl.first()+" filter: "+fd->selectedFilter());
4.422 + me->exportImage (fl.first(), imageIO.getType (fd->selectedFilter() ) );
4.423 + }
4.424 }
4.425 }
4.426
5.1 --- a/mainwindow.h Tue Jun 13 08:49:12 2006 +0000
5.2 +++ b/mainwindow.h Tue Jun 13 13:54:53 2006 +0000
5.3 @@ -75,7 +75,7 @@
5.4 void fileImportDir();
5.5 void fileExportXML();
5.6 void fileExportXHTML();
5.7 - void fileExportImage(int);
5.8 + void fileExportImage();
5.9 void fileExportASCII();
5.10 void fileExportLaTeX();
5.11 void fileExportKDEBookmarks();
5.12 @@ -190,6 +190,8 @@
5.13 int maxLastMaps;
5.14 QString lastFileDir;
5.15 Q3Process *procBrowser;
5.16 +
5.17 + QStringList imageTypes;
5.18 };
5.19
5.20
6.1 --- a/mapeditor.cpp Tue Jun 13 08:49:12 2006 +0000
6.2 +++ b/mapeditor.cpp Tue Jun 13 13:54:53 2006 +0000
6.3 @@ -127,18 +127,25 @@
6.4 extern QAction *actionSettingsPasteNewHeading;
6.5 extern QAction *actionSettingsUseFlagGroups;
6.6
6.7 -extern Q3PopupMenu *branchContextMenu;
6.8 -extern Q3PopupMenu *branchLinksContextMenu;
6.9 -extern Q3PopupMenu *branchLinksContextMenuDup;
6.10 -extern Q3PopupMenu *floatimageContextMenu;
6.11 -extern Q3PopupMenu *saveImageFormatMenu;
6.12 -extern Q3PopupMenu *exportImageFormatMenu;
6.13 -extern Q3PopupMenu *canvasContextMenu;
6.14 +extern QMenu* branchContextMenu;
6.15 +extern QMenu* branchAddContextMenu;
6.16 +extern QMenu* branchRemoveContextMenu;
6.17 +extern QMenu* branchLinksContextMenu;
6.18 +extern QMenu* branchLinksContextMenuDup;
6.19 +extern QMenu* floatimageContextMenu;
6.20 +extern QMenu* saveImageFormatMenu;
6.21 +extern QMenu* canvasContextMenu;
6.22 +extern QMenu* lastMapsMenu;
6.23 +extern QMenu* importMenu;
6.24 +extern QMenu* exportMenu;
6.25 +
6.26
6.27 extern Settings settings;
6.28 +extern ImageIO imageIO;
6.29
6.30 extern QString iconPath;
6.31 extern QDir vymBaseDir;
6.32 +extern QDir lastImageDir;
6.33
6.34 int MapEditor::mapNum=0; // make instance
6.35
6.36 @@ -1124,14 +1131,14 @@
6.37 setHideTmpMode (HideNone);
6.38 }
6.39
6.40 -void MapEditor::exportImage(QString fn, int item)
6.41 +void MapEditor::exportImage(QString fn, QString format)
6.42 {
6.43 // Finish open lineEdits
6.44 if (lineedit) finishedLineEdit();
6.45
6.46 setExportMode (true);
6.47 QPixmap pix (getPixmap());
6.48 - pix.save(fn, exportImageFormatMenu->text(item) );
6.49 + pix.save(fn, format);
6.50 setExportMode (false);
6.51 }
6.52
6.53 @@ -2506,6 +2513,7 @@
6.54
6.55 void MapEditor::updateActions()
6.56 {
6.57 +return; //FIXME testing
6.58 QAction *a;
6.59 if (getLinkColorHint()==HeadingColor)
6.60 actionFormatLinkColorHint->setOn(true);
6.61 @@ -2850,7 +2858,8 @@
6.62 if ( fd->exec() == QDialog::Accepted )
6.63 {
6.64 saveState(selection, QString("Add floatimage to %1").arg(getName(selection)));
6.65 - lastImageDir=fn.left(fn.findRev ("/"));
6.66 + // FIXME in QT4 use: lastImageDir=fd->directory();
6.67 + lastImageDir=QDir (fd->dirPath());
6.68 QStringList flist = fd->selectedFiles();
6.69 QStringList::Iterator it = flist.begin();
6.70 while( it != flist.end() )
7.1 --- a/mapeditor.h Tue Jun 13 08:49:12 2006 +0000
7.2 +++ b/mapeditor.h Tue Jun 13 13:54:53 2006 +0000
7.3 @@ -81,8 +81,8 @@
7.4 HideTmpMode getHideTmpMode(); // temporary hide stuff
7.5 public:
7.6 void setExportMode (bool); // temporary hide stuff during export
7.7 - void exportImage (QString fn); // export as PNG
7.8 - void exportImage (QString fn, int); // export in given format
7.9 + void exportImage (QString fn); // export as PNG
7.10 + void exportImage (QString fn, QString); // export in given format
7.11 void exportOOPresentation(const QString &,const QString &);
7.12 void exportXML(const QString&); // export to directory
7.13 void clear(); // clear map
7.14 @@ -235,7 +235,6 @@
7.15 QString fileDir; // dir where file is saved
7.16 QString destPath; // path to .vym file (needed for vymlinks)
7.17 QString mapName; // fileName without ".vym"
7.18 - QString lastImageDir; // save dir for adding images
7.19
7.20 bool isInteractive; // non interactive don't need tmpdirs
7.21 QString tmpMapDir; // tmp directory with data for undo/redo