# HG changeset patch # User insilmaril # Date 1193046608 0 # Node ID 6cdc2e7b19375413a8f00aeda29c609a1b1f6fbc # Parent 53c66cb9f5bd4317bb5e0a9100373b744698cfce Various patches: Better windows support, branch sorting, Freedesktop support diff -r 53c66cb9f5bd -r 6cdc2e7b1937 demos/vym-projectplan.vym Binary file demos/vym-projectplan.vym has changed diff -r 53c66cb9f5bd -r 6cdc2e7b1937 mainwindow.cpp --- a/mainwindow.cpp Mon Oct 22 09:50:03 2007 +0000 +++ b/mainwindow.cpp Mon Oct 22 09:50:08 2007 +0000 @@ -20,6 +20,19 @@ #include "texteditor.h" #include "warningdialog.h" +#if defined(Q_OS_WIN32) +// Define only this structure as opposed to +// including full 'windows.h'. FindWindow +// clashes with the one in Win32 API. +typedef struct _PROCESS_INFORMATION +{ + long hProcess; + long hThread; + long dwProcessId; + long dwThreadId; +} PROCESS_INFORMATION, *LPPROCESS_INFORMATION; +#endif + extern TextEditor *textEditor; extern Main *mainWindow; extern QString tmpVymDir; @@ -77,7 +90,7 @@ // Create unique temporary directory bool ok; - tmpVymDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX"); + tmpVymDir=makeTmpDir (ok,"vym"); if (!ok) { qWarning ("Mainwindow: Could not create temporary directory, failed to start vym"); @@ -135,12 +148,20 @@ // application to open URLs p="/mainwindow/readerURL"; #if defined(Q_OS_LINUX) - s=settings.value (p,"konqueror").toString(); + s=settings.value (p,"xdg-open").toString(); #else #if defined(Q_OS_MACX) s=settings.value (p,"/usr/bin/open").toString(); - #else - s=settings.value (p,"mozilla"); + + #else + #if defined(Q_OS_WIN32) + // Assume that system has been set up so that + // Explorer automagically opens up the URL + // in the user's preferred browser. + s=settings.value (p,"explorer").toString(); + #else + s=settings.value (p,"mozilla").toString(); + #endif #endif #endif settings.setValue( p,s); @@ -148,7 +169,7 @@ // application to open PDFs p="/mainwindow/readerPDF"; #if defined(Q_OS_LINUX) - s=settings.value (p,"acroread").toString(); + s=settings.value (p,"xdg-open").toString(); #else #if defined(Q_OS_MACX) s=settings.value (p,"/usr/bin/open").toString(); @@ -582,6 +603,11 @@ editMenu->addAction (a); actionEditMoveDown=a; + a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this ); + connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) ); + a->setEnabled (true); + a->addTo( tb ); + actionEditSortChildren=a; a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ),this); a->setShortcut ( Qt::Key_ScrollLock ); @@ -1784,7 +1810,7 @@ // Create temporary directory for packing bool ok; - QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX"); + QString tmpMapDir=makeTmpDir (ok,"vym-pack"); if (!ok) { QMessageBox::critical( 0, tr( "Critical Load Error" ), @@ -1863,7 +1889,7 @@ { me->setFilePath (fn); tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName()); - if (fn.left(9)!="/tmp/vym-") + if (!isInTmpDir (fn)) { // Only append to lastMaps if not loaded from a tmpDir // e.g. imported bookmarks are in a tmpDir @@ -2008,7 +2034,7 @@ { // Create temporary directory for packing bool ok; - QString tmpMapDir=makeUniqueDir (ok,"/tmp/vym-XXXXXX"); + QString tmpMapDir=makeTmpDir (ok,"vym-zip"); if (!ok) { QMessageBox::critical( 0, tr( "Critical Load Error" ), @@ -2536,7 +2562,12 @@ tr("Please use Settings->")+tr("Set application to open an URL")); return; } +#if defined(Q_OS_WIN32) + // There's no sleep in VCEE, replace it with Qt's QThread::wait(). + this->thread()->wait(3000); +#else sleep (3); +#endif } if (browser.contains("konqueror")) { @@ -2546,11 +2577,21 @@ // Try to open new tab in existing konqueror started previously by vym p=new QProcess (this); args.clear(); - args<< QString("konqueror-%1").arg(procBrowser->pid())<< - "konqueror-mainwindow#1"<< - "newTab" << +#if defined(Q_OS_WIN32) + // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure. + // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic. + args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<< + "konqueror-mainwindow#1"<< + "newTab" << urls.at(i); +#else + args<< QString("konqueror-%1").arg(procBrowser->pid())<< + "konqueror-mainwindow#1"<< + "newTab" << + urls.at(i); +#endif p->start ("dcop",args); + cout << args.join(" ").ascii()<waitForStarted() ) success=false; } if (!success) @@ -2819,6 +2860,12 @@ currentMapEditor()->moveBranchDown(); } +void Main::editSortChildren() +{ + if (currentMapEditor()) + currentMapEditor()->sortChildren(); +} + void Main::editToggleScroll() { if (currentMapEditor()) @@ -3631,6 +3678,9 @@ #if defined(Q_OS_MACX) searchList << "./vym.app/Contents/Resources/doc"; #else + #if defined(VYM_DOCDIR) + searchList << VYM_DOCDIR; + #endif // default path in SUSE LINUX searchList <<"/usr/share/doc/packages/vym"; #endif @@ -3757,3 +3807,31 @@ } } + + +////////////////////////////////// +/* +@@ -2544,18 +2576,27 @@ + // Try to open new tab in existing konqueror started previously by vym + p=new QProcess (this); + args.clear(); +- args<< QString("konqueror-%1").arg(procBrowser->pid())<< +- "konqueror-mainwindow#1"<< +- "newTab" << ++#if defined(Q_OS_WIN32) ++ // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure. ++ // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic. ++ args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<< ++ "konqueror-mainwindow#1"<< ++ "newTab" << + urls.at(i); ++#else ++ args<< QString("konqueror-%1").arg(procBrowser->pid())<< ++ "konqueror-mainwindow#1"<< ++ "newTab" << ++ urls.at(i); ++#endif + p->start ("dcop",args); + if ( !p->waitForStarted() ) success=false; + } +*/ diff -r 53c66cb9f5bd -r 6cdc2e7b1937 mainwindow.h --- a/mainwindow.h Mon Oct 22 09:50:03 2007 +0000 +++ b/mainwindow.h Mon Oct 22 09:50:08 2007 +0000 @@ -126,6 +126,7 @@ void editMapInfo(); void editMoveUp(); void editMoveDown(); + void editSortChildren(); void editToggleScroll(); void editUnscrollChilds(); void editNewBranch(); @@ -254,6 +255,7 @@ QAction *actionEditPaste; QAction *actionEditMoveUp; QAction *actionEditMoveDown; + QAction *actionEditSortChildren; QAction *actionEditToggleScroll; QAction* actionEditOpenURL; QAction* actionEditOpenURLTab; diff -r 53c66cb9f5bd -r 6cdc2e7b1937 mapeditor.cpp --- a/mapeditor.cpp Mon Oct 22 09:50:03 2007 +0000 +++ b/mapeditor.cpp Mon Oct 22 09:50:08 2007 +0000 @@ -2174,7 +2174,7 @@ void MapEditor::addMapInsertInt (const QString &path, int pos) { BranchObj *sel=xelection.getBranch(); - if (sel); + if (sel) { QString pathDir=path.left(path.findRev("/")); QDir d(pathDir); @@ -2330,6 +2330,21 @@ } } +void MapEditor::sortChildren() +{ + BranchObj* bo=xelection.getBranch(); + if (bo) + { + if(bo->countBranches()>1) + { + bo->sortChildren(); + saveStateChangingPart(bo,bo, "sortChildren ()",QString("Sort children of %1").arg(getName(bo))); + mapCenter->reposition(); + ensureSelectionVisible(); + } + } +} + void MapEditor::linkTo(const QString &dstString) { FloatImageObj *fio=xelection.getFloatImage(); diff -r 53c66cb9f5bd -r 6cdc2e7b1937 mapeditor.h --- a/mapeditor.h Mon Oct 22 09:50:03 2007 +0000 +++ b/mapeditor.h Mon Oct 22 09:50:08 2007 +0000 @@ -189,6 +189,7 @@ void moveRel (const double &x, const double &y); void moveBranchUp(); //!< Move branch up void moveBranchDown(); //!< Move branch down + void sortChildren(); //!< Sort children lexically private: void linkTo(const QString &); public: diff -r 53c66cb9f5bd -r 6cdc2e7b1937 version.h --- a/version.h Mon Oct 22 09:50:03 2007 +0000 +++ b/version.h Mon Oct 22 09:50:08 2007 +0000 @@ -4,10 +4,10 @@ #include #define __VYM_NAME "VYM" -#define __VYM_VERSION "1.10.1" +#define __VYM_VERSION "1.11.0" //#define __VYM_CODENAME "Codename: 1.10.0-RC-3" #define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "September 30, 2007" +#define __VYM_BUILD_DATE "2007-10-19" bool checkVersion(const QString &); diff -r 53c66cb9f5bd -r 6cdc2e7b1937 vym.pro --- a/vym.pro Mon Oct 22 09:50:03 2007 +0000 +++ b/vym.pro Mon Oct 22 09:50:08 2007 +0000 @@ -3,6 +3,13 @@ CONFIG += qt warn_on release debug CONFIG += x86 ppc + +# Manifest embedding was suggested by Qt docs somewhere... +win32: CONFIG += embed_manifest_exe + +# Without this, M_PI, and M_PI_2 won't be defined. +win32:DEFINES *= _USE_MATH_DEFINES + ICON =icons/vym.icns QT += qt3support @@ -121,26 +128,43 @@ TRANSLATIONS += lang/vym_es.ts TRANSLATIONS += lang/vym_it.ts -count( INSTALLDIR, 0 ) { - INSTALLDIR = /usr/local +isEmpty( PREFIX ) { + PREFIX = /usr/local + count( INSTALLDIR, 1 ) { + PREFIX = $${INSTALLDIR} + message( "Please use PREFIX instead of INSTALLDIR" ) + } +} +isEmpty( BINDIR ) { + BINDIR = $${PREFIX}/bin +} +isEmpty( DATADIR ) { + DATADIR = $${PREFIX}/share +} +isEmpty( DOCDIR ) { + DOCDIR = $${DATADIR}/doc/packages/vym +} +isEmpty( DEMODIR ) { + DEMODIR = $${DOCDIR} } message( "Installation directory" ) -message( $$INSTALLDIR ) +message( $$PREFIX ) -target.path = $${INSTALLDIR}/bin +target.path = $${BINDIR} INSTALLS += target support.files = styles/ scripts/ icons/ flags/ lang/ macros/ exports/ -support.path = $${INSTALLDIR}/share/vym +support.path = $${DATADIR}/vym INSTALLS += support -doc.files = tex/vym.pdf -doc.path = $${INSTALLDIR}/share/doc/packages/vym +doc.files = tex/vym.pdf +doc.path = $${DOCDIR} INSTALLS += doc +DEFINES += VYM_DOCDIR=\\\"$${DOCDIR}\\\" demo.files = demos/ -demo.path = $${INSTALLDIR}/share/doc/packages/vym +demo.path = $${DEMODIR} INSTALLS += demo