# HG changeset patch
# User insilmaril
# Date 1150188552 0
# Node ID 6a0342b3c519a0c7bacc7cc3f4b27fec2a5bd2c4
# Parent 608f976aa7bb2b4dac092947ec03150442c82641
ported standard flags to QT4
diff -r 608f976aa7bb -r 6a0342b3c519 aboutdialog.cpp
--- a/aboutdialog.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/aboutdialog.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -45,13 +45,11 @@
""
"
Credits "
""
- "- Matt from www.satbp.com for Taskjuggler export
"
"- Jakob Hilmer for image drag and drop, "About vym" window patch
"
"- Thomas Schraitle for the stylesheet used for XHTML-export
"
"- Debianization by Christoph Thielecke and Steffen Joeris
"
- "- Clemens Kraus for HTML-export "
- "(www.clemens-kraus.de)
"
"- Ken Wimer and Olaf Hering for Mac support
"
+ "- Matt from www.satbp.com for Taskjuggler export
"
"
"
"");
credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
diff -r 608f976aa7bb -r 6a0342b3c519 demos/todo.vym
Binary file demos/todo.vym has changed
diff -r 608f976aa7bb -r 6a0342b3c519 flagobj.cpp
--- a/flagobj.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/flagobj.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -36,8 +36,8 @@
icon=new ImageObj (canvas);
icon->move (absPos.x(), absPos.y() );
- button=NULL;
state=false;
+ action=NULL;
}
void FlagObj::copy (FlagObj* other)
@@ -48,10 +48,8 @@
tooltip=other->tooltip;
state=other->state;
icon->copy(other->icon);
+ action=other->action;
setVisibility (other->isVisibleObj() );
- // button is not copied, because
- // we won't copy to a parentRow and
- // all others don't need a button
}
void FlagObj::move(double x, double y)
@@ -119,24 +117,21 @@
return tooltip;
}
-void FlagObj::setButton(QAction* b)
-{
- button=b;
-}
-
-void FlagObj::updateButton()
-{
- if (button)
- button->setOn(state);
- else
- qWarning ("FlagObj::updateButton no button defined");
-}
-
QPixmap FlagObj::getPixmap()
{
return icon->getPixmap();
}
+void FlagObj::setAction (QAction* a)
+{
+ action=a;
+}
+
+void FlagObj::updateAction ()
+{
+ if (action) action->setChecked(state);
+}
+
bool FlagObj::isActive()
{
return state;
@@ -172,12 +167,6 @@
}
}
-void FlagObj::setEnabled(bool b)
-{
- button->setEnabled (b);
-}
-
-
void FlagObj::setUsed (bool b)
{
used=b;
diff -r 608f976aa7bb -r 6a0342b3c519 flagobj.h
--- a/flagobj.h Tue Jun 06 14:58:11 2006 +0000
+++ b/flagobj.h Tue Jun 13 08:49:12 2006 +0000
@@ -30,14 +30,13 @@
const QString getGroup();
void setToolTip(const QString&);
const QString getToolTip();
- void setButton (QAction*);
- void updateButton ();
QPixmap getPixmap();
+ void setAction(QAction*);
+ void updateAction ();
bool isActive();
void toggle();
void activate();
void deactivate();
- void setEnabled (bool);
void setUsed (bool);
bool isUsed();
void saveToDir (const QString&, const QString&);
@@ -52,7 +51,7 @@
virtual void calcBBoxSize();
private:
ImageObj* icon;
- QAction* button;
+ QAction* action;
};
#endif
diff -r 608f976aa7bb -r 6a0342b3c519 flagrowobj.cpp
--- a/flagrowobj.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/flagrowobj.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -1,5 +1,7 @@
#include "flagrowobj.h"
+#include
+
/////////////////////////////////////////////////////////////////
// FlagRowObj
/////////////////////////////////////////////////////////////////
@@ -232,15 +234,16 @@
}
}
+void FlagRowObj::setToolBar(QToolBar *tb)
+{
+ toolbar=tb;
+}
+
void FlagRowObj::setEnabled (bool b)
{
- // If we have no parent, we are the default FlagRowObj
- // and have QToolbarButtons
- if (!parentRow)
+ if (toolbar)
{
- FlagObj *fo;
- for (fo=flag.first();fo; fo=flag.next() )
- fo->setEnabled (b);
+ toolbar->setEnabled (b);
}
}
@@ -286,45 +289,13 @@
name=n;
}
-void FlagRowObj::makeToolbar (Q3MainWindow *w, const QString &n)
-{
- //Only make toolbar for the parentrow, not each row in branches
- if (!parentRow)
- {
- // create bar and buttons
- Q3ToolBar* tb = new Q3ToolBar( w);
- tb->setLabel (n);
- QAction *a;
- FlagObj *fo;
- for (fo=flag.first();fo; fo=flag.next() )
- {
- a=new QAction (
-// FIXME was in QT3: fo->getToolTip(),
- fo->getPixmap(),
- fo->getName(),
-// 0,
- w
-// fo->getName()
- );
- a->setToggleAction(true);
-// a->setTooltip (fo->getToolTip());
- // FIXME should not be enabled by default, later in updateToolbar
- a->setEnabled(true);
- a->addTo (tb);
- fo->setButton (a);
- connect(a, SIGNAL( activated() ),
- w, SLOT( standardFlagChanged() ) );
- }
- } else
- qWarning ("FlagRowObj::makeToolbar must not be called for ordinary rows");
-}
-
void FlagRowObj::updateToolbar()
{
FlagObj *fo;
if (parentRow)
{
// We are just a branch, not the toolbar default
+ // but state has to be copied from ourselves to parentrow!
parentRow->deactivateAll();
// In parentRow activate all existing (==active) flags
for (fo=flag.first();fo; fo=flag.next() )
@@ -333,8 +304,12 @@
} else
{
// We are the toolbar default
- for (fo=flag.first();fo; fo=flag.next() )
- fo->updateButton();
+ if (toolbar)
+ {
+ // Update state of actions in toolbar
+ for (fo=flag.first();fo; fo=flag.next() )
+ fo->updateAction();
+ }
}
}
diff -r 608f976aa7bb -r 6a0342b3c519 flagrowobj.h
--- a/flagrowobj.h Tue Jun 06 14:58:11 2006 +0000
+++ b/flagrowobj.h Tue Jun 13 08:49:12 2006 +0000
@@ -1,7 +1,7 @@
#ifndef FLAGROWOBJ_H
#define FLAGROWOBJ_H
-#include
+#include
//Added by qt3to4:
#include
@@ -29,17 +29,19 @@
void deactivate(const QString&);
void deactivateAll();
void deactivateGroup(FlagObj *);
+ void setToolBar (QToolBar *);
void setEnabled (bool);
void setShowFlags (bool);
void resetUsedCounter();
QString saveToDir (const QString &,const QString &,bool);
void setName (const QString&); // prefix for exporting flags to dir
- void makeToolbar (Q3MainWindow*, const QString &); // Create Toolbar buttons
+ void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons
void updateToolbar(); // Update Toolbar buttons
private:
FlagRowObj* parentRow; // look for flags in this row
FlagObj* findFlag (const QString&);
Q3PtrList flag;
+ QToolBar *toolbar;
QString name;
bool showFlags; // FloatObjects want to hide their flags
};
diff -r 608f976aa7bb -r 6a0342b3c519 main.cpp
--- a/main.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/main.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include
@@ -8,7 +8,7 @@
#include
//Added by qt3to4:
#include
-#include
+#include
#include "settings.h"
#include "options.h"
@@ -79,16 +79,16 @@
QAction *actionFormatLinkColorHint;
QAction *actionFormatLinkColor;
-Q3ActionGroup *actionGroupModModes;
+QActionGroup *actionGroupModModes;
QAction *actionModModeColor;
QAction *actionModModeLink;
QAction *actionModModeCopy;
-Q3ActionGroup *actionGroupFormatFrameTypes;
+QActionGroup *actionGroupFormatFrameTypes;
QAction *actionFormatFrameNone;
QAction *actionFormatFrameRectangle;
-Q3ActionGroup *actionGroupFormatLinkStyles;
+QActionGroup *actionGroupFormatLinkStyles;
QAction *actionFormatIncludeImagesVer;
QAction *actionFormatIncludeImagesHor;
QAction *actionFormatHideLinkUnselected;
@@ -122,7 +122,7 @@
Q3PopupMenu *exportImageFormatMenu;
-Settings settings;
+Settings settings ("vym","vym"); // Organization, Application name
Options options;
int statusbarTime=3500;
diff -r 608f976aa7bb -r 6a0342b3c519 mainwindow.cpp
--- a/mainwindow.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/mainwindow.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -1,9 +1,11 @@
+#include
+
#include "mainwindow.h"
-#include
-#include
-#include
-#include
+//#include
+//#include
+//#include
+//#include
#include
#include
#include
@@ -19,7 +21,7 @@
#include
#include
#include
-#include
+#include
#include
//#include // for random seed
@@ -101,16 +103,16 @@
extern QAction *actionFormatIncludeImagesVer;
extern QAction *actionFormatIncludeImagesHor;
-extern Q3ActionGroup* actionGroupModModes;
+extern QActionGroup* actionGroupModModes;
extern QAction* actionModModeColor;
extern QAction* actionModModeLink;
extern QAction* actionModModeCopy;
-extern Q3ActionGroup *actionGroupFormatFrameTypes;
+extern QActionGroup *actionGroupFormatFrameTypes;
extern QAction *actionFormatFrameNone;
extern QAction *actionFormatFrameRectangle;
-extern Q3ActionGroup *actionGroupFormatLinkStyles;
+extern QActionGroup *actionGroupFormatLinkStyles;
extern QAction *actionFormatLinkStyleLine;
extern QAction *actionFormatLinkStyleParabel;
extern QAction *actionFormatLinkStylePolyLine;
@@ -150,7 +152,7 @@
extern QString flagsPath;
Main::Main(QWidget* parent, const char* name, Qt::WFlags f) :
- Q3MainWindow(parent,name,f)
+ QMainWindow(parent,name,f)
{
mainWindow=this;
@@ -319,8 +321,7 @@
// File Actions
void Main::setupFileActions()
{
- Q3ToolBar *tb = new Q3ToolBar( this );
- tb->setLabel( "File Actions" );
+ QToolBar *tb = addToolBar( tr ("&File") );
Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&File" ), menu );
@@ -418,7 +419,7 @@
//Edit Actions
void Main::setupEditActions()
{
- Q3ToolBar *tb = new Q3ToolBar( this );
+ QToolBar *tb = addToolBar( tr ("&Edit") );
tb->setLabel( "Edit Actions" );
Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&Edit" ), menu );
@@ -607,24 +608,28 @@
menu->insertSeparator();
// Shortcuts to modify heading:
+ /*
a = new QAction(tr( "Edit heading" ),this);
a->setStatusTip ( tr( "edit Heading" ));
- a->setShortcut ( Qt::Key_Enter );
- connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
+ a->setShortcut ( Qt::Key_Enter);
+ connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
actionListBranches.append(a);
+ */
a = new QAction( tr( "Edit heading" ), this);
a->setStatusTip (tr( "edit Heading" ));
a->setShortcut (Qt::Key_Return );
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
- actionListBranches.append(a);
+ //actionListBranches.append(a);
+ a->addTo( menu );
actionEditHeading=a;
+ /*
a = new QAction( tr( "Edit heading" ),this);
a->setStatusTip (tr( "edit Heading" ));
a->setShortcut ( Qt::Key_F2 );
connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
a->setEnabled (false);
- actionEditHeading=a;
actionListBranches.append(a);
+ */
// Shortcut to delete selection
a = new QAction( tr( "Delete Selection" ),this);
@@ -638,11 +643,11 @@
alt = new QAction(tr( "Add branch as child" ), this);
alt->setStatusTip ( tr( "Add a branch as child of selection" ));
alt->setShortcut (Qt::Key_A);
- connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
+ connect( alt, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
a = new QAction(tr( "Add branch as child" ), this);
a->setStatusTip ( tr( "Add a branch as child of selection" ));
a->setShortcut (Qt::Key_Insert);
- a->setEnabled (false);
+// a->setEnabled (false);
connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
actionListBranches.append(a);
#if defined (Q_OS_MACX)
@@ -783,7 +788,7 @@
Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "F&ormat" ), menu );
- Q3ToolBar *tb = new Q3ToolBar( this );
+ QToolBar *tb = addToolBar( tr("Format Actions","Toolbars"));
QAction *a;
QPixmap pix( 16,16);
pix.fill (Qt::black);
@@ -824,7 +829,7 @@
actionFormatColorSubtree=a;
menu->insertSeparator();
- actionGroupFormatLinkStyles=new Q3ActionGroup ( this, "formatLinkStyles");
+ actionGroupFormatLinkStyles=new QActionGroup ( this);
actionGroupFormatLinkStyles->setExclusive (true);
a= new QAction( tr( "Linkstyle Line" ), actionGroupFormatLinkStyles);
a->setStatusTip (tr( "Line" ));
@@ -848,7 +853,7 @@
actionFormatLinkStylePolyParabel=a;
actionGroupFormatLinkStyles->addTo (menu);
- actionGroupFormatFrameTypes=new Q3ActionGroup ( this, "formatFrameTypes");
+ actionGroupFormatFrameTypes=new QActionGroup ( this);
actionGroupFormatFrameTypes->setExclusive (true);
a = new QAction( tr( "No Frame" ), actionGroupFormatFrameTypes );
a->setStatusTip (tr("No Frame"));
@@ -904,7 +909,7 @@
// View Actions
void Main::setupViewActions()
{
- Q3ToolBar *tb = new Q3ToolBar( this );
+ QToolBar *tb = addToolBar( tr("View Actions","Toolbars") );
tb->setLabel( "View Actions" );
Q3PopupMenu *menu = new Q3PopupMenu( this );
menuBar()->insertItem( tr( "&View" ), menu );
@@ -972,10 +977,9 @@
//QPopupMenu *menu = new QPopupMenu( this );
//menuBar()->insertItem( tr( "&Mode (using modifiers)" ), menu );
- Q3ToolBar *tb = new Q3ToolBar( this );
- tb->setLabel( tr ("Modes when using modifiers") );
+ QToolBar *tb = addToolBar( tr ("Modes when using modifiers","Toolbars") );
QAction *a;
- actionGroupModModes=new Q3ActionGroup ( this, "formatLinkStyles");
+ actionGroupModModes=new QActionGroup ( this);
actionGroupModModes->setExclusive (true);
a= new QAction( QPixmap(iconPath+"modecolor.png"), tr( "Use modifier to color branches" ), actionGroupModModes);
a->setShortcut (Qt::Key_J);
@@ -1040,145 +1044,282 @@
systemFlagsDefault->addFlag (fo);
// Create Standard Flags
+ QToolBar *tb=addToolBar (tr ("Standard Flags","Standard Flag Toolbar"));
+
standardFlagsDefault = new FlagRowObj ();
standardFlagsDefault->setVisibility (false);
standardFlagsDefault->setName ("standardFlagsDef");
+ standardFlagsDefault->setToolBar (tb);
fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
fo->setName ("exclamationmark");
fo->setGroup("standard-mark");
- fo->setToolTip(tr("Take care!","Standardflag"));
+ QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Take care!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo); // makes deep copy
fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
fo->setName("questionmark");
fo->setGroup("standard-mark");
- fo->setToolTip(tr("Really?","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Really?","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
fo->setName("hook-green");
fo->setGroup("standard-hook");
- fo->setToolTip(tr("ok!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("ok!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
fo->setName("cross-red");
fo->setGroup("standard-hook");
- fo->setToolTip(tr("Not ok!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Not ok!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
fo->setName("stopsign");
- fo->setToolTip(tr("This won't work!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("This won't work!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
fo->setName("smiley-good");
fo->setGroup("standard-smiley");
- fo->setToolTip(tr("Good","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Good","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
fo->setName("smiley-sad");
fo->setGroup("standard-smiley");
- fo->setToolTip(tr("Bad","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Bad","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
// Original omg.png (in KDE emoticons)
fo->setName("smiley-omg");
fo->setGroup("standard-smiley");
- fo->setToolTip(tr("Oh no!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Oh no!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
fo->setName("clock");
- fo->setToolTip(tr("Time critical","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Time critical","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-phone.png"));
fo->setName("phone");
- fo->setToolTip(tr("Call...","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Call...","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-lamp.png"));
fo->setName("lamp");
- fo->setToolTip(tr("Idea!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Idea!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
fo->setName("arrow-up");
fo->setGroup("standard-arrow");
- fo->setToolTip(tr("Important","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Important","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
fo->setName("arrow-down");
fo->setGroup("standard-arrow");
- fo->setToolTip(tr("Unimportant","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Unimportant","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
fo->setName("2arrow-up");
fo->setGroup("standard-arrow");
- fo->setToolTip(tr("Very important!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Very important!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
fo->setName("2arrow-down");
fo->setGroup("standard-arrow");
- fo->setToolTip(tr("Very unimportant!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Very unimportant!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
fo->setName("thumb-up");
fo->setGroup("standard-thumb");
- fo->setToolTip(tr("I like this","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("I like this","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
fo->setName("thumb-down");
fo->setGroup("standard-thumb");
- fo->setToolTip(tr("I like this","Standardflag"));
- fo->setToolTip(tr("I do not like this","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("I do not like this","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-rose.png"));
fo->setName("rose");
- fo->setToolTip(tr("Rose","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Rose","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-heart.png"));
fo->setName("heart");
- fo->setToolTip(tr("I just love... ","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("I just love... ","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-present.png"));
fo->setName("present");
- fo->setToolTip(tr("Surprise!","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Surprise!","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-flash.png"));
fo->setName("flash");
- fo->setToolTip(tr("Dangerous","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Dangerous","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-info.png"));
// Original: xsldbg_output.png
fo->setName("info");
- fo->setToolTip(tr("Info","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("Info","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
// Original khelpcenter.png
fo->setName("lifebelt");
- fo->setToolTip(tr("This will help","Standardflag"));
+ a=new QAction (fo->getPixmap(),fo->getName(),this);
+ tb->addAction (a);
+ fo->setAction (a);
+ a->setCheckable(true);
+ a->setObjectName(fo->getName());
+ a->setToolTip(tr("This will help","Standardflag"));
+ connect (a, SIGNAL( activated() ), this, SLOT( standardFlagChanged() ) );
standardFlagsDefault->addFlag (fo);
delete (fo);
-
- standardFlagsDefault->makeToolbar(this, "Standard Flags");
}
// Settings Actions
@@ -1638,7 +1779,7 @@
// create a new mapeditor in a new tab
if ( lmode==NewMap && (!me || !me->isDefault() ) )
{
- me = new MapEditor (tabWidget,true);
+ me= new MapEditor ( NULL,true);
tabWidget->addTab (me,fn);
tabIndex=tabWidget->indexOf (me);
tabWidget->setCurrentPage (tabIndex);
@@ -2544,12 +2685,19 @@
void Main::editHeading()
{
+ qWarning ("Main::editHeading called");
if (currentMapEditor())
currentMapEditor()->editHeading();
}
void Main::editNewBranch()
{
+ //FIXME
+ // tried to see if maybe currentMapEditor is not set, but
+ // ME does not seem to send a key event anyway...:q
+ //here i was last time...
+
+ cout << "Main::editNewBranch\n";
if (currentMapEditor())
currentMapEditor()->addNewBranch(0);
}
diff -r 608f976aa7bb -r 6a0342b3c519 mainwindow.h
--- a/mainwindow.h Tue Jun 06 14:58:11 2006 +0000
+++ b/mainwindow.h Tue Jun 13 08:49:12 2006 +0000
@@ -2,12 +2,12 @@
#define MAINWINDOW_H
#include
-#include
+#include
#include
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -22,7 +22,7 @@
#include "texteditor.h"
#include "xml.h"
-class Main : public Q3MainWindow
+class Main : public QMainWindow
{
Q_OBJECT
diff -r 608f976aa7bb -r 6a0342b3c519 mapeditor.cpp
--- a/mapeditor.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/mapeditor.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -28,7 +28,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -101,16 +101,16 @@
extern QAction *actionFormatBackColor;
extern QAction *actionFormatLinkColor;
-extern Q3ActionGroup* actionGroupModModes;
+extern QActionGroup* actionGroupModModes;
extern QAction* actionModModeColor;
extern QAction* actionModModeLink;
extern QAction* actionModModeCopy;
-extern Q3ActionGroup *actionGroupFormatFrameTypes;
+extern QActionGroup *actionGroupFormatFrameTypes;
extern QAction *actionFormatFrameNone;
extern QAction *actionFormatFrameRectangle;
-extern Q3ActionGroup *actionGroupFormatLinkStyles;
+extern QActionGroup *actionGroupFormatLinkStyles;
extern QAction *actionFormatIncludeImagesVer;
extern QAction *actionFormatIncludeImagesHor;
extern QAction *actionFormatHideLinkUnselected;
@@ -2197,15 +2197,19 @@
{
if (selection)
{
- BranchObj *bo=(BranchObj*)selection;
- QString s;
- if (bo->isSetStandardFlag(f))
- s="Unset";
- else
- s="Set";
- saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand
- bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
- adjustCanvasSize();
+ if (typeid(*selection) == typeid(BranchObj) ||
+ typeid(*selection) == typeid(MapCenterObj))
+ {
+ BranchObj *bo=(BranchObj*)selection;
+ QString s;
+ if (bo->isSetStandardFlag(f))
+ s="Unset";
+ else
+ s="Set";
+ saveState(selection, QString("%1 standard flag \"%2\" of %3").arg(s).arg(f).arg(getName(bo)));// TODO undoCommand
+ bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
+ adjustCanvasSize();
+ }
}
}
@@ -2640,7 +2644,7 @@
if ( (typeid(*selection) == typeid(FloatImageObj)) )
{
FloatObj *fo=(FloatImageObj*)selection;
- standardFlagsDefault->setEnabled (false);
+//FIXME do this in mainwindow standardFlagsDefault->setEnabled (false);
actionEditOpenURL->setEnabled (false);
actionEditOpenVymLink->setEnabled (false);
@@ -2663,7 +2667,7 @@
} else
{
- standardFlagsDefault->setEnabled (false);
+//FIXME do this in mainwindow standardFlagsDefault->setEnabled (false);
actionEditCopy->setEnabled (false);
actionEditCut->setEnabled (false);
diff -r 608f976aa7bb -r 6a0342b3c519 settings.cpp
--- a/settings.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/settings.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -1,8 +1,114 @@
#include
+#include
#include "settings.h"
-#include "misc.h"
+#include "file.h"
using namespace std;
+
+/////////////////////////////////////////////////////////////////
+// SimpleSettings
+/////////////////////////////////////////////////////////////////
+SimpleSettings::SimpleSettings()
+{
+ clear();
+}
+
+SimpleSettings::~SimpleSettings()
+{
+}
+
+void SimpleSettings::clear()
+{
+ keylist.clear();
+ valuelist.clear();
+}
+
+void SimpleSettings::readSettings (const QString &path)
+{
+ QString s;
+ if (!loadStringFromDisk(path,s))
+ {
+ qWarning ("SimpleSettings::readSettings() Couldn't read "+path);
+ return;
+ }
+ QStringList lines;
+ lines=QStringList::split (QRegExp("\n"),s,false);
+ int i;
+ QStringList::Iterator it=lines.begin();
+ while (it !=lines.end() )
+ {
+ i=(*it).find("=",0);
+ keylist.append((*it).left(i));
+ valuelist.append((*it).right((*it).length()-i-1));
+ it++;
+ }
+}
+
+void SimpleSettings::writeSettings (const QString &path)
+{
+ QString s;
+ QStringList::Iterator itk=keylist.begin();
+ QStringList::Iterator itv=valuelist.begin();
+
+ // First search for value in settings saved in map
+ while (itk !=keylist.end() )
+ {
+ s+=*itk+"="+*itv+"\n";
+ itk++;
+ itv++;
+ }
+ if (!saveStringToDisk(path,s))
+ qWarning ("SimpleSettings::writeSettings() Couldn't write "+path);
+}
+
+QString SimpleSettings::readEntry (const QString &key)
+{
+ QStringList::Iterator itk=keylist.begin();
+ QStringList::Iterator itv=valuelist.begin();
+
+ // First search for value in settings saved in map
+ while (itk !=keylist.end() )
+ {
+ if (*itk == key)
+ return *itv;
+ itk++;
+ itv++;
+ }
+ qWarning ("SimpleSettings::readEntry() Couldn't find key "+key);
+ return "";
+}
+
+void SimpleSettings::setEntry (const QString &key, const QString &value)
+{
+ QStringList::Iterator itk=keylist.begin();
+ QStringList::Iterator itv=valuelist.begin();
+
+ if (!key.isEmpty() )
+ {
+ // Search for existing entry first
+ while (itk !=keylist.end() )
+ {
+ if (*itk == key)
+ {
+ if (!value.isEmpty())
+ *itv=value;
+ else
+ *itv="";
+ *itv=value;
+ return;
+ }
+ itk++;
+ itv++;
+ }
+
+ // If no entry exists, append a new one
+ keylist.append (key);
+ valuelist.append (value);
+ }
+}
+
+
+
/////////////////////////////////////////////////////////////////
// Settings
/////////////////////////////////////////////////////////////////
@@ -11,6 +117,11 @@
clear();
}
+Settings::Settings(const QString & organization, const QString & application ):QSettings (organization,application)
+{
+ clear();
+}
+
Settings::~Settings()
{
}
@@ -116,17 +227,3 @@
return s;
}
-void Settings::write()
-{
- QStringList::Iterator itp=pathlist.begin();
- QStringList::Iterator itk=keylist.begin();
- QStringList::Iterator itv=valuelist.begin();
-
- while (itp !=pathlist.end() )
- {
- itp++;
- itk++;
- itv++;
- }
-}
-
diff -r 608f976aa7bb -r 6a0342b3c519 settings.h
--- a/settings.h Tue Jun 06 14:58:11 2006 +0000
+++ b/settings.h Tue Jun 13 08:49:12 2006 +0000
@@ -7,18 +7,38 @@
#include "misc.h"
+// Some helper functions and simplified settings class
+// to read and parse settings e.g. in undo/redo directories
+class SimpleSettings
+{
+public:
+ SimpleSettings ();
+ ~SimpleSettings ();
+ void clear();
+ void readSettings(const QString &);
+ void writeSettings(const QString &);
+ QString readEntry (const QString &);
+ void setEntry (const QString &,const QString &);
+private:
+ QStringList keylist;
+ QStringList valuelist;
+};
+
+
+// Overloaded QSettings class, used to save some settings in
+// a map instead of users home directory
class Settings:public QSettings,public xmlObj
{
public:
Settings ();
+ Settings (const QString & , const QString &);
~Settings ();
void clear();
void clearLocal (const QString &);
QString readLocalEntry ( const QString &, const QString &, const QString &);
void setLocalEntry (const QString &, const QString &, const QString &);
QString getXMLData (const QString &);
- void write ();
protected:
QStringList pathlist;
diff -r 608f976aa7bb -r 6a0342b3c519 texteditor.cpp
--- a/texteditor.cpp Tue Jun 06 14:58:11 2006 +0000
+++ b/texteditor.cpp Tue Jun 13 08:49:12 2006 +0000
@@ -26,7 +26,7 @@
//Added by qt3to4:
#include
#include
-#include
+#include
#include
#include
@@ -416,7 +416,7 @@
actionTextUnderline->setToggleAction( true );
menu->insertSeparator();
- Q3ActionGroup *grp = new Q3ActionGroup( this );
+ QActionGroup *grp = new QActionGroup( this );
connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
actionAlignLeft = new QAction( QPixmap (iconPath+"text_left.png"), tr( "&Left" ),grp );
@@ -435,7 +435,7 @@
grp->addTo( tb );
grp->addTo( menu );
- Q3ActionGroup *grp2 = new Q3ActionGroup( this );
+ QActionGroup *grp2 = new QActionGroup( this );
grp2->setExclusive(false);
actionAlignSubScript = new QAction( QPixmap (iconPath+"text_sub.png"), tr( "Subs&cript" ),grp2 );
actionAlignSubScript->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_B );