[rkward-cvs] SF.net SVN: rkward:[3513] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Apr 18 11:37:09 UTC 2011
Revision: 3513
http://rkward.svn.sourceforge.net/rkward/?rev=3513&view=rev
Author: tfry
Date: 2011-04-18 11:37:09 +0000 (Mon, 18 Apr 2011)
Log Message:
-----------
Also save / restore sidebar placement of tool windows.
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/windows/rktoolwindowbar.cpp
trunk/rkward/rkward/windows/rktoolwindowlist.cpp
trunk/rkward/rkward/windows/rktoolwindowlist.h
trunk/rkward/rkward/windows/rkworkplace.cpp
trunk/rkward/rkward/windows/rkworkplace.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/ChangeLog 2011-04-18 11:37:09 UTC (rev 3513)
@@ -1,3 +1,4 @@
+- Include the sidebar position of tool windows when saving / restoring the workplace layout
- "Pending jobs" tool window is not longer shown in the bottom sidebar by default
- Support removing individual tool windows from the sidebars, completely
- Add an action to interrupt all (current and pending) commands
Modified: trunk/rkward/rkward/windows/rktoolwindowbar.cpp
===================================================================
--- trunk/rkward/rkward/windows/rktoolwindowbar.cpp 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/rkward/windows/rktoolwindowbar.cpp 2011-04-18 11:37:09 UTC (rev 3513)
@@ -326,7 +326,7 @@
RKMDIWindow *window = idToWidget (id_of_popup);
RK_ASSERT (window);
- RKWorkplace::mainWorkplace ()->placeInToolWindowBar (window, (RKToolWindowList::Placement) target);
+ RKWorkplace::mainWorkplace ()->placeInToolWindowBar (window, target);
}
Modified: trunk/rkward/rkward/windows/rktoolwindowlist.cpp
===================================================================
--- trunk/rkward/rkward/windows/rktoolwindowlist.cpp 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/rkward/windows/rktoolwindowlist.cpp 2011-04-18 11:37:09 UTC (rev 3513)
@@ -16,6 +16,7 @@
***************************************************************************/
#include "rktoolwindowlist.h"
+#include "rkmdiwindow.h"
#include "../debug.h"
@@ -60,3 +61,15 @@
RK_ASSERT (false);
}
+
+QString RKToolWindowList::idOfWindow (RKMDIWindow *window) {
+ RK_TRACE (APP);
+
+ for (int i = 0; i < RKToolWindowListPrivate::registered_tool_windows.size (); ++i) {
+ if (RKToolWindowListPrivate::registered_tool_windows[i].window == window) {
+ return RKToolWindowListPrivate::registered_tool_windows[i].id;
+ }
+ }
+ RK_ASSERT (false);
+ return QString ();
+}
Modified: trunk/rkward/rkward/windows/rktoolwindowlist.h
===================================================================
--- trunk/rkward/rkward/windows/rktoolwindowlist.h 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/rkward/windows/rktoolwindowlist.h 2011-04-18 11:37:09 UTC (rev 3513)
@@ -42,6 +42,7 @@
void registerToolWindow (RKMDIWindow *window, const QString &id, Placement default_placement);
void unregisterToolWindow (RKMDIWindow *window);
RKMDIWindow* findToolWindowById (const QString &id);
+ QString idOfWindow (RKMDIWindow *window);
QList<ToolWindowRepresentation>& registeredToolWindows ();
};
Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp 2011-04-18 11:37:09 UTC (rev 3513)
@@ -172,6 +172,7 @@
windows.append (window);
connect (window, SIGNAL (destroyed (QObject *)), this, SLOT (removeWindow (QObject *)));
connect (window, SIGNAL (windowActivated(RKMDIWindow*)), history, SLOT (windowActivated(RKMDIWindow*)));
+ if (window->isToolWindow () && !window->tool_window_bar) return;
if (attached) attachWindow (window);
else detachWindow (window, false);
}
@@ -184,20 +185,23 @@
}
}
-void RKWorkplace::placeInToolWindowBar (RKMDIWindow *window, RKToolWindowList::Placement position) {
+void RKWorkplace::placeInToolWindowBar (RKMDIWindow *window, int position) {
RK_TRACE (APP);
RK_ASSERT (window->isToolWindow ());
+ if ((position < 0) || (position >= TOOL_WINDOW_BAR_COUNT)) {
+ RK_ASSERT (false); // but could happen for a broken workplace representation
+ position = RKToolWindowList::Nowhere;
+ }
if (position == RKToolWindowList::Nowhere) {
if (window->tool_window_bar) window->tool_window_bar->removeWidget (window);
- return;
} else {
tool_window_bars[position]->addWidget (window);
}
if (!windows.contains (window)) { // first time, we see this window?
addWindow (window, true);
- RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
+ if (window->isAttached () && window->tool_window_bar) RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
}
}
@@ -510,6 +514,7 @@
for (int i=0; i < wview->count (); ++i) {
list.append (static_cast<RKMDIWindow*> (wview->widget (i)));
}
+ list.append (getObjectList (RKMDIWindow::ToolWindow, RKMDIWindow::AnyWindowState));
foreach (RKMDIWindow *win, list) {
QString type, specification;
QStringList params;
@@ -525,11 +530,23 @@
} else if (win->isType (RKMDIWindow::HelpWindow)) {
type = "help";
specification = static_cast<RKHTMLWindow*> (win)->restorableUrl ().url ();
+ } else if (win->isToolWindow ()) {
+ type = RKToolWindowList::idOfWindow (win);
}
if (!type.isEmpty ()) {
if (!win->isAttached ()) {
params.append (QString ("detached,") + QString::number (win->x ()) + ',' + QString::number (win->y ()) + ',' + QString::number (win->width ()) + ',' + QString::number (win->height ()));
}
+ if (win->isToolWindow ()) {
+ int sidebar = RKToolWindowList::Nowhere;
+ for (int i = 0; i < TOOL_WINDOW_BAR_COUNT; ++i) {
+ if (win->tool_window_bar == tool_window_bars[i]) {
+ sidebar = i;
+ break;
+ }
+ }
+ params.append (QString ("sidebar,") + QString::number (sidebar));
+ }
workplace_description.append (type + "::" + params.join (":") + "::" + specification);
}
}
@@ -597,7 +614,7 @@
params = description[i].mid (typeend + 2, specstart - typeend - 2).split (':', QString::SkipEmptyParts);
specification = description[i].mid (specstart + 2);
} else {
- specification = description[i].mid (typeend +1 );
+ specification = description[i].mid (typeend + 1);
}
RKMDIWindow *win = 0;
@@ -614,12 +631,17 @@
} else if (type == "help") {
win = openHelpWindow (checkAdjustRestoredUrl (specification, base), true);
} else {
- RK_ASSERT (false);
+ win = RKToolWindowList::findToolWindowById (type);
+ RK_ASSERT (win);
}
// apply generic window parameters
if (win) {
for (int p = 0; p < params.size (); ++p) {
+ if (params[p].startsWith ("sidebar")) {
+ int position = params[p].section (',', 1).toInt ();
+ placeInToolWindowBar (win, position);
+ }
if (params[p].startsWith ("detached")) {
QStringList geom = params[p].split (',');
win->hide ();
Modified: trunk/rkward/rkward/windows/rkworkplace.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.h 2011-04-18 10:37:05 UTC (rev 3512)
+++ trunk/rkward/rkward/windows/rkworkplace.h 2011-04-18 11:37:09 UTC (rev 3513)
@@ -180,7 +180,7 @@
RKToolWindowBar* tool_window_bars[TOOL_WINDOW_BAR_COUNT];
friend class RKToolWindowBar;
- void placeInToolWindowBar (RKMDIWindow *window, RKToolWindowList::Placement position);
+ void placeInToolWindowBar (RKMDIWindow *window, int position);
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list