fixing minor issues

openmw-30
Marek Kochanowicz 11 years ago
parent 9e01a54d72
commit 57131332f4

@ -27,7 +27,6 @@ namespace CSMWorld
enum Display
{
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_LongString,

@ -1,6 +1,9 @@
#include "tablemimedata.hpp"
#include <string>
#include <QDebug>
#include "universalid.hpp"
#include "columnbase.hpp"
@ -33,7 +36,8 @@ std::string CSMWorld::TableMimeData::getIcon() const
{
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;
@ -50,7 +54,7 @@ std::string CSMWorld::TableMimeData::getIcon() const
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();
@ -360,8 +364,6 @@ CSMWorld::UniversalId::Type CSMWorld::TableMimeData::convertEnums (CSMWorld::Col
case CSMWorld::ColumnBase::Display_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:
return CSMWorld::UniversalId::Type_None;
@ -377,10 +379,6 @@ CSMWorld::ColumnBase::Display CSMWorld::TableMimeData::convertEnums (CSMWorld::U
return CSMWorld::ColumnBase::Display_Race;
case CSMWorld::UniversalId::Type_Cell_Missing:
return CSMWorld::ColumnBase::Display_Cell_Missing;
case CSMWorld::UniversalId::Type_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
{
return &mDocument;
}
}

@ -56,6 +56,7 @@ namespace CSMWorld
UniversalId returnMatching(CSMWorld::ColumnBase::Display type) const;
static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
static CSMWorld::ColumnBase::Display convertEnums(CSMWorld::UniversalId::Type type);
private:

@ -5,8 +5,6 @@
#include <qt4/QtGui/qevent.h>
#include <boost/algorithm/string.hpp>
#include <apps/opencs/model/world/tablemimedata.hpp>
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
{
QString id(QString::fromUtf8(record.c_str()));
id.remove(0,1);
QStringList splited(id.split(' ')); //Well, this is the simplest approach
int x = splited.begin()->toInt();
int y = (splited.begin()+1)->toInt();
std::istringstream stream (record.c_str());
char ignore;
stream >> ignore;
char ignore1; // : or ;
char ignore2; // #
int x, y;
stream >> ignore1 >> ignore2 >> x >> y;
return std::make_pair(x, y);
}

@ -5,7 +5,7 @@
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)
{

@ -28,9 +28,9 @@ namespace CSVWorld
public:
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:
void startDrag(const DragRecordTable& table);

@ -348,7 +348,7 @@ void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
startDrag(*this);
}
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDragedRecords() const
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() const
{
QModelIndexList selected(getSelectedCells(true, false));
std::vector<CSMWorld::UniversalId> ids;

@ -63,7 +63,7 @@ namespace CSVWorld
RegionMap (const CSMWorld::UniversalId& universalId, CSMDoc::Document& document,
QWidget *parent = 0);
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const;
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
signals:

@ -561,7 +561,7 @@ std::vector<std::string> CSVWorld::Table::getColumnsWithDisplay(CSMWorld::Column
return titles;
}
std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDragedRecords() const
std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDraggedRecords() const
{
QModelIndexList selectedRows = selectionModel()->selectedRows();

@ -76,7 +76,7 @@ namespace CSVWorld
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:

Loading…
Cancel
Save