fixes for InfoView ownership and display

This commit is contained in:
Stephen Birarda 2013-09-18 16:42:51 -07:00
parent 5479c5b40f
commit bbbdc4f88c
4 changed files with 17 additions and 19 deletions

View file

@ -321,7 +321,7 @@ void Application::initializeGL() {
Menu::getInstance()->checkForUpdates();
#endif
InfoView::showFirstTime();
InfoView::showFirstTime(Menu::getInstance());
}
void Application::paintGL() {

View file

@ -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) {

View file

@ -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();

View file

@ -684,7 +684,7 @@ bool Menu::isVoxelModeActionChecked() {
}
void Menu::aboutApp() {
InfoView::forcedShow();
InfoView::forcedShow(this);
}
void updateDSHostname(const QString& domainServerHostname) {