From 0ac322b2542c29f873a3b2d77c52e4381a8986bf Mon Sep 17 00:00:00 2001 From: Brett Weir Date: Thu, 7 Apr 2016 05:01:04 -0700 Subject: [PATCH] Various critical bug fixes - Fix first-run path selector setup (IDE-188) - Properly catch mouse-driven tab close (IDE-189) - Remove Details+ tab from Build Manager --- src/projectview | 2 +- src/propelleride/buildmanager.cpp | 44 +++++++------------------- src/propelleride/buildmanager.h | 4 +-- src/propelleride/filemanager.cpp | 44 +++++++++++--------------- src/propelleride/filemanager.h | 4 +-- src/propelleride/forms/buildmanager.ui | 14 -------- src/propelleride/mainwindow.cpp | 10 +++--- src/propelleride/pathselector.cpp | 1 + src/propelleride/preferences.cpp | 6 +++- src/propelleride/preferences.h | 2 +- 10 files changed, 47 insertions(+), 84 deletions(-) diff --git a/src/projectview b/src/projectview index 4eb61d2..41051a5 160000 --- a/src/projectview +++ b/src/projectview @@ -1 +1 @@ -Subproject commit 4eb61d2d5498689810e3b6d3be370114c0c272b1 +Subproject commit 41051a5a9842d8a1fefa2fb5ec10cb16148a4527 diff --git a/src/propelleride/buildmanager.cpp b/src/propelleride/buildmanager.cpp index d4177f3..7f1527a 100644 --- a/src/propelleride/buildmanager.cpp +++ b/src/propelleride/buildmanager.cpp @@ -12,17 +12,13 @@ BuildManager::BuildManager(QWidget *parent) { ui.setupUi(this); - hideDetails(); - ui.activeText->setText(" "); setStage(0); - connect(&timer,SIGNAL(timeout()),this,SLOT(hideStatus())); + connect(&timer, SIGNAL(timeout()), this, SLOT(hideStatus())); currentTheme = &Singleton::Instance(); updateColors(); - - connect(ui.label, SIGNAL(clicked()), this, SLOT(toggleDetails())); } BuildManager::~BuildManager() @@ -61,15 +57,15 @@ void BuildManager::setConfiguration(BuildManager::Configuration config) void BuildManager::handleCompilerError(QProcess::ProcessError e) { + qCritical() << "Build failure" << config.compiler; failure = true; timer.stop(); - hideStatus(); + QString errorstring; switch (e) { case QProcess::FailedToStart: - errorstring = tr("Could not start \"%1.\"\n" - "Please check Preferences.").arg(config.compiler); + errorstring = tr("Failed to start compiler: '%1'; check Preferences").arg(config.compiler); break; case QProcess::Crashed: case QProcess::Timedout: @@ -85,6 +81,9 @@ void BuildManager::handleCompilerError(QProcess::ProcessError e) QMessageBox::critical((QWidget *) parent(), tr("Build Failed"), tr("%1").arg(errorstring)); + + emit buildError(); + emit finished(); } void BuildManager::compilerFinished(int exitCode, QProcess::ExitStatus status) @@ -93,7 +92,6 @@ void BuildManager::compilerFinished(int exitCode, QProcess::ExitStatus status) { failure = true; setText(tr("Build failed!")); - showDetails(); emit finished(); } else @@ -263,8 +261,12 @@ void BuildManager::build() args.append("-L" + include); } + QString actionstring = tr("Building '%1'...") + .arg(QFileInfo(config.file).fileName()); + setStage(1); - setText(tr("Building %1...").arg(QFileInfo(config.file).fileName())); + print(actionstring, Qt::darkYellow); + setText(actionstring); args.append(config.file); @@ -329,28 +331,6 @@ void BuildManager::keyPressEvent(QKeyEvent * event) } } -void BuildManager::showDetails() -{ - ui.label->setText("Details -"); - ui.plainTextEdit->show(); - adjustSize(); -} - -void BuildManager::hideDetails() -{ - ui.label->setText("Details +"); - ui.plainTextEdit->hide(); - adjustSize(); -} - -void BuildManager::toggleDetails() -{ - if (ui.plainTextEdit->isVisible()) - hideDetails(); - else - showDetails(); -} - void BuildManager::setBuild(bool active) { ui.iconBuild->setEnabled(active); diff --git a/src/propelleride/buildmanager.h b/src/propelleride/buildmanager.h index 8248ca8..e8dd48d 100644 --- a/src/propelleride/buildmanager.h +++ b/src/propelleride/buildmanager.h @@ -52,6 +52,7 @@ class BuildManager : public QFrame void terminalReceived(QString text); void statusChanged(const QString & text); void finished(); + void buildError(); public slots: void loadSuccess(); @@ -83,9 +84,6 @@ public slots: void keyPressEvent(QKeyEvent * event); public slots: - void toggleDetails(); - void showDetails(); - void hideDetails(); void updateColors(); void setStage(int stage); diff --git a/src/propelleride/filemanager.cpp b/src/propelleride/filemanager.cpp index 357c746..727562f 100644 --- a/src/propelleride/filemanager.cpp +++ b/src/propelleride/filemanager.cpp @@ -291,15 +291,7 @@ void FileManager::saveFile(const QString & fileName, int index) void FileManager::closeFile() { - int index = currentIndex(); - - if (count() > 0) - { - if (getEditor(index)->contentChanged()) - saveAndClose(); - else - closeFile(index); - } + closeFile(currentIndex()); } void FileManager::closeAll() @@ -307,19 +299,12 @@ void FileManager::closeAll() setCurrentIndex(0); while (count() > 0) { - if (getEditor(0)->contentChanged()) - { - if (saveAndClose()) - return; - } - else - { - closeFile(0); - } + if (!closeFile(0)) + return; } } -int FileManager::saveAndClose() +bool FileManager::saveAndClose(int index) { QMessageBox dialog; dialog.setText(tr("Your code has been modified.")); @@ -330,22 +315,29 @@ int FileManager::saveAndClose() switch (dialog.exec()) { case QMessageBox::Save: - save(); - closeFile(currentIndex()); + save(index); + return true; break; case QMessageBox::Discard: - closeFile(currentIndex()); + return true; break; case QMessageBox::Cancel: - return 1; default: break; } - return 0; + return false; } -void FileManager::closeFile(int index) +bool FileManager::closeFile(int index) { + if (getEditor(index)->contentChanged()) + { + if (!saveAndClose(index)) + { + return false; + } + } + if (count() > 0 && index >= 0 && index < count()) { getEditor(index)->disconnect(); @@ -358,6 +350,8 @@ void FileManager::closeFile(int index) createBackgroundImage(); emit closeAvailable(false); } + + return true; } void FileManager::createBackgroundImage() diff --git a/src/propelleride/filemanager.h b/src/propelleride/filemanager.h index 49ae131..a192a6a 100644 --- a/src/propelleride/filemanager.h +++ b/src/propelleride/filemanager.h @@ -42,8 +42,8 @@ public slots: void closeAll(); void closeFile(); - void closeFile(int index); - int saveAndClose(); + bool closeFile(int index); + bool saveAndClose(int index); void nextTab(); void previousTab(); diff --git a/src/propelleride/forms/buildmanager.ui b/src/propelleride/forms/buildmanager.ui index 37e5504..4d350e8 100644 --- a/src/propelleride/forms/buildmanager.ui +++ b/src/propelleride/forms/buildmanager.ui @@ -283,13 +283,6 @@ - - - - Details + - - - @@ -317,13 +310,6 @@ - - - ClickableLabel - QLabel -
clickable.h
-
-
diff --git a/src/propelleride/mainwindow.cpp b/src/propelleride/mainwindow.cpp index 7592858..233a076 100644 --- a/src/propelleride/mainwindow.cpp +++ b/src/propelleride/mainwindow.cpp @@ -26,8 +26,9 @@ MainWindow::MainWindow(QWidget *parent) // setup preferences dialog connect(&preferences, SIGNAL(accepted()), this, SLOT(getApplicationSettings())); - connect(&builder, SIGNAL(compilerErrorInfo(QString,int)), this, SLOT(highlightFileLine(QString,int))); - connect(&builder, SIGNAL(finished()), this, SLOT(enableBuildControls())); + connect(&builder, SIGNAL(compilerErrorInfo(QString,int)), this, SLOT(highlightFileLine(QString,int))); + connect(&builder, SIGNAL(finished()), this, SLOT(enableBuildControls())); + connect(&builder, SIGNAL(buildError()), &preferences, SLOT(showPreferences())); parser = language.getParser(); connect(&preferences,SIGNAL(updateColors()),this,SLOT(recolorProjectView())); @@ -283,8 +284,6 @@ void MainWindow::openRecentFile() void MainWindow::setProject() { - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - int index = ui.editorTabs->currentIndex(); QString shortname, filename; if (index > -1) @@ -308,7 +307,6 @@ void MainWindow::setProject() parser->setLibraryPaths(spinIncludes); recolorProjectView(); - QApplication::restoreOverrideCursor(); } void MainWindow::showBrowser() @@ -433,6 +431,8 @@ void MainWindow::recolorProjectView() parser->styleRule("constants",QIcon(),theme->getColor(ColorScheme::SyntaxKeywords)); parser->styleRule("_includes_",QIcon(),theme->getColor(ColorScheme::SyntaxText)); parser->setFont(theme->getFont()); + + qCDebug(logmainwindow) << "updating project view"; parser->buildModel(); ui.projectview->setModel(parser->treeModel()); } diff --git a/src/propelleride/pathselector.cpp b/src/propelleride/pathselector.cpp index 7e2a44d..f2c1228 100644 --- a/src/propelleride/pathselector.cpp +++ b/src/propelleride/pathselector.cpp @@ -17,6 +17,7 @@ PathSelector::PathSelector(QString language, restore(); load(); + save(); connect(ui.deletePath, SIGNAL(clicked()), this, SLOT(deletePath())); connect(ui.addPath, SIGNAL(clicked()), this, SLOT(addPath())); diff --git a/src/propelleride/preferences.cpp b/src/propelleride/preferences.cpp index 85679d8..f3a24a9 100644 --- a/src/propelleride/preferences.cpp +++ b/src/propelleride/preferences.cpp @@ -99,7 +99,11 @@ void Preferences::setupLanguages() PathSelector * spin; QString app = QApplication::applicationDirPath(); spin = new PathSelector("spin", - app + QString(DEFAULT_COMPILER), +#if defined(Q_OS_MAC) + app + "/" + QString(DEFAULT_COMPILER), +#else + QString(DEFAULT_COMPILER), +#endif QStringList() << app + QString(APP_RESOURCES_PATH) + QString("/library/library")); diff --git a/src/propelleride/preferences.h b/src/propelleride/preferences.h index fd58ca4..31c6428 100644 --- a/src/propelleride/preferences.h +++ b/src/propelleride/preferences.h @@ -24,7 +24,7 @@ #error "We don't support that OS yet..." #endif -#define DEFAULT_COMPILER "/openspin" APP_EXTENSION +#define DEFAULT_COMPILER "openspin" APP_EXTENSION class Preferences : public QDialog {