+ make help system more flexible
This commit is contained in:
parent
6b98223c07
commit
7602b8f20c
|
@ -430,7 +430,7 @@ StdCmdOnlineHelp::StdCmdOnlineHelp()
|
|||
|
||||
void StdCmdOnlineHelp::activated(int iMsg)
|
||||
{
|
||||
Gui::getMainWindow()->showDocumentation();
|
||||
Gui::getMainWindow()->showDocumentation(QString());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -211,6 +211,16 @@ std::string Translator::activeLanguage() const
|
|||
return d->activatedLanguage;
|
||||
}
|
||||
|
||||
std::string Translator::locale(const std::string& lang) const
|
||||
{
|
||||
std::string loc;
|
||||
std::map<std::string, std::string>::const_iterator tld = d->mapLanguageTopLevelDomain.find(lang);
|
||||
if (tld != d->mapLanguageTopLevelDomain.end())
|
||||
loc = tld->second;
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
||||
QStringList Translator::directories() const
|
||||
{
|
||||
QStringList list;
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
void refresh();
|
||||
/** Returns the currently installed language. If no language is installed an empty string is returned. */
|
||||
std::string activeLanguage() const;
|
||||
/** Returns the locale (e.g. "de") to the given language name. */
|
||||
std::string locale(const std::string&) const;
|
||||
/** Returns a list of supported languages. */
|
||||
TStringList supportedLanguages() const;
|
||||
/** Returns a map of supported languages/locales. */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
# include <QMimeData>
|
||||
# include <QCloseEvent>
|
||||
# include <QContextMenuEvent>
|
||||
# include <QDesktopServices>
|
||||
# include <QDesktopWidget>
|
||||
# include <QDockWidget>
|
||||
# include <QFontMetrics>
|
||||
|
@ -548,12 +549,17 @@ void MainWindow::whatsThis()
|
|||
QWhatsThis::enterWhatsThisMode();
|
||||
}
|
||||
|
||||
void MainWindow::showDocumentation(const char* Article)
|
||||
void MainWindow::showDocumentation(const QString& help)
|
||||
{
|
||||
QString help;
|
||||
if (Article && Article[0] != '\0')
|
||||
help = QString::fromUtf8("%1.html").arg(QLatin1String(Article));
|
||||
d->assistant->showDocumentation(help);
|
||||
QUrl url(help);
|
||||
if (url.scheme().isEmpty()) {
|
||||
QString page;
|
||||
page = QString::fromUtf8("%1.html").arg(help);
|
||||
d->assistant->showDocumentation(page);
|
||||
}
|
||||
else {
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::event(QEvent *e)
|
||||
|
@ -576,7 +582,7 @@ bool MainWindow::event(QEvent *e)
|
|||
}
|
||||
else if (e->type() == QEvent::WhatsThisClicked) {
|
||||
QWhatsThisClickedEvent* wt = static_cast<QWhatsThisClickedEvent*>(e);
|
||||
showDocumentation((const char*)wt->href().toUtf8());
|
||||
showDocumentation(wt->href());
|
||||
}
|
||||
else if (e->type() == QEvent::ApplicationWindowIconChange) {
|
||||
// if application icon changes apply it to the main window and the "About..." dialog
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
/** Shows the Tip-of-the-day dialog after startup. */
|
||||
void showTipOfTheDay(bool force=false);
|
||||
/** Shows the online documentation. */
|
||||
void showDocumentation(const char* Article=0);
|
||||
void showDocumentation(const QString& help);
|
||||
//@}
|
||||
|
||||
/** @name Layout Methods
|
||||
|
|
Loading…
Reference in New Issue
Block a user