Skip to content

Commit 6ae5fe9

Browse files
committed
Merge branch 'v1.2'
2 parents 4109213 + ae76ce0 commit 6ae5fe9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1141
-207
lines changed

YATE.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CONFIG += c++11 DISCORD_ENABLED
77
# You can make your code fail to compile if it uses deprecated APIs.
88
# In order to do so, uncomment the following line.
99
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
VERSION = 1.0.10.0
10+
VERSION = 1.2.0.0
1111
SOURCES += \
1212
analysisviewitem.cpp \
1313
analysisviewmodel.cpp \
@@ -24,6 +24,7 @@ SOURCES += \
2424
main.cpp \
2525
miniz.cpp \
2626
settingsdialog.cpp \
27+
timelineimagegenerator.cpp \
2728
updater.cpp \
2829
yatewindow.cpp \
2930
zipmanager.cpp
@@ -60,6 +61,7 @@ HEADERS += \
6061
logevent.h \
6162
miniz.h \
6263
settingsdialog.h \
64+
timelineimagegenerator.h \
6365
updater.h \
6466
yatewindow.h \
6567
zipmanager.h

analysiswindow.cpp

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "ui_analysiswindow.h"
33
#include "analysisviewmodel.h"
44
#include "huntimagegenerator.h"
5+
#include "timelineimagegenerator.h"
56
#include "huntinfo.h"
67
#include <QFileDialog>
78
#include <QDesktopServices>
@@ -13,14 +14,15 @@
1314
#include <QImage>
1415
#include <QMimeData>
1516

17+
1618
namespace Yate {
1719
AnalysisWindow::AnalysisWindow(QWidget *parent) :
1820
QMainWindow(parent), ui(new Ui::AnalysisWindow),
1921
model_(nullptr), hunt_(nullptr), selectedNight_(-1)
2022
{
2123
qDebug() << "Initializing analysis window.";
22-
isGenerating_.storeRelaxed(0);
2324
ui->setupUi(this);
25+
isGenerating_.storeRelaxed(0);
2426
unhighlightNight();
2527
qDebug() << "Initialized analysis window.";
2628
}
@@ -129,10 +131,14 @@ void AnalysisWindow::highlightNight(int night)
129131
if (isGenerating_.loadRelaxed() != 1) {
130132
ui->btnExport->setEnabled(true);
131133
ui->btnCopyImg->setEnabled(true);
134+
ui->btnExportTimeline->setEnabled(true);
135+
ui->btnCopyTimeline->setEnabled(true);
132136
}
133137

134138
ui->btnExport->setToolTip("");
135139
ui->btnCopyImg->setToolTip("");
140+
ui->btnExportTimeline->setToolTip("");
141+
ui->btnCopyTimeline->setToolTip("");
136142
}
137143

138144
void AnalysisWindow::unhighlightNight()
@@ -142,6 +148,10 @@ void AnalysisWindow::unhighlightNight()
142148
ui->btnExport->setToolTip("Select a night analysis to export.");
143149
ui->btnCopyImg->setEnabled(false);
144150
ui->btnCopyImg->setToolTip("Select a night analysis to copy.");
151+
ui->btnExportTimeline->setEnabled(false);
152+
ui->btnExportTimeline->setToolTip("Select a night analysis to generate timeline.");
153+
ui->btnCopyTimeline->setEnabled(false);
154+
ui->btnCopyTimeline->setToolTip("Select a night analysis to generate timeline.");
145155

146156
}
147157

@@ -185,6 +195,8 @@ void AnalysisWindow::on_btnExport_clicked()
185195
savePath_ = savePath;
186196
ui->btnExport->setEnabled(false);
187197
ui->btnCopyImg->setEnabled(false);
198+
ui->btnExportTimeline->setEnabled(false);
199+
ui->btnCopyTimeline->setEnabled(false);
188200
isGenerating_.storeRelaxed(1);
189201
HuntImageGenerator *gen = new HuntImageGenerator(savePath, night, night.host(), night.squad());
190202
QThread *genThread = new QThread;
@@ -235,6 +247,9 @@ void AnalysisWindow::on_btnCopyImg_clicked()
235247
QSettings settings;
236248
NightInfo &night = hunt_->night(selectedNight_);
237249
ui->btnExport->setEnabled(false);
250+
ui->btnCopyImg->setEnabled(false);
251+
ui->btnExportTimeline->setEnabled(false);
252+
ui->btnCopyTimeline->setEnabled(false);
238253
isGenerating_.storeRelaxed(1);
239254
HuntImageGenerator *gen = new HuntImageGenerator("", night, night.host(), night.squad());
240255
QThread *genThread = new QThread;
@@ -246,4 +261,90 @@ void AnalysisWindow::on_btnCopyImg_clicked()
246261
genThread->start();
247262
}
248263

264+
265+
266+
267+
268+
void AnalysisWindow::on_btnExportTimeline_clicked()
269+
{
270+
if (selectedNight_ == -1 || (selectedNight_ >= hunt_->nightCount())) {
271+
unhighlightNight();
272+
return;
273+
}
274+
qDebug() << "Exporting timeline image.";
275+
QSettings settings;
276+
NightInfo &night = hunt_->night(selectedNight_);
277+
QString defaultSavePath = "";
278+
if (!settings.value(SETTINGS_KEY_LAST_SAVE_DIR).isNull()) {
279+
defaultSavePath = settings.value(SETTINGS_KEY_LAST_SAVE_DIR).toString();
280+
if (!QFileInfo(defaultSavePath).exists() || !QFileInfo(defaultSavePath).isDir()) {
281+
defaultSavePath = "";
282+
settings.remove(SETTINGS_KEY_LAST_SAVE_DIR);
283+
}
284+
}
285+
QString saveFileDir;
286+
if(defaultSavePath.size()) {
287+
saveFileDir = defaultSavePath + QDir::separator() + "Timeline_" + QDateTime::currentDateTime().toString("MM_dd_yy_hh") + ".png";
288+
} else {
289+
saveFileDir = "Hunt_" + QDateTime::currentDateTime().toString("MM_dd_yy_hh") + ".png";
290+
}
291+
QString savePath = QFileDialog::getSaveFileName(this, "Export Hunt Summary", saveFileDir, ".png (PNG)");
292+
if (!savePath.size()) {
293+
return;
294+
}
295+
296+
if (!savePath.endsWith(".png")) {
297+
if (!savePath.endsWith(".")) {
298+
savePath = savePath + ".";
299+
}
300+
savePath = savePath + "png";
301+
}
302+
QString parentSavePath = QFileInfo(savePath).absoluteDir().absolutePath();
303+
settings.setValue(SETTINGS_KEY_LAST_SAVE_DIR, parentSavePath);
304+
savePath_ = savePath;
305+
ui->btnExport->setEnabled(false);
306+
ui->btnCopyImg->setEnabled(false);
307+
ui->btnExportTimeline->setEnabled(false);
308+
ui->btnCopyTimeline->setEnabled(false);
309+
isGenerating_.storeRelaxed(1);
310+
TimelineImageGenerator *gen = new TimelineImageGenerator(savePath, night, night.host(), night.squad());
311+
QThread *genThread = new QThread;
312+
gen->moveToThread(genThread);
313+
connect(genThread, &QThread::finished, genThread, &QThread::deleteLater);
314+
connect(genThread, &QThread::finished, gen, &QThread::deleteLater);
315+
connect(genThread, &QThread::started, gen, &TimelineImageGenerator::exportImage);
316+
connect(gen, &TimelineImageGenerator::exportFinished, this, &AnalysisWindow::exportFinished);
317+
genThread->start();
318+
}
319+
320+
321+
void AnalysisWindow::on_btnCopyTimeline_clicked()
322+
{
323+
if (selectedNight_ == -1 || (selectedNight_ >= hunt_->nightCount())) {
324+
unhighlightNight();
325+
return;
326+
}
327+
qDebug() << "Generating timeline image.";
328+
329+
QSettings settings;
330+
NightInfo &night = hunt_->night(selectedNight_);
331+
ui->btnExport->setEnabled(false);
332+
ui->btnCopyImg->setEnabled(false);
333+
ui->btnExportTimeline->setEnabled(false);
334+
ui->btnCopyTimeline->setEnabled(false);
335+
isGenerating_.storeRelaxed(1);
336+
TimelineImageGenerator *gen = new TimelineImageGenerator("", night, night.host(), night.squad());
337+
QThread *genThread = new QThread;
338+
gen->moveToThread(genThread);
339+
connect(genThread, &QThread::finished, genThread, &QThread::deleteLater);
340+
connect(genThread, &QThread::finished, gen, &QThread::deleteLater);
341+
connect(genThread, &QThread::started, gen, &TimelineImageGenerator::generateAndEmit);
342+
connect(gen, &TimelineImageGenerator::generateFinished, this, &AnalysisWindow::generateFinished);
343+
genThread->start();
344+
}
345+
346+
347+
348+
349+
249350
}

analysiswindow.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <QImage>
66
#include <QAtomicInt>
77

8+
89
namespace Ui {
910
class AnalysisWindow;
1011
}
@@ -34,6 +35,10 @@ private slots:
3435
void exportFinished(bool);
3536
void generateFinished(QImage);
3637

38+
void on_btnExportTimeline_clicked();
39+
40+
void on_btnCopyTimeline_clicked();
41+
3742
void on_btnCopyImg_clicked();
3843

3944
private:

analysiswindow.ui

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,31 @@
2121
<item>
2222
<layout class="QHBoxLayout" name="horizontalLayout">
2323
<item>
24-
<widget class="QWidget" name="widget" native="true">
25-
<property name="sizePolicy">
26-
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
27-
<horstretch>1</horstretch>
28-
<verstretch>0</verstretch>
29-
</sizepolicy>
24+
<widget class="QPushButton" name="btnCopyTimeline">
25+
<property name="enabled">
26+
<bool>false</bool>
27+
</property>
28+
<property name="text">
29+
<string>Copy Timeline Image</string>
30+
</property>
31+
<property name="icon">
32+
<iconset resource="assets/breeze.qrc">
33+
<normaloff>:/tl.svg</normaloff>:/tl.svg</iconset>
34+
</property>
35+
</widget>
36+
</item>
37+
<item>
38+
<widget class="QPushButton" name="btnExportTimeline">
39+
<property name="enabled">
40+
<bool>false</bool>
41+
</property>
42+
<property name="text">
43+
<string>Export Timeline Image</string>
44+
</property>
45+
<property name="icon">
46+
<iconset resource="assets/breeze.qrc">
47+
<normaloff>:/tl.svg</normaloff>:/tl.svg</iconset>
3048
</property>
31-
<layout class="QHBoxLayout" name="horizontalLayout_2">
32-
<item>
33-
<widget class="QWidget" name="widget_2" native="true"/>
34-
</item>
35-
</layout>
3649
</widget>
3750
</item>
3851
<item>
@@ -41,7 +54,7 @@
4154
<bool>false</bool>
4255
</property>
4356
<property name="text">
44-
<string>Copy Image</string>
57+
<string>Copy Summary Image</string>
4558
</property>
4659
<property name="icon">
4760
<iconset resource="assets/breeze.qrc">
@@ -55,7 +68,7 @@
5568
<bool>false</bool>
5669
</property>
5770
<property name="text">
58-
<string>Export Image</string>
71+
<string>Export Summary Image</string>
5972
</property>
6073
<property name="icon">
6174
<iconset resource="assets/breeze.qrc">

assets/MaterialDark.qss

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,67 @@ QPushButton:disabled{
6161
color: rgb(150, 150, 150);
6262
background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255));
6363
}
64-
QCheckBox:disabled{
64+
QCheckBox:disabled, QRadioButton:disabled{
6565
color: rgb(150, 150, 150);
6666
}
67+
68+
69+
QRadioButton
70+
{
71+
spacing: 0.5ex;
72+
outline: none;
73+
color: #eff0f1;
74+
margin-bottom: 0.2ex;
75+
}
76+
77+
QRadioButton:disabled
78+
{
79+
color: #76797c;
80+
}
81+
82+
QRadioButton::indicator:unchecked,
83+
QRadioButton::indicator:unchecked:focus
84+
{
85+
border-image: url(:/dark/radio_unchecked_disabled.svg);
86+
}
87+
88+
89+
QRadioButton::indicator:unchecked:hover,
90+
QRadioButton::indicator:unchecked:pressed
91+
{
92+
border: none;
93+
outline: none;
94+
border-image: url(:/dark/radio_unchecked.svg);
95+
}
96+
97+
98+
QRadioButton::indicator:checked
99+
{
100+
border: none;
101+
outline: none;
102+
border-image: url(:/dark/radio_checked.svg);
103+
}
104+
105+
QRadioButton::indicator:checked:hover,
106+
QRadioButton::indicator:checked:focus,
107+
QRadioButton::indicator:checked:pressed
108+
{
109+
border: none;
110+
outline: none;
111+
border-image: url(:/dark/radio_checked.svg);
112+
}
113+
114+
QRadioButton::indicator:checked:disabled
115+
{
116+
outline: none;
117+
border-image: url(:/dark/radio_checked_disabled.svg);
118+
}
119+
120+
QRadioButton::indicator:unchecked:disabled
121+
{
122+
border-image: url(:/dark/radio_unchecked_disabled.svg);
123+
}
124+
67125
QLineEdit {
68126
border-width: 1px; border-radius: 4px;
69127
border-color: rgb(58, 58, 58);
@@ -199,6 +257,7 @@ QCheckBox {
199257
padding: 2px;
200258
}
201259

260+
202261
QStatusBar {
203262
color:rgb(240,240,240);
204263
}

assets/breeze.qrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,23 @@
9090
<file>MaterialDark.qss</file>
9191
<file>png.svg</file>
9292
<file>RobotoMonoV.ttf</file>
93+
<file>tl.svg</file>
94+
<file>timeline/DayBegin.png</file>
95+
<file>timeline/EidolonCapture.png</file>
96+
<file>timeline/EidolonDespawn.png</file>
97+
<file>timeline/EidolonKill.png</file>
98+
<file>timeline/EidolonSpawn.png</file>
99+
<file>timeline/HostJoin.png</file>
100+
<file>timeline/HostUnload.png</file>
101+
<file>timeline/Invalid.png</file>
102+
<file>timeline/LimbBreak.png</file>
103+
<file>timeline/LootDrop.png</file>
104+
<file>timeline/NightBegin.png</file>
105+
<file>timeline/ShardInsert.png</file>
106+
<file>timeline/ShardRemove.png</file>
107+
<file>timeline/ShrineDisable.png</file>
108+
<file>timeline/ShrineEnable.png</file>
109+
<file>timeline/SquadJoin.png</file>
110+
<file>timeline/EidolonTeleport.png</file>
93111
</qresource>
94112
</RCC>

assets/timeline/DayBegin.png

43.8 KB

assets/timeline/DayBegin_lg.png

236 KB

assets/timeline/EidolonCapture.png

228 KB
845 KB

0 commit comments

Comments
 (0)