From 8f7be18a64cfb5a25f87d0348eb48566cbd6d4e8 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Tue, 25 Oct 2011 16:53:44 +0800 Subject: [PATCH] Simplify the scrollback setting dialog to avoid potential confusion. - the change is not saved into profile and only influences current tab - remove the 'Save to current profile' checkbox - remove the 'Defaults' button - change dialog title from "Scrollback Options" to "Adjust Scrollback" - change action from "Scrollback Options..." to "Adjust Scrollback..." The new dialog makes the "Adjust Scrollback..." action more consistent with most of other actions in the context menu, since they only influence or work in the context of current tab. The UI change is not quite satisfactory. Feel free to refine the UI part to make it more clear and elegant. BUG: 227144 FIXED-IN : 4.8 REVIEW: 102688 --- desktop/partui.rc | 4 ++-- desktop/sessionui.rc | 4 ++-- src/HistorySizeDialog.cpp | 49 ++++++--------------------------------- src/HistorySizeDialog.h | 28 +--------------------- src/SessionController.cpp | 30 +++++------------------- src/SessionController.h | 2 +- 6 files changed, 19 insertions(+), 98 deletions(-) diff --git a/desktop/partui.rc b/desktop/partui.rc index eba44dc5..fccc0b65 100644 --- a/desktop/partui.rc +++ b/desktop/partui.rc @@ -1,13 +1,13 @@ - + S&crollback - + diff --git a/desktop/sessionui.rc b/desktop/sessionui.rc index de43553b..f8f1cd68 100644 --- a/desktop/sessionui.rc +++ b/desktop/sessionui.rc @@ -1,6 +1,6 @@ - + @@ -52,7 +52,7 @@ - + diff --git a/src/HistorySizeDialog.cpp b/src/HistorySizeDialog.cpp index ad08cbfd..48f555c0 100644 --- a/src/HistorySizeDialog.cpp +++ b/src/HistorySizeDialog.cpp @@ -42,14 +42,12 @@ HistorySizeDialog::HistorySizeDialog( QWidget* parent ) , _noHistoryButton(0) , _fixedHistoryButton(0) , _unlimitedHistoryButton(0) - , _saveToCurrentProfileButton(0) , _lineCountBox(0) - , _defaultMode(FixedSizeHistory) , _defaultLineCount(1000) { // basic dialog properties - setPlainCaption( i18n("Scrollback Options") ); - setButtons( KDialog::Default | KDialog::Ok | KDialog::Cancel ); + setPlainCaption( i18n("Adjust Scrollback") ); + setButtons( KDialog::Ok | KDialog::Cancel ); setDefaultButton( KDialog::Ok ); setModal( false ); @@ -92,54 +90,21 @@ HistorySizeDialog::HistorySizeDialog( QWidget* parent ) lineCountLayout->addWidget(_lineCountBox); lineCountLayout->addWidget(lineCountLabel); - _saveToCurrentProfileButton = new QCheckBox( i18n("Save to current profile") ); + QLabel* warningLabel = new QLabel(i18n("
The adjustment is only temporary.
"),this); + dialogLayout->addWidget(warningLabel); + dialogLayout->insertSpacing(-1, 5); dialogLayout->addWidget(_noHistoryButton); dialogLayout->addLayout(lineCountLayout); dialogLayout->addWidget(_unlimitedHistoryButton); - dialogLayout->insertSpacing(3, 10); - dialogLayout->addWidget(_saveToCurrentProfileButton); - - connect(this,SIGNAL(defaultClicked()),this,SLOT(useDefaults())); + dialogLayout->insertSpacing(-1, 10); connect(this,SIGNAL(accepted()),this,SLOT(emitOptionsChanged())); } void HistorySizeDialog::emitOptionsChanged() { - emit optionsChanged( mode() , lineCount(), saveToCurrentProfile() ); -} - -void HistorySizeDialog::setDefaultMode( HistoryMode mode ) -{ - _defaultMode = mode; -} - -HistorySizeDialog::HistoryMode HistorySizeDialog::defaultMode() const -{ - return _defaultMode; -} - -void HistorySizeDialog::setDefaultLineCount( int count ) -{ - _defaultLineCount = count; -} - -int HistorySizeDialog::defaultLineCount() const -{ - return _defaultLineCount; -} - -bool HistorySizeDialog::saveToCurrentProfile() const -{ - return _saveToCurrentProfileButton->isChecked(); -} - -void HistorySizeDialog::useDefaults() -{ - setMode( _defaultMode ); - setLineCount( _defaultLineCount ); - _saveToCurrentProfileButton->setChecked(false); + emit optionsChanged( mode() , lineCount() ); } void HistorySizeDialog::setMode( HistoryMode mode ) diff --git a/src/HistorySizeDialog.h b/src/HistorySizeDialog.h index e4ee4b23..8361bf2a 100644 --- a/src/HistorySizeDialog.h +++ b/src/HistorySizeDialog.h @@ -77,26 +77,6 @@ public: /** Sets the number of lines for the fixed size history mode. */ void setLineCount(int lines); - /** - * Sets the default history mode. When the user clicks on the "Defaults" button, - * this mode will be used. - */ - void setDefaultMode( HistoryMode mode ); - - /** Returns the default mode, as set with setDefaultMode() */ - HistoryMode defaultMode() const; - - /** - * Sets the default line count. When the user clicks on the "Defaults" button, - * the line count will be set to this number. - */ - void setDefaultLineCount( int count ); - - /** Returns the default line count, as set with setDefaultLineCount() */ - int defaultLineCount() const; - - bool saveToCurrentProfile() const; - signals: /** * Emitted when the user changes the scroll-back mode or line count and @@ -105,14 +85,10 @@ signals: * @param mode The current history mode. This is a value from the HistoryMode enum. * @param lineCount The current line count. This is only applicable if mode is * FixedSizeHistory - * @param saveToCurrentProfile Determines if the changes are saved to current profile. */ - void optionsChanged(int mode , int lineCount, bool saveToCurrentProfile); + void optionsChanged(int mode , int lineCount); private slots: - // changes the mode and line count back to the defaults - // specified with setDefaultMode() and setDefaultLineCount() - void useDefaults(); // fires the optionsChanged() signal with the current mode // and line count as arguments @@ -122,10 +98,8 @@ private: QAbstractButton* _noHistoryButton; QAbstractButton* _fixedHistoryButton; QAbstractButton* _unlimitedHistoryButton; - QAbstractButton* _saveToCurrentProfileButton; KIntSpinBox* _lineCountBox; - HistoryMode _defaultMode; int _defaultLineCount; }; diff --git a/src/SessionController.cpp b/src/SessionController.cpp index e6b75b3b..c96b746a 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -528,8 +528,9 @@ void SessionController::setupActions() action = KStandardAction::saveAs(this, SLOT(saveHistory()), collection); action->setText(i18n("Save Output &As...")); - action = collection->addAction("configure-history", this, SLOT(showHistoryOptions())); - action->setText(i18n("Configure Scrollback...")); + action = collection->addAction("adjust-history", this, SLOT(showHistoryOptions())); + action->setText(i18n("Adjust Scrollback...")); + // TODO: find a suitable icon which matches the action and not misleading action->setIcon(KIcon("configure")); action = collection->addAction("clear-history", this, SLOT(clearHistory())); @@ -1027,8 +1028,8 @@ void SessionController::showHistoryOptions() dialog->setMode( HistorySizeDialog::NoHistory ); } - connect( dialog , SIGNAL(optionsChanged(int,int,bool)) , - this , SLOT(scrollBackOptionsChanged(int,int,bool)) ); + connect( dialog , SIGNAL(optionsChanged(int,int)) , + this , SLOT(scrollBackOptionsChanged(int,int)) ); dialog->show(); } @@ -1037,7 +1038,7 @@ void SessionController::sessionResizeRequest(const QSize& size) //kDebug() << "View resize requested to " << size; _view->setSize(size.width(),size.height()); } -void SessionController::scrollBackOptionsChanged(int mode, int lines, bool saveToCurrentProfile ) +void SessionController::scrollBackOptionsChanged(int mode, int lines) { switch (mode) { @@ -1051,25 +1052,6 @@ void SessionController::scrollBackOptionsChanged(int mode, int lines, bool saveT _session->setHistoryType( HistoryTypeFile() ); break; } - if (saveToCurrentProfile) - { - Profile::Ptr profile = SessionManager::instance()->sessionProfile(_session); - - switch (mode) - { - case HistorySizeDialog::NoHistory: - profile->setProperty(Profile::HistoryMode , Profile::DisableHistory); - break; - case HistorySizeDialog::FixedSizeHistory: - profile->setProperty(Profile::HistoryMode , Profile::FixedSizeHistory); - profile->setProperty(Profile::HistorySize , lines); - break; - case HistorySizeDialog::UnlimitedHistory: - profile->setProperty(Profile::HistoryMode , Profile::UnlimitedHistory); - break; - } - SessionManager::instance()->changeProfile(profile, profile->setProperties()); - } } void SessionController::saveHistory() diff --git a/src/SessionController.h b/src/SessionController.h index 9bf42e71..63b846ca 100644 --- a/src/SessionController.h +++ b/src/SessionController.h @@ -224,7 +224,7 @@ private slots: void requireUrlFilterUpdate(); void highlightMatches(bool highlight); - void scrollBackOptionsChanged(int mode , int lines, bool saveToCurrentProfile); + void scrollBackOptionsChanged(int mode , int lines); void sessionResizeRequest(const QSize& size); void trackOutput(QKeyEvent* event); // move view to end of current output // when a key press occurs in the