mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 16:13:28 +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();
|
||||
#endif
|
||||
|
||||
InfoView::showFirstTime();
|
||||
InfoView::showFirstTime(Menu::getInstance());
|
||||
}
|
||||
|
||||
void Application::paintGL() {
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
#define SETTINGS_VERSION_KEY "info-version"
|
||||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
||||
|
||||
InfoView::InfoView(bool forced) :
|
||||
InfoView::InfoView(bool forced, QWidget* parent) :
|
||||
QWebView(parent),
|
||||
_forced(forced) {
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
|
@ -28,12 +29,12 @@ InfoView::InfoView(bool forced) :
|
|||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
||||
}
|
||||
|
||||
void InfoView::showFirstTime() {
|
||||
new InfoView(false);
|
||||
void InfoView::showFirstTime(QWidget* parent) {
|
||||
new InfoView(false, parent);
|
||||
}
|
||||
|
||||
void InfoView::forcedShow() {
|
||||
new InfoView(true);
|
||||
void InfoView::forcedShow(QWidget* parent) {
|
||||
new InfoView(true, parent);
|
||||
}
|
||||
|
||||
bool InfoView::shouldShow() {
|
||||
|
@ -45,18 +46,15 @@ bool InfoView::shouldShow() {
|
|||
|
||||
QString lastVersion = settings->value(SETTINGS_VERSION_KEY).toString();
|
||||
|
||||
QWebFrame* mainFrame = page()->mainFrame();
|
||||
QWebElement versionTag = mainFrame->findFirstElement("#version");
|
||||
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
|
||||
QString version = versionTag.attribute("value");
|
||||
|
||||
if (lastVersion == QString::null || version == QString::null || lastVersion != version) {
|
||||
if (version != QString::null) {
|
||||
settings->setValue(SETTINGS_VERSION_KEY, version);
|
||||
}
|
||||
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
|
||||
settings->setValue(SETTINGS_VERSION_KEY, version);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void InfoView::loaded(bool ok) {
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
class InfoView : public QWebView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void showFirstTime();
|
||||
static void forcedShow();
|
||||
static void showFirstTime(QWidget* parent);
|
||||
static void forcedShow(QWidget* parent);
|
||||
|
||||
private:
|
||||
InfoView(bool forced);
|
||||
InfoView(bool forced, QWidget* parent);
|
||||
bool _forced;
|
||||
bool shouldShow();
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ bool Menu::isVoxelModeActionChecked() {
|
|||
}
|
||||
|
||||
void Menu::aboutApp() {
|
||||
InfoView::forcedShow();
|
||||
InfoView::forcedShow(this);
|
||||
}
|
||||
|
||||
void updateDSHostname(const QString& domainServerHostname) {
|
||||
|
|
Loading…
Reference in a new issue