[rkward/work/preview_with_menu] rkward/plugin: Minor cleanup
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Feb 5 11:48:03 UTC 2016
Git commit c9195f697c14bd9550b2f957a283ec47c36fbc85 by Thomas Friedrichsmeier.
Committed on 04/02/2016 at 19:16.
Pushed by tfry into branch 'work/preview_with_menu'.
Minor cleanup
M +13 -5 rkward/plugin/rkstandardcomponentgui.cpp
http://commits.kde.org/rkward/c9195f697c14bd9550b2f957a283ec47c36fbc85
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 609ed8b..cace532 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -51,7 +51,7 @@ public:
RK_TRACE (PLUGIN);
RKExtensionSplitter::window = window;
extension = extension_area;
- addWidget (main_area);
+ addWidget (main_area); // Right now, this class supports only left -> right and top -> bottom layout
addWidget (extension_area);
setStretchFactor (0, 0); // When resizing the window, *and* the extension (preview) is visible, effectively resize the extension. Dialog area can be resized via splitter.
setStretchFactor (1, 1);
@@ -67,7 +67,7 @@ public:
QList<int> sizes = QSplitter::sizes ();
if (new_visible) {
- int s = RKSettingsModulePlugins::defaultCodeHeight (); // TODO: separatly for width, height.
+ int s = defaultExtensionSize ();
if (s < 80) s = 80;
size_change = s;
extension->show ();
@@ -109,8 +109,16 @@ public:
};
void saveSize () {
- // TODO: separately for width / height
- if (extension->isVisible ()) RKSettingsModulePlugins::setDefaultCodeHeight (sizes ()[1]);
+ if (extension->isVisible ()) {
+#warning clean up!
+ if (orientation () == Qt::Horizontal) RKSettingsModulePlugins::setDefaultOtherPreviewHeight (sizes ()[1]);
+ else RKSettingsModulePlugins::setDefaultCodeHeight (sizes ()[1]);
+ }
+ }
+
+ int defaultExtensionSize () {
+#warning clean up!
+ return ((orientation () == Qt::Horizontal) ? RKSettingsModulePlugins::defaultOtherPreviewHeight() : RKSettingsModulePlugins::defaultCodeHeight ());
}
bool isExtensionVisible () const { return extension->isVisible (); };
@@ -267,7 +275,7 @@ void RKStandardComponentGUI::finalize () {
preview_splitter->insertWidget (i, previews[i].area);
}
if (any_preview_visible) {
- preview_splitter->setMinimumWidth (RKSettingsModulePlugins::defaultCodeHeight ()); // enforce minimum, here to achieve sane size on show. Will be cleared directly after show.
+ preview_splitter->setMinimumWidth (splitter->defaultExtensionSize ()); // enforce minimum, here to achieve sane size on show. Will be cleared directly after show.
} else {
preview_splitter->hide ();
}
More information about the rkward-tracker
mailing list