Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions gui/desktop/generate_qrc_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@
import sys
import argparse

import xml.etree.cElementTree as ET

def main():
parser = argparse.ArgumentParser()
parser.add_argument("data_dir")
args = parser.parse_args(sys.argv[1:])

data_root = args.data_dir
individual_files = []
with open('data.qrc', 'w') as qrc:
qrc.write('<RCC>\n')
qrc.write(' <qresource prefix="/">\n')
for root, dirs, files in os.walk(data_root):
for file in files:
f = os.path.join(root, file)
if os.path.isfile(f):
f = f.replace('\\', '/')
individual_files.append(f)

for file in individual_files:
embed_path = file.replace(data_root, '')
qrc.write(' <file alias=\"' + embed_path + '\">' + file + '</file>\n')
rcc = ET.Element("RCC")
resources = ET.SubElement(rcc, "qresource", prefix="/")
for root, dirs, files in os.walk(data_root):
for file in files:
f = os.path.join(root, file)
if os.path.isfile(f):
f = f.replace('\\', '/')
individual_files.append(f)

for file in individual_files:
embed_path = file.replace(data_root, '')
ET.SubElement(resources, "file", alias=embed_path).text = file

qrc.write(' </qresource>\n')
qrc.write('</RCC>')
ET.ElementTree(rcc).write("data.qrc")

main()
7 changes: 5 additions & 2 deletions gui/desktop/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<string notr="true"/>
</property>
<property name="currentIndex">
<number>6</number>
<number>0</number>
</property>
<widget class="QWidget" name="getting_started_tab">
<attribute name="title">
Expand Down Expand Up @@ -2462,13 +2462,16 @@ color: lightgray</string>
</property>
<property name="minimumSize">
<size>
<width>364</width>
<width>346</width>
<height>346</height>
</size>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
Expand Down
26 changes: 16 additions & 10 deletions gui/desktop/tracker/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QMouseEvent>
#include <QMessageBox>
#include <QColorDialog>
#include <QPainter>

#include <../ui_mainwindow.h>

Expand Down Expand Up @@ -750,10 +751,10 @@ void MainWindow::initialize_tracker()
"background-position: center;"
"}");
ui->overworld_map_widget->setStyleSheet("QWidget#overworld_map_widget {background-image: url(" + getTrackerAssetPath("sea_chart.png") + ");}");
ui->chart_list_widget->setStyleSheet("QWidget#chart_list_widget {border-image: url(" + getTrackerAssetPath("area_empty.png") + ");}");
set_location_list_widget_background("empty");
ui->entrance_list_widget->setStyleSheet("QWidget#entrance_list_widget {border-image: url(" + getTrackerAssetPath("area_empty.png") + ");}");
ui->entrance_destination_widget->setStyleSheet("QWidget#entrance_destination_widget {border-image: url(" + getTrackerAssetPath("area_empty.png") + ");}");
ui->chart_list_widget->setStyleSheet("QWidget#chart_list_widget {border-image: url(" + getTrackerAssetPath("areas/Empty.png") + ");}");
set_location_list_widget_background("Empty");
ui->entrance_list_widget->setStyleSheet("QWidget#entrance_list_widget {border-image: url(" + getTrackerAssetPath("areas/Empty.png") + ");}");
ui->entrance_destination_widget->setStyleSheet("QWidget#entrance_destination_widget {border-image: url(" + getTrackerAssetPath("areas/Empty.png") + ");}");
ui->other_areas_widget->setStyleSheet("QWidget#other_areas_widget {background-color: rgba(160, 160, 160, 0.85);}");
ui->stat_box->setStyleSheet("QWidget#stat_box {background-color: rgba(79, 79, 79, 0.85);}");

Expand Down Expand Up @@ -1424,11 +1425,7 @@ void MainWindow::tracker_show_specific_area(const std::string& areaPrefix)
ui->location_list_entrances_button->setVisible(!areaEntrances[areaPrefix].empty());

// Update the image used for the background of the area location labels
// Currently this lags the tracker a little bit, so maybe revisit later
// std::replace(areaPrefix.begin(), areaPrefix.end(), ' ', '_');
// std::transform(areaPrefix.begin(), areaPrefix.end(), areaPrefix.begin(), [](char& c){return std::tolower(c);});
// std::erase(areaPrefix, '\'');
// set_location_list_widget_background(areaPrefix);
set_location_list_widget_background(areaPrefix);
}

void MainWindow::tracker_clear_specific_area(const std::string& areaPrefix)
Expand Down Expand Up @@ -1466,7 +1463,16 @@ void MainWindow::tracker_area_right_clicked(const std::string& areaPrefix)

void MainWindow::set_location_list_widget_background(const std::string& area)
{
ui->location_list_widget->setStyleSheet("QWidget#location_list_widget {border-image: url(" + getTrackerAssetPath("area_" + area + ".png") + ");}");
QPixmap island(getTrackerAssetPath("areas/" + area + ".png"));
QPainter painter(&island);
painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
painter.fillRect(island.rect(), QColor(216, 186, 106, 179));
painter.end();

QPalette palette;
const int width = ui->location_list_widget->width(), height = ui->location_list_widget->height();
palette.setBrush(QPalette::Window, island.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
ui->location_list_widget->setPalette(palette);
}

void MainWindow::tracker_display_current_item_text(const std::string& currentItem)
Expand Down