mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
fixing minor issues
This commit is contained in:
parent
9e01a54d72
commit
57131332f4
@ -27,7 +27,6 @@ namespace CSMWorld
|
|||||||
enum Display
|
enum Display
|
||||||
{
|
{
|
||||||
Display_None, //Do not use
|
Display_None, //Do not use
|
||||||
Display_Cell_Missing, //Do not used, actually. It is here to simplify dragging non-existed cells handling
|
|
||||||
Display_String,
|
Display_String,
|
||||||
Display_LongString,
|
Display_LongString,
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "tablemimedata.hpp"
|
#include "tablemimedata.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
#include "columnbase.hpp"
|
#include "columnbase.hpp"
|
||||||
|
|
||||||
@ -33,7 +36,8 @@ std::string CSMWorld::TableMimeData::getIcon() const
|
|||||||
{
|
{
|
||||||
if (mUniversalId.empty())
|
if (mUniversalId.empty())
|
||||||
{
|
{
|
||||||
return "";
|
qDebug()<<"TableMimeData object does not hold any records!"; //because throwing in the event loop tends to be problematic
|
||||||
|
throw("TableMimeData object does not hold any records!");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tmpIcon;
|
std::string tmpIcon;
|
||||||
@ -50,7 +54,7 @@ std::string CSMWorld::TableMimeData::getIcon() const
|
|||||||
|
|
||||||
if (tmpIcon != mUniversalId[i].getIcon())
|
if (tmpIcon != mUniversalId[i].getIcon())
|
||||||
{
|
{
|
||||||
return ":/multitype.png"; //icon stolen from gnome
|
return ":/multitype.png"; //icon stolen from gnome TODO: get new icon
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpIcon = mUniversalId[i].getIcon();
|
tmpIcon = mUniversalId[i].getIcon();
|
||||||
@ -360,8 +364,6 @@ CSMWorld::UniversalId::Type CSMWorld::TableMimeData::convertEnums (CSMWorld::Col
|
|||||||
case CSMWorld::ColumnBase::Display_Script:
|
case CSMWorld::ColumnBase::Display_Script:
|
||||||
return CSMWorld::UniversalId::Type_Script;
|
return CSMWorld::UniversalId::Type_Script;
|
||||||
|
|
||||||
case CSMWorld::ColumnBase::Display_Cell_Missing:
|
|
||||||
return CSMWorld::UniversalId::Type_Cell_Missing; //this one actually never happens, since there is no display_Cell_missing column anywhere.
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CSMWorld::UniversalId::Type_None;
|
return CSMWorld::UniversalId::Type_None;
|
||||||
@ -377,10 +379,6 @@ CSMWorld::ColumnBase::Display CSMWorld::TableMimeData::convertEnums (CSMWorld::U
|
|||||||
return CSMWorld::ColumnBase::Display_Race;
|
return CSMWorld::ColumnBase::Display_Race;
|
||||||
|
|
||||||
|
|
||||||
case CSMWorld::UniversalId::Type_Cell_Missing:
|
|
||||||
return CSMWorld::ColumnBase::Display_Cell_Missing;
|
|
||||||
|
|
||||||
|
|
||||||
case CSMWorld::UniversalId::Type_Skill:
|
case CSMWorld::UniversalId::Type_Skill:
|
||||||
return CSMWorld::ColumnBase::Display_Skill;
|
return CSMWorld::ColumnBase::Display_Skill;
|
||||||
|
|
||||||
@ -537,4 +535,4 @@ CSMWorld::ColumnBase::Display CSMWorld::TableMimeData::convertEnums (CSMWorld::U
|
|||||||
const CSMDoc::Document* CSMWorld::TableMimeData::getDocumentPtr() const
|
const CSMDoc::Document* CSMWorld::TableMimeData::getDocumentPtr() const
|
||||||
{
|
{
|
||||||
return &mDocument;
|
return &mDocument;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ namespace CSMWorld
|
|||||||
UniversalId returnMatching(CSMWorld::ColumnBase::Display type) const;
|
UniversalId returnMatching(CSMWorld::ColumnBase::Display type) const;
|
||||||
|
|
||||||
static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
|
static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
|
||||||
|
|
||||||
static CSMWorld::ColumnBase::Display convertEnums(CSMWorld::UniversalId::Type type);
|
static CSMWorld::ColumnBase::Display convertEnums(CSMWorld::UniversalId::Type type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include <qt4/QtGui/qevent.h>
|
#include <qt4/QtGui/qevent.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
|
||||||
#include <apps/opencs/model/world/tablemimedata.hpp>
|
#include <apps/opencs/model/world/tablemimedata.hpp>
|
||||||
|
|
||||||
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget *parent, const CSMDoc::Document& document)
|
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget *parent, const CSMDoc::Document& document)
|
||||||
@ -89,11 +87,14 @@ void CSVRender::PagedWorldspaceWidget::dropEvent (QDropEvent* event)
|
|||||||
|
|
||||||
std::pair< int, int > CSVRender::PagedWorldspaceWidget::getCoordinatesFromId (const std::string& record) const
|
std::pair< int, int > CSVRender::PagedWorldspaceWidget::getCoordinatesFromId (const std::string& record) const
|
||||||
{
|
{
|
||||||
QString id(QString::fromUtf8(record.c_str()));
|
std::istringstream stream (record.c_str());
|
||||||
id.remove(0,1);
|
char ignore;
|
||||||
QStringList splited(id.split(' ')); //Well, this is the simplest approach
|
stream >> ignore;
|
||||||
int x = splited.begin()->toInt();
|
char ignore1; // : or ;
|
||||||
int y = (splited.begin()+1)->toInt();
|
char ignore2; // #
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
stream >> ignore1 >> ignore2 >> x >> y;
|
||||||
return std::make_pair(x, y);
|
return std::make_pair(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
void CSVWorld::DragRecordTable::startDrag (const CSVWorld::DragRecordTable& table)
|
void CSVWorld::DragRecordTable::startDrag (const CSVWorld::DragRecordTable& table)
|
||||||
{
|
{
|
||||||
CSMWorld::TableMimeData* mime = new CSMWorld::TableMimeData (table.getDragedRecords(), mDocument);
|
CSMWorld::TableMimeData* mime = new CSMWorld::TableMimeData (table.getDraggedRecords(), mDocument);
|
||||||
|
|
||||||
if (mime)
|
if (mime)
|
||||||
{
|
{
|
||||||
|
@ -28,9 +28,9 @@ namespace CSVWorld
|
|||||||
public:
|
public:
|
||||||
DragRecordTable(CSMDoc::Document& document, QWidget* parent = NULL);
|
DragRecordTable(CSMDoc::Document& document, QWidget* parent = NULL);
|
||||||
|
|
||||||
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const = 0;
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const = 0;
|
||||||
|
|
||||||
virtual void setEditLock(bool locked);
|
void setEditLock(bool locked);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void startDrag(const DragRecordTable& table);
|
void startDrag(const DragRecordTable& table);
|
||||||
|
@ -348,7 +348,7 @@ void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
|||||||
startDrag(*this);
|
startDrag(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDragedRecords() const
|
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() const
|
||||||
{
|
{
|
||||||
QModelIndexList selected(getSelectedCells(true, false));
|
QModelIndexList selected(getSelectedCells(true, false));
|
||||||
std::vector<CSMWorld::UniversalId> ids;
|
std::vector<CSMWorld::UniversalId> ids;
|
||||||
|
@ -63,7 +63,7 @@ namespace CSVWorld
|
|||||||
RegionMap (const CSMWorld::UniversalId& universalId, CSMDoc::Document& document,
|
RegionMap (const CSMWorld::UniversalId& universalId, CSMDoc::Document& document,
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
|
|
||||||
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const;
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ std::vector<std::string> CSVWorld::Table::getColumnsWithDisplay(CSMWorld::Column
|
|||||||
return titles;
|
return titles;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDragedRecords() const
|
std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDraggedRecords() const
|
||||||
{
|
{
|
||||||
|
|
||||||
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||||
|
@ -76,7 +76,7 @@ namespace CSVWorld
|
|||||||
|
|
||||||
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
||||||
|
|
||||||
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const;
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user