logic: file paths

Changed relative file paths for resources to absolute paths to ensure functionality of shortcuts and file associations on windows platform
This commit is contained in:
Manuel Dobusch
2016-01-26 15:28:43 +01:00
parent e0d7f1d613
commit 8d6220dafb
39 changed files with 291 additions and 84 deletions
+6 -3
View File
@@ -9,6 +9,7 @@
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "qt/utility/utilityQt.h"
#include "utility/Version.h"
#include "utility/ResourcePaths.h"
QtAbout::QtAbout(QWidget *parent)
: QtSettingsWindow(parent)
@@ -30,7 +31,7 @@ void QtAbout::setup()
"}"
);
setStyleSheet(utility::getStyleSheet("data/gui/about/about.css").c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "about/about.css").c_str());
QVBoxLayout* windowLayout = new QVBoxLayout();
windowLayout->setContentsMargins(30, 30, 30, 20);
@@ -39,8 +40,9 @@ void QtAbout::setup()
QHBoxLayout* rowTitle = new QHBoxLayout();
windowLayout->addLayout(rowTitle);
QtDeviceScaledPixmap coatiLogo("data/gui/about/logo.png");
QtDeviceScaledPixmap coatiLogo((ResourcePaths::getGuiPath() + "about/logo.png").c_str());
coatiLogo.scaleToWidth(120);
QLabel* coatiLogoLabel = new QLabel(this);
coatiLogoLabel->setPixmap(coatiLogo.pixmap());
coatiLogoLabel->resize(coatiLogo.width(), coatiLogo.height());
@@ -115,8 +117,9 @@ void QtAbout::setup()
rowAcknowledgementsLogos->addStretch();
QtDeviceScaledPixmap fhsLogo("data/gui/about/logo_fhs.png");
QtDeviceScaledPixmap fhsLogo((ResourcePaths::getGuiPath() + "about/logo_fhs.png").c_str());
fhsLogo.scaleToHeight(60);
QLabel* fhsLabel = new QLabel(this);
fhsLabel->setPixmap(fhsLogo.pixmap());
fhsLabel->resize(fhsLogo.width(), fhsLogo.height());
+6 -3
View File
@@ -13,6 +13,8 @@
#include "qt/utility/utilityQt.h"
#include "settings/ApplicationSettings.h"
#include "utility/file/FilePath.h"
#include "utility/AppPath.h"
#include "utility/ResourcePaths.h"
QtLicense::QtLicense(QWidget *parent)
: QtSettingsWindow(parent, 68)
@@ -51,8 +53,8 @@ void QtLicense::load()
void QtLicense::setup()
{
setStyleSheet((
utility::getStyleSheet("data/gui/setting_window/window.css") +
utility::getStyleSheet("data/gui/license/license.css")
utility::getStyleSheet(ResourcePaths::getGuiPath() + "data/gui/setting_window/window.css") +
utility::getStyleSheet(ResourcePaths::getGuiPath() + "data/gui/license/license.css")
).c_str());
addLogo();
@@ -146,7 +148,8 @@ void QtLicense::handleUpdateButtonPress()
{
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
appSettings->setLicenseString(license.getLicenseString());
FilePath p("");
std::string appLocation = AppPath::getAppPath(); // for easier debugging
FilePath p(appLocation);
appSettings->setLicenseCheck(license.hashLocation(p.absolute().str()));
appSettings->save();
}
+4 -3
View File
@@ -26,6 +26,7 @@
#include "utility/messaging/type/MessageUndo.h"
#include "utility/messaging/type/MessageWindowFocus.h"
#include "utility/messaging/type/MessageZoom.h"
#include "utility/ResourcePaths.h"
#include "version.h"
#include "isTrial.h"
@@ -112,7 +113,7 @@ QtMainWindow::QtMainWindow()
setCentralWidget(nullptr);
setDockNestingEnabled(true);
setWindowIcon(QIcon("./data/gui/icon/logo_1024_1024.png"));
setWindowIcon(QIcon((ResourcePaths::getGuiPath() + "icon/logo_1024_1024.png").c_str()));
setWindowFlags(Qt::Widget);
// QApplication::setOverrideCursor(Qt::ArrowCursor);
@@ -121,7 +122,7 @@ QtMainWindow::QtMainWindow()
app->installEventFilter(new MouseReleaseFilter(this));
app->installEventFilter(new MouseWheelFilter(this));
app->setStyleSheet(utility::getStyleSheet("data/gui/tooltip.css").c_str());
app->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "tooltip.css").c_str());
m_recentProjectAction = new QAction*[ApplicationSettings::MaximalAmountOfRecentProjects];
@@ -495,7 +496,7 @@ void QtMainWindow::resetZoom()
void QtMainWindow::switchColorScheme()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "./data/color_schemes", "XML Files (*.xml)");
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), (ResourcePaths::getColorSchemesPath()).c_str(), "XML Files (*.xml)");
if (!fileName.isEmpty())
{
+4 -3
View File
@@ -11,6 +11,7 @@
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "qt/utility/utilityQt.h"
#include "utility/messaging/type/MessageInterruptTasks.h"
#include "utility/ResourcePaths.h"
QtSettingsWindow::QtSettingsWindow(QWidget *parent, int displacement)
: QWidget(parent, Qt::Dialog | Qt::FramelessWindowHint)
@@ -119,14 +120,14 @@ void QtSettingsWindow::mouseReleaseEvent(QMouseEvent *event)
void QtSettingsWindow::setupForm()
{
QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_blurry.png");
QtDeviceScaledPixmap coati_logo((ResourcePaths::getGuiPath() + "startscreen/logo_blurry.png").c_str());
coati_logo.scaleToWidth(400);
QLabel* coatiLogoLabel = new QLabel(m_window);
coatiLogoLabel->setPixmap(coati_logo.pixmap());
coatiLogoLabel->resize(coati_logo.width(), coati_logo.height());
coatiLogoLabel->move(100, 100);
setStyleSheet(utility::getStyleSheet("data/gui/setting_window/window.css").c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "setting_window/window.css").c_str());
QVBoxLayout* windowLayout = new QVBoxLayout();
windowLayout->setContentsMargins(25, 30, 25, 20);
@@ -169,7 +170,7 @@ void QtSettingsWindow::populateForm(QFormLayout* layout)
void QtSettingsWindow::addLogo()
{
QtDeviceScaledPixmap coatiLogo("data/gui/startscreen/logo.png");
QtDeviceScaledPixmap coatiLogo((ResourcePaths::getGuiPath() + "startscreen/logo.png").c_str());
coatiLogo.scaleToWidth(200);
QLabel* coatiLogoLabel = new QLabel(this);
+4 -2
View File
@@ -6,6 +6,8 @@
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "utility/ResourcePaths.h"
namespace
{
class InitThread : public QThread
@@ -23,11 +25,11 @@ QtSplashScreen::QtSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f)
: QSplashScreen(pixmap, f)
, m_state(0)
{
QtDeviceScaledPixmap foreground("data/gui/splash_white.png");
QtDeviceScaledPixmap foreground((ResourcePaths::getGuiPath() + "splash_white.png").c_str());
foreground.scaleToHeight(pixmap.size().height() * 0.8);
m_foreground = foreground.pixmap();
QtDeviceScaledPixmap background("data/gui/splash_blue.png");
QtDeviceScaledPixmap background((ResourcePaths::getGuiPath() + "splash_blue.png").c_str());
background.scaleToHeight(pixmap.size().height() * 0.9);
m_background = background.pixmap();
}
+3 -2
View File
@@ -7,6 +7,7 @@
#include "settings/ApplicationSettings.h"
#include "utility/file/FileSystem.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/ResourcePaths.h"
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "qt/utility/utilityQt.h"
@@ -33,7 +34,7 @@ QtStartScreen::QtStartScreen(QWidget *parent)
void QtStartScreen::setup()
{
setStyleSheet(utility::getStyleSheet("data/gui/startscreen/startscreen.css").c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "startscreen/startscreen.css").c_str());
addLogo();
@@ -57,7 +58,7 @@ void QtStartScreen::setup()
recentProjectsLabel->setObjectName("recentLabel");
int position = 290;
QIcon cpp_icon("data/gui/startscreen/icon_cpp.png");
QIcon cpp_icon((ResourcePaths::getGuiPath() + "startscreen/icon_cpp.png").c_str());
std::vector<FilePath> recentProjects = ApplicationSettings::getInstance()->getRecentProjects();
for (size_t i = 0; i < recentProjects.size() && i < ApplicationSettings::MaximalAmountOfRecentProjects; i++)
{