diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 233b3e439..76511f535 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -364,6 +364,11 @@ int CSMDoc::Document::getState() const return state; } +const boost::filesystem::path& CSMDoc::Document::getResourceDir() const +{ + return mResDir; +} + const boost::filesystem::path& CSMDoc::Document::getSavePath() const { return mSavePath; diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 4c442428e..a2579af4c 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -115,6 +115,8 @@ namespace CSMDoc int getState() const; + const boost::filesystem::path& getResourceDir() const; + const boost::filesystem::path& getSavePath() const; const boost::filesystem::path& getProjectPath() const; diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index ed4dcff76..42dbe51ac 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,8 @@ #include "../tools/subviews.hpp" +#include + #include "viewmanager.hpp" #include "operations.hpp" #include "subview.hpp" @@ -303,6 +306,17 @@ void CSVDoc::View::setupDebugMenu() connect (runLog, SIGNAL (triggered()), this, SLOT (addRunLogSubView())); } +void CSVDoc::View::setupHelpMenu() +{ + QMenu *help = menuBar()->addMenu (tr ("Help")); + + QAction* about = createMenuEntry("About OpenMW-CS", ":./info.png", help, "document-help-about"); + connect (about, SIGNAL (triggered()), this, SLOT (infoAbout())); + + QAction* aboutQt = createMenuEntry("About Qt", ":./qt.png", help, "document-help-qt"); + connect (aboutQt, SIGNAL (triggered()), this, SLOT (infoAboutQt())); +} + QAction* CSVDoc::View::createMenuEntry(CSMWorld::UniversalId::Type type, QMenu* menu, const char* shortcutName) { const std::string title = CSMWorld::UniversalId (type).getTypeName(); @@ -339,6 +353,7 @@ void CSVDoc::View::setupUi() setupCharacterMenu(); setupAssetsMenu(); setupDebugMenu(); + setupHelpMenu(); } void CSVDoc::View::setupShortcut(const char* name, QAction* action) @@ -674,6 +689,52 @@ void CSVDoc::View::save() mDocument->save(); } +void CSVDoc::View::infoAbout() +{ + // Get current OpenMW version + QString versionInfo = (Version::getOpenmwVersionDescription(mDocument->getResourceDir().string())+ +#if defined(__x86_64__) || defined(_M_X64) + " (64-bit)").c_str(); +#else + " (32-bit)").c_str(); +#endif + + // Get current year + time_t now = time(NULL); + struct tm tstruct; + char copyrightInfo[40]; + tstruct = *localtime(&now); + strftime(copyrightInfo, sizeof(copyrightInfo), "Copyright © 2008-%Y OpenMW Team", &tstruct); + + QString aboutText = QString( + "

" + "

OpenMW Construction Set

" + "%1\n\n" + "%2\n\n" + "%3\n\n" + "" + "" + "" + "" + "" + "
%4https://openmw.org
%5https://forum.openmw.org
%6https://gitlab.com/OpenMW/openmw/issues
%7irc://irc.freenode.net/#openmw
" + "

") + .arg(versionInfo + , tr("OpenMW-CS is a content file editor for OpenMW, a modern, free and open source game engine.") + , tr(copyrightInfo) + , tr("Home Page:") + , tr("Forum:") + , tr("Bug Tracker:") + , tr("IRC:")); + + QMessageBox::about(this, "About OpenMW-CS", aboutText); +} + +void CSVDoc::View::infoAboutQt() +{ + QMessageBox::aboutQt(this); +} + void CSVDoc::View::verify() { addSubView (mDocument->verify()); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index 7a9a48b0f..c4046a7a1 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -85,6 +85,8 @@ namespace CSVDoc void setupDebugMenu(); + void setupHelpMenu(); + void setupUi(); void setupShortcut(const char* name, QAction* action); @@ -165,6 +167,10 @@ namespace CSVDoc void exit(); + void infoAbout(); + + void infoAboutQt(); + void verify(); void addGlobalsSubView(); diff --git a/files/opencs/qt.png b/files/opencs/qt.png new file mode 100644 index 000000000..381cb2251 Binary files /dev/null and b/files/opencs/qt.png differ diff --git a/files/opencs/resources.qrc b/files/opencs/resources.qrc index 5fd9860e1..6987544d7 100644 --- a/files/opencs/resources.qrc +++ b/files/opencs/resources.qrc @@ -68,6 +68,7 @@ object.png pathgrid.png potion.png + qt.png race.png random-item.png random.png