Skip to content

Commit c3582d0

Browse files
committed
Project compiles on Qt5!;
1 parent 81bc463 commit c3582d0

18 files changed

+117
-28
lines changed

src/RGApplicationName.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ifndef RGAPPLICATIONNAME_H
2+
#define RGAPPLICATIONNAME_H
3+
#include <QString>
4+
extern const QString applicationName;
5+
#endif // RGAPPLICATIONNAME_H

src/RGEditPath.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RGEditPath::RGEditPath(QGraphicsItem *parent) :
2929
{
3030
setPos(0,0);
3131
setCursor(Qt::CrossCursor);
32-
setAcceptsHoverEvents(true);
32+
setAcceptHoverEvents(true);
3333
setFlag(QGraphicsItem::ItemHasNoContents);
3434
}
3535

src/RGEditPath.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include <QGraphicsObject>
2525
#include <QtGui>
26+
#include <QGraphicsView>
27+
#include <QGraphicsSceneMouseEvent>
2628
#include "RGEditPathPoint.h"
2729

2830
class RGEditPath : public QGraphicsObject

src/RGEditPathPoint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <QGraphicsObject>
2525
#include <QPoint>
2626
#include <QtGui>
27+
#include <QGraphicsScene>
28+
#include <QGraphicsSceneMouseEvent>
2729

2830
class RGEditPathPoint : public QGraphicsObject
2931
{

src/RGEncVideo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323

2424
#include <QObject>
2525
#include <QProcess>
26-
#include <QMessageBox>
26+
#include <QtWidgets/QMessageBox>
2727
#include "ui_videosettings.h"
28+
#include <QFileDialog>
2829

2930
class RGEncVideo : public QWidget
3031
{

src/RGGoogleMap.cpp

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* Workaround with google api, dragging the map doesn't work,
2727
* emulating Chrome, fixes this.
2828
*/
29-
class myWebPage : public QWebPage
29+
class myWebPage : public QWebEnginePage
3030
{
3131
protected:
3232

@@ -49,8 +49,12 @@ RGGoogleMap::RGGoogleMap(QWidget *parent)
4949
ui.setupUi(this);
5050

5151
QFile file("google-maps-template.html");
52-
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
52+
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
53+
QFileInfo fileInfo(file.fileName());
54+
qDebug() << "I can't open google-maps-template.html !!!";
55+
qDebug() << "Path:" << fileInfo.absoluteFilePath();
5356
return;
57+
}
5458

5559
QTextStream in(&file);
5660
while (!in.atEnd()) {
@@ -59,26 +63,59 @@ RGGoogleMap::RGGoogleMap(QWidget *parent)
5963

6064
ui.progressBar->hide();
6165
ui.progressBar->setRange(0, 100);
62-
ui.spinBoxX->setValue(RGSettings::getGMXResolution());
63-
ui.spinBoxY->setValue(RGSettings::getGMYResolution());
66+
ui.spinBoxX->setValue(RGSettings::getGMXResolution());
67+
ui.spinBoxY->setValue(RGSettings::getGMYResolution());
6468

65-
ui.webView->setPage(new myWebPage());
69+
//ui.webView->setPage(new myWebPage());
6670

6771
//Init map resolution
6872
on_fixButton_clicked(true);
6973
}
70-
74+
RGGoogleMap::~RGGoogleMap()
75+
{
76+
qDebug() << "~RGGoogleMap() destroyed";
77+
if(ui.webView->page() != nullptr){
78+
qDebug() << "RGGoogleMap destorying webview->page";
79+
ui.webView->page()->~QWebEnginePage();
80+
}
81+
if(ui.webView != nullptr){
82+
qDebug() << "RGGoogleMap destorying webview";
83+
ui.webView->close();
84+
}
85+
}
7186
void RGGoogleMap::accept()
7287
{
7388
m_map = QPixmap(ui.webView->size());
7489
ui.webView->render(&m_map);
7590

76-
RGSettings::setGMXResolution(ui.spinBoxX->value());
77-
RGSettings::setGMYResolution(ui.spinBoxY->value());
91+
RGSettings::setGMXResolution(ui.spinBoxX->value());
92+
RGSettings::setGMYResolution(ui.spinBoxY->value());
93+
qDebug() << "Closing dialog by accepted";
94+
if(ui.webView->page() != nullptr){
95+
qDebug() << "RGGoogleMap destorying webview->page";
96+
ui.webView->page()->~QWebEnginePage();
97+
}
98+
if(ui.webView != nullptr){
99+
qDebug() << "RGGoogleMap destorying webview";
100+
ui.webView->close();
101+
}
102+
78103

79104
QDialog::accept();
80105
}
81-
106+
void RGGoogleMap::rejected()
107+
{
108+
qDebug() << "RGGoogleMap::rejected()";
109+
if(ui.webView->page() != nullptr){
110+
qDebug() << "RGGoogleMap destorying webview->page";
111+
ui.webView->page()->~QWebEnginePage();
112+
}
113+
if(ui.webView != nullptr){
114+
qDebug() << "RGGoogleMap destorying webview";
115+
ui.webView->close();
116+
}
117+
QDialog::reject();
118+
}
82119

83120
void RGGoogleMap::on_goButton_clicked(bool)
84121
{
@@ -88,13 +125,14 @@ void RGGoogleMap::on_goButton_clicked(bool)
88125
//https://www.google.nl/maps/@52.374716,4.898623,12z
89126

90127
QString manUrl = ui.lineEdit->text();
91-
QUrl url = manUrl;
128+
QUrl url = manUrl;
92129
QString latlon;
93130
QString zoom;
94131
if (url.hasFragment() || url.host().contains("google"))
95132
{
96-
latlon = url.queryItemValue ("ll");
97-
zoom = url.queryItemValue ("z");
133+
QUrlQuery query(url);
134+
latlon = query.queryItemValue ("ll");
135+
zoom = query.queryItemValue ("z");
98136
if (latlon.isEmpty() || zoom.isEmpty())
99137
{
100138
//Now try the new google maps URL format (the construction is not supported by QUrl, so parse the URL manually
@@ -122,7 +160,11 @@ void RGGoogleMap::on_goButton_clicked(bool)
122160
return;
123161
}
124162

125-
163+
if(ui.webView->page() != nullptr){
164+
qDebug() << "RGGoogleMap destorying webview->page";
165+
ui.webView->page()->~QWebEnginePage();
166+
ui.webView->setPage(new myWebPage());
167+
}
126168
ui.webView->setHtml(genHtml(latlon, zoom));
127169
ui.webView->reload();
128170
}
@@ -165,3 +207,4 @@ QString RGGoogleMap::genHtml(const QString &latlon, const QString &zoom) const
165207

166208
return html;
167209
}
210+

src/RGGoogleMap.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,23 @@
2222
#include <QString>
2323
#include <QPixmap>
2424

25+
#include <QWebEngineView>
26+
#include <QWebEnginePage>
27+
#include <QMessageBox>
28+
2529
class RGGoogleMap : public QDialog
2630
{
2731
Q_OBJECT
2832

2933
public:
3034
RGGoogleMap(QWidget *parent);
3135

32-
QPixmap getMap() const {return m_map;}
36+
QPixmap getMap() const {return m_map;}
37+
~RGGoogleMap();
3338

3439
public slots:
3540
void accept();
41+
void rejected();
3642

3743
private slots:
3844
void on_goButton_clicked(bool);
@@ -48,4 +54,17 @@ private slots:
4854
Ui_googleMap ui;
4955
QString m_html_template;
5056
QPixmap m_map;
57+
58+
//ToDo: Create function that destroys the webview page and the webview
59+
//void unload_qwebengine();
60+
//tries to delete the page on the ui.webengine and the ui.webengine itself
61+
//void unload_qwebengine()
62+
//{
63+
//if(ui.webView->page() != nullptr){
64+
// ui.webView->page()->~QWebEnginePage();
65+
//}
66+
//if(ui.webView != nullptr){
67+
// ui.webView->close();
68+
//}
69+
//}
5170
};

src/RGMainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,4 +444,4 @@ void RGMainWindow::initVideoEncoderFromSettings()
444444
{
445445
qDebug()<<"encoder found !";
446446
}
447-
}
447+
}

src/RGMainWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <QMainWindow>
2525
#include <QProcess>
2626
#include <QStringList>
27+
#include <QTextBrowser>
28+
#include <QFileDialog>
2729

2830
class QWidget;
2931
class QTimer;

src/RGVehicle.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ bool RGVehicle::getMirror()
136136
void RGVehicle::setMirror(bool mirror)
137137
{
138138
if(mMirror!=mirror)
139-
this->scale(-1,1);
139+
//this->scale(-1,1);
140+
this->setTransform(QTransform::fromScale(-1, 1), true);
140141
mMirror=mirror;
141142
}
142143

@@ -168,13 +169,15 @@ void RGVehicle::setRotation(qreal angle)
168169
if(angle<270 && angle>90){
169170
if(mRotMirror==false){
170171
mRotMirror=true;
171-
this->scale(-1,1);
172+
//this->scale(-1,1);
173+
this->setTransform(QTransform::fromScale(-1, 1), true);
172174
}
173175
angle=180-angle;
174176
}
175177
else if(mRotMirror==true){
176178
mRotMirror=false;
177-
this->scale(-1,1);
179+
//this->scale(-1,1);
180+
this->setTransform(QTransform::fromScale(-1, 1), true);
178181
}
179182
if(mMirror) angle=-angle;
180183
QGraphicsItem::setRotation(angle+mStartAngle);

0 commit comments

Comments
 (0)