Skip to content

Commit

Permalink
sped up statusbar
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkite committed Aug 13, 2015
1 parent da8a807 commit 969b0e9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 26 deletions.
2 changes: 2 additions & 0 deletions glmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ void GLMap::mouseMoveEvent(QMouseEvent *event) {
int y = mouse.y();
if (x >= 0 && y >= 0 && x < world->tilesWide && y < world->tilesHigh) {
auto tile = &world->tiles[y * world->tilesWide + x];


if (fogOfWarEnabled && !tile->seen()) {
emit status(QString("%1,%2 - Murky Blackness").arg(x).arg(y));
} else if (tile->active()) {
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
app.installTranslator(&translator);

app.setApplicationName("Terrafirma");
app.setApplicationVersion("3.0.3");
app.setApplicationVersion("3.0.4");
app.setOrganizationName("seancode");

MainWindow w;
Expand Down
11 changes: 9 additions & 2 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <QFileDialog>
#include <QSettings>
#include <QDebug>
#include <QLabel>
#include "./mainwindow.h"
#include "./ui_mainwindow.h"
#include "./handle.h"
Expand All @@ -25,9 +26,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
findChests = NULL;
hilite = NULL;

QLabel *status = new QLabel();
ui->statusBar->addWidget(status, 1);

connect(ui->map, SIGNAL(error(QString)),
this, SLOT(showError(QString)));

connect(ui->map, SIGNAL(status(QString)),
status, SLOT(setText(QString)), Qt::DirectConnection);

settings = new SettingsDialog(this);
connect(settings, SIGNAL(accepted()), this, SLOT(resetPaths()));

Expand All @@ -45,8 +52,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),

connect(world.data(), SIGNAL(loadError(QString)),
this, SLOT(showError(QString)));
connect(world.data(), SIGNAL(status(QString, int)),
ui->statusBar, SLOT(showMessage(QString, int)));
connect(world.data(), SIGNAL(status(QString)),
status, SLOT(setText(QString)));
connect(world.data(), SIGNAL(loaded(bool)),
this, SLOT(setNPCs(bool)));

Expand Down
18 changes: 1 addition & 17 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<x>0</x>
<y>0</y>
<width>640</width>
<height>21</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuTerrafirma">
Expand Down Expand Up @@ -744,22 +744,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>map</sender>
<signal>status(QString)</signal>
<receiver>statusBar</receiver>
<slot>showMessage(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>150</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>289</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionSettings</sender>
<signal>triggered()</signal>
Expand Down
2 changes: 1 addition & 1 deletion terrafirma.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!-- Increase product version each release.. and that's the only change -->
<?define ProductVersion="3.0.3.0"?>
<?define ProductVersion="3.0.4.0"?>
<?define ProductUpgradeCode="77851f13-31d3-473a-8654-5b6325fc53ab"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Terrafirma" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Sean Kasun" UpgradeCode="$(var.ProductUpgradeCode)">
Expand Down
8 changes: 4 additions & 4 deletions world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void World::loadTiles(QSharedPointer<Handle> handle, int version,
const QList<bool> &extra) {
for (int x = 0; x < tilesWide; x++) {
emit status(tr("Reading tiles: %1%").arg(
static_cast<int>(x * 100.0f / tilesWide)), 0);
static_cast<int>(x * 100.0f / tilesWide)));
int offset = x;
for (int y = 0; y < tilesHigh; y++) {
int rle = tiles[offset].load(handle, version, extra);
Expand All @@ -144,7 +144,7 @@ void World::loadTiles(QSharedPointer<Handle> handle, int version,

void World::loadChests(QSharedPointer<Handle> handle, int) {
chests.clear();
emit status("Loading Chests...", 0);
emit status("Loading Chests...");
int numChests = handle->r16();
int itemsPerChest = handle->r16();
for (int i = 0; i < numChests; i++) {
Expand All @@ -168,7 +168,7 @@ void World::loadChests(QSharedPointer<Handle> handle, int) {

void World::loadSigns(QSharedPointer<Handle> handle, int) {
signs.clear();
emit status("Loading Signs...", 0);
emit status("Loading Signs...");
int numSigns = handle->r16();
for (int i = 0; i < numSigns; i++) {
Sign sign;
Expand All @@ -181,7 +181,7 @@ void World::loadSigns(QSharedPointer<Handle> handle, int) {

void World::loadNPCs(QSharedPointer<Handle> handle, int version) {
npcs.clear();
emit status("Loading NPCs...", 0);
emit status("Loading NPCs...");
while (handle->r8()) {
NPC npc;
npc.title = handle->rs();
Expand Down
2 changes: 1 addition & 1 deletion world.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class World : public QObject, public QRunnable {

signals:
void loaded(bool loaded);
void status(QString msg, int num);
void status(QString msg);
void loadError(QString reason);

protected:
Expand Down

0 comments on commit 969b0e9

Please sign in to comment.