Skip to content

Commit 20ed1ae

Browse files
committed
Corrected translatios, added level name editing feature.
1 parent 0d7806e commit 20ed1ae

File tree

7 files changed

+213
-152
lines changed

7 files changed

+213
-152
lines changed

animationeditor.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ void AnimationEditor::paintEvent(QPaintEvent *)
4848

4949
pt.fillRect(this->rect(),Qt::SolidPattern);
5050

51+
pt.setPen(Qt::white);
5152
pt.drawLine(TileSizeX + 3, 0, TileSizeX + 2, this->height());
5253

5354
if (Buffer->getCount() > 0)

mainwindow.cpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <QFileDialog>
44
#include "neweventdialog.h"
55
#include <QTextStream>
6+
#include <QInputDialog>
67

78
MainWindow::MainWindow(QWidget *parent) :
89
QMainWindow(parent),
@@ -181,7 +182,7 @@ void MainWindow::on_actionZapisz_triggered()
181182
QDataStream out(&file);
182183

183184
Level->saveToStream(out);
184-
185+
file.close();
185186
Selector->getTexture()->save(CurrentFileName+".png");
186187
UndoStack->notifySaved();
187188
}
@@ -202,6 +203,7 @@ void MainWindow::on_actionOtw_rz_triggered()
202203
QDataStream in(&file); // read the data serialized from the file
203204

204205
Level->loadFromStream(in);
206+
file.close();
205207

206208
ui->sbTileWidth->setValue( Level->Buffer->getTileSizeX() );
207209
ui->sbTileHeight->setValue( Level->Buffer->getTileSizeY() );
@@ -401,7 +403,8 @@ void MainWindow::on_actionNowy_triggered()
401403
Level->clearAll();
402404
Level->Layers.append( new TileMap() );
403405

404-
slFileName->setText(tr("Unnamed"));
406+
Level->setName( tr("Unnamed"));
407+
slFileName->setText( Level->Name );
405408

406409
if (UndoStack != NULL)
407410
delete UndoStack;
@@ -758,11 +761,15 @@ void MainWindow::on_actionExport_level_as_JSON_triggered()
758761
FilesPath = QFileInfo(fileName).absolutePath();
759762

760763
Level->saveToJSON( fileName );
761-
// QFile file( fileName );
762-
// if ( file.open(QIODevice::WriteOnly) )
763-
// {
764-
// QTextStream stream( &file );
765-
// Level->Layers[ui->cbSelectLayer->currentIndex()]->saveLayerAsText(stream);
766-
// file.close();
767-
// }
764+
}
765+
766+
void MainWindow::on_actionSet_level_name_triggered()
767+
{
768+
bool ok;
769+
QString text = QInputDialog::getText(this, tr("Set level name"),
770+
tr("Level name:"), QLineEdit::Normal,
771+
Level->Name , &ok);
772+
if (ok /* && !text.isEmpty() */)
773+
Level->setName( text );
774+
slFileName->setText( Level->Name );
768775
}

mainwindow.h

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ private slots:
7777

7878
void on_actionExport_level_as_JSON_triggered();
7979

80+
void on_actionSet_level_name_triggered();
81+
8082
private:
8183
void closeEvent(QCloseEvent *event);
8284
void resizeEvent( QResizeEvent * );

mainwindow.ui

+7
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ remove:</string>
884884
<addaction name="actionZapisz_jako"/>
885885
<addaction name="separator"/>
886886
<addaction name="actionWczytaj_textur_o_rozmiarach"/>
887+
<addaction name="actionSet_level_name"/>
888+
<addaction name="separator"/>
887889
<addaction name="actionExport_level_as_JSON"/>
888890
<addaction name="menuExportuj_warstw"/>
889891
<addaction name="menuExportuj_textur"/>
@@ -1151,6 +1153,11 @@ remove:</string>
11511153
<string>Export level as JSON file</string>
11521154
</property>
11531155
</action>
1156+
<action name="actionSet_level_name">
1157+
<property name="text">
1158+
<string>Set level name</string>
1159+
</property>
1160+
</action>
11541161
</widget>
11551162
<layoutdefault spacing="6" margin="11"/>
11561163
<resources>

0 commit comments

Comments
 (0)