[Kde-imaging] KDE/kdegraphics/libs/libksane/libksane
Kåre Särs
kare.sars at iki.fi
Mon Nov 23 22:49:09 CET 2009
SVN commit 1053346 by sars:
Add public API for collapsing the option tabs.
CCMAIL:kde-imaging at kde.org
I had planned to add public API for collapsing the option with the "splitter collapser", but I forgot about it until a couple of days ago. I see this as such a minor change that I would like to add it even tho I have not added it to the feature plan for 4.4 before the soft freeze.
I will revert the change if i get objections.
M +4 -0 ksane.h
M +9 -0 ksane_widget.cpp
M +15 -0 splittercollapser.cpp
M +5 -0 splittercollapser.h
--- trunk/KDE/kdegraphics/libs/libksane/libksane/ksane.h #1053345:1053346
@@ -202,6 +202,10 @@
* @param enable specifies if the auto selection should be turned on or off. */
void enableAutoSelect(bool enable);
+ /** This function is used to programatically collapse/restore the options.
+ * @param collapse defines the state to set. */
+ void setOptionsCollapsed(bool collapse);
+
public Q_SLOTS:
/** This method can be used to cancel a scan or prevent an automatic new scan. */
void scanCancel();
--- trunk/KDE/kdegraphics/libs/libksane/libksane/ksane_widget.cpp #1053345:1053346
@@ -782,5 +782,14 @@
}
}
+void KSaneWidget::setOptionsCollapsed(bool collapse)
+{
+ if (collapse) {
+ QTimer::singleShot(0, d->m_optionsCollapser, SLOT(slotCollapse()));
+ }
+ else {
+ QTimer::singleShot(0, d->m_optionsCollapser, SLOT(slotRestore()));
+ }
+}
} // NameSpace KSaneIface
--- trunk/KDE/kdegraphics/libs/libksane/libksane/splittercollapser.cpp #1053345:1053346
@@ -266,6 +266,21 @@
d->mSplitter->setSizes(sizes);
}
+void SplitterCollapser::slotCollapse() {
+ if (d->isVisible()) slotClicked();
+ // else do nothing
+}
+
+void SplitterCollapser::slotRestore() {
+ if (!d->isVisible()) slotClicked();
+ // else do nothing
+}
+
+void SplitterCollapser::slotSetCollapsed(bool collapse) {
+ if (collapse == d->isVisible()) slotClicked();
+ // else do nothing
+}
+
void SplitterCollapser::paintEvent(QPaintEvent*) {
QStylePainter painter(this);
qreal opacity = d->mOpacityTimeLine->currentFrame() / 1000.;
--- trunk/KDE/kdegraphics/libs/libksane/libksane/splittercollapser.h #1053345:1053346
@@ -44,6 +44,11 @@
virtual QSize sizeHint() const;
+public Q_SLOTS:
+ void slotCollapse();
+ void slotRestore();
+ void slotSetCollapsed(bool collapsed);
+
protected:
virtual bool eventFilter(QObject*, QEvent*);
More information about the Kde-imaging
mailing list