ui: reset window layout option in view menu

This commit is contained in:
malte_langkabel
2017-04-10 18:45:32 +02:00
parent 050e31c1fd
commit 23341d63d0
11 changed files with 40 additions and 25 deletions
+4
View File
@@ -635,6 +635,10 @@ if(UNIX AND NOT APPLE)
"-E" "create_symlink"
"${CMAKE_SOURCE_DIR}/bin/app/data"
"${CMAKE_BINARY_DIR}/app/data"
COMMAND "${CMAKE_COMMAND}"
"-E" "create_symlink"
"${CMAKE_SOURCE_DIR}/bin/app/user"
"${CMAKE_BINARY_DIR}/app/user"
)
# Linux package
include(cmake/LinuxPackage.cmake)
+4 -4
View File
@@ -1,8 +1,8 @@
[General]
DOCK_LOCATIONS=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\x2\0\0\a\x80\0\0\x3\xcd\xfc\x1\0\0\0\x2\xfc\0\0\0\0\0\0\x4\x90\0\0\0\0\0\xff\xff\xff\xfc\x2\0\0\0\x1\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0L\0o\0g\0\0\0\x2\xc6\0\0\0\xc1\0\0\0\0\0\0\0\0\xfc\0\0\0\0\0\0\a\x80\0\0\x1\xf5\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfc\0\0\0\x16\0\0\x2\xfe\0\0\0\xa5\0\xff\xff\xff\xfc\x1\0\0\0\x2\xfc\0\0\0\0\0\0\x3\xd6\0\0\x1\"\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfb\0\0\0\x14\0\x44\0o\0\x63\0k\0S\0\x65\0\x61\0r\0\x63\0h\x1\0\0\0\x16\0\0\0\x44\0\0\0\x44\0\xff\xff\xff\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0G\0r\0\x61\0p\0h\x1\0\0\0^\0\0\x2\xb6\0\0\0]\0\xff\xff\xff\xfb\0\0\0\x10\0\x44\0o\0\x63\0k\0\x43\0o\0\x64\0\x65\x1\0\0\x3\xda\0\0\x3\xa6\0\0\0P\0\xff\xff\xff\xfb\0\0\0\x14\0\x44\0o\0\x63\0k\0S\0t\0\x61\0t\0u\0s\x1\0\0\x3\x18\0\0\0\xcb\0\0\0\xcb\0\xff\xff\xff\0\0\a\x80\0\0\0\0\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)
DOCK_LOCATIONS=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\x2\0\0\x4\x83\0\0\x2\xb3\xfc\x1\0\0\0\x2\xfc\0\0\0\0\0\0\x4\x90\0\0\0\0\0\xff\xff\xff\xfc\x2\0\0\0\x1\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0L\0o\0g\0\0\0\x2\xc6\0\0\0\xc1\0\0\0\0\0\0\0\0\xfc\0\0\0\0\0\0\x4\x83\0\0\x2\x46\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfc\0\0\0\x16\0\0\x2\xb3\0\0\0\xa3\0\xff\xff\xff\xfc\x1\0\0\0\x2\xfc\0\0\0\0\0\0\x2P\0\0\x1\x65\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfb\0\0\0\x14\0\x44\0o\0\x63\0k\0S\0\x65\0\x61\0r\0\x63\0h\x1\0\0\0\x16\0\0\0M\0\0\0\x44\0\xff\xff\xff\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0G\0r\0\x61\0p\0h\x1\0\0\0g\0\0\x2\x62\0\0\0[\0\xff\xff\xff\xfb\0\0\0\x10\0\x44\0o\0\x63\0k\0\x43\0o\0\x64\0\x65\x1\0\0\x2T\0\0\x2/\0\0\0\xdd\0\xff\xff\xff\xfb\0\0\0\x14\0\x44\0o\0\x63\0k\0S\0t\0\x61\0t\0u\0s\0\0\0\x2I\0\0\0\xcb\0\0\0\xcb\0\xff\xff\xff\0\0\x4\x83\0\0\0\0\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)
[MainWindow]
maximized=true
size=@Size(1287 811)
position=@Point(259 117)
maximized=false
size=@Size(1200 800)
position=@Point(80 50)
showTitleBars=true
-12
View File
@@ -103,18 +103,6 @@ function(AddSharedToComponent componentName)
COMPONENT ${componentName}
)
INSTALL(FILES
${CMAKE_SOURCE_DIR}/bin/app/data/fallback/ApplicationSettings.xml
COMPONENT ${componentName}
DESTINATION Sourcetrail/user
)
INSTALL(FILES
${CMAKE_SOURCE_DIR}/bin/app/data/fallback/window_settings.ini
COMPONENT ${componentName}
DESTINATION Sourcetrail/user
)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/bin/app/user
DESTINATION Sourcetrail
COMPONENT ${componentName}
+1 -6
View File
@@ -82,14 +82,9 @@ cp -R ../../../bin/app/data/color_schemes $RES_DIR/data/color_schemes
cp -R ../../../bin/app/data/fonts $RES_DIR/data/fonts
cp -R ../../../bin/app/data/gui $RES_DIR/data/gui
cp -R ../../../bin/app/data/java $RES_DIR/data/java
cp -R ../../../bin/app/data/fallback $RES_DIR/data/fallback
cp -R ../../../bin/app/user/projects $RES_DIR/data/projects
mkdir -p $RES_DIR/user
mkdir -p $RES_DIR/user/log
cp ../../../bin/app/user/window_settings.ini $RES_DIR/user/window_settings.ini
cp ../../../bin/app/data/fallback/ApplicationSettings.xml $RES_DIR/user/ApplicationSettings.xml
cp -R ../../../bin/app/data/3rd_party_licenses $BIN_DIR/3rd_party_licenses
echo -e $INFO "Copying dynamic libraries."
+5
View File
@@ -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/";
+1
View File
@@ -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);
}
+2 -1
View File
@@ -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
+14
View File
@@ -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;
}
+4
View File
@@ -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();