several minor improvements
This commit is contained in:
parent
32f2a6e8eb
commit
993dde6733
2 changed files with 30 additions and 7 deletions
|
@ -18,6 +18,10 @@
|
||||||
#include "fileiconprovider.h"
|
#include "fileiconprovider.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
const int ANDROID_INIT_HIGHLIGHTER_DELAY = 100;
|
||||||
|
#endif
|
||||||
|
|
||||||
EditorTabs::EditorTabs(QTabWidget * widget):
|
EditorTabs::EditorTabs(QTabWidget * widget):
|
||||||
tabWidget(widget)
|
tabWidget(widget)
|
||||||
{
|
{
|
||||||
|
@ -132,10 +136,9 @@ void EditorTabs::createTab(QString filepath, bool initHighlight)
|
||||||
emit tabOpened(tabIndex);
|
emit tabOpened(tabIndex);
|
||||||
if (initHighlight) {
|
if (initHighlight) {
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
QTimer::singleShot(100, this, ([this](){
|
Editor * currentEditor = editor;
|
||||||
if (editor != nullptr) {
|
QTimer::singleShot(ANDROID_INIT_HIGHLIGHTER_DELAY, currentEditor, ([currentEditor](){
|
||||||
editor->initHighlighter();
|
currentEditor->initHighlighter();
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
#else
|
#else
|
||||||
editor->initHighlighter();
|
editor->initHighlighter();
|
||||||
|
|
|
@ -52,6 +52,7 @@ bool MainWindow::WANT_RESTART = false;
|
||||||
|
|
||||||
int const TERMINAL_START_DELAY = 250; // should not be less then PROJECT_LOAD_DELAY
|
int const TERMINAL_START_DELAY = 250; // should not be less then PROJECT_LOAD_DELAY
|
||||||
int const CHECK_SCALE_FACTOR_DELAY = 2000;
|
int const CHECK_SCALE_FACTOR_DELAY = 2000;
|
||||||
|
int const INPUT_METHOD_ENSURE_CURSOR_VISIBLE_DELAY = 500;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -144,9 +145,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
|
|
||||||
// restore window geometry & state
|
// restore window geometry & state
|
||||||
QSettings windowSettings;
|
QSettings windowSettings;
|
||||||
|
if (windowSettings.allKeys().size() > 0) {
|
||||||
restoreGeometry(windowSettings.value("main_window_geometry").toByteArray());
|
restoreGeometry(windowSettings.value("main_window_geometry").toByteArray());
|
||||||
restoreState(windowSettings.value("main_window_state").toByteArray());
|
restoreState(windowSettings.value("main_window_state").toByteArray());
|
||||||
|
} else {
|
||||||
|
ui->sidebarDockWidget->hide();
|
||||||
|
ui->outputDockWidget->hide();
|
||||||
|
}
|
||||||
// plugins
|
// plugins
|
||||||
SpellChecker::instance().load();
|
SpellChecker::instance().load();
|
||||||
terminal = Terminal::instance().load();
|
terminal = Terminal::instance().load();
|
||||||
|
@ -694,6 +699,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!MainWindow::WANT_RESTART && ui->sidebarDockWidget->isVisible()) {
|
||||||
|
sidebarActionTriggered(false);
|
||||||
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!MainWindow::WANT_RESTART && !Helper::showQuestion(tr("Confirmation"), tr("Do you want to exit ?"))) {
|
if (!MainWindow::WANT_RESTART && !Helper::showQuestion(tr("Confirmation"), tr("Do you want to exit ?"))) {
|
||||||
MainWindow::WANT_RESTART = false;
|
MainWindow::WANT_RESTART = false;
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -1214,6 +1224,9 @@ void MainWindow::on_actionClose_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionQuit_triggered()
|
void MainWindow::on_actionQuit_triggered()
|
||||||
{
|
{
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
MainWindow::WANT_RESTART = true; // force quit (restart is disabled on Android)
|
||||||
|
#endif
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3027,6 +3040,13 @@ void MainWindow::inputMethodVisibleChanged()
|
||||||
ui->tabWidget->tabBar()->setVisible(false);
|
ui->tabWidget->tabBar()->setVisible(false);
|
||||||
tabWidgetSplit->tabBar()->setVisible(false);
|
tabWidgetSplit->tabBar()->setVisible(false);
|
||||||
tabsListButton->hide();
|
tabsListButton->hide();
|
||||||
|
|
||||||
|
QTimer::singleShot(INPUT_METHOD_ENSURE_CURSOR_VISIBLE_DELAY, this, [this](){
|
||||||
|
Editor * textEditor = getActiveEditor();
|
||||||
|
if (textEditor != nullptr) {
|
||||||
|
textEditor->ensureCursorVisible();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
ui->statusBar->setVisible(true);
|
ui->statusBar->setVisible(true);
|
||||||
ui->tabWidget->tabBar()->setVisible(true);
|
ui->tabWidget->tabBar()->setVisible(true);
|
||||||
|
|
Loading…
Reference in a new issue