mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 02:35:16 +02:00
Merge pull request #958 from birarda/master
fixes for InfoView ownership and display
This commit is contained in:
commit
f6754ea9c7
4 changed files with 17 additions and 19 deletions
|
@ -321,7 +321,7 @@ void Application::initializeGL() {
|
||||||
Menu::getInstance()->checkForUpdates();
|
Menu::getInstance()->checkForUpdates();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InfoView::showFirstTime();
|
InfoView::showFirstTime(Menu::getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::paintGL() {
|
void Application::paintGL() {
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
#define SETTINGS_VERSION_KEY "info-version"
|
#define SETTINGS_VERSION_KEY "info-version"
|
||||||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||||
|
|
||||||
InfoView::InfoView(bool forced) :
|
InfoView::InfoView(bool forced, QWidget* parent) :
|
||||||
|
QWebView(parent),
|
||||||
_forced(forced) {
|
_forced(forced) {
|
||||||
|
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
|
@ -28,12 +29,12 @@ InfoView::InfoView(bool forced) :
|
||||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::showFirstTime() {
|
void InfoView::showFirstTime(QWidget* parent) {
|
||||||
new InfoView(false);
|
new InfoView(false, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::forcedShow() {
|
void InfoView::forcedShow(QWidget* parent) {
|
||||||
new InfoView(true);
|
new InfoView(true, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InfoView::shouldShow() {
|
bool InfoView::shouldShow() {
|
||||||
|
@ -45,18 +46,15 @@ bool InfoView::shouldShow() {
|
||||||
|
|
||||||
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
||||||
|
|
||||||
QWebFrame* mainFrame = page()->mainFrame();
|
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
|
||||||
QWebElement versionTag = mainFrame->findFirstElement("#version");
|
|
||||||
QString version = versionTag.attribute("value");
|
QString version = versionTag.attribute("value");
|
||||||
|
|
||||||
if (lastVersion == QString::null || version == QString::null || lastVersion != version) {
|
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
|
||||||
if (version != QString::null) {
|
settings->setValue(SETTINGS_VERSION_KEY, version);
|
||||||
settings->setValue(SETTINGS_VERSION_KEY, version);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoView::loaded(bool ok) {
|
void InfoView::loaded(bool ok) {
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
class InfoView : public QWebView {
|
class InfoView : public QWebView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void showFirstTime();
|
static void showFirstTime(QWidget* parent);
|
||||||
static void forcedShow();
|
static void forcedShow(QWidget* parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InfoView(bool forced);
|
InfoView(bool forced, QWidget* parent);
|
||||||
bool _forced;
|
bool _forced;
|
||||||
bool shouldShow();
|
bool shouldShow();
|
||||||
|
|
||||||
|
|
|
@ -684,7 +684,7 @@ bool Menu::isVoxelModeActionChecked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::aboutApp() {
|
void Menu::aboutApp() {
|
||||||
InfoView::forcedShow();
|
InfoView::forcedShow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDSHostname(const QString& domainServerHostname) {
|
void updateDSHostname(const QString& domainServerHostname) {
|
||||||
|
|
Loading…
Reference in a new issue