forked from collin80/SavvyCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated help into the system. Most all the sub-screens that are ac…
…tually complete and working have integrated help now. Press F1 to bring up help for a given window.
- Loading branch information
Showing
39 changed files
with
528 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#include <QDebug> | ||
#include "helpwindow.h" | ||
#include "ui_helpwindow.h" | ||
|
||
HelpWindow* HelpWindow::self = 0; | ||
|
||
HelpWindow::HelpWindow(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::HelpWindow) | ||
{ | ||
ui->setupUi(this); | ||
|
||
m_helpEngine = new QHelpEngineCore("SavvyCAN.qhc", this); | ||
if (!m_helpEngine->setupData()) { | ||
delete m_helpEngine; | ||
m_helpEngine = 0; | ||
qDebug() << "Could not load help file!"; | ||
} | ||
|
||
readSettings(); | ||
} | ||
|
||
HelpWindow::~HelpWindow() | ||
{ | ||
writeSettings(); | ||
delete ui; | ||
} | ||
|
||
void HelpWindow::closeEvent(QCloseEvent *event) | ||
{ | ||
Q_UNUSED(event); | ||
writeSettings(); | ||
} | ||
|
||
void HelpWindow::readSettings() | ||
{ | ||
QSettings settings; | ||
if (settings.value("Main/SaveRestorePositions", false).toBool()) | ||
{ | ||
resize(settings.value("HelpViewer/WindowSize", QSize(600, 700)).toSize()); | ||
move(settings.value("HelpViewer/WindowPos", QPoint(50, 50)).toPoint()); | ||
} | ||
} | ||
|
||
void HelpWindow::writeSettings() | ||
{ | ||
QSettings settings; | ||
|
||
if (settings.value("Main/SaveRestorePositions", false).toBool()) | ||
{ | ||
settings.setValue("HelpViewer/WindowSize", size()); | ||
settings.setValue("HelpViewer/WindowPos", pos()); | ||
} | ||
} | ||
|
||
HelpWindow* HelpWindow::getRef() | ||
{ | ||
if (!self) | ||
{ | ||
self = new HelpWindow(); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
void HelpWindow::showHelp(QString help) | ||
{ | ||
if (m_helpEngine) { | ||
qDebug() << "Searching for " << help; | ||
QByteArray helpData = m_helpEngine->fileData(QUrl("qthelp://org.sphinx.savvycan.181/doc/" + help)); | ||
ui->textHelp->setText(helpData); | ||
} | ||
else | ||
{ | ||
qDebug() << "Help engine not loaded!"; | ||
} | ||
|
||
readSettings(); | ||
self->show(); | ||
} | ||
/* | ||
QVariant HelpBrowser::loadResource(int type, const QUrl &name) | ||
{ | ||
QByteArray ba; | ||
if (type < 4 && m_helpEngine) { | ||
QUrl url(name); | ||
if (name.isRelative()) | ||
url = source().resolved(url); | ||
ba = m_helpEngine->fileData(url); | ||
} | ||
return ba; | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef HELPWINDOW_H | ||
#define HELPWINDOW_H | ||
|
||
#include <QDialog> | ||
#include <QtHelp> | ||
|
||
namespace Ui { | ||
class HelpWindow; | ||
} | ||
|
||
class HelpWindow : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit HelpWindow(QWidget *parent = 0); | ||
~HelpWindow(); | ||
void showHelp(QString help); | ||
static HelpWindow *getRef(); | ||
|
||
private: | ||
void readSettings(); | ||
void writeSettings(); | ||
void closeEvent(QCloseEvent *event); | ||
|
||
Ui::HelpWindow *ui; | ||
static HelpWindow *self; | ||
QHelpEngineCore *m_helpEngine; | ||
}; | ||
|
||
#endif // HELPWINDOW_H |
Oops, something went wrong.