From 17f1a286e2f1492b127dbb56c7d469091bb1f9ec Mon Sep 17 00:00:00 2001 From: sfb Date: Fri, 9 Dec 2011 08:10:02 -0600 Subject: [PATCH] Changed: #1409 Fixed some things for a sane compiler (Linux/gcc) --HG-- branch : branch-tile-edit-ovqt-plugin --- .../tile_editor/tile_editor_main_window.cpp | 200 +++++++++--------- .../src/plugins/tile_editor/tile_model.h | 4 +- 2 files changed, 102 insertions(+), 102 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp index 48e8ff36f..12596e1bb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -39,7 +39,7 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) m_undoStack = new QUndoStack(this); // Retrieve the menu manager - Core::ICore *core = Core::ICore::instance(); + Core::ICore *core = Core::ICore::instance(); Core::MenuManager *menuManager = core->menuManager(); QMenu *m_tileEditorMenu; @@ -77,8 +77,8 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) m_ui->tileSetLV->setModel(m_model); //m_ui->tileSetLV->setRootIndex(m_model->index(0,0)); connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd())); - connect(m_ui->tileSetLV->selectionModel(), - SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), + connect(m_ui->tileSetLV->selectionModel(), + SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(changeActiveTileSet(const QModelIndex &, const QModelIndex &))); // 128x128 List View @@ -143,98 +143,98 @@ void TileEditorMainWindow::onActionDeleteImage(bool triggered) void TileEditorMainWindow::onTileSetAdd() { - bool ok; - QString text = QInputDialog::getText(this, tr("Add Tile Set"), tr("Enter Tile Set name:"), QLineEdit::Normal, "", &ok); - if (ok && !text.isEmpty()) - { - //if (ui.tileSetListWidget->findItems(text, Qt::MatchExactly).count() > 0) - //{ - // QMessageBox::information( this, tr("Error Adding Tile Set"), tr("This name already exists") ); - //} - //else - //{ - - //QModelIndex index = m_ui->tileSetLV->selectionModel()->currentIndex(); - TileModel *model = static_cast(m_ui->tileSetLV->model()); - - //if(index.isValid()) - //{ - // if(!model->insertRow(index.row()+1, index.parent())) - // return; - - // //updateActions() - - // for(int column=0; columncolumnCount(index.parent()); column++) - // { - // QModelIndex child = model->index(index.row()+1, column, index.parent()); - // model->setData(child, QVariant(text), Qt::EditRole); - // } - //} - //else - //{ - // Create the new tile set. - QVector items; - items.push_back(text); - TileItem *tileSet = new TileItem(items); - - // child for 128x128 tiles - QVector tiles128; - tiles128.push_back(QString("128")); - TileTypeTileItem *tile128= new TileTypeTileItem(tiles128); - - // child for 256x256 tiles - QVector tiles256; - tiles256.push_back(QString("256")); - TileTypeTileItem *tile256= new TileTypeTileItem(tiles256); - - - // child for transition tiles. - QVector tilesTrans; - tilesTrans.push_back(QString("Transition")); - TileTypeTileItem *tileTrans= new TileTypeTileItem(tilesTrans); - - // Add the default transition tiles. - // TODO tie this to CTileSet::count from NeL - for(int transPos=0; transPos<48; transPos++) - { - QVector tileInfo; - tileInfo.push_back(QString("filename").append(QString::number(transPos+1))); - TileItem *transTile= new TileItem(tileInfo); - tileTrans->appendRow(transTile); - } - - // child for displacement tiles - QVector tilesDisp; - tilesDisp.push_back(QString("Displacement")); - TileTypeTileItem *tileDisp= new TileTypeTileItem(tilesDisp); - - // Add the default displacement tiles. - // TODO tie this to CTileSet::CountDisplace from NeL - for(int dispPos=0; dispPos<16; dispPos++) - { - QVector tileInfo; - tileInfo.push_back(QString("filename").append(QString::number(dispPos+1))); - TileItem *dispTile= new TileItem(tileInfo); - tileDisp->appendRow(dispTile); - } - - // Append them in the correct order to the tile set. - tileSet->appendRow(tile128); - tileSet->appendRow(tile256); - tileSet->appendRow(tileTrans); - tileSet->appendRow(tileDisp); - - model->appendRow(tileSet); - - m_ui->tileSetLV->reset(); - //updateActions() - //} - - // tileBank.addTileSet( text.toStdString() ); - - // ui.tileSetListWidget->addItem(text); - // ui.tileSetListWidget->setCurrentRow(ui.tileSetListWidget->count() - 1); - //} + bool ok; + QString text = QInputDialog::getText(this, tr("Add Tile Set"), tr("Enter Tile Set name:"), QLineEdit::Normal, "", &ok); + if (ok && !text.isEmpty()) + { + //if (ui.tileSetListWidget->findItems(text, Qt::MatchExactly).count() > 0) + //{ + // QMessageBox::information( this, tr("Error Adding Tile Set"), tr("This name already exists") ); + //} + //else + //{ + + //QModelIndex index = m_ui->tileSetLV->selectionModel()->currentIndex(); + TileModel *model = static_cast(m_ui->tileSetLV->model()); + + //if(index.isValid()) + //{ + // if(!model->insertRow(index.row()+1, index.parent())) + // return; + + // //updateActions() + + // for(int column=0; columncolumnCount(index.parent()); column++) + // { + // QModelIndex child = model->index(index.row()+1, column, index.parent()); + // model->setData(child, QVariant(text), Qt::EditRole); + // } + //} + //else + //{ + // Create the new tile set. + QVector items; + items.push_back(text); + TileItem *tileSet = new TileItem(items); + + // child for 128x128 tiles + QVector tiles128; + tiles128.push_back(QString("128")); + TileTypeTileItem *tile128= new TileTypeTileItem(tiles128); + + // child for 256x256 tiles + QVector tiles256; + tiles256.push_back(QString("256")); + TileTypeTileItem *tile256= new TileTypeTileItem(tiles256); + + + // child for transition tiles. + QVector tilesTrans; + tilesTrans.push_back(QString("Transition")); + TileTypeTileItem *tileTrans= new TileTypeTileItem(tilesTrans); + + // Add the default transition tiles. + // TODO tie this to CTileSet::count from NeL + for(int transPos=0; transPos<48; transPos++) + { + QVector tileInfo; + tileInfo.push_back(QString("filename").append(QString::number(transPos+1))); + TileItem *transTile= new TileItem(tileInfo); + tileTrans->appendRow(transTile); + } + + // child for displacement tiles + QVector tilesDisp; + tilesDisp.push_back(QString("Displacement")); + TileTypeTileItem *tileDisp= new TileTypeTileItem(tilesDisp); + + // Add the default displacement tiles. + // TODO tie this to CTileSet::CountDisplace from NeL + for(int dispPos=0; dispPos<16; dispPos++) + { + QVector tileInfo; + tileInfo.push_back(QString("filename").append(QString::number(dispPos+1))); + TileItem *dispTile= new TileItem(tileInfo); + tileDisp->appendRow(dispTile); + } + + // Append them in the correct order to the tile set. + tileSet->appendRow(tile128); + tileSet->appendRow(tile256); + tileSet->appendRow(tileTrans); + tileSet->appendRow(tileDisp); + + model->appendRow(tileSet); + + m_ui->tileSetLV->reset(); + //updateActions() + //} + + // tileBank.addTileSet( text.toStdString() ); + + // ui.tileSetListWidget->addItem(text); + // ui.tileSetListWidget->setCurrentRow(ui.tileSetListWidget->count() - 1); + //} } } @@ -247,13 +247,13 @@ void TileEditorMainWindow::onActionAddTile(int tabId) void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex) { - QModelIndex &tile128Idx = newIndex.child(0,0); - QModelIndex &tile256Idx = newIndex.child(1,0); - QModelIndex &tileTransIdx = newIndex.child(2,0); - QModelIndex &tileDispIdx = newIndex.child(3,0); + const QModelIndex &tile128Idx = newIndex.child(0,0); + const QModelIndex &tile256Idx = newIndex.child(1,0); + const QModelIndex &tileTransIdx = newIndex.child(2,0); + const QModelIndex &tileDispIdx = newIndex.child(3,0); m_ui->listView128->setRootIndex(tile128Idx); m_ui->listView256->setRootIndex(tile256Idx); m_ui->listViewTransition->setRootIndex(tileTransIdx); m_ui->listViewDisplacement->setRootIndex(tileDispIdx); -} \ No newline at end of file +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h index 692d1ee65..140f60555 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/tile_editor/tile_model.h @@ -28,8 +28,8 @@ class TileModel : public QAbstractItemModel Q_OBJECT public: - TileModel::TileModel(const QStringList &headers, QObject *parent); - ~TileModel(); + TileModel(const QStringList &headers, QObject *parent); + ~TileModel(); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const;