ui: reset window layout option in view menu
This commit is contained in:
@@ -7,6 +7,11 @@ std::string ResourcePaths::getColorSchemesPath()
|
||||
return AppPath::getAppPath() + "data/color_schemes/";
|
||||
}
|
||||
|
||||
std::string ResourcePaths::getFallbackPath()
|
||||
{
|
||||
return AppPath::getAppPath() + "data/fallback/";
|
||||
}
|
||||
|
||||
std::string ResourcePaths::getFontsPath()
|
||||
{
|
||||
return AppPath::getAppPath() + "data/fonts/";
|
||||
|
||||
@@ -7,6 +7,7 @@ class ResourcePaths
|
||||
{
|
||||
public:
|
||||
static std::string getColorSchemesPath();
|
||||
static std::string getFallbackPath();
|
||||
static std::string getFontsPath();
|
||||
static std::string getGuiPath();
|
||||
static std::string getJavaPath();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QDir>
|
||||
#include "utility/AppPath.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
@@ -40,6 +41,7 @@ void setupApp(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(ResourcePaths::getFallbackPath()), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/user/" ), userDataPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "utility/AppPath.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/UserPaths.h"
|
||||
|
||||
bool appIsMacBundle = false;
|
||||
@@ -55,7 +56,7 @@ void setupPlatform(int argc, char *argv[])
|
||||
// ----------------------------------------------------------------------------
|
||||
// Makes the mac bundle copy the user files to the Application Support folder
|
||||
QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
QString oldDataPath = QString::fromStdString(UserPaths::getUserDataPath() + "user/");
|
||||
QString oldDataPath = QString::fromStdString(ResourcePaths::getFallbackPath());
|
||||
|
||||
QDir dataDir(dataPath);
|
||||
if (!dataDir.exists())
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "vld.h"
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "utility/utilityApp.h"
|
||||
|
||||
@@ -58,8 +59,8 @@ void setupApp(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
// use files in fallback folder if Coati has not been installed and used before
|
||||
FileSystem::copyFile("data/fallback/ApplicationSettings.xml", UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile("data/fallback/window_settings.ini", UserPaths::getWindowSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath() + "ApplicationSettings.xml", UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath() + "window_settings.ini", UserPaths::getWindowSettingsPath());
|
||||
}
|
||||
|
||||
#endif // INCLUDES_WINDOWS_H
|
||||
|
||||
@@ -196,13 +196,19 @@ void QtMainWindow::loadLayout()
|
||||
}
|
||||
setShowDockWidgetTitleBars(settings.value("showTitleBars", true).toBool());
|
||||
settings.endGroup();
|
||||
loadDockWidgetLayout();
|
||||
}
|
||||
|
||||
void QtMainWindow::loadDockWidgetLayout()
|
||||
{
|
||||
QSettings settings(UserPaths::getWindowSettingsPath().c_str(), QSettings::IniFormat);
|
||||
this->restoreState(settings.value("DOCK_LOCATIONS").toByteArray());
|
||||
|
||||
for (DockWidget dock : m_dockWidgets)
|
||||
{
|
||||
dock.action->setChecked(!dock.widget->isHidden());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QtMainWindow::saveLayout()
|
||||
@@ -517,6 +523,13 @@ void QtMainWindow::resetZoom()
|
||||
MessageResetZoom().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::resetWindowLayout()
|
||||
{
|
||||
FileSystem::remove(UserPaths::getWindowSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath() + "window_settings.ini", UserPaths::getWindowSettingsPath());
|
||||
loadDockWidgetLayout();
|
||||
}
|
||||
|
||||
void QtMainWindow::openRecentProject()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
@@ -659,6 +672,7 @@ void QtMainWindow::setupViewMenu()
|
||||
menu->addAction(tr("Larger font"), this, SLOT(zoomIn()), QKeySequence::ZoomIn);
|
||||
menu->addAction(tr("Smaller font"), this, SLOT(zoomOut()), QKeySequence::ZoomOut);
|
||||
menu->addAction(tr("Reset font size"), this, SLOT(resetZoom()), QKeySequence(Qt::CTRL + Qt::Key_0));
|
||||
menu->addAction(tr("Reset window layout"), this, SLOT(resetWindowLayout()));
|
||||
|
||||
m_viewMenu = menu;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
void loadLayout();
|
||||
void saveLayout();
|
||||
|
||||
void loadDockWidgetLayout();
|
||||
|
||||
void forceEnterLicense(bool expired);
|
||||
|
||||
protected:
|
||||
@@ -111,6 +113,8 @@ public slots:
|
||||
void zoomOut();
|
||||
void resetZoom();
|
||||
|
||||
void resetWindowLayout();
|
||||
|
||||
void openRecentProject();
|
||||
void updateRecentProjectMenu();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user