Bug 139882

Summary: JJ: "Driver Settings" tab: lower pane can only show 3 lines, has fixed height, should be resizeable (better usability)
Product: [Unmaintained] kdeprint Reporter: Kurt Pfeifle <pfeifle>
Component: generalAssignee: KDEPrint Devel Mailinglist <kde-print-devel>
Status: CLOSED FIXED    
Severity: normal CC: jlayt, niko.sams
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: "Driver Settings" tab with fixed-size lower pane
"Driver Settings" tab with resize-able lower pane [Mockup]

Description Kurt Pfeifle 2007-01-10 22:10:11 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs

KDEPrint/kprinter gives CUPS users access to set print joboptions by displaying the respective features as represented in the drivers PPD file. This happens on the "Driver Settings" tab.

The tab is divided into two panes: top and bottom. The top pane allows to select/highlight a specific feature (ex: "PageSize"), which makes the lower pane display all available values for the feature (ex: A3, A4, Letter), so the user can select it.

Problem:
--------
The lower pane is fixed in height; it can display only 3 items at one time. However, some features do have more than 10 choices, and the scrolling can be very annoying. Even if the dialog is expanded vertically to the full height of the screen, this does not change the height of the lower pane.

Suggested Solution:
-------------------
Make the border between the top and lower pane moveable (make the lower pane resize-able/expand-able).

Gain:
-----
A little bit more usability at this spot of the interface.
Comment 1 Kurt Pfeifle 2007-01-10 22:14:08 UTC
Created attachment 19223 [details]
"Driver Settings" tab with fixed-size lower pane

The lower pane of the "Driver Settings" is not re-sizeable, but fixed height,
showing only 3 of possibly many choices at once. Scrollbar gives access to more
choices, but an overview at once is impossible.
Comment 2 Kurt Pfeifle 2007-01-10 22:16:03 UTC
Created attachment 19224 [details]
"Driver Settings" tab with resize-able lower pane [Mockup]

The lower pane should be made resizeable (using mouse to drag the border), like
shown in this gimp-ed mockup.
Comment 3 Aaron J. Seigo 2007-01-11 06:56:14 UTC
SVN commit 622237 by aseigo:

use a splitter
hide the header
don't show the radio button selector (crash on click)
get rid of the ugly groupbox (use a bold label instead)
get rid of the gratuitous subclass of QTreeWidget

holy crap batman! 15 minutes of fiddling around and it looks one par with the one in kde3, only with BR#139882 addressed!

CCMAIL:kpfeifle@danka.de
BUG:139882


 M  +4 -1      driver.cpp  
 M  +20 -14    driverview.cpp  
 M  +3 -8      driverview.h  
 M  +20 -12    droptionview.cpp  
 M  +3 -2      droptionview.h  


--- trunk/KDE/kdelibs/kdeprint/driver.cpp #622236:622237
@@ -116,6 +116,7 @@
 DriverItem* DrMain::createTreeView(QTreeWidget *parent)
 {
 	DriverItem	*root = new DriverItem(parent, this);
+	root->setExpanded(true);
 	createTree(root);
 	return root;
 }
@@ -250,8 +251,10 @@
 {
 	DriverItem	*item(0);
 
-	foreach (DrGroup* subgroup, m_subgroups)
+	foreach (DrGroup* subgroup, m_subgroups) {
 		item = subgroup->createItem(parent, item);
+		item->setExpanded(true);
+	}
 
 	foreach (DrBase* option, m_listoptions)
 		item = option->createItem(parent, item);
--- trunk/KDE/kdelibs/kdeprint/driverview.cpp #622236:622237
@@ -22,16 +22,14 @@
 #include "driveritem.h"
 #include "driver.h"
 
+#include <QHeaderView>
 #include <QLayout>
+#include <QSplitter>
+#include <QTreeWidget>
 
+#include <kdialog.h>
 #include <klocale.h>
 
-DrListView::DrListView( QWidget *parent )
-    : QTreeWidget(parent)
-{
-	setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
-}
-
 //****************************************************************************************************
 
 DriverView::DriverView( QWidget *parent )
@@ -88,19 +86,27 @@
 
 	m_driver = 0;
 
-	m_view = new DrListView(this);
-	  m_view->setWhatsThis(whatsThisPPDOptionsDriverPage);
-	m_optview = new DrOptionView(this);
-	  m_optview->setWhatsThis(whatsThisOptionSettingsDriverPage);
+	QSplitter* splitter = new QSplitter(Qt::Vertical, this);
 
+	m_view = new QTreeWidget(splitter);
+	m_view->header()->hide();
+	m_view->setWhatsThis(whatsThisPPDOptionsDriverPage);
+	splitter->addWidget(m_view);
+
+	m_optview = new DrOptionView(splitter);
+	m_optview->setWhatsThis(whatsThisOptionSettingsDriverPage);
+	splitter->addWidget(m_optview);
+
+	// make sure the top gets enough room
+	splitter->setStretchFactor(0, 10);
+
 	QVBoxLayout	*main_ = new QVBoxLayout(this);
 	main_->setMargin(0);
-	main_->setSpacing(10);
-	main_->addWidget(m_view,1);
-	main_->addWidget(m_optview,0);
+	main_->setSpacing(KDialog::spacingHint());
+	main_->addWidget(splitter);
 
 	connect(m_view,SIGNAL(itemSelectionChanged()), this, SLOT( slotItemSelectionChanged() ) );
-  connect(this,SIGNAL(itemSelected(QTreeWidgetItem*)), m_optview,SLOT(slotItemSelected(QTreeWidgetItem*)));
+	connect(this,SIGNAL(itemSelected(QTreeWidgetItem*)), m_optview,SLOT(slotItemSelected(QTreeWidgetItem*)));
 	connect(m_optview,SIGNAL(changed()),SLOT(slotChanged()));
 }
 
--- trunk/KDE/kdelibs/kdeprint/driverview.h #622236:622237
@@ -22,20 +22,15 @@
 #define DRIVERVIEW_H
 
 #include <QMap>
-#include <QTreeWidget>
 #include <QWidget>
 
 #include <kdelibs_export.h>
 
+class QTreeWidget;
+class QTreeWidgetItem;
 class DrOptionView;
 class DrMain;
 
-class KDEPRINT_EXPORT DrListView : public QTreeWidget
-{
-public:
-	DrListView(QWidget *parent = 0);
-};
-
 class KDEPRINT_EXPORT DriverView : public QWidget
 {
 	Q_OBJECT
@@ -57,7 +52,7 @@
 	void slotItemSelectionChanged();
 
 private:
-	DrListView	*m_view;
+	QTreeWidget	*m_view;
 	DrOptionView	*m_optview;
 	DrMain		*m_driver;
 	int 		m_conflict;
--- trunk/KDE/kdelibs/kdeprint/droptionview.cpp #622236:622237
@@ -295,9 +295,20 @@
 //******************************************************************************************************
 
 DrOptionView::DrOptionView(QWidget *parent)
-	: QGroupBox(parent)
+	: QWidget(parent)
 {
+	QVBoxLayout* layout = new QVBoxLayout(this);
+	layout->setSpacing(KDialog::spacingHint());
+	layout->setMargin(0);
+
+	m_title = new QLabel(this);
+	layout->addWidget(m_title);
+	setTitle(i18n("No Option Selected"));
+
 	m_stack = new QStackedWidget(this);
+	layout->addWidget(m_stack);
+	layout->setStretchFactor(m_stack, 10);
+	layout->addStretch(1);
 
 	OptionBaseView	*w = new OptionBaseView(m_stack);
 	connect(w,SIGNAL(valueChanged(const QString&)),SLOT(slotValueChanged(const QString&)));
@@ -319,18 +330,8 @@
 	connect(w,SIGNAL(valueChanged(const QString&)),SLOT(slotValueChanged(const QString&)));
 	m_optionBaseID[ m_stack->addWidget(w) ] = DrBase::Boolean;
 
-	m_stack->setCurrentWidget(w);
-	setTitle(i18n("No Option Selected"));
+	m_stack->setCurrentIndex(0);
 
-	setLayout( new QVBoxLayout );
-	layout()->setSpacing( KDialog::spacingHint() );
-	layout()->setMargin( KDialog::marginHint() );
-	QVBoxLayout	*main_ = new QVBoxLayout();
-	main_->setMargin(0);
-	main_->setSpacing(0);
-	main_->addWidget(m_stack);
-	layout()->addItem(main_);
-
 	m_item = 0;
 	m_block = false;
 	m_allowfixed = true;
@@ -360,13 +361,20 @@
 			enabled = ((m_item->drItem()->get("fixed") != "1") || m_allowfixed);
 		}
 		else
+		{
 			setTitle(i18n("No Option Selected"));
+		}
 		m_stack->setCurrentWidget(w);
 		w->setEnabled(enabled);
 		m_block = false;
 	}
 }
 
+void DrOptionView::setTitle(const QString& title)
+{
+	m_title->setText("<b>" + title + "<b>");
+}
+
 OptionBaseView *DrOptionView::optionBaseView( int id )
 {
 	for ( int i = 0; i < 5; ++i )
--- trunk/KDE/kdelibs/kdeprint/droptionview.h #622236:622237
@@ -21,7 +21,6 @@
 #define DROPTIONVIEW_H
 
 #include <qwidget.h>
-#include <QGroupBox>
 #include <qstringlist.h>
 
 class QLineEdit;
@@ -114,7 +113,7 @@
 	QStringList	m_choices;
 };
 
-class DrOptionView : public QGroupBox
+class DrOptionView : public QWidget
 {
 	Q_OBJECT
 public:
@@ -130,8 +129,10 @@
 
 private:
 	OptionBaseView *optionBaseView( int id );
+	void setTitle(const QString& title);
 	
 	int m_optionBaseID[5];
+	QLabel		* m_title;
 	QStackedWidget	*m_stack;
 	DriverItem	*m_item;
 	bool		m_block;
Comment 4 Niko Sams 2007-01-12 07:39:18 UTC
I hope I did understand this right, here my patch for kde 3.5 that adds a qsplitter:

--- driverview.cpp.orig 2007-01-12 07:32:18.000000000 +0100
+++ driverview.cpp      2007-01-12 07:23:09.000000000 +0100
@@ -27,6 +27,7 @@
 #include <qlayout.h>
 #include <qwhatsthis.h>
 #include <klocale.h>
+#include <qsplitter.h>

 DrListView::DrListView(QWidget *parent, const char *name)
 : KListView(parent,name)
@@ -93,14 +94,16 @@

        m_driver = 0;

-       m_view = new DrListView(this);
+       QSplitter *splitter_ = new QSplitter(Qt::Vertical, this);
+                splitter_->setChildrenCollapsible(false);
+
+       m_view = new DrListView(splitter_);
          QWhatsThis::add(m_view, whatsThisPPDOptionsDriverPage);
-       m_optview = new DrOptionView(this);
+       m_optview = new DrOptionView(splitter_);
          QWhatsThis::add(m_optview, whatsThisOptionSettingsDriverPage);
-
+
        QVBoxLayout     *main_ = new QVBoxLayout(this, 0, 10);
-       main_->addWidget(m_view,1);
-       main_->addWidget(m_optview,0);
+       main_->addWidget(splitter_);

        connect(m_view,SIGNAL(selectionChanged(QListViewItem*)),m_optview,SLOT(slotItemSelected(QListViewItem*)));
        connect(m_optview,SIGNAL(changed()),SLOT(slotChanged()));
Comment 5 Cristian Tibirna 2007-02-24 19:33:03 UTC
I applied the patch to 3_5 branch too.
Comment 6 John Layt 2008-12-31 20:39:53 UTC
Closing old Resolved status bug.