diff --git a/ADeditor/ADeditor.pro.user b/ADeditor/ADeditor.pro.user index 423e8b5..9068534 100644 --- a/ADeditor/ADeditor.pro.user +++ b/ADeditor/ADeditor.pro.user @@ -46,7 +46,7 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/Users/Andrey/Desktop/aliendefender/build + C:/Users/Andrey/Desktop/ADeditor-build 5 2 true diff --git a/ADeditor/ADeditor.pro.user.1.3 b/ADeditor/ADeditor.pro.user.1.3 new file mode 100644 index 0000000..833beb4 --- /dev/null +++ b/ADeditor/ADeditor.pro.user.1.3 @@ -0,0 +1,283 @@ + + + + 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 + + + activebuildconfiguration + Debug + + + buildConfiguration-Debug + + Debug + 0 + 0 + + 2 + + + + buildConfiguration-Release + + Release + 0 + + 0 + + + + buildconfiguration-Debug-buildstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + 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-7vXnOW + 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/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SHELL=/bin/bash + SPEECHD_PORT=6561 + SSH_AGENT_PID=1158 + SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + USER=andrey + USERNAME=andrey + XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/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-1281338556.676663-803309736 + + + /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro + -spec + linux-g++ + -r + CONFIG+=debug + + /usr/bin/qmake-qt4 + false + /home/andrey/AD/aliendefender/ADeditor + + + + buildconfiguration-Debug-buildstep1 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + 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-7vXnOW + 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/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SHELL=/bin/bash + SPEECHD_PORT=6561 + SSH_AGENT_PID=1158 + SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + USER=andrey + USERNAME=andrey + XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/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-1281338556.676663-803309736 + + false + + -w + + /usr/bin/make + true + /home/andrey/AD/aliendefender/ADeditor + + + + buildconfiguration-Debug-cleanstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-5i8Go7nPio,guid=870ffe971971ceac89206f0e4c5facbd + 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-7vXnOW + 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/1124,unix/buull-eeePC:/tmp/.ICE-unix/1124 + SHELL=/bin/bash + SPEECHD_PORT=6561 + SSH_AGENT_PID=1158 + SSH_AUTH_SOCK=/tmp/keyring-7vXnOW/ssh + USER=andrey + USERNAME=andrey + XAUTHORITY=/var/run/gdm/auth-for-andrey-HWCXAG/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-1281338556.676663-803309736 + + true + + clean + -w + + /usr/bin/make + true + /home/andrey/AD/aliendefender/ADeditor + true + + clean + + + + + buildconfiguration-Release-buildstep0 + + Release + + + + buildconfiguration-Release-buildstep1 + + Release + + + + buildconfiguration-Release-cleanstep0 + + Release + + + + buildconfigurations + + Debug + Release + + + + buildstep0 + + + + + + + buildstep1 + + + + + + buildsteps + + trolltech.qt4projectmanager.qmake + trolltech.qt4projectmanager.make + + + + cleanstep0 + + + true + + + + cleansteps + + trolltech.qt4projectmanager.make + + + + defaultFileEncoding + System + + + project + + + diff --git a/ADeditor/alienmodel.cpp b/ADeditor/alienmodel.cpp index b046d76..1539806 100644 --- a/ADeditor/alienmodel.cpp +++ b/ADeditor/alienmodel.cpp @@ -3,19 +3,19 @@ AlienModel::AlienModel(QList maliens, QObject *parent) : QAbstractListModel(parent) { - aliens = maliens; + aliens = maliens; } void AlienModel::refresh(QList maliens) { - aliens = maliens; + aliens = maliens; } int AlienModel::rowCount(const QModelIndex &) const { - return aliens.count(); + return aliens.count(); } @@ -24,12 +24,12 @@ QVariant AlienModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - if (index.row() >= aliens.size()) + if (index.row() >= aliens.size()) return QVariant(); if (role == Qt::DisplayRole) { - return aliens.at(index.row()).name; + return aliens.at(index.row()).name; } return QVariant(); } diff --git a/ADeditor/alienmodel.h b/ADeditor/alienmodel.h index c41890d..5630686 100644 --- a/ADeditor/alienmodel.h +++ b/ADeditor/alienmodel.h @@ -8,16 +8,16 @@ class AlienModel : public QAbstractListModel { Q_OBJECT public: - explicit AlienModel(QList *data, QObject *parent = 0); + explicit AlienModel(QList aliens, QObject *parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; - void refresh(QList aliens); + void refresh(QList aliens); signals: public slots: private: - QList *data; + QList aliens; }; #endif // ALIENMODEL_H diff --git a/ADeditor/mainwindow.cpp b/ADeditor/mainwindow.cpp index 7aa7072..85eaad7 100644 --- a/ADeditor/mainwindow.cpp +++ b/ADeditor/mainwindow.cpp @@ -11,14 +11,22 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); adloader = new Loader(this); adloader->load("data2.xml"); + 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); + + 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); + 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->cbTwSplash->setModel((QAbstractItemModel * )splModel); } @@ -89,6 +97,17 @@ void MainWindow::lvTowers_select(QModelIndex index, QModelIndex) ui->leTwName->setText(tw.name); ui->sbTwRadius->setValue(tw.radius); ui->sbTwReload->setValue(tw.reload); + ui->cbTwSplash->setCurrentIndex(adloader->splashes.keys().indexOf(tw.splashId)); +} + + +void MainWindow::lvSplashes_select(QModelIndex index, QModelIndex) +{ + tbSplash spl = adloader->splashes.values().at(index.row()); + ui->sbSplLifeTime->setValue(spl.lifetime); + ui->sbSplSpeed->setValue(spl.speed); + ui->cbSplAutoControl->setChecked(spl.autoControl); + ui->leSplName->setText(spl.name); } @@ -99,48 +118,56 @@ void MainWindow::on_pbSave_clicked() alModel->refresh(adloader->aliens.values()); } + void MainWindow::on_sbAlHealth_valueChanged(double value) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].health = value; } + void MainWindow::on_sbAlArmor_valueChanged(double value) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].armor = value; } + void MainWindow::on_sbAlregeneration_valueChanged(double value) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].regeneration = value; } + void MainWindow::on_sbAlSpeed_valueChanged(double value) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].speed = value; } + void MainWindow::on_sbAlPrise_valueChanged(int val) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].prise = val; } + void MainWindow::on_sbAlScore_valueChanged(int val) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].score = val; } + void MainWindow::on_cbAlIsFly_clicked(bool checked) { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; adloader->aliens[id].isFlying = checked; } + void MainWindow::on_leAlName_editingFinished() { int id = adloader->aliens.values().at(ui->lvAliens->currentIndex().row()).id; @@ -149,12 +176,14 @@ void MainWindow::on_leAlName_editingFinished() ui->lvAliens->setModel((QAbstractItemModel * )alModel); } + void MainWindow::on_pbAlAdd_clicked() { int i = 1; while (adloader->aliens.contains(i)) i++; tbAlien al; al.id = i; + al.name = tr("Alien"); adloader->aliens.insert(al.id,al); int index = adloader->aliens.keys().indexOf(i); alModel->refresh(adloader->aliens.values()); @@ -163,6 +192,7 @@ void MainWindow::on_pbAlAdd_clicked() ui->lvAliens->selectionModel()->setCurrentIndex(ui->lvAliens->model()->index(index,0),QItemSelectionModel::Select); } + void MainWindow::on_pbAlDel_clicked() { QMessageBox msgBox; @@ -182,6 +212,7 @@ void MainWindow::on_pbAlDel_clicked() } } + void MainWindow::on_leTwName_editingFinished() { int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; @@ -190,7 +221,161 @@ void MainWindow::on_leTwName_editingFinished() ui->lvTowers->setModel((QAbstractItemModel * )twModel); } + +void MainWindow::on_sbTwBuildTime_valueChanged(int val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].buildTime = val; +} + + +void MainWindow::on_sbTwCost_valueChanged(int val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].cost = val; +} + + +void MainWindow::on_cbTwSplash_currentIndexChanged(int index) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].splashId = adloader->splashes.values().at(index).id; +} + +void MainWindow::on_sbTwReload_valueChanged(int val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].reload = val; +} + + +void MainWindow::on_sbTwRadius_valueChanged(double val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].radius = val; +} + + +void MainWindow::on_sbTwExpByShot_valueChanged(double val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByShot = val; +} + + +void MainWindow::on_sbTwExpByDam_valueChanged(double val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByDamage = val; +} + + +void MainWindow::on_sbTwExpByKill_valueChanged(double val) +{ + int id = adloader->towers.values().at(ui->lvTowers->currentIndex().row()).id; + adloader->towers[id].expByKill = val; +} + + void MainWindow::on_pbTwAdd_clicked() { - + int i = 1; + while (adloader->towers.contains(i)) i++; + tbTower tw; + tw.id = i; + tw.name = tr("Tower"); + 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); +} + + +void MainWindow::on_pbTwDel_clicked() +{ + 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?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + if (ret == QMessageBox::Ok) + { + adloader->towers.remove(id); + 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); + } +} + +void MainWindow::on_leSplName_editingFinished() +{ + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].name = ui->leSplName->text(); + splModel->refresh(adloader->splashes.values()); + ui->lvSplashes->setModel((QAbstractItemModel * )splModel); + ui->cbTwSplash->setModel((QAbstractItemModel * )splModel); +} + + +void MainWindow::on_sbSplSpeed_valueChanged(double val) +{ + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].speed = val; +} + + +void MainWindow::on_cbSplAutoControl_toggled(bool checked) +{ + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].autoControl = checked; +} + + +void MainWindow::on_sbSplLifeTime_valueChanged(int val) +{ + int id = adloader->splashes.values().at(ui->lvSplashes->currentIndex().row()).id; + adloader->splashes[id].lifetime = val; +} + + +void MainWindow::on_pbSplAdd_clicked() +{ + int i = 1; + while (adloader->splashes.contains(i)) i++; + tbSplash spl; + spl.id = i; + spl.name = tr("Splash"); + 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->cbTwSplash->setModel((QAbstractItemModel * )splModel); +} + + +void MainWindow::on_pbSlpDel_clicked() +{ + QMessageBox msgBox; + int id = adloader->splashes.keys().at(ui->lvSplashes->currentIndex().row()); + 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); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + if (ret == QMessageBox::Ok) + { + adloader->splashes.remove(id); + 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->cbTwSplash->setModel((QAbstractItemModel * )splModel); + } } diff --git a/ADeditor/mainwindow.h b/ADeditor/mainwindow.h index dee6adf..d9edf95 100644 --- a/ADeditor/mainwindow.h +++ b/ADeditor/mainwindow.h @@ -7,7 +7,7 @@ #include "alienmodel.h" #include "towermodel.h" - +#include "splashmodel.h" namespace Ui { class MainWindow; @@ -27,8 +27,24 @@ private: Loader * adloader; AlienModel * alModel; TowerModel * twModel; + SplashModel * splModel; private slots: + void on_pbSlpDel_clicked(); + void on_pbSplAdd_clicked(); + void on_sbSplLifeTime_valueChanged(int ); + void on_cbSplAutoControl_toggled(bool checked); + void on_sbSplSpeed_valueChanged(double ); + void on_leSplName_editingFinished(); + void on_pbTwDel_clicked(); + void on_sbTwExpByKill_valueChanged(double ); + void on_sbTwExpByDam_valueChanged(double ); + void on_sbTwExpByShot_valueChanged(double ); + void on_sbTwRadius_valueChanged(double ); + void on_sbTwReload_valueChanged(int ); + void on_cbTwSplash_currentIndexChanged(int index); + void on_sbTwCost_valueChanged(int ); + void on_sbTwBuildTime_valueChanged(int ); void on_pbTwAdd_clicked(); void on_leTwName_editingFinished(); void on_pbAlDel_clicked(); @@ -44,6 +60,7 @@ private slots: void on_pbSave_clicked(); void lvAliens_select(QModelIndex, QModelIndex); void lvTowers_select(QModelIndex, QModelIndex); + void lvSplashes_select(QModelIndex, QModelIndex); void on_cbAlRegeneration_toggled(bool checked); void on_cbAlArmor_toggled(bool checked); }; diff --git a/ADeditor/mainwindow.ui b/ADeditor/mainwindow.ui index 1c29f3f..eb65b39 100644 --- a/ADeditor/mainwindow.ui +++ b/ADeditor/mainwindow.ui @@ -512,7 +512,14 @@ - + + + 10 + + + true + + @@ -856,6 +863,29 @@ + + + + + + + 0 + 0 + + + + LifeTime + + + Qt::AlignCenter + + + + + + + + @@ -892,29 +922,6 @@ - - - - - - - 0 - 0 - - - - LifeTime - - - Qt::AlignCenter - - - - - - - - diff --git a/ADeditor/schema.xml b/ADeditor/schema.xml index 5611a66..408c5e9 100644 --- a/ADeditor/schema.xml +++ b/ADeditor/schema.xml @@ -112,7 +112,12 @@ - + + + + + + @@ -159,7 +164,7 @@ - + diff --git a/ADeditor/splashmodel.cpp b/ADeditor/splashmodel.cpp index b30de91..4fc459d 100644 --- a/ADeditor/splashmodel.cpp +++ b/ADeditor/splashmodel.cpp @@ -1,6 +1,35 @@ #include "splashmodel.h" -SplashModel::SplashModel(QList splashes, QObject *parent) : +SplashModel::SplashModel(QList msplashes, QObject *parent) : QAbstractListModel(parent) { + splashes = msplashes; +} + + +void SplashModel::refresh(QList msplashes) +{ + splashes = msplashes; +} + + +int SplashModel::rowCount(const QModelIndex &) const +{ + return splashes.count(); +} + + +QVariant SplashModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (index.row() >= splashes.size()) + return QVariant(); + + if (role == Qt::DisplayRole) + { + return splashes.at(index.row()).name; + } + return QVariant(); } diff --git a/ADeditor/splashmodel.h b/ADeditor/splashmodel.h index 2c8c168..8621048 100644 --- a/ADeditor/splashmodel.h +++ b/ADeditor/splashmodel.h @@ -9,8 +9,8 @@ class SplashModel : public QAbstractListModel Q_OBJECT public: explicit SplashModel(QList splashes, QObject *parent = 0); - //int rowCount(const QModelIndex &parent = QModelIndex()) const; - //QVariant data(const QModelIndex &index, int role) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; void refresh(QList splashes); signals: