From 2ffec90c19e0a5906bd862f6eb5bbc5161e4c9fd Mon Sep 17 00:00:00 2001 From: Andreas Stallinger Date: Mon, 4 Apr 2016 20:43:56 +0200 Subject: [PATCH] ui: startscreen display not existing project * displays moved or deleted recent projects as disabled button --- src/lib/data/search/SearchIndex.cpp | 2 +- src/lib/settings/ApplicationSettings.cpp | 3 --- src/lib_gui/qt/window/QtLicense.cpp | 6 ++++-- src/lib_gui/qt/window/QtStartScreen.cpp | 14 ++++++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index f089bee5..633425b2 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -30,7 +30,7 @@ void SearchIndex::addNode(Id id, const NameHierarchy& nameHierarchy) Edge* currentEdge = currentNode->edges[i]; const std::string& edgeString = currentEdge->s; - int matchCount = 0; + size_t matchCount = 0; for (size_t j = 0; j < edgeString.size() && j < remaining.size(); j++) { if (edgeString[j] != remaining[j]) diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index f5ae858a..a2953005 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -163,10 +163,7 @@ std::vector ApplicationSettings::getRecentProjects() const for (FilePath project: loadedRecentProjects) { - if (project.exists()) - { recentProjects.push_back(project); - } } return recentProjects; } diff --git a/src/lib_gui/qt/window/QtLicense.cpp b/src/lib_gui/qt/window/QtLicense.cpp index ee54979a..1206a8f1 100644 --- a/src/lib_gui/qt/window/QtLicense.cpp +++ b/src/lib_gui/qt/window/QtLicense.cpp @@ -1,5 +1,6 @@ #include "qt/window/QtLicense.h" +#include #include #include #include @@ -105,7 +106,6 @@ void QtLicense::populateWindow(QWidget* widget) linkLabel->setGeometry(275, 300, 300, 50); subLayout->addWidget(linkLabel); - QVBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addLayout(subLayout); @@ -123,12 +123,14 @@ void QtLicense::windowReady() updateNextButton("Activate"); setPreviousVisible(false); + updateCloseButton("Quit Coati"); + m_title->hide(); } void QtLicense::handleClose() { - emit canceled(); + QApplication::quit(); } void QtLicense::handleNext() diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index 306d3538..a4f357f5 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -1,6 +1,7 @@ #include "qt/window/QtStartScreen.h" #include +#include #include #include @@ -18,7 +19,16 @@ QtRecentProjectButton::QtRecentProjectButton(const FilePath& projectFilePath, QW , m_projectFilePath(projectFilePath) { this->setText(m_projectFilePath.withoutExtension().fileName().c_str()); - this->setToolTip(m_projectFilePath.str().c_str()); + if ( projectFilePath.exists() ) + { + this->setToolTip(m_projectFilePath.str().c_str()); + } + else + { + std::string missingFileText = "Couldn't find " + m_projectFilePath.str() + " in your filesystem"; + this->setToolTip(missingFileText.c_str()); + this->setEnabled(false); + } } void QtRecentProjectButton::handleButtonClick() @@ -69,7 +79,7 @@ void QtStartScreen::setupStartScreen() int position = 290; QIcon cpp_icon((ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str()); std::vector recentProjects = ApplicationSettings::getInstance()->getRecentProjects(); - for (size_t i = 0; i < recentProjects.size() && i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount(); i++) + for (size_t i = 0; i < recentProjects.size() && (int)i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount(); i++) { QtRecentProjectButton* button = new QtRecentProjectButton(recentProjects[i], this); button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac