build: split user and data folder, moving user data to Application Support on Mac
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFontDatabase>
|
||||
#include <QPainter>
|
||||
@@ -150,4 +151,29 @@ namespace utility
|
||||
painter.drawImage(0, 0, colorImage);
|
||||
return QPixmap::fromImage(image);
|
||||
}
|
||||
|
||||
void copyNewFilesFromDirectory(QString src, QString dst)
|
||||
{
|
||||
QDir dir(src);
|
||||
if (!dir.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
{
|
||||
QString dst_path = dst + QDir::separator() + d;
|
||||
|
||||
dir.mkpath(dst_path);
|
||||
copyNewFilesFromDirectory(src + QDir::separator() + d, dst_path);
|
||||
}
|
||||
|
||||
foreach (QString f, dir.entryList(QDir::Files))
|
||||
{
|
||||
if (!QFile::exists(dst + QDir::separator() + f))
|
||||
{
|
||||
QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace utility
|
||||
std::string getStyleSheet(const std::string& path);
|
||||
|
||||
QPixmap colorizePixmap(const QPixmap& pixmap, QColor color);
|
||||
|
||||
void copyNewFilesFromDirectory(QString src, QString dst);
|
||||
}
|
||||
|
||||
# endif // UTILITY_QT_H
|
||||
|
||||
@@ -34,11 +34,10 @@
|
||||
#include "utility/messaging/type/MessageWindowFocus.h"
|
||||
#include "utility/messaging/type/MessageZoom.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "version.h"
|
||||
#include "isTrial.h"
|
||||
|
||||
std::string QtMainWindow::m_windowSettingsPath = "data/window_settings.ini";
|
||||
|
||||
QtViewToggle::QtViewToggle(View* view, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_view(view)
|
||||
@@ -214,7 +213,7 @@ void QtMainWindow::hideView(View* view)
|
||||
|
||||
void QtMainWindow::loadLayout()
|
||||
{
|
||||
QSettings settings(m_windowSettingsPath.c_str(), QSettings::IniFormat);
|
||||
QSettings settings(UserPaths::getWindowSettingsPath().c_str(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup("MainWindow");
|
||||
resize(settings.value("size", QSize(600, 400)).toSize());
|
||||
@@ -236,7 +235,7 @@ void QtMainWindow::loadLayout()
|
||||
|
||||
void QtMainWindow::saveLayout()
|
||||
{
|
||||
QSettings settings(m_windowSettingsPath.c_str(), QSettings::IniFormat);
|
||||
QSettings settings(UserPaths::getWindowSettingsPath().c_str(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup("MainWindow");
|
||||
settings.setValue("maximized", isMaximized());
|
||||
@@ -557,11 +556,6 @@ void QtMainWindow::updateRecentProjectMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::setWindowSettingsPath(const std::string& windowSettingsPath)
|
||||
{
|
||||
m_windowSettingsPath = windowSettingsPath;
|
||||
}
|
||||
|
||||
void QtMainWindow::toggleShowDockWidgetTitleBars()
|
||||
{
|
||||
setShowDockWidgetTitleBars(!m_showDockWidgetTitleBars);
|
||||
|
||||
@@ -130,8 +130,6 @@ public slots:
|
||||
|
||||
void updateRecentProjectMenu();
|
||||
|
||||
static void setWindowSettingsPath(const std::string& windowSettingsPath);
|
||||
|
||||
private slots:
|
||||
void toggleShowDockWidgetTitleBars();
|
||||
|
||||
@@ -172,8 +170,6 @@ private:
|
||||
|
||||
QShortcut* m_escapeShortcut;
|
||||
|
||||
static std::string m_windowSettingsPath;
|
||||
|
||||
QtThreadedFunctor<std::string, std::string, std::vector<std::string>, std::vector<std::string>> m_createNewProjectFunctor;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user