From: <mrj...@us...> - 2007-12-26 21:46:55
|
Revision: 2384 http://tora.svn.sourceforge.net/tora/?rev=2384&view=rev Author: mrjohnson0 Date: 2007-12-26 13:46:50 -0800 (Wed, 26 Dec 2007) Log Message: ----------- finish toolbar port Modified Paths: -------------- branches/tora-1.4/tora/src/torollback.cpp branches/tora-1.4/tora/src/torollback.h Modified: branches/tora-1.4/tora/src/torollback.cpp =================================================================== --- branches/tora-1.4/tora/src/torollback.cpp 2007-12-26 21:46:13 UTC (rev 2383) +++ branches/tora-1.4/tora/src/torollback.cpp 2007-12-26 21:46:50 UTC (rev 2384) @@ -66,7 +66,6 @@ #include <qmenubar.h> #include <qmessagebox.h> #include <qpainter.h> -#include <q3popupmenu.h> #include <qpushbutton.h> #include <qregexp.h> #include <qsplitter.h> @@ -79,8 +78,9 @@ #include <q3whatsthis.h> #include <qwidget.h> #include <qworkspace.h> -//Added by qt3to4: + #include <QPixmap> +#include <QMenu> #include "icons/addrollback.xpm" #include "icons/offline.xpm" @@ -679,6 +679,7 @@ UpdateSegmentsAct = new QAction(QPixmap(const_cast<const char**>(refresh_xpm)), tr("Update segment list"), this); + UpdateSegmentsAct->setShortcut(QKeySequence::Refresh); connect(UpdateSegmentsAct, SIGNAL(triggered()), this, SLOT(refresh(void))); toolbar->addAction(UpdateSegmentsAct); @@ -725,10 +726,10 @@ SIGNAL(activated(const QString &)), this, SLOT(changeRefresh(const QString &))); toolbar->addWidget(Refresh); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); - toChangeConnection * chConn = new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); - toolbar->addWidget(chConn); + toolbar->addWidget(new toSpacer()); + new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); + QSplitter *splitter = new QSplitter(Qt::Vertical, this); Segments = new toRollbackView(splitter); Segments->setSelectionMode(Q3ListView::Single); @@ -770,46 +771,29 @@ setFocusProxy(Segments); } -#if 0 // todo -#define TO_ID_ONLINE (toMain::TO_TOOL_MENU_ID+ 0) -#define TO_ID_OFFLINE (toMain::TO_TOOL_MENU_ID+ 1) -#define TO_ID_CREATE (toMain::TO_TOOL_MENU_ID+ 2) -#define TO_ID_DROP (toMain::TO_TOOL_MENU_ID+ 3) -#endif +void toRollback::windowActivated(QWidget *widget) { + if (widget == this) { + if (!ToolMenu) { + ToolMenu = new QMenu(tr("&Rollback"), this); -void toRollback::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), - toKeySequence(tr("F5", "Rollback|Refresh"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(online_xpm)), tr("Online"), - this, SLOT(online(void)), 0, TO_ID_ONLINE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(offline_xpm)), tr("Offline"), - this, SLOT(offline(void)), 0, TO_ID_OFFLINE); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(addrollback_xpm)), tr("Create segment..."), - this, SLOT(addSegment(void)), 0, TO_ID_CREATE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(trash_xpm)), tr("Drop segment"), - this, SLOT(dropSegment(void)), 0, TO_ID_DROP); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("&Change Refresh"), Refresh, SLOT(setFocus(void)), - toKeySequence(tr("Alt+R", "Rollback|Change refresh"))); - toMainWidget()->menuBar()->insertItem(tr("&Rollback"), ToolMenu, -1, toToolMenuIndex()); - ToolMenu->setItemEnabled(TO_ID_ONLINE, OnlineButton->isEnabled()); - ToolMenu->setItemEnabled(TO_ID_OFFLINE, OfflineButton->isEnabled()); - ToolMenu->setItemEnabled(TO_ID_DROP, DropButton->isEnabled()); -#endif + ToolMenu->addAction(UpdateSegmentsAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(OnlineAct); + ToolMenu->addAction(OfflineAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(NewAct); + ToolMenu->addAction(DropAct); + + ToolMenu->addSeparator(); + + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } @@ -869,11 +853,6 @@ OfflineAct->setEnabled(false); } DropAct->setEnabled(item); -#if 0 // todo - ToolMenu->setItemEnabled(TO_ID_ONLINE, OnlineButton->isEnabled()); - ToolMenu->setItemEnabled(TO_ID_OFFLINE, OfflineButton->isEnabled()); - ToolMenu->setItemEnabled(TO_ID_DROP, DropButton->isEnabled()); -#endif } void toRollback::changeRefresh(const QString &str) Modified: branches/tora-1.4/tora/src/torollback.h =================================================================== --- branches/tora-1.4/tora/src/torollback.h 2007-12-26 21:46:13 UTC (rev 2383) +++ branches/tora-1.4/tora/src/torollback.h 2007-12-26 21:46:50 UTC (rev 2384) @@ -43,14 +43,12 @@ #include "totool.h" #include <qdialog.h> -//Added by qt3to4: -#include <Q3PopupMenu> #include <Q3ListViewItem> #include <algorithm> class QComboBox; -class Q3PopupMenu; +class QMenu; class toConnection; class toResultItem; class toResultView; @@ -94,7 +92,7 @@ QAction * NewAct; QAction * DropAct; - Q3PopupMenu *ToolMenu; + QMenu *ToolMenu; QComboBox *Refresh; QString currentSegment(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |