diff -r 7c3ee77f4449 -r 53efc2562a7d mapeditor.cpp --- a/mapeditor.cpp Mon Nov 20 12:12:00 2006 +0000 +++ b/mapeditor.cpp Mon Nov 20 12:12:02 2006 +0000 @@ -46,6 +46,9 @@ extern Settings settings; extern ImageIO imageIO; +extern QString vymName; +extern QString vymVersion; + extern QString iconPath; extern QDir vymBaseDir; extern QDir lastImageDir; @@ -87,16 +90,10 @@ linkstyle=StylePolyParabel; // Create bitmap cursors, platform dependant - // FIXME should now work also on Mac... - //#if defined(Q_OS_MACX) - // HandOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 ); - // PickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); - //#else - HandOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1); - PickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); - CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 5,5 ); - XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 5,27 ); - //#endif + HandOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1); + PickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); + CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 1,1 ); + XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 1,7 ); setFocusPolicy (Qt::StrongFocus); @@ -146,10 +143,6 @@ mapCenter->reposition(); // for positioning heading - // Initialize history window; - historyWindow.setME(this); - historyWindow.setStepsTotal(stepsTotal); - historyWindow.update (undoSet); } MapEditor::~MapEditor() @@ -299,7 +292,7 @@ if (linkcolorhint==HeadingColor) colhint=attribut("linkColorHint","HeadingColor"); - QString mapAttr=attribut("version",__VYM_VERSION); + QString mapAttr=attribut("version",vymVersion); if (!saveSel || saveSel==mapCenter) mapAttr+= attribut("author",mapCenter->getAuthor()) + attribut("comment",mapCenter->getComment()) + @@ -487,7 +480,7 @@ undoSet.setEntry (QString("/history/step-%1/redoCommand").arg(curStep),redoCom); undoSet.setEntry (QString("/history/step-%1/redoSelection").arg(curStep),redoSelection); undoSet.setEntry (QString("/history/step-%1/comment").arg(curStep),comment); - undoSet.setEntry (QString("/history/version"),__VYM_VERSION); + undoSet.setEntry (QString("/history/version"),vymVersion); undoSet.writeSettings(histPath); /* TODO remove after testing @@ -506,7 +499,7 @@ if (saveSel) cout << " saveSel="<getSelectString().ascii()<updateHistory (undoSet); setChanged(); updateActions(); } @@ -962,14 +955,6 @@ } } -void MapEditor::toggleHistoryWindow() -{ - if (historyWindow.isVisible()) - historyWindow.hide(); - else - historyWindow.show(); -} - bool MapEditor::isDefault() { @@ -1033,9 +1018,6 @@ // Forget the .vym (or .xml) for name of map mapName=fileName.left(fileName.findRev(".",-1,true) ); - - // Adjust history window - historyWindow.setCaption (__VYM " - " +tr("History for ")+fileName); } } @@ -1493,7 +1475,7 @@ if (!checkVersion(version)) QMessageBox::warning(0,tr("Warning"), - tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(__VYM_VERSION)); + tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(vymVersion)); // Find out current undo directory @@ -1514,7 +1496,6 @@ cout << " ---------------------------"<updateHistory (undoSet); updateActions(); /* TODO remove testing -*/ cout << "ME::redo() end\n"; cout << " undosAvail="<updateHistory (undoSet); updateActions(); } @@ -1629,14 +1610,12 @@ return false; } -void MapEditor::gotoStep (int i) +void MapEditor::gotoHistoryStep (int i) { // Restore variables int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail")); int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail")); - cout << "ME::goto "<addFilter (QString (tr("vym map") + " (*.vym)")); - fd->setCaption(__VYM " - " +tr("Link to another map")); + QStringList filters; + filters <<"VYM map (*.vym)"; + QFileDialog *fd=new QFileDialog( this,vymName+" - " +tr("Link to another map")); + fd->setFilters (filters); + fd->setCaption(vymName+" - " +tr("Link to another map")); if (! bo->getVymLink().isEmpty() ) - fd->setSelection( bo->getVymLink() ); + fd->selectFile( bo->getVymLink() ); fd->show(); QString fn; @@ -3163,7 +3144,7 @@ fd->setContentsPreviewEnabled( TRUE ); fd->setContentsPreview( p, p ); fd->setPreviewMode( Q3FileDialog::Contents ); - fd->setCaption(__VYM " - " +tr("Load image")); + fd->setCaption(vymName+" - " +tr("Load image")); fd->setDir (lastImageDir); fd->show(); @@ -3210,7 +3191,7 @@ FloatImageObj *fio=((FloatImageObj*)selection); QFileDialog *fd=new QFileDialog( this); fd->setFilters (imageIO.getFilters()); - fd->setCaption(__VYM " - " +tr("Save image")); + fd->setCaption(vymName+" - " +tr("Save image")); fd->setFileMode( QFileDialog::AnyFile ); fd->setDirectory (lastImageDir); // fd->setSelection (fio->getOriginalFilename()); @@ -3221,7 +3202,7 @@ { if (QFile (fd->selectedFile()).exists() ) { - QMessageBox mb( __VYM, + QMessageBox mb( vymName, tr("The file %1 exists already.\n" "Do you want to overwrite it?").arg(fd->selectedFile()), QMessageBox::Warning, @@ -3344,10 +3325,12 @@ (typeid(*selection) == typeid(BranchObj)) || (typeid(*selection) == typeid(MapCenterObj)) ) { - Q3FileDialog *fd=new Q3FileDialog( this,__VYM " - " +tr("Choose directory structure to import")); - fd->setMode (Q3FileDialog::DirectoryOnly); - fd->addFilter (QString (tr("vym map") + " (*.vym)")); - fd->setCaption(__VYM " - " +tr("Choose directory structure to import")); + QStringList filters; + filters <<"VYM map (*.vym)"; + QFileDialog *fd=new QFileDialog( this,vymName+ " - " +tr("Choose directory structure to import")); + fd->setMode (QFileDialog::DirectoryOnly); + fd->setFilters (filters); + fd->setCaption(vymName+" - " +tr("Choose directory structure to import")); fd->show(); QString fn;