mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
Add link to opencs documentation on readthedocs, available through
context menu. The documentation opens in default browser. There are 3 contexts: - global: opens the OpenMW CS User Manual main page - when a record is selected: opens the "Tables" page - when the filter field is selected: opens the "Record Filters" page There is also a link to the OpenCS tutorial in the help menu.
This commit is contained in:
parent
b42d097739
commit
513ac8986d
@ -63,6 +63,8 @@ set(OPENMW_VERSION_COMMITDATE "")
|
||||
|
||||
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
||||
set(OPENMW_DOC_BASEURL "https://openmw.readthedocs.io/en/master/")
|
||||
|
||||
set(GIT_CHECKOUT FALSE)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||
find_package(Git)
|
||||
@ -605,6 +607,7 @@ endif()
|
||||
|
||||
# Components
|
||||
add_subdirectory (components)
|
||||
target_compile_definitions(components PRIVATE OPENMW_DOC_BASEURL="${OPENMW_DOC_BASEURL}")
|
||||
|
||||
# Apps and tools
|
||||
if (BUILD_OPENMW)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "maindialog.hpp"
|
||||
|
||||
#include <components/version/version.hpp>
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
@ -54,12 +55,15 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
||||
iconWidget->setCurrentRow(0);
|
||||
iconWidget->setFlow(QListView::LeftToRight);
|
||||
|
||||
QPushButton *helpButton = new QPushButton(tr("Help"));
|
||||
QPushButton *playButton = new QPushButton(tr("Play"));
|
||||
buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close"));
|
||||
buttonBox->addButton(helpButton, QDialogButtonBox::HelpRole);
|
||||
buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
|
||||
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
||||
connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
|
||||
|
||||
// Remove what's this? button
|
||||
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
@ -614,3 +618,8 @@ void Launcher::MainDialog::play()
|
||||
if (mGameInvoker->startProcess(QLatin1String("openmw"), true))
|
||||
return qApp->quit();
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::help()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("reference/index.html");
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ namespace Launcher
|
||||
public slots:
|
||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void play();
|
||||
void help();
|
||||
|
||||
private slots:
|
||||
void wizardStarted();
|
||||
|
@ -271,6 +271,8 @@ void CSMPrefs::State::declare()
|
||||
declareShortcut ("document-file-newaddon", "New Addon", QKeySequence());
|
||||
declareShortcut ("document-file-open", "Open", QKeySequence(Qt::ControlModifier | Qt::Key_O));
|
||||
declareShortcut ("document-file-save", "Save", QKeySequence(Qt::ControlModifier | Qt::Key_S));
|
||||
declareShortcut ("document-help-help", "Help", QKeySequence(Qt::Key_F1));
|
||||
declareShortcut ("document-help-tutorial", "Tutorial", QKeySequence());
|
||||
declareShortcut ("document-file-verify", "Verify", QKeySequence());
|
||||
declareShortcut ("document-file-merge", "Merge", QKeySequence());
|
||||
declareShortcut ("document-file-errorlog", "Open Load Error Log", QKeySequence());
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "../tools/subviews.hpp"
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
#include <components/version/version.hpp>
|
||||
|
||||
#include "viewmanager.hpp"
|
||||
@ -315,6 +316,12 @@ void CSVDoc::View::setupHelpMenu()
|
||||
{
|
||||
QMenu *help = menuBar()->addMenu (tr ("Help"));
|
||||
|
||||
QAction* helpInfo = createMenuEntry("Help", ":/info.png", help, "document-help-help");
|
||||
connect (helpInfo, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
|
||||
QAction* tutorial = createMenuEntry("Tutorial", ":/info.png", help, "document-help-tutorial");
|
||||
connect (tutorial, SIGNAL (triggered()), this, SLOT (tutorial()));
|
||||
|
||||
QAction* about = createMenuEntry("About OpenMW-CS", ":./info.png", help, "document-help-about");
|
||||
connect (about, SIGNAL (triggered()), this, SLOT (infoAbout()));
|
||||
|
||||
@ -708,6 +715,16 @@ void CSVDoc::View::save()
|
||||
mDocument->save();
|
||||
}
|
||||
|
||||
void CSVDoc::View::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/index.html");
|
||||
}
|
||||
|
||||
void CSVDoc::View::tutorial()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/tour.html");
|
||||
}
|
||||
|
||||
void CSVDoc::View::infoAbout()
|
||||
{
|
||||
// Get current OpenMW version
|
||||
|
@ -169,6 +169,10 @@ namespace CSVDoc
|
||||
|
||||
void exit();
|
||||
|
||||
static void openHelp();
|
||||
|
||||
static void tutorial();
|
||||
|
||||
void infoAbout();
|
||||
|
||||
void infoAboutQt();
|
||||
|
@ -1,12 +1,18 @@
|
||||
#include "editwidget.hpp"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAction>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QString>
|
||||
#include <QApplication>
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
#include "../../model/world/idtablebase.hpp"
|
||||
#include "../../model/world/columns.hpp"
|
||||
#include "../../model/prefs/shortcut.hpp"
|
||||
|
||||
CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent)
|
||||
: QLineEdit (parent), mParser (data), mIsEmpty(true)
|
||||
@ -29,6 +35,13 @@ CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent)
|
||||
|
||||
mStateColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Modification);
|
||||
mDescColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Description);
|
||||
|
||||
mHelpAction = new QAction (tr ("Help"), this);
|
||||
connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
mHelpAction->setIcon(QIcon(":/info.png"));
|
||||
addAction (mHelpAction);
|
||||
auto* openHelpShortcut = new CSMPrefs::Shortcut("help", this);
|
||||
openHelpShortcut->associateAction(mHelpAction);
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::textChanged (const QString& text)
|
||||
@ -211,3 +224,17 @@ std::string CSVFilter::EditWidget::generateFilter (std::pair< std::string, std::
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu *menu = createStandardContextMenu();
|
||||
menu->addAction(mHelpAction);
|
||||
menu->exec(event->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
|
||||
void CSVFilter::EditWidget::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/record-filters.html");
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ namespace CSVFilter
|
||||
bool mIsEmpty;
|
||||
int mStateColumnIndex;
|
||||
int mDescColumnIndex;
|
||||
QAction *mHelpAction;
|
||||
|
||||
public:
|
||||
|
||||
@ -40,6 +41,7 @@ namespace CSVFilter
|
||||
|
||||
private:
|
||||
std::string generateFilter(std::pair<std::string, std::vector<std::string> >& seekedString) const;
|
||||
void contextMenuEvent (QContextMenuEvent *event) override;
|
||||
|
||||
private slots:
|
||||
|
||||
@ -51,6 +53,8 @@ namespace CSVFilter
|
||||
|
||||
void filterRowsInserted (const QModelIndex& parent, int start, int end);
|
||||
|
||||
static void openHelp();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QString>
|
||||
#include <QtCore/qnamespace.h>
|
||||
|
||||
#include <components/misc/helpviewer.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
@ -155,6 +156,9 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if (mHelpAction)
|
||||
menu.addAction (mHelpAction);
|
||||
|
||||
menu.exec (event->globalPos());
|
||||
}
|
||||
|
||||
@ -387,6 +391,13 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||
connect (mEditIdAction, SIGNAL (triggered()), this, SLOT (editCell()));
|
||||
addAction (mEditIdAction);
|
||||
|
||||
mHelpAction = new QAction (tr ("Help"), this);
|
||||
connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp()));
|
||||
mHelpAction->setIcon(QIcon(":/info.png"));
|
||||
addAction (mHelpAction);
|
||||
CSMPrefs::Shortcut* openHelpShortcut = new CSMPrefs::Shortcut("help", this);
|
||||
openHelpShortcut->associateAction(mHelpAction);
|
||||
|
||||
connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
||||
this, SLOT (tableSizeUpdate()));
|
||||
|
||||
@ -561,6 +572,11 @@ void CSVWorld::Table::editCell()
|
||||
emit editRequest(mEditIdAction->getCurrentId(), "");
|
||||
}
|
||||
|
||||
void CSVWorld::Table::openHelp()
|
||||
{
|
||||
Misc::HelpViewer::openHelp("manuals/openmw-cs/tables.html");
|
||||
}
|
||||
|
||||
void CSVWorld::Table::viewRecord()
|
||||
{
|
||||
if (!(mModel->getFeatures() & CSMWorld::IdTableBase::Feature_View))
|
||||
|
@ -65,6 +65,7 @@ namespace CSVWorld
|
||||
QAction *mPreviewAction;
|
||||
QAction *mExtendedDeleteAction;
|
||||
QAction *mExtendedRevertAction;
|
||||
QAction *mHelpAction;
|
||||
TableEditIdAction *mEditIdAction;
|
||||
CSMWorld::IdTableProxyModel *mProxyModel;
|
||||
CSMWorld::IdTableBase *mModel;
|
||||
@ -128,6 +129,8 @@ namespace CSVWorld
|
||||
|
||||
void editCell();
|
||||
|
||||
static void openHelp();
|
||||
|
||||
void editRecord();
|
||||
|
||||
void cloneRecord();
|
||||
|
@ -86,7 +86,7 @@ add_component_dir (esmterrain
|
||||
)
|
||||
|
||||
add_component_dir (misc
|
||||
gcd constants utf8stream stringops resourcehelpers rng messageformatparser weakcache
|
||||
gcd constants utf8stream stringops resourcehelpers rng messageformatparser weakcache helpviewer
|
||||
)
|
||||
|
||||
add_component_dir (debug
|
||||
|
12
components/misc/helpviewer.cpp
Normal file
12
components/misc/helpviewer.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "helpviewer.hpp"
|
||||
|
||||
#include <QString>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
void Misc::HelpViewer::openHelp(const char* url)
|
||||
{
|
||||
QString link {OPENMW_DOC_BASEURL};
|
||||
link.append(url);
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
7
components/misc/helpviewer.hpp
Normal file
7
components/misc/helpviewer.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace Misc {
|
||||
namespace HelpViewer {
|
||||
void openHelp(const char* url);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user