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
wilder-portage
Jekyll Wu 15 years ago
parent 102371bb3a
commit 8f7be18a64
  1. 4
      desktop/partui.rc
  2. 4
      desktop/sessionui.rc
  3. 49
      src/HistorySizeDialog.cpp
  4. 28
      src/HistorySizeDialog.h
  5. 30
      src/SessionController.cpp
  6. 2
      src/SessionController.h

@ -1,13 +1,13 @@
<!DOCTYPE kpartgui>
<kpartgui name="konsolepart" version="6">
<kpartgui name="konsolepart" version="7">
<Menu name="session-popup-menu">
<Action name="edit_copy"/>
<Action name="edit_paste"/>
<Menu name="history"><text>S&amp;crollback</text>
<Action name="file_save_as" group="session-history-operations"/>
<Separator group="session-history-operations"/>
<Action name="configure-history" group="session-history-operations"/>
<Action name="adjust-history" group="session-history-operations"/>
<Separator group="session-history-operations"/>
<Action name="clear-history" group="session-history-operations"/>
<Action name="clear-history-and-reset" group="session-history-operations"/>

@ -1,6 +1,6 @@
<!DOCTYPE kpartgui>
<kpartgui name="session" version="15">
<kpartgui name="session" version="16">
<MenuBar>
<Menu name="file">
<Action name="close-session" group="session-tab-operations"/>
@ -52,7 +52,7 @@
<Separator/>
<Action name="set-encoding"/>
<Action name="clear-history"/>
<Action name="configure-history"/>
<Action name="adjust-history"/>
<Separator/>
<Action name="show-menubar"/>
<Action name="switch-profile"/>

@ -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("<span style=\"color:gray;\"><center><bold>The adjustment is only temporary.</bold></center></span>"),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 )

@ -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;
};

@ -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()

@ -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

Loading…
Cancel
Save