diff options
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 8151e29..08f0435 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -53,6 +53,7 @@ #ifdef Q_OS_MAC #include "CocoaUtils.h" #endif +#include "PlatformUtils.h" #include <QMenu> #include <QTime> @@ -104,6 +105,8 @@ #define OPENCSG_VERSION_STRING "unknown, <1.3.2" #endif +#include "boosty.h" + extern QString examplesdir; // Global application state @@ -227,6 +230,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->fileActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(this->fileActionReload, SIGNAL(triggered()), this, SLOT(actionReload())); connect(this->fileActionQuit, SIGNAL(triggered()), this, SLOT(quit())); + connect(this->fileShowLibraryFolder, SIGNAL(triggered()), this, SLOT(actionShowLibraryFolder())); #ifndef __APPLE__ QList<QKeySequence> shortcuts = this->fileActionSave->shortcuts(); shortcuts.push_back(QKeySequence(Qt::Key_F2)); @@ -951,6 +955,20 @@ void MainWindow::actionSaveAs() } } +void MainWindow::actionShowLibraryFolder() +{ + std::string path = PlatformUtils::libraryPath(); + if (!fs::exists(path)) { + PRINTB("WARNING: Library path %s doesnt exist. Creating", path); + if (!PlatformUtils::createLibraryPath()) { + PRINTB("ERROR: Cannot create library path: %s",path); + } + } + QString url = QString::fromStdString( path ); + //PRINTB("Opening file browser for %s", url.toStdString() ); + QDesktopServices::openUrl(QUrl::fromLocalFile( url )); +} + void MainWindow::actionReload() { if (checkEditorModified()) refreshDocument(); |