Permalink
Browse files

terminal plugin works again (with the current qtermwidget version). P…

…refs are really cool.
  • Loading branch information...
1 parent e5dcfbf commit 750bf9903c43d69bfa96656082c86a99dfc74830 @pvanek pvanek committed Feb 3, 2012
Showing with 26 additions and 25 deletions.
  1. +18 −19 plugins/terminal/terminal/TerminalPlugin.cpp
  2. +8 −6 plugins/terminal/terminal/TerminalPlugin.h
@@ -10,23 +10,22 @@
#include "qtermwidget.h"
-Preferences::Preferences(QTermWidget * term, const QObject * parent,
- int colorIX, const QString & emulation,
- const QFont & font)
+
+Preferences::Preferences(const QObject *parent,
+ const QString &color,
+ const QString &emulation,
+ const QFont &font)
: QWidget()
{
setupUi(this);
- QStringList colorSchemes;
- colorSchemes << "White On Black" << \
- "Green On Black" << \
- "Black On Light Yellow";
- colorSchemaCombo->addItems(colorSchemes);
- colorSchemaCombo->setCurrentIndex(colorIX);
- connect(colorSchemaCombo, SIGNAL(currentIndexChanged(int)),
- parent, SLOT(colorSchemaChanged(int)));
+ colorSchemaCombo->addItems(QTermWidget::availableColorSchemes());
+ int cix = colorSchemaCombo->findText(color);
+ colorSchemaCombo->setCurrentIndex(cix != -1 ? cix : 0);
+ connect(colorSchemaCombo, SIGNAL(currentIndexChanged(const QString&)),
+ parent, SLOT(colorSchemaChanged(const QString &)));
-// emulationComboBox->addItems(term->availableKeyBindings());
+ emulationComboBox->addItems(QTermWidget::availableKeyBindings());
int eix = emulationComboBox->findText(emulation);
emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 );
connect(emulationComboBox, SIGNAL(currentIndexChanged(const QString&)),
@@ -43,7 +42,6 @@ Preferences::Preferences(QTermWidget * term, const QObject * parent,
TerminalPlugin::TerminalPlugin() : QObject(), JuffPlugin() {
-// w_ = new QWidget();
w_ = new QTermWidget();
w_->setScrollBarPosition(QTermWidget::ScrollBarRight);
w_->setWindowTitle(tr("Terminal"));
@@ -58,11 +56,11 @@ void TerminalPlugin::init()
{
prefFont.fromString(PluginSettings::getString(this, "TerminalFont"));
prefFontSize = prefFont.pointSize();
- prefColorScheme = PluginSettings::getInt(this, "TerminalColorScheme");
+ prefColorScheme = PluginSettings::getString(this, "TerminalColorScheme");
prefEmulation = PluginSettings::getString(this, "TerminalEmulation");
w_->setColorScheme(prefColorScheme);
w_->setTerminalFont(prefFont);
-// w_->setKeyBindings(prefEmulation);
+ w_->setKeyBindings(prefEmulation);
}
TerminalPlugin::~TerminalPlugin() {
@@ -98,7 +96,7 @@ Juff::ActionList TerminalPlugin::mainMenuActions(Juff::MenuID id) const
QWidget * TerminalPlugin::settingsPage() const
{
- return new Preferences(w_, this, prefColorScheme, prefEmulation, prefFont);
+ return new Preferences(this, prefColorScheme, prefEmulation, prefFont);
}
void TerminalPlugin::applySettings()
@@ -109,12 +107,12 @@ void TerminalPlugin::applySettings()
PluginSettings::set(this, "TerminalColorScheme", prefColorScheme);
w_->setColorScheme(prefColorScheme);
w_->setTerminalFont(prefFont);
-// w_->setKeyBindings(prefEmulation);
+ w_->setKeyBindings(prefEmulation);
}
-void TerminalPlugin::colorSchemaChanged(int val)
+void TerminalPlugin::colorSchemaChanged(const QString & val)
{
- prefColorScheme = val + 1;
+ prefColorScheme = val;
}
void TerminalPlugin::emulationChanged(const QString & val)
@@ -153,3 +151,4 @@ void TerminalPlugin::showTerminal()
}
Q_EXPORT_PLUGIN2(terminal, TerminalPlugin)
+
@@ -23,8 +23,9 @@ class Preferences : public QWidget, Ui::Preferences
Q_OBJECT
public:
- Preferences(QTermWidget * term, const QObject * parent,
- int colorIX, const QString & emulation,
+ Preferences(const QObject * parent,
+ const QString &color,
+ const QString & emulation,
const QFont & font);
};
@@ -48,9 +49,9 @@ Q_INTERFACES(JuffPlugin)
void applySettings();
public slots:
- void colorSchemaChanged(int val);
- void emulationChanged(const QString & val);
- void fontChanged(const QFont & val);
+ void colorSchemaChanged(const QString &val);
+ void emulationChanged(const QString &val);
+ void fontChanged(const QFont &val);
void fontSizeChanged(int val);
private slots:
@@ -61,7 +62,7 @@ private slots:
QAction* termAct_;
QTermWidget * m_term;
- int prefColorScheme;
+ QString prefColorScheme;
QString prefEmulation;
QFont prefFont;
int prefFontSize;
@@ -70,3 +71,4 @@ private slots:
};
#endif
+

0 comments on commit 750bf99

Please sign in to comment.