diff --git a/ADeditor/ADeditor b/ADeditor/ADeditor
index cfefb00..89a9835 100755
Binary files a/ADeditor/ADeditor and b/ADeditor/ADeditor differ
diff --git a/ADeditor/ADeditor.pro.user b/ADeditor/ADeditor.pro.user
index 9068534..0d3bdbf 100644
--- a/ADeditor/ADeditor.pro.user
+++ b/ADeditor/ADeditor.pro.user
@@ -1,111 +1,254 @@
- ProjectExplorer.Project.ActiveTarget
+ RunConfiguration0-BaseEnvironmentBase
+ 2
+
+
+ RunConfiguration0-CommandLineArguments
+
+
+
+ RunConfiguration0-ProFile
+ ADeditor.pro
+
+
+ RunConfiguration0-RunConfiguration.name
+ ADeditor
+
+
+ RunConfiguration0-UseDyldImageSuffix
+ false
+
+
+ RunConfiguration0-UseTerminal
+ false
+
+
+ RunConfiguration0-UserEnvironmentChanges
+
+
+
+ RunConfiguration0-UserSetName
+ false
+
+
+ RunConfiguration0-UserSetWorkingDirectory
+ false
+
+
+ RunConfiguration0-UserWorkingDirectory
+
+
+
+ RunConfiguration0-type
+ Qt4ProjectManager.Qt4RunConfiguration
+
+
+ activeRunConfiguration
0
- ProjectExplorer.Project.EditorSettings
+ activebuildconfiguration
+ Debug
+
+
+ buildConfiguration-Debug
- UTF-8
+ Debug
+ 2
+ 0
+ 2
- ProjectExplorer.Project.Target.0
+ buildconfiguration-Debug-buildstep0
- Настольный компьютер
- Qt4ProjectManager.Target.DesktopTarget
- 0
- 0
-
-
-
- QtProjectManager.QMakeBuildStep
-
-
-
-
- Qt4ProjectManager.MakeStep
- false
-
-
-
- 2
-
-
- Qt4ProjectManager.MakeStep
- true
-
- clean
-
-
-
- 1
- false
-
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- C:/Users/Andrey/Desktop/ADeditor-build
- 5
- 2
- true
-
-
-
-
- QtProjectManager.QMakeBuildStep
-
-
-
-
- Qt4ProjectManager.MakeStep
- false
-
-
-
- 2
-
-
- Qt4ProjectManager.MakeStep
- true
-
-
-
- 1
- false
-
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- C:/Users/Andrey/Desktop/aliendefender/ADeditor-build-desktop
- 5
- 2
- true
-
- 2
-
- ADeditor
- Qt4ProjectManager.Qt4RunConfiguration
- 2
-
- ADeditor.pro
- false
- false
-
- false
- true
- C:\Users\Andrey\Desktop\ADeditor-build
-
- 1
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1146
+ SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821
+
+
+ /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro
+ -spec
+ linux-g++
+ -r
+ CONFIG+=debug
+
+ /usr/bin/qmake-qt4
+ false
+ /home/andrey/AD/aliendefender/ADeditor
- ProjectExplorer.Project.TargetCount
- 1
+ buildconfiguration-Debug-buildstep1
+
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1146
+ SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821
+
+ false
+
+ -w
+
+ /usr/bin/make
+ true
+ /home/andrey/AD/aliendefender/ADeditor
+
- ProjectExplorer.Project.Updater.FileVersion
- 4
+ buildconfiguration-Debug-cleanstep0
+
+ Debug
+
+ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5VyjD99lFj,guid=cf0067cbadce72e8c9c0f05e4c74f11a
+ DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
+ DESKTOP_SESSION=gnome
+ DISPLAY=:0.0
+ GDMSESSION=gnome
+ GDM_KEYBOARD_LAYOUT=us
+ GDM_LANG=ru_RU.UTF-8
+ GNOME_DESKTOP_SESSION_ID=this-is-deprecated
+ GNOME_KEYRING_CONTROL=/tmp/keyring-sQCAQN
+ GTK_MODULES=canberra-gtk-module
+ HOME=/home/andrey
+ LANG=ru_RU.UTF-8
+ LD_LIBRARY_PATH=/usr/lib/qtcreator:
+ LOGNAME=andrey
+ MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
+ ORBIT_SOCKETDIR=/tmp/orbit-andrey
+ PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ PWD=/home/andrey
+ QTDIR=/usr/share/qt4
+ SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1112,unix/buull-eeePC:/tmp/.ICE-unix/1112
+ SHELL=/bin/bash
+ SPEECHD_PORT=6561
+ SSH_AGENT_PID=1146
+ SSH_AUTH_SOCK=/tmp/keyring-sQCAQN/ssh
+ USER=andrey
+ USERNAME=andrey
+ XAUTHORITY=/var/run/gdm/auth-for-andrey-QG4tiG/database
+ XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
+ XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
+ XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1282732313.174012-433654821
+
+ true
+
+ clean
+ -w
+
+ /usr/bin/make
+ true
+ /home/andrey/AD/aliendefender/ADeditor
+ true
+
+ clean
+
+
+
+
+ buildconfigurations
+
+ Debug
+
+
+
+ buildstep0
+
+
+
+
+
+
+ buildstep1
+
+
+
+
+
+ buildsteps
+
+ trolltech.qt4projectmanager.qmake
+ trolltech.qt4projectmanager.make
+
+
+
+ cleanstep0
+
+
+ true
+
+
+
+ cleansteps
+
+ trolltech.qt4projectmanager.make
+
+
+
+ defaultFileEncoding
+ System
+
+
+ project
+
diff --git a/ADeditor/Makefile b/ADeditor/Makefile
index 78a005d..3803c83 100644
--- a/ADeditor/Makefile
+++ b/ADeditor/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: ADeditor
-# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???. 24 15:25:17 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???. 25 23:57:34 2010
# Project: ADeditor.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ADeditor.pro
@@ -46,16 +46,24 @@ OBJECTS_DIR = ./
SOURCES = main.cpp \
mainwindow.cpp \
../loader.cpp \
- alienmodel.cpp moc_mainwindow.cpp \
+ alienmodel.cpp \
+ towermodel.cpp \
+ splashmodel.cpp moc_mainwindow.cpp \
moc_loader.cpp \
- moc_alienmodel.cpp
+ moc_alienmodel.cpp \
+ moc_towermodel.cpp \
+ moc_splashmodel.cpp
OBJECTS = main.o \
mainwindow.o \
loader.o \
alienmodel.o \
+ towermodel.o \
+ splashmodel.o \
moc_mainwindow.o \
moc_loader.o \
- moc_alienmodel.o
+ moc_alienmodel.o \
+ moc_towermodel.o \
+ moc_splashmodel.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
@@ -159,7 +167,7 @@ qmake: FORCE
dist:
@$(CHK_DIR_EXISTS) .tmp/ADeditor1.0.0 || $(MKDIR) .tmp/ADeditor1.0.0
- $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.h ../loader.h alienmodel.h .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp ../loader.cpp alienmodel.cpp .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/ADeditor1.0.0/ && (cd `dirname .tmp/ADeditor1.0.0` && $(TAR) ADeditor1.0.0.tar ADeditor1.0.0 && $(COMPRESS) ADeditor1.0.0.tar) && $(MOVE) `dirname .tmp/ADeditor1.0.0`/ADeditor1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ADeditor1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.h ../loader.h alienmodel.h towermodel.h splashmodel.h .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp ../loader.cpp alienmodel.cpp towermodel.cpp splashmodel.cpp .tmp/ADeditor1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/ADeditor1.0.0/ && (cd `dirname .tmp/ADeditor1.0.0` && $(TAR) ADeditor1.0.0.tar ADeditor1.0.0 && $(COMPRESS) ADeditor1.0.0.tar) && $(MOVE) `dirname .tmp/ADeditor1.0.0`/ADeditor1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ADeditor1.0.0
clean:compiler_clean
@@ -178,14 +186,17 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
-compiler_moc_header_make_all: moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp
+compiler_moc_header_make_all: moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp moc_towermodel.cpp moc_splashmodel.cpp
compiler_moc_header_clean:
- -$(DEL_FILE) moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp
-moc_mainwindow.cpp: ../loader.h \
+ -$(DEL_FILE) moc_mainwindow.cpp moc_loader.cpp moc_alienmodel.cpp moc_towermodel.cpp moc_splashmodel.cpp
+moc_mainwindow.cpp: alienmodel.h \
+ ../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
+ towermodel.h \
+ splashmodel.h \
mainwindow.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
@@ -204,6 +215,22 @@ moc_alienmodel.cpp: ../loader.h \
alienmodel.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) alienmodel.h -o moc_alienmodel.cpp
+moc_towermodel.cpp: ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ towermodel.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) towermodel.h -o moc_towermodel.cpp
+
+moc_splashmodel.cpp: ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ splashmodel.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) splashmodel.h -o moc_splashmodel.cpp
+
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
@@ -228,21 +255,26 @@ compiler_clean: compiler_moc_header_clean compiler_uic_clean
####### Compile
main.o: main.cpp mainwindow.h \
- ../loader.h \
- ../game_data.h \
- ../player.h \
- ../base_types.h \
- ../map.h
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
-
-mainwindow.o: mainwindow.cpp mainwindow.h \
+ alienmodel.h \
../loader.h \
../game_data.h \
../player.h \
../base_types.h \
../map.h \
- ui_mainwindow.h \
- alienmodel.h
+ towermodel.h \
+ splashmodel.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+mainwindow.o: mainwindow.cpp mainwindow.h \
+ alienmodel.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h \
+ towermodel.h \
+ splashmodel.h \
+ ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
loader.o: ../loader.cpp ../loader.h \
@@ -260,6 +292,22 @@ alienmodel.o: alienmodel.cpp alienmodel.h \
../map.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o alienmodel.o alienmodel.cpp
+towermodel.o: towermodel.cpp towermodel.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o towermodel.o towermodel.cpp
+
+splashmodel.o: splashmodel.cpp splashmodel.h \
+ ../loader.h \
+ ../game_data.h \
+ ../player.h \
+ ../base_types.h \
+ ../map.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o splashmodel.o splashmodel.cpp
+
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
@@ -269,6 +317,12 @@ moc_loader.o: moc_loader.cpp
moc_alienmodel.o: moc_alienmodel.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_alienmodel.o moc_alienmodel.cpp
+moc_towermodel.o: moc_towermodel.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_towermodel.o moc_towermodel.cpp
+
+moc_splashmodel.o: moc_splashmodel.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_splashmodel.o moc_splashmodel.cpp
+
####### Install
install: FORCE
diff --git a/ADeditor/data2.xml b/ADeditor/data2.xml
index 8b3f43c..5fef992 100644
--- a/ADeditor/data2.xml
+++ b/ADeditor/data2.xml
@@ -15,22 +15,22 @@
-
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
@@ -42,7 +42,7 @@
-
+
@@ -50,15 +50,15 @@
-
+
-
+
-
-
+
+
diff --git a/ADeditor/mainwindow.cpp b/ADeditor/mainwindow.cpp
index 85eaad7..dbe1cb6 100644
--- a/ADeditor/mainwindow.cpp
+++ b/ADeditor/mainwindow.cpp
@@ -15,17 +15,17 @@ MainWindow::MainWindow(QWidget *parent) :
alModel = new AlienModel(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
connect(ui->lvAliens->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvAliens_select(QModelIndex, QModelIndex)));
- ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
splModel = new SplashModel(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
connect(ui->lvSplashes->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvSplashes_select(QModelIndex, QModelIndex)));
- ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
twModel = new TowerModel(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel);
connect(ui->lvTowers->selectionModel(),SIGNAL(currentChanged(QModelIndex, QModelIndex)),this,SLOT(lvTowers_select(QModelIndex, QModelIndex)));
- ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
}
@@ -111,11 +111,54 @@ void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex)
}
+void MainWindow::closeEvent(QCloseEvent *event)
+{
+ QMessageBox msgBox;
+ msgBox.setText(tr("Save changes?"));
+ msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
+ msgBox.setDefaultButton(QMessageBox::Save);
+ int ret = msgBox.exec();
+ switch (ret)
+ {
+ case QMessageBox::Save :
+ adloader->save("data2.xml");
+ event->accept();
+ break;
+ case QMessageBox::Cancel :
+ event->ignore();
+ break;
+ default:
+ event->accept();
+ }
+}
+
void MainWindow::on_pbSave_clicked()
{
adloader->save("data2.xml");
- adloader->load("data2.xml");
- alModel->refresh(adloader->aliens.values());
+}
+
+
+void MainWindow::on_pbReload_clicked()
+{
+ QMessageBox msgBox;
+ msgBox.setText(tr("All unsaved changes will be lost"));
+ msgBox.setInformativeText(tr("Are you sure?"));
+ msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+ msgBox.setDefaultButton(QMessageBox::Ok);
+ int ret = msgBox.exec();
+ if (ret == QMessageBox::Ok)
+ {
+ adloader->load("data2.xml");
+ alModel->refresh(adloader->aliens.values());
+ twModel->refresh(adloader->towers.values());
+ splModel->refresh(adloader->splashes.values());
+ ui->lvAliens->reset();
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
+ ui->lvTowers->reset();
+ ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
+ ui->lvSplashes->reset();
+ ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
+ }
}
@@ -174,6 +217,7 @@ void MainWindow::on_leAlName_editingFinished()
adloader->aliens[id].name = ui->leAlName->text();
alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
+ ui->lvAliens->repaint();
}
@@ -184,17 +228,22 @@ void MainWindow::on_pbAlAdd_clicked()
tbAlien al;
al.id = i;
al.name = tr("Alien");
+ al.health = 1;
+ al.prise = 0;
+ al.score = 1;
+ al.speed = 1;
adloader->aliens.insert(al.id,al);
int index = adloader->aliens.keys().indexOf(i);
alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset();
- ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::Select);
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
}
void MainWindow::on_pbAlDel_clicked()
{
+ if (adloader->aliens.size() < 2) return;
QMessageBox msgBox;
int id = adloader->aliens.keys().at(ui->lvAliens->currentIndex().row());
msgBox.setText(tr("Delete alien %1 id=%2").arg(adloader->aliens.value(id).name).arg(id));
@@ -208,7 +257,7 @@ void MainWindow::on_pbAlDel_clicked()
alModel->refresh(adloader->aliens.values());
ui->lvAliens->setModel((QAbstractItemModel * )alModel);
ui->lvAliens->reset();
- ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
}
}
@@ -284,18 +333,24 @@ void MainWindow::on_pbTwAdd_clicked()
tbTower tw;
tw.id = i;
tw.name = tr("Tower");
+ tw.splashId = adloader->splashes.keys().at(0);
+ tw.buildTime = 1;
+ tw.cost = 1;
+ tw.radius = 1;
+ tw.reload = 1;
adloader->towers.insert(tw.id,tw);
int index = adloader->towers.keys().indexOf(i);
twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset();
- ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::Select);
+ ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
}
void MainWindow::on_pbTwDel_clicked()
{
- QMessageBox msgBox;
+ if (adloader->towers.size() < 2) return;
+ QMessageBox msgBox;
int id = adloader->towers.keys().at(ui->lvTowers->currentIndex().row());
msgBox.setText(tr("Delete tower %1 id=%2").arg(adloader->towers.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
@@ -308,7 +363,7 @@ void MainWindow::on_pbTwDel_clicked()
twModel->refresh(adloader->towers.values());
ui->lvTowers->setModel((QAbstractItemModel * )twModel);
ui->lvTowers->reset();
- ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvTowers->selectionModel()->setCurrentIndex(ui->lvTowers->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
}
}
@@ -350,20 +405,34 @@ void MainWindow::on_pbSplAdd_clicked()
tbSplash spl;
spl.id = i;
spl.name = tr("Splash");
+ spl.lifetime = 1;
+ spl.speed = 1;
adloader->splashes.insert(spl.id,spl);
int index = adloader->splashes.keys().indexOf(i);
splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset();
- ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::Select);
+ ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(index,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
}
void MainWindow::on_pbSlpDel_clicked()
{
+ if (adloader->splashes.size() < 2) return;
QMessageBox msgBox;
int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row());
+ for (int i=0; itowers.size(); i++)
+ {
+ if (adloader->towers.values().at(i).splashId == id)
+ {
+ msgBox.setText(tr("You can not delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id));
+ msgBox.setInformativeText(tr("It used by tower %1").arg(adloader->towers.values().at(i).name));
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.exec();
+ return;
+ }
+ }
msgBox.setText(tr("Delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
@@ -375,7 +444,15 @@ void MainWindow::on_pbSlpDel_clicked()
splModel->refresh(adloader->splashes.values());
ui->lvSplashes->setModel((QAbstractItemModel * )splModel);
ui->lvSplashes->reset();
- ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::Select);
+ ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(0,0),QItemSelectionModel::ClearAndSelect);
ui->cbTwSplash->setModel((QAbstractItemModel * )splModel);
}
}
+
+
+void MainWindow::on_pushButton_clicked()
+{
+ int splIndex = adloader->splashes.keys().indexOf(adloader->towers.values().at(ui->lvTowers->currentIndex().row()).splashId);
+ ui->lvSplashes->selectionModel()->setCurrentIndex(ui->lvSplashes->model()->index(splIndex,0),QItemSelectionModel::ClearAndSelect);
+ ui->tabWidget->setCurrentWidget(ui->tabSplashes);
+}
diff --git a/ADeditor/mainwindow.h b/ADeditor/mainwindow.h
index d9edf95..23328f4 100644
--- a/ADeditor/mainwindow.h
+++ b/ADeditor/mainwindow.h
@@ -4,6 +4,7 @@
#include
#include
#include
+#include
#include "alienmodel.h"
#include "towermodel.h"
@@ -29,8 +30,11 @@ private:
TowerModel * twModel;
SplashModel * splModel;
+ void closeEvent(QCloseEvent *);
private slots:
- void on_pbSlpDel_clicked();
+ void on_pbReload_clicked();
+ void on_pushButton_clicked();
+ void on_pbSlpDel_clicked();
void on_pbSplAdd_clicked();
void on_sbSplLifeTime_valueChanged(int );
void on_cbSplAutoControl_toggled(bool checked);
diff --git a/ADeditor/mainwindow.ui b/ADeditor/mainwindow.ui
index eb65b39..e044637 100644
--- a/ADeditor/mainwindow.ui
+++ b/ADeditor/mainwindow.ui
@@ -24,7 +24,7 @@
-
- 2
+ 0
@@ -93,6 +93,9 @@
1
+
+ 0.000000000000000
+
999999999.000000000000000
@@ -192,6 +195,9 @@
5
+
+ 0.000010000000000
+
99.000000000000000
@@ -225,6 +231,9 @@
-
+
+ 0
+
999999999
@@ -252,6 +261,9 @@
-
+
+ 1
+
999999999
@@ -466,7 +478,20 @@
-
-
+
+
+ 1
+
+
+ 999999999
+
+
+ 50
+
+
+ 50
+
+
@@ -489,7 +514,14 @@
-
-
+
+
+ 1
+
+
+ 999999999
+
+
@@ -513,14 +545,24 @@
-
-
- 10
-
true
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Edit
+
+
+
-
@@ -542,7 +584,14 @@
-
-
+
+
+ 1
+
+
+ 999999999
+
+
@@ -565,7 +614,17 @@
-
-
+
+
+ 3
+
+
+ 1.000000000000000
+
+
+ 0.100000000000000
+
+
@@ -588,7 +647,14 @@
-
-
+
+
+ 3
+
+
+ 999999999.000000000000000
+
+
@@ -611,7 +677,14 @@
-
-
+
+
+ 3
+
+
+ 999999999.000000000000000
+
+
@@ -634,7 +707,14 @@
-
-
+
+
+ 3
+
+
+ 999999999.000000000000000
+
+
@@ -851,10 +931,10 @@
5
- 99.000000000000000
+ 9999.000000000000000
- 0.010000000000000
+ 0.001000000000000
0.010000000000000
@@ -882,7 +962,17 @@
-
-
+
+
+ 1
+
+
+ 999999999
+
+
+ 1
+
+
@@ -1047,7 +1137,7 @@
- -
+
-
PointingHandCursor
@@ -1057,6 +1147,13 @@
+ -
+
+
+ Reload
+
+
+
diff --git a/ADeditor/schema.xml b/ADeditor/schema.xml
index 408c5e9..40f1986 100644
--- a/ADeditor/schema.xml
+++ b/ADeditor/schema.xml
@@ -112,12 +112,13 @@
-
+
+