some fixes
This commit is contained in:
parent
d1a8b6602b
commit
4bf4bbea6a
8 changed files with 37 additions and 24 deletions
|
@ -12,7 +12,6 @@ enum CardItemType {
|
|||
typeCard = QGraphicsItem::UserType + 1,
|
||||
typeCardDrag = QGraphicsItem::UserType + 2,
|
||||
typeZone = QGraphicsItem::UserType + 3,
|
||||
typeZoneView = QGraphicsItem::UserType + 4,
|
||||
typeOther = QGraphicsItem::UserType + 5
|
||||
};
|
||||
|
||||
|
|
|
@ -19,14 +19,22 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
|
|||
CardZone *cardZone = 0;
|
||||
ZoneViewZone *zoneViewZone = 0;
|
||||
for (int i = colliding.size() - 1; i >= 0; i--) {
|
||||
if (!zoneViewZone) zoneViewZone = qgraphicsitem_cast<ZoneViewZone *>(colliding.at(i));
|
||||
if (!cardZone) cardZone = qgraphicsitem_cast<CardZone *>(colliding.at(i));
|
||||
CardZone *temp = qgraphicsitem_cast<CardZone *>(colliding.at(i));
|
||||
if (temp)
|
||||
qDebug() << "zone name:" << temp->getName();
|
||||
if (!cardZone)
|
||||
cardZone = temp;
|
||||
if (!zoneViewZone)
|
||||
zoneViewZone = qobject_cast<ZoneViewZone *>(temp);
|
||||
}
|
||||
CardZone *cursorZone = 0;
|
||||
if (zoneViewZone)
|
||||
if (zoneViewZone) {
|
||||
qDebug() << "zv found";
|
||||
cursorZone = zoneViewZone;
|
||||
else if (cardZone)
|
||||
} else if (cardZone) {
|
||||
qDebug() << "normal found";
|
||||
cursorZone = cardZone;
|
||||
}
|
||||
if (!cursorZone)
|
||||
return;
|
||||
currentZone = cursorZone;
|
||||
|
|
|
@ -70,14 +70,14 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||
AbstractCardItem::paint(painter, option, widget);
|
||||
|
||||
painter->save();
|
||||
QPen pen(Qt::DotLine);
|
||||
pen.setWidth(2);
|
||||
QPen pen;//(Qt::DotLine);
|
||||
pen.setWidth(3);
|
||||
if (originZone == "main")
|
||||
pen.setColor(QColor(0, 255, 0));
|
||||
else
|
||||
pen.setColor(QColor(255, 255, 0));
|
||||
pen.setColor(QColor(255, 0, 0));
|
||||
painter->setPen(pen);
|
||||
painter->drawRect(QRectF(1, 1, CARD_WIDTH - 2, CARD_HEIGHT - 2));
|
||||
painter->drawRect(QRectF(1.5, 1.5, CARD_WIDTH - 3, CARD_HEIGHT - 3));
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@ RemoteDeckList_TreeModel::FileNode *RemoteDeckList_TreeModel::DirectoryNode::get
|
|||
RemoteDeckList_TreeModel::RemoteDeckList_TreeModel(Client *_client, QObject *parent)
|
||||
: QAbstractItemModel(parent), client(_client)
|
||||
{
|
||||
QFileIconProvider fip;
|
||||
dirIcon = fip.icon(QFileIconProvider::Folder);
|
||||
fileIcon = fip.icon(QFileIconProvider::File);
|
||||
|
||||
root = new DirectoryNode;
|
||||
refreshTree();
|
||||
}
|
||||
|
@ -118,7 +122,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
|
|||
}
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
return index.column() == 0 ? QFileIconProvider().icon(QFileIconProvider::Folder) : QVariant();
|
||||
return index.column() == 0 ? dirIcon : QVariant();
|
||||
default: return QVariant();
|
||||
}
|
||||
} else {
|
||||
|
@ -133,7 +137,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
|
|||
}
|
||||
}
|
||||
case Qt::DecorationRole:
|
||||
return index.column() == 0 ? QFileIconProvider().icon(QFileIconProvider::File) : QVariant();
|
||||
return index.column() == 0 ? fileIcon : QVariant();
|
||||
case Qt::TextAlignmentRole:
|
||||
return index.column() == 1 ? Qt::AlignRight : Qt::AlignLeft;
|
||||
default: return QVariant();
|
||||
|
|
|
@ -58,6 +58,8 @@ private:
|
|||
Client *client;
|
||||
DirectoryNode *root;
|
||||
|
||||
QIcon fileIcon, dirIcon;
|
||||
|
||||
QModelIndex nodeToIndex(Node *node) const;
|
||||
signals:
|
||||
void treeRefreshed();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
SettingsCache::SettingsCache()
|
||||
{
|
||||
settings = new QSettings;
|
||||
settings = new QSettings(this);
|
||||
|
||||
lang = settings->value("personal/lang").toString();
|
||||
|
||||
|
@ -15,9 +15,12 @@ SettingsCache::SettingsCache()
|
|||
tableBgPath = settings->value("zonebg/table").toString();
|
||||
playerBgPath = settings->value("zonebg/playerarea").toString();
|
||||
|
||||
picDownload = settings->value("personal/picturedownload", 0).toInt();
|
||||
doubleClickToPlay = settings->value("interface/doubleclicktoplay", 1).toInt();
|
||||
economicGrid = settings->value("table/economic", 0).toInt();
|
||||
picDownload = settings->value("personal/picturedownload", false).toBool();
|
||||
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
||||
economicGrid = settings->value("table/economic", false).toBool();
|
||||
|
||||
zoneViewSortByName = settings->value("zoneview/sortbyname", false).toBool();
|
||||
zoneViewSortByType = settings->value("zoneview/sortbytype", false).toBool();
|
||||
}
|
||||
|
||||
void SettingsCache::setLang(const QString &_lang)
|
||||
|
|
|
@ -18,17 +18,14 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
|
|||
setFont(font);
|
||||
|
||||
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
|
||||
setLayout(vbox);
|
||||
|
||||
if (numberCards == -1) {
|
||||
sortByNameCheckBox = new QCheckBox;
|
||||
sortByNameCheckBox->setChecked(settingsCache->getZoneViewSortByName());
|
||||
QGraphicsProxyWidget *sortByNameProxy = new QGraphicsProxyWidget;
|
||||
sortByNameProxy->setWidget(sortByNameCheckBox);
|
||||
vbox->addItem(sortByNameProxy);
|
||||
|
||||
sortByTypeCheckBox = new QCheckBox;
|
||||
sortByTypeCheckBox->setChecked(settingsCache->getZoneViewSortByType());
|
||||
QGraphicsProxyWidget *sortByTypeProxy = new QGraphicsProxyWidget;
|
||||
sortByTypeProxy->setWidget(sortByTypeCheckBox);
|
||||
vbox->addItem(sortByTypeProxy);
|
||||
|
@ -58,8 +55,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
|
|||
if (sortByNameCheckBox) {
|
||||
connect(sortByNameCheckBox, SIGNAL(stateChanged(int)), zone, SLOT(setSortByName(int)));
|
||||
connect(sortByTypeCheckBox, SIGNAL(stateChanged(int)), zone, SLOT(setSortByType(int)));
|
||||
sortByNameCheckBox->setChecked(settingsCache->getZoneViewSortByName());
|
||||
sortByTypeCheckBox->setChecked(settingsCache->getZoneViewSortByType());
|
||||
}
|
||||
|
||||
setLayout(vbox);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
|
@ -77,12 +77,11 @@ void ZoneViewWidget::retranslateUi()
|
|||
void ZoneViewWidget::resizeToZoneContents()
|
||||
{
|
||||
QRectF zoneRect = zone->getOptimumRect();
|
||||
qDebug() << "resizeToZone: w=" << zoneRect.width() << "h=" << zoneRect.height();
|
||||
qDebug() << "maxW=" << maximumWidth() << "maxH=" << maximumHeight();
|
||||
QSizeF newSize(zoneRect.width() + 10, zoneRect.height() + extraHeight);
|
||||
QSizeF newSize(zoneRect.width() + 10, zoneRect.height() + extraHeight + 10);
|
||||
setMaximumSize(newSize);
|
||||
resize(newSize);
|
||||
qDebug() << "w=" << size().width() << "h=" << size().height();
|
||||
if (layout())
|
||||
layout()->invalidate();
|
||||
}
|
||||
|
||||
void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
||||
|
|
|
@ -16,8 +16,6 @@ private:
|
|||
CardZone *origZone;
|
||||
bool sortByName, sortByType;
|
||||
public:
|
||||
enum { Type = typeZoneView };
|
||||
int type() const { return Type; }
|
||||
ZoneViewZone(Player *_p, CardZone *_origZone, int _numberCards = -1, QGraphicsItem *parent = 0);
|
||||
~ZoneViewZone();
|
||||
QRectF boundingRect() const;
|
||||
|
|
Loading…
Reference in a new issue