ui: startscreen project icons

* language specific icon on startscreen
* TODO maybe replace the icons with others
This commit is contained in:
Andreas Stallinger
2016-10-20 12:17:35 +02:00
parent ea207c786d
commit a388932864
5 changed files with 26 additions and 2 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+22 -2
View File
@@ -7,6 +7,7 @@
#include <QMessageBox>
#include "settings/ApplicationSettings.h"
#include "settings/ProjectSettings.h"
#include "utility/file/FileSystem.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/ResourcePaths.h"
@@ -95,6 +96,22 @@ void QtStartScreen::updateButtons()
if (i < recentProjects.size())
{
button->setProjectPath(recentProjects[i]);
LanguageType lang = ProjectSettings::getLanguageOfProject(recentProjects[i]);
switch (lang)
{
case LanguageType::LANGUAGE_C:
button->setIcon(*m_cIcon);
break;
case LANGUAGE_CPP:
button->setIcon(*m_cppIcon);
break;
case LANGUAGE_JAVA:
button->setIcon(*m_javaIcon);
break;
default:
button->setIcon(*m_projectIcon);
break;
}
button->setFixedWidth(button->fontMetrics().width(button->text()) + 45);
connect(button, SIGNAL(clicked()), button, SLOT(handleButtonClick()));
if (button->projectExists())
@@ -211,14 +228,17 @@ void QtStartScreen::setupStartScreen(bool unlocked)
col->addSpacing(20);
QIcon cpp_icon((ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str());
m_cppIcon = new QIcon((ResourcePaths::getGuiPath() + "icon/cpp_icon.png").c_str());
m_cIcon = new QIcon((ResourcePaths::getGuiPath() + "icon/c_icon.png").c_str());
m_javaIcon = new QIcon((ResourcePaths::getGuiPath() + "icon/java_icon.png").c_str());
m_projectIcon = new QIcon((ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str());
for (int i = 0
; i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount()
; i++)
{
QtRecentProjectButton* button = new QtRecentProjectButton(this);
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
button->setIcon(cpp_icon);
button->setIcon(*m_projectIcon);
button->setIconSize(QSize(25, 25));
button->setMinimumSize(button->fontMetrics().width(button->text()) + 45, 40);
button->setObjectName("recentButtonMissing");
+4
View File
@@ -50,6 +50,10 @@ private slots:
private:
std::vector<QtRecentProjectButton*> m_recentProjectsButtons;
QIcon* m_cppIcon;
QIcon* m_cIcon;
QIcon* m_javaIcon;
QIcon* m_projectIcon;
};
#endif // QT_START_SCREEN_H