Merge pull request #2089 from akortunov/qthelp

Editor: Add basic info window
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit dc1c2358b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;

@ -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;

@ -5,6 +5,7 @@
#include <QCloseEvent>
#include <QMenuBar>
#include <QMessageBox>
#include <QMdiArea>
#include <QDockWidget>
#include <QApplication>
@ -25,6 +26,8 @@
#include "../tools/subviews.hpp"
#include <components/version/version.hpp>
#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(
"<p style=\"white-space: pre-wrap;\">"
"<b><h2>OpenMW Construction Set</h2></b>"
"%1\n\n"
"%2\n\n"
"%3\n\n"
"<table>"
"<tr><td>%4</td><td><a href=\"https://openmw.org\">https://openmw.org</a></td></tr>"
"<tr><td>%5</td><td><a href=\"https://forum.openmw.org\">https://forum.openmw.org</a></td></tr>"
"<tr><td>%6</td><td><a href=\"https://gitlab.com/OpenMW/openmw/issues\">https://gitlab.com/OpenMW/openmw/issues</a></td></tr>"
"<tr><td>%7</td><td><a href=\"https://webchat.freenode.net/?channels=openmw&uio=OT10cnVlde\">irc://irc.freenode.net/#openmw</a></td></tr>"
"</table>"
"</p>")
.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());

@ -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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

@ -68,6 +68,7 @@
<file>object.png</file>
<file>pathgrid.png</file>
<file>potion.png</file>
<file>qt.png</file>
<file>race.png</file>
<file>random-item.png</file>
<file>random.png</file>

Loading…
Cancel
Save