ui: windows installer

Created a windows installer (vs deployment project).
This commit is contained in:
Manuel Dobusch
2015-12-02 14:50:02 +01:00
parent 09bc453fb0
commit 04196db81d
34 changed files with 5491 additions and 6 deletions
+4
View File
@@ -9,6 +9,7 @@
#include "Application.h"
#include "includes.h" // defines 'void setup(int argc, char *argv[])'
#include "qt/window/QtMainWindow.h"
#include "qt/window/QtSplashScreen.h"
#include "qt/network/QtNetworkFactory.h"
#include "qt/utility/utilityQt.h"
@@ -25,6 +26,7 @@ void init()
std::shared_ptr<FileLogger> fileLogger = std::make_shared<FileLogger>();
fileLogger->setLogLevel(Logger::LOG_ALL);
FileLogger::setFilePath(logPath);
LogManager::getInstance()->addLogger(fileLogger);
utility::loadFontsFromDirectory("data/fonts", ".otf");
@@ -52,6 +54,8 @@ int main(int argc, char *argv[])
QtViewFactory viewFactory;
QtNetworkFactory networkFactory;
QtMainWindow::setWindowSettingsPath(windowSettingsPath);
Application::setAppSettingsPath(appSettingsPath);
std::shared_ptr<Application> app = Application::create(version, &viewFactory, &networkFactory);
if (splash)
@@ -1,6 +1,10 @@
#ifndef INCLUDES_DEFAULT_H
#define INCLUDES_DEFAULT_H
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
void setup(int argc, char *argv[])
{
}
+4
View File
@@ -5,6 +5,10 @@
#include <QApplication>
#include <QDir>
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
void setup(int argc, char *argv[])
{
// ----------------------------------------------------------------------------
@@ -1,10 +1,25 @@
#ifndef INCLUDES_WINDOWS_H
#define INCLUDES_WINDOWS_H
#include <string>
#include "vld.h"
#define DEPLOY
#ifdef DEPLOY
static std::string appSettingsPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/ApplicationSettings.xml";
static std::string windowSettingsPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/window_settings.ini";
static std::string logPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/log/";
#else
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
#endif
void setup(int argc, char *argv[])
{
}
#endif // INCLUDES_WINDOWS_H
+8 -2
View File
@@ -26,6 +26,7 @@
#include "utility/messaging/type/MessageZoom.h"
#include "version.h"
std::string QtMainWindow::m_windowSettingsPath = "data/window_settings.ini";
QtViewToggle::QtViewToggle(View* view, QWidget *parent)
: QWidget(parent)
@@ -146,7 +147,7 @@ void QtMainWindow::hideView(View* view)
void QtMainWindow::loadLayout()
{
QSettings settings("data/window_settings.ini", QSettings::IniFormat);
QSettings settings(m_windowSettingsPath.c_str(), QSettings::IniFormat);
settings.beginGroup("MainWindow");
resize(settings.value("size", QSize(600, 400)).toSize());
@@ -167,7 +168,7 @@ void QtMainWindow::loadLayout()
void QtMainWindow::saveLayout()
{
QSettings settings("data/window_settings.ini", QSettings::IniFormat);
QSettings settings(m_windowSettingsPath.c_str(), QSettings::IniFormat);
settings.beginGroup("MainWindow");
settings.setValue("maximized", isMaximized());
@@ -484,6 +485,11 @@ void QtMainWindow::updateRecentProjectMenu()
}
}
void QtMainWindow::setWindowSettingsPath(const std::string& windowSettingsPath)
{
m_windowSettingsPath = windowSettingsPath;
}
void QtMainWindow::showLicenses()
{
hideScreens();
+4
View File
@@ -89,6 +89,8 @@ public slots:
void handleEscapeShortcut();
void updateRecentProjectMenu();
static void setWindowSettingsPath(const std::string& windowSettingsPath);
private:
struct DockWidget
{
@@ -122,6 +124,8 @@ private:
QShortcut* m_escapeShortcut;
bool m_startScreenWasVisible;
static std::string m_windowSettingsPath;
};
#endif // QT_MAIN_WINDOW_H
+9 -2
View File
@@ -16,6 +16,8 @@
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
std::string Application::m_appSettingsPath = "data/ApplicationSettings.xml";
std::shared_ptr<Application> Application::create(
const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory
){
@@ -51,7 +53,7 @@ std::shared_ptr<Application> Application::create(
void Application::loadSettings()
{
ApplicationSettings::getInstance()->load("data/ApplicationSettings.xml");
ApplicationSettings::getInstance()->load(FilePath(m_appSettingsPath));
ColorScheme::getInstance()->load(ApplicationSettings::getInstance()->getColorSchemePath());
GraphViewStyle::loadStyleSettings();
@@ -111,6 +113,11 @@ void Application::saveProject(const FilePath& projectSettingsFilePath)
}
}
void Application::setAppSettingsPath(const std::string& appSettingsPath)
{
m_appSettingsPath = appSettingsPath;
}
void Application::handleMessage(MessageActivateWindow* message)
{
m_mainView->activateWindow();
@@ -177,5 +184,5 @@ void Application::updateRecentProjects(const FilePath& projectSettingsFilePath)
}
appSettings->setRecentProjects(recentProjects);
appSettings->save("data/ApplicationSettings.xml");
appSettings->save(m_appSettingsPath);
}
+4
View File
@@ -36,6 +36,8 @@ public:
void refreshProject();
void saveProject(const FilePath& projectSettingsFilePath);
static void setAppSettingsPath(const std::string& appSettingsPath);
private:
Application();
@@ -54,6 +56,8 @@ private:
std::shared_ptr<ComponentManager> m_componentManager;
std::shared_ptr<IDECommunicationController> m_ideCommunicationController;
static std::string m_appSettingsPath;
};
#endif // APPLICATION_H
+17 -1
View File
@@ -1,9 +1,10 @@
#include "FileLogger.h"
#include <direct.h>
#include <fstream>
#include <sstream>
const std::string FileLogger::s_filePath = "data/log/";
std::string FileLogger::s_filePath = "data/log/";
FileLogger::FileLogger()
: Logger("FileLogger")
@@ -15,6 +16,13 @@ FileLogger::~FileLogger()
{
}
void FileLogger::setFilePath(const std::string& filePath)
{
s_filePath = filePath;
createDirectory();
}
void FileLogger::logInfo(const LogMessage& message)
{
logMessage("INFO", message);
@@ -44,6 +52,14 @@ void FileLogger::setupFileName()
m_fileName = filename.str();
}
void FileLogger::createDirectory()
{
if (s_filePath.length() > 0)
{
mkdir(s_filePath.c_str());
}
}
void FileLogger::logMessage(const std::string& type, const LogMessage& message)
{
std::ofstream fileStream;
+4 -1
View File
@@ -12,12 +12,15 @@ public:
FileLogger();
virtual ~FileLogger();
static void setFilePath(const std::string& filePath);
private:
virtual void logInfo(const LogMessage& message);
virtual void logWarning(const LogMessage& message);
virtual void logError(const LogMessage& message);
static const std::string s_filePath;
static void createDirectory();
static std::string s_filePath;
void setupFileName();
void logMessage(const std::string& type, const LogMessage& message);