Implemented the GUI part of saving...
This commit is contained in:
parent
2f9b4f1b5e
commit
d3698a5c1a
5 changed files with 140 additions and 0 deletions
|
@ -32,6 +32,8 @@
|
|||
#include "tile_item.h"
|
||||
#include "tile_item_delegate.h"
|
||||
|
||||
#include "tilebank_saver.h"
|
||||
|
||||
TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
m_ui(new Ui::TileEditorMainWindow)
|
||||
|
@ -142,6 +144,14 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
|||
connect(m_ui->actionZoom200, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map()));
|
||||
m_zoomSignalMapper->setMapping(m_ui->actionZoom200, 2);
|
||||
connect(m_zoomSignalMapper, SIGNAL(mapped(int)), this, SLOT(onZoomFactor(int)));
|
||||
|
||||
QAction *saveAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE );
|
||||
saveAction->setEnabled( true );
|
||||
QAction *saveAsAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE_AS );
|
||||
saveAsAction->setEnabled( true );
|
||||
|
||||
connect( m_ui->actionSaveTileBank, SIGNAL( triggered() ), this, SLOT( save() ) );
|
||||
connect( m_ui->actionSaveTileBankAs, SIGNAL( triggered() ), this, SLOT( saveAs() ) );
|
||||
}
|
||||
|
||||
TileEditorMainWindow::~TileEditorMainWindow()
|
||||
|
@ -161,6 +171,45 @@ TileEditorMainWindow::~TileEditorMainWindow()
|
|||
m_tileModels.clear();
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::save()
|
||||
{
|
||||
saveAs();
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::saveAs()
|
||||
{
|
||||
if( m_fileName.isEmpty() )
|
||||
{
|
||||
m_fileName = QFileDialog::getSaveFileName( this,
|
||||
tr( "Save TileBank as..." ),
|
||||
"",
|
||||
tr( "TileBank files (*.tilebank)" ) );
|
||||
|
||||
if( m_fileName.isEmpty() )
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
QList< QString > landNames;
|
||||
|
||||
int c = m_ui->landLW->count();
|
||||
for( int i = 0; i < c; i++ )
|
||||
{
|
||||
QListWidgetItem *item = m_ui->landLW->item( i );
|
||||
landNames.push_back( item->text() );
|
||||
}
|
||||
|
||||
TileBankSaver saver;
|
||||
bool ok = saver.save( m_fileName.toUtf8().constData(), m_tileModels, landNames );
|
||||
|
||||
if( !ok )
|
||||
{
|
||||
QMessageBox::critical( this,
|
||||
tr( "Saving tilebank" ),
|
||||
tr( "Failed to save tilebank :(" ) );
|
||||
}
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onZoomFactor(int level)
|
||||
{
|
||||
int tile128Scaled=TileModel::TILE_128_BASE_SIZE;
|
||||
|
|
|
@ -42,6 +42,10 @@ public:
|
|||
|
||||
QUndoStack *getUndoStack() { return m_undoStack; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void save();
|
||||
void saveAs();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onActionAddTile(bool triggered);
|
||||
void onActionDeleteTile(bool triggered);
|
||||
|
@ -102,6 +106,8 @@ private:
|
|||
TAB_DISPLACEMENT = 3,
|
||||
TAB_DETAILS = 4
|
||||
};
|
||||
|
||||
QString m_fileName;
|
||||
};
|
||||
|
||||
#endif // TILE_EDITOR_MAIN_WINDOW_H
|
||||
|
|
|
@ -95,6 +95,16 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void save()
|
||||
{
|
||||
m_tileEditorMainWindow->save();
|
||||
}
|
||||
|
||||
void saveAs()
|
||||
{
|
||||
m_tileEditorMainWindow->saveAs();
|
||||
}
|
||||
|
||||
virtual QWidget *widget()
|
||||
{
|
||||
return m_tileEditorMainWindow;
|
||||
|
|
37
code/studio/src/plugins/tile_editor/tilebank_saver.cpp
Normal file
37
code/studio/src/plugins/tile_editor/tilebank_saver.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Ryzom Core Studio - Tile Editor plugin
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "tilebank_saver.h"
|
||||
#include "tile_model.h"
|
||||
|
||||
#include "nel/3d/tile_bank.h"
|
||||
|
||||
TileBankSaver::TileBankSaver()
|
||||
{
|
||||
}
|
||||
|
||||
TileBankSaver::~TileBankSaver()
|
||||
{
|
||||
}
|
||||
|
||||
bool TileBankSaver::save( const char *fileName, const QList< TileModel* > &models, const QList< QString > &lands )
|
||||
{
|
||||
NL3D::CTileBank bank;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
38
code/studio/src/plugins/tile_editor/tilebank_saver.h
Normal file
38
code/studio/src/plugins/tile_editor/tilebank_saver.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Ryzom Core Studio - Tile Editor plugin
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef TILEBANK_SAVER_H
|
||||
#define TILEBANK_SAVER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
class TileModel;
|
||||
|
||||
class TileBankSaver
|
||||
{
|
||||
public:
|
||||
TileBankSaver();
|
||||
~TileBankSaver();
|
||||
|
||||
bool save( const char *filename, const QList< TileModel* > &models, const QList< QString > &lands );
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in a new issue