mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
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
|
||||
// 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
|
||||
// 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/>.
|
||||
|
||||
|
||||
|
|
|
@ -307,11 +307,11 @@ QVariant TileItemNode::data(int column, int role) const
|
|||
// Retrieve the target tile size.
|
||||
uint32 tileSize = TileModel::getTileTypeSize(parent->getTileType());
|
||||
|
||||
if(tileFilename.isEmpty() || tileFilename == "empty")
|
||||
tileFilename = ":/placeHolder/images/empty_image.png";
|
||||
|
||||
QPixmap pixmap;// = new QPixmap();
|
||||
if(!pixmap.load(tileFilename))
|
||||
if(tileFilename.isEmpty() || tileFilename == "empty")
|
||||
tileFilename = ":/placeHolder/images/empty_image.png";
|
||||
|
||||
QPixmap pixmap;// = new QPixmap();
|
||||
if(!pixmap.load(tileFilename))
|
||||
nlinfo("failed to load %s", tileFilename.toAscii().data());
|
||||
|
||||
if(TileModel::CurrentZoomFactor == TileModel::TileZoom200)
|
||||
|
|
|
@ -12,44 +12,44 @@
|
|||
// 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 TILE_ITEM_DELEGATE_H
|
||||
#define TILE_ITEM_DELEGATE_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
class TileItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
|
||||
enum TZoomFactor
|
||||
{
|
||||
ZoomSmall = 0,
|
||||
ZoomNormal = 1,
|
||||
ZoomLarge = 2
|
||||
};
|
||||
|
||||
static const int PIXMAP_MARGIN = 5;
|
||||
|
||||
TileItemDelegate();
|
||||
virtual ~TileItemDelegate();
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
|
||||
|
||||
TZoomFactor getZoomFactor();
|
||||
void setZoomFactor(TZoomFactor zoomFactor);
|
||||
|
||||
public Q_SLOTS:
|
||||
void currentTab(int index);
|
||||
|
||||
private:
|
||||
TZoomFactor m_zoomFactor;
|
||||
int m_imageHint;
|
||||
};
|
||||
|
||||
#endif // TILE_ITEM_DELEGATE_H
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifndef TILE_ITEM_DELEGATE_H
|
||||
#define TILE_ITEM_DELEGATE_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
class TileItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
|
||||
enum TZoomFactor
|
||||
{
|
||||
ZoomSmall = 0,
|
||||
ZoomNormal = 1,
|
||||
ZoomLarge = 2
|
||||
};
|
||||
|
||||
static const int PIXMAP_MARGIN = 5;
|
||||
|
||||
TileItemDelegate();
|
||||
virtual ~TileItemDelegate();
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const;
|
||||
|
||||
TZoomFactor getZoomFactor();
|
||||
void setZoomFactor(TZoomFactor zoomFactor);
|
||||
|
||||
public Q_SLOTS:
|
||||
void currentTab(int index);
|
||||
|
||||
private:
|
||||
TZoomFactor m_zoomFactor;
|
||||
int m_imageHint;
|
||||
};
|
||||
|
||||
#endif // TILE_ITEM_DELEGATE_H
|
||||
|
|
|
@ -24,22 +24,22 @@
|
|||
// Initialize the static members
|
||||
TileModel::TTileZoomFactor TileModel::CurrentZoomFactor;
|
||||
|
||||
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
||||
{
|
||||
QVector<QVariant> rootData;
|
||||
Q_FOREACH(QString header, headers)
|
||||
rootData << header;
|
||||
|
||||
rootItem = new Node(rootData);
|
||||
|
||||
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
||||
m_indexDisplay = true;
|
||||
m_fileDisplay = true;
|
||||
}
|
||||
|
||||
TileModel::~TileModel()
|
||||
{
|
||||
delete rootItem;
|
||||
TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent)
|
||||
{
|
||||
QVector<QVariant> rootData;
|
||||
Q_FOREACH(QString header, headers)
|
||||
rootData << header;
|
||||
|
||||
rootItem = new Node(rootData);
|
||||
|
||||
TileModel::CurrentZoomFactor = TileModel::TileZoom100;
|
||||
m_indexDisplay = true;
|
||||
m_fileDisplay = true;
|
||||
}
|
||||
|
||||
TileModel::~TileModel()
|
||||
{
|
||||
delete rootItem;
|
||||
}
|
||||
|
||||
Node *TileModel::getItem(const QModelIndex &index) const
|
||||
|
@ -92,33 +92,33 @@ int TileModel::columnCount(const QModelIndex &parent) const
|
|||
return parentItem->columnCount();
|
||||
}
|
||||
|
||||
QVariant TileModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
Node *item = static_cast<Node*>(index.internalPointer());
|
||||
|
||||
// Translate the display role to the settings-specific role.
|
||||
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if(m_indexDisplay && m_fileDisplay)
|
||||
role = TileFilenameIndexRole;
|
||||
else if(m_fileDisplay)
|
||||
role = TileFilenameRole;
|
||||
else if(m_indexDisplay)
|
||||
role = TileIndexRole;
|
||||
}
|
||||
return item->data(index.column(), role);
|
||||
QVariant TileModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
Node *item = static_cast<Node*>(index.internalPointer());
|
||||
|
||||
// Translate the display role to the settings-specific role.
|
||||
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if(m_indexDisplay && m_fileDisplay)
|
||||
role = TileFilenameIndexRole;
|
||||
else if(m_fileDisplay)
|
||||
role = TileFilenameRole;
|
||||
else if(m_indexDisplay)
|
||||
role = TileIndexRole;
|
||||
}
|
||||
return item->data(index.column(), role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return Qt::ItemIsEnabled;
|
||||
|
||||
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
||||
Qt::ItemFlags TileModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return Qt::ItemIsEnabled;
|
||||
|
||||
return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
|
|
Loading…
Reference in a new issue