Commit 3a9b2ac9 authored by Victor Yacovlev's avatar Victor Yacovlev

Show console toggle button

parent 1a672c74
This diff is collapsed.
......@@ -949,6 +949,9 @@ void MainWindow::loadSettings()
}
restoreState(m_plugin->mySettings()->value(Plugin::MainWindowStateKey).toByteArray());
ui->splitter->restoreState(m_plugin->mySettings()->value(Plugin::MainWindowSplitterStateKey).toByteArray());
bool showConsole = m_plugin->mySettings()->value(Plugin::MainWindowShowConsoleKey, true).toBool();
ui->actionShow_Console_Pane->setChecked(showConsole);
m_plugin->showConsolePane(showConsole);
}
void MainWindow::saveSettings()
......@@ -958,6 +961,7 @@ void MainWindow::saveSettings()
sett->setValue(Plugin::MainWindowGeometryKey, r);
sett->setValue(Plugin::MainWindowStateKey, saveState());
sett->setValue(Plugin::MainWindowSplitterStateKey, ui->splitter->saveState());
sett->setValue(Plugin::MainWindowShowConsoleKey, ui->actionShow_Console_Pane->isChecked());
}
void MainWindow::restoreSession()
......
......@@ -114,6 +114,7 @@
<property name="title">
<string>Window</string>
</property>
<addaction name="actionShow_Console_Pane"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
......@@ -250,6 +251,17 @@
<enum>Qt::ApplicationShortcut</enum>
</property>
</action>
<action name="actionShow_Console_Pane">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Console Pane</string>
</property>
<property name="shortcut">
<string>F12</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
......
......@@ -32,6 +32,7 @@ QString Plugin::SessionTabIndexKey = "Session/TabIndex";
QString Plugin::RecentFileKey = "History/FileDialog";
QString Plugin::RecentFilesKey = "History/RecentFiles";
QString Plugin::MainWindowGeometryKey = "Geometry/MainWindow";
QString Plugin::MainWindowShowConsoleKey = "State/ConsoleToggle";
QString Plugin::MainWindowStateKey = "State/MainWindow";
QString Plugin::MainWindowSplitterStateKey = "State/MainWindowSplitter";
QString Plugin::DockVisibleKey = "DockWindow/Visible";
......@@ -151,6 +152,15 @@ QString Plugin::initialize(const QStringList & parameters)
// termWindow->toggleViewAction()->setShortcut(QKeySequence("F12"));
#endif
connect(mainWindow_->ui->actionShow_Console_Pane,
SIGNAL(triggered(bool)),
this,
SLOT(showConsolePane(bool)));
QToolButton * btnShowConsole = new QToolButton(mainWindow_);
btnShowConsole->setDefaultAction(mainWindow_->ui->actionShow_Console_Pane);
btnShowConsole->setToolTip(mainWindow_->ui->actionShow_Console_Pane->text());
mainWindow_->statusBar_->addButtonToLeft(btnShowConsole);
QToolButton * btnSaveTerm = new QToolButton(mainWindow_);
btnSaveTerm->setPopupMode(QToolButton::InstantPopup);
QMenu * menuSaveTerm = new QMenu(btnSaveTerm);
......@@ -414,14 +424,26 @@ void Plugin::handleSecondaryWindowDocked(QWidget * w, const QString & title)
actorsDockPlace_->addTab(w, w->windowTitle());
actorsDockPlace_->setCurrentWidget(w);
actorsDockPlace_->setVisible(true);
mainWindow_->ui->actionShow_Console_Pane->setChecked(true);
showConsolePane(true);
}
void Plugin::handleSecondaryWindowUndocked(QWidget * w)
{
int index = actorsDockPlace_->indexOf(w);
actorsDockPlace_->removeTab(index);
if (actorsDockPlace_->count() == 0)
if (actorsDockPlace_->count() == 0) {
actorsDockPlace_->setVisible(false);
if (m_terminal->isEmpty()) {
mainWindow_->ui->actionShow_Console_Pane->setChecked(false);
showConsolePane(false);
}
}
}
void Plugin::showConsolePane(bool v)
{
mainWindow_->ui->bottomWidget->setVisible(v);
}
......
......@@ -39,6 +39,7 @@ public:
static QString RecentFileKey;
static QString RecentFilesKey;
static QString MainWindowGeometryKey;
static QString MainWindowShowConsoleKey;
static QString MainWindowStateKey;
static QString MainWindowSplitterStateKey;
static QString DockVisibleKey;
......@@ -56,6 +57,7 @@ protected slots:
void prepareKumirProgramToRun();
void handleSecondaryWindowDocked(QWidget * w, const QString & title);
void handleSecondaryWindowUndocked(QWidget * w);
void showConsolePane(bool v);
protected:
QString initialize(const QStringList &arguments);
......
......@@ -93,6 +93,11 @@ Term::Term(QWidget *parent) :
}
bool Term::isEmpty() const
{
return sessions_.isEmpty();
}
QSize Term::minimumSizeHint() const
{
QSize result = m_plane->minimumSizeHint();
......
......@@ -16,6 +16,7 @@ public:
explicit Term(QWidget *parent = 0);
bool isActiveComponent() const;
QSize minimumSizeHint() const;
bool isEmpty() const;
signals:
void openTextEditor(const QString & suggestedFileName, const QString & text);
void message(const QString &);
......
......@@ -600,8 +600,8 @@ void SecondaryWindowPrivate::init(QWidget *centralWidget,
topBorder_->setFixedHeight(qMax(maxButtonHeight, topBorderHeight));
toggleVisibleAction_ = new QAction(this);
toggleVisibleAction_->setCheckable(true);
connect(toggleVisibleAction_, SIGNAL(triggered(bool)), pClass_, SLOT(setVisible(bool)));
toggleVisibleAction_->setCheckable(false);
connect(toggleVisibleAction_, SIGNAL(triggered()), pClass_, SLOT(activate()));
startTimer(500);
......@@ -615,6 +615,14 @@ void SecondaryWindowPrivate::init(QWidget *centralWidget,
dockPlace_->setMinimumWidth(centralWidget_->minimumWidth());
}
void SecondaryWindow::activate()
{
if (!isVisible())
setVisible(true);
if (isFloating())
activateWindow();
}
void SecondaryWindowPrivate::timerEvent(QTimerEvent *e)
{
e->accept();
......
......@@ -53,6 +53,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *evt);
protected slots:
void checkForPlaceVisible(bool show);
void activate();
private:
class SecondaryWindowPrivate *pImpl_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment