Line endings...
This commit is contained in:
parent
ab2e54a3c8
commit
2ddd7e1035
4 changed files with 101 additions and 101 deletions
|
@ -1,17 +1,17 @@
|
||||||
// Ryzom Core Studio - Tile Editor plugin
|
// Ryzom Core Studio - Tile Editor plugin
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -307,11 +307,11 @@ QVariant TileItemNode::data(int column, int role) const
|
||||||
// Retrieve the target tile size.
|
// Retrieve the target tile size.
|
||||||
uint32 tileSize = TileModel::getTileTypeSize(parent->getTileType());
|
uint32 tileSize = TileModel::getTileTypeSize(parent->getTileType());
|
||||||
|
|
||||||
if(tileFilename.isEmpty() || tileFilename == "empty")
|
if(tileFilename.isEmpty() || tileFilename == "empty")
|
||||||
tileFilename = ":/placeHolder/images/empty_image.png";
|
tileFilename = ":/placeHolder/images/empty_image.png";
|
||||||
|
|
||||||
QPixmap pixmap;// = new QPixmap();
|
QPixmap pixmap;// = new QPixmap();
|
||||||
if(!pixmap.load(tileFilename))
|
if(!pixmap.load(tileFilename))
|
||||||
nlinfo("failed to load %s", tileFilename.toAscii().data());
|
nlinfo("failed to load %s", tileFilename.toAscii().data());
|
||||||
|
|
||||||
if(TileModel::CurrentZoomFactor == TileModel::TileZoom200)
|
if(TileModel::CurrentZoomFactor == TileModel::TileZoom200)
|
||||||
|
|
|
@ -12,44 +12,44 @@
|
||||||
// GNU Affero General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef TILE_ITEM_DELEGATE_H
|
#ifndef TILE_ITEM_DELEGATE_H
|
||||||
#define TILE_ITEM_DELEGATE_H
|
#define TILE_ITEM_DELEGATE_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
class TileItemDelegate : public QStyledItemDelegate
|
class TileItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum TZoomFactor
|
enum TZoomFactor
|
||||||
{
|
{
|
||||||
ZoomSmall = 0,
|
ZoomSmall = 0,
|
||||||
ZoomNormal = 1,
|
ZoomNormal = 1,
|
||||||
ZoomLarge = 2
|
ZoomLarge = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int PIXMAP_MARGIN = 5;
|
static const int PIXMAP_MARGIN = 5;
|
||||||
|
|
||||||
TileItemDelegate();
|
TileItemDelegate();
|
||||||
virtual ~TileItemDelegate();
|
virtual ~TileItemDelegate();
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
|
||||||
|
|
||||||
TZoomFactor getZoomFactor();
|
TZoomFactor getZoomFactor();
|
||||||
void setZoomFactor(TZoomFactor zoomFactor);
|
void setZoomFactor(TZoomFactor zoomFactor);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void currentTab(int index);
|
void currentTab(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TZoomFactor m_zoomFactor;
|
TZoomFactor m_zoomFactor;
|
||||||
int m_imageHint;
|
int m_imageHint;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TILE_ITEM_DELEGATE_H
|
#endif // TILE_ITEM_DELEGATE_H
|
||||||
|
|
|
@ -24,22 +24,22 @@
|
||||||
// Initialize the static members
|
// Initialize the static members
|
||||||
TileModel::TTileZoomFactor TileModel::CurrentZoomFactor;
|
TileModel::TTileZoomFactor TileModel::CurrentZoomFactor;
|
||||||
|
|
||||||
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
QVector<QVariant> rootData;
|
QVector<QVariant> rootData;
|
||||||
Q_FOREACH(QString header, headers)
|
Q_FOREACH(QString header, headers)
|
||||||
rootData << header;
|
rootData << header;
|
||||||
|
|
||||||
rootItem = new Node(rootData);
|
rootItem = new Node(rootData);
|
||||||
|
|
||||||
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
||||||
m_indexDisplay = true;
|
m_indexDisplay = true;
|
||||||
m_fileDisplay = true;
|
m_fileDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileModel::~TileModel()
|
TileModel::~TileModel()
|
||||||
{
|
{
|
||||||
delete rootItem;
|
delete rootItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *TileModel::getItem(const QModelIndex &index) const
|
Node *TileModel::getItem(const QModelIndex &index) const
|
||||||
|
@ -92,33 +92,33 @@ int TileModel::columnCount(const QModelIndex &parent) const
|
||||||
return parentItem->columnCount();
|
return parentItem->columnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant TileModel::data(const QModelIndex &index, int role) const
|
QVariant TileModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
Node *item = static_cast<Node*>(index.internalPointer());
|
Node *item = static_cast<Node*>(index.internalPointer());
|
||||||
|
|
||||||
// Translate the display role to the settings-specific role.
|
// Translate the display role to the settings-specific role.
|
||||||
|
|
||||||
if(role == Qt::DisplayRole)
|
if(role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
if(m_indexDisplay && m_fileDisplay)
|
if(m_indexDisplay && m_fileDisplay)
|
||||||
role = TileFilenameIndexRole;
|
role = TileFilenameIndexRole;
|
||||||
else if(m_fileDisplay)
|
else if(m_fileDisplay)
|
||||||
role = TileFilenameRole;
|
role = TileFilenameRole;
|
||||||
else if(m_indexDisplay)
|
else if(m_indexDisplay)
|
||||||
role = TileIndexRole;
|
role = TileIndexRole;
|
||||||
}
|
}
|
||||||
return item->data(index.column(), role);
|
return item->data(index.column(), role);
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
return Qt::ItemIsEnabled;
|
return Qt::ItemIsEnabled;
|
||||||
|
|
||||||
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
|
|
Loading…
Reference in a new issue