Added meny entry for disclosing the library path. Part of #125

felipesanches-svg
Marius Kintel 2013-05-21 18:02:16 -04:00
parent e2772c70b8
commit 13e4bcd50e
7 changed files with 24 additions and 1 deletions

View File

@ -302,6 +302,7 @@ SOURCES += src/version_check.cc \
src/parsersettings.cc \
src/stl-utils.cc \
src/boost-utils.cc \
src/PlatformUtils.cc \
\
src/nodedumper.cc \
src/traverser.cc \
@ -385,7 +386,7 @@ macx {
src/CocoaUtils.h
SOURCES += src/AppleEvents.cc
OBJECTIVE_SOURCES += src/CocoaUtils.mm \
src/PlatformUtils.mm
src/PlatformUtils-mac.mm
}
unix:!macx {
SOURCES += src/PlatformUtils-posix.cc

View File

@ -101,6 +101,7 @@ private slots:
void actionSave();
void actionSaveAs();
void actionReload();
void actionShowLibraryFolder();
private slots:
void pasteViewportTranslation();

View File

@ -137,6 +137,7 @@
<addaction name="fileActionOpen"/>
<addaction name="menuOpenRecent"/>
<addaction name="menuExamples"/>
<addaction name="fileShowLibraryFolder"/>
<addaction name="separator"/>
<addaction name="fileActionClose"/>
<addaction name="fileActionSave"/>
@ -688,6 +689,11 @@
<string>Check for Update..</string>
</property>
</action>
<action name="fileShowLibraryFolder">
<property name="text">
<string>Show Library Folder...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

7
src/PlatformUtils.cc Normal file
View File

@ -0,0 +1,7 @@
#include "PlatformUtils.h"
#include "boosty.h"
std::string PlatformUtils::libraryPath()
{
return boosty::stringy(fs::path(PlatformUtils::documentsPath()) / "OpenSCAD" / "libraries");
}

View File

@ -6,6 +6,7 @@
namespace PlatformUtils {
std::string documentsPath();
std::string libraryPath();
}

View File

@ -53,6 +53,7 @@
#ifdef Q_OS_MAC
#include "CocoaUtils.h"
#endif
#include "PlatformUtils.h"
#include <QMenu>
#include <QTime>
@ -227,6 +228,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 +953,11 @@ void MainWindow::actionSaveAs()
}
}
void MainWindow::actionShowLibraryFolder()
{
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(PlatformUtils::libraryPath())));
}
void MainWindow::actionReload()
{
if (checkEditorModified()) refreshDocument();