mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
Using Qt Designer .ui file instead of manually coding dialog
This commit is contained in:
parent
4a4b483532
commit
f9bb98680d
5 changed files with 210 additions and 51 deletions
|
@ -60,6 +60,7 @@ find_package(Qt5Svg REQUIRED)
|
||||||
find_package(Qt5WebKit REQUIRED)
|
find_package(Qt5WebKit REQUIRED)
|
||||||
find_package(Qt5WebKitWidgets REQUIRED)
|
find_package(Qt5WebKitWidgets REQUIRED)
|
||||||
find_package(Qt5Xml REQUIRED)
|
find_package(Qt5Xml REQUIRED)
|
||||||
|
find_package(Qt5UiTools REQUIRED)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
||||||
|
@ -135,7 +136,7 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
||||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml)
|
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml UiTools)
|
||||||
|
|
||||||
# include headers for interface and InterfaceConfig.
|
# include headers for interface and InterfaceConfig.
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
182
interface/resources/ui/updateDialog.ui
Normal file
182
interface/resources/ui/updateDialog.ui
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::NonModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>750</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Update Required</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>751</width>
|
||||||
|
<height>71</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(236, 236, 236);</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="updateDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>240</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>271</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>36</pointsize>
|
||||||
|
<stylestrategy>PreferAntialias</stylestrategy>
|
||||||
|
<kerning>false</kerning>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(51, 51, 51);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Update Required</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="updateContent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>100</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>561</width>
|
||||||
|
<height>61</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>You are currently running build 312, the latest build available is 375. Please download and install the most recent release to access the latest features and bug fixes.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>360</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>364</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="downloadButton">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"> background-color: #333333;
|
||||||
|
border-width: 0;
|
||||||
|
border-radius: 9px;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 100;
|
||||||
|
color: #b7b7b7;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Download</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="skipButton">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"> background-color: #333333;
|
||||||
|
border-width: 0;
|
||||||
|
border-radius: 9px;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 100;
|
||||||
|
color: #b7b7b7;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Skip Version</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closeButton">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"> background-color: #333333;
|
||||||
|
border-width: 0;
|
||||||
|
border-radius: 9px;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 100;
|
||||||
|
color: #b7b7b7;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -89,7 +89,7 @@ const float MIRROR_FULLSCREEN_DISTANCE = 0.35f;
|
||||||
const float MIRROR_REARVIEW_DISTANCE = 0.65f;
|
const float MIRROR_REARVIEW_DISTANCE = 0.65f;
|
||||||
const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
|
const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
|
||||||
|
|
||||||
const QString CHECK_VERSION_URL = "http://www.google.com";
|
const QString CHECK_VERSION_URL = "http://highfidelity.io/latestVersion.xml";
|
||||||
|
|
||||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
||||||
fprintf(stdout, "%s", message.toLocal8Bit().constData());
|
fprintf(stdout, "%s", message.toLocal8Bit().constData());
|
||||||
|
@ -4602,7 +4602,7 @@ void Application::updateLocalOctreeCache(bool firstTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::checkVersion() {
|
void Application::checkVersion() {
|
||||||
QUrl url("https://a-tower.below92.com/version.xml");
|
QUrl url(CHECK_VERSION_URL);
|
||||||
QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
|
QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
connect(downloadXML, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseVersionXml(QNetworkReply*)));
|
connect(downloadXML, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseVersionXml(QNetworkReply*)));
|
||||||
|
@ -4631,14 +4631,15 @@ void Application::parseVersionXml(QNetworkReply *reply) {
|
||||||
xml.readNext();
|
xml.readNext();
|
||||||
_latestVersion = new QString(xml.text().toString());
|
_latestVersion = new QString(xml.text().toString());
|
||||||
}
|
}
|
||||||
|
if (xml.name() == _operatingSystem) {
|
||||||
|
xml.readNext();
|
||||||
|
_downloadURL = new QUrl(xml.text().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_downloadURL = new QUrl(CHECK_VERSION_URL);
|
|
||||||
|
|
||||||
if (!shouldSkipVersion() && applicationVersion() != _latestVersion) {
|
if (!shouldSkipVersion() && applicationVersion() != _latestVersion) {
|
||||||
UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes);
|
UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes);
|
||||||
_updateDialog->exec();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4655,7 +4656,7 @@ bool Application::shouldSkipVersion() {
|
||||||
QByteArray skipFileContents = skipFile->readAll();
|
QByteArray skipFileContents = skipFile->readAll();
|
||||||
QString *skipVersion = new QString(skipFileContents);
|
QString *skipVersion = new QString(skipFileContents);
|
||||||
skipFile->close();
|
skipFile->close();
|
||||||
if (*skipVersion == *_latestVersion ) {
|
if (*skipVersion == *_latestVersion /*|| applicationVersion() == "0.1"*/) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
#include <QtUiTools>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
@ -26,44 +27,26 @@ const QString dialogTitle = "Update Required";
|
||||||
|
|
||||||
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes) : QDialog(parent, Qt::Dialog) {
|
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes) : QDialog(parent, Qt::Dialog) {
|
||||||
|
|
||||||
|
QUiLoader updateDialogLoader;
|
||||||
|
|
||||||
|
QFile updateDialogUi("resources/ui/updateDialog.ui");
|
||||||
|
updateDialogUi.open(QFile::ReadOnly);
|
||||||
|
QWidget *updateDialog = updateDialogLoader.load(&updateDialogUi, this);
|
||||||
|
updateDialogUi.close();
|
||||||
|
|
||||||
|
updateDialog->show();
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
|
||||||
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2.\n \
|
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2. Please download and install the most recent release to access the latest features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion);
|
||||||
Please download and install the most recent release to access the latest \
|
|
||||||
features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion);
|
|
||||||
|
|
||||||
int leftPosition = leftStartingPosition;
|
|
||||||
setWindowTitle(dialogTitle);
|
|
||||||
//setWindowFlags(Qt::WindowTitleHint);
|
|
||||||
setModal(true);
|
|
||||||
resize(dialogWidth, dialogHeigth);
|
|
||||||
QFile styleSheet("resources/styles/update_dialog.qss");
|
|
||||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
|
||||||
setStyleSheet(styleSheet.readAll());
|
|
||||||
}
|
|
||||||
_releaseNotes = new QLabel(this);
|
|
||||||
_releaseNotes->setText(releaseNotes);
|
|
||||||
_releaseNotes->setObjectName("releaseNotes");
|
|
||||||
|
|
||||||
_updateRequired = new QLabel(this);
|
QPushButton *_downloadButton = updateDialog->findChild<QPushButton*>("downloadButton");
|
||||||
_updateRequired->setText(updateRequired);
|
QPushButton *_skipButton = updateDialog->findChild<QPushButton*>("skipButton");
|
||||||
_updateRequired->setObjectName("updateRequired");
|
QPushButton *_closeButton = updateDialog->findChild<QPushButton*>("closeButton");
|
||||||
|
QLabel *_updateContent = updateDialog->findChild<QLabel*>("updateContent");
|
||||||
|
|
||||||
_downloadButton = new QPushButton("Download", this);
|
_updateContent->setText(updateRequired);
|
||||||
_downloadButton->setObjectName("downloadButton");
|
|
||||||
_downloadButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
|
||||||
leftPosition += buttonWidth;
|
|
||||||
|
|
||||||
_skipButton = new QPushButton("Skip Version", this);
|
|
||||||
_skipButton->setObjectName("skipButton");
|
|
||||||
_skipButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
|
||||||
leftPosition += buttonWidth;
|
|
||||||
|
|
||||||
_closeButton = new QPushButton("Close", this);
|
|
||||||
_closeButton->setObjectName("closeButton");
|
|
||||||
_closeButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
|
||||||
|
|
||||||
_titleBackground = new QFrame();
|
|
||||||
|
|
||||||
connect(_downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
connect(_downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
||||||
connect(_skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
connect(_skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
||||||
|
@ -79,9 +62,10 @@ void UpdateDialog::handleDownload() {
|
||||||
void UpdateDialog::handleSkip() {
|
void UpdateDialog::handleSkip() {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
application->skipVersion();
|
application->skipVersion();
|
||||||
close();
|
this->QDialog::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleClose() {
|
void UpdateDialog::handleClose() {
|
||||||
close();
|
qDebug("###### HANDLECLOSE\n");
|
||||||
|
this->QDialog::close();
|
||||||
}
|
}
|
|
@ -22,15 +22,6 @@ class UpdateDialog : public QDialog {
|
||||||
public:
|
public:
|
||||||
UpdateDialog(QWidget*, QString releaseNotes);
|
UpdateDialog(QWidget*, QString releaseNotes);
|
||||||
|
|
||||||
private:
|
|
||||||
QLabel *_updateRequired;
|
|
||||||
QLabel *_releaseNotes;
|
|
||||||
QPushButton *_downloadButton;
|
|
||||||
QPushButton *_skipButton;
|
|
||||||
QPushButton *_closeButton;
|
|
||||||
QFrame *_titleBackground;
|
|
||||||
QUrl *_downloadURL;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleDownload();
|
void handleDownload();
|
||||||
void handleSkip();
|
void handleSkip();
|
||||||
|
|
Loading…
Reference in a new issue