ui: startscreen display not existing project

* displays moved or deleted recent projects as disabled button
This commit is contained in:
Andreas Stallinger
2016-04-04 20:43:56 +02:00
parent f3dc12b0ed
commit 2ffec90c19
4 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -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])
-3
View File
@@ -163,10 +163,7 @@ std::vector<FilePath> ApplicationSettings::getRecentProjects() const
for (FilePath project: loadedRecentProjects)
{
if (project.exists())
{
recentProjects.push_back(project);
}
}
return recentProjects;
}
+4 -2
View File
@@ -1,5 +1,6 @@
#include "qt/window/QtLicense.h"
#include <QApplication>
#include <QLineEdit>
#include <QLabel>
#include <QTextEdit>
@@ -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()
+12 -2
View File
@@ -1,6 +1,7 @@
#include "qt/window/QtStartScreen.h"
#include <QLabel>
#include <QString>
#include <QHBoxLayout>
#include <QVBoxLayout>
@@ -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<FilePath> 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