Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
4bf4bbea
Commit
4bf4bbea
authored
Mar 08, 2010
by
Max-Wilhelm Bruker
Browse files
some fixes
parent
d1a8b660
Changes
8
Show whitespace changes
Inline
Side-by-side
cockatrice/src/abstractcarditem.h
View file @
4bf4bbea
...
@@ -12,7 +12,6 @@ enum CardItemType {
...
@@ -12,7 +12,6 @@ enum CardItemType {
typeCard
=
QGraphicsItem
::
UserType
+
1
,
typeCard
=
QGraphicsItem
::
UserType
+
1
,
typeCardDrag
=
QGraphicsItem
::
UserType
+
2
,
typeCardDrag
=
QGraphicsItem
::
UserType
+
2
,
typeZone
=
QGraphicsItem
::
UserType
+
3
,
typeZone
=
QGraphicsItem
::
UserType
+
3
,
typeZoneView
=
QGraphicsItem
::
UserType
+
4
,
typeOther
=
QGraphicsItem
::
UserType
+
5
typeOther
=
QGraphicsItem
::
UserType
+
5
};
};
...
...
cockatrice/src/carddragitem.cpp
View file @
4bf4bbea
...
@@ -19,14 +19,22 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
...
@@ -19,14 +19,22 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
CardZone
*
cardZone
=
0
;
CardZone
*
cardZone
=
0
;
ZoneViewZone
*
zoneViewZone
=
0
;
ZoneViewZone
*
zoneViewZone
=
0
;
for
(
int
i
=
colliding
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
for
(
int
i
=
colliding
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
if
(
!
zoneViewZone
)
zoneViewZone
=
qgraphicsitem_cast
<
ZoneViewZone
*>
(
colliding
.
at
(
i
));
CardZone
*
temp
=
qgraphicsitem_cast
<
CardZone
*>
(
colliding
.
at
(
i
));
if
(
!
cardZone
)
cardZone
=
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
;
CardZone
*
cursorZone
=
0
;
if
(
zoneViewZone
)
if
(
zoneViewZone
)
{
qDebug
()
<<
"zv found"
;
cursorZone
=
zoneViewZone
;
cursorZone
=
zoneViewZone
;
else
if
(
cardZone
)
}
else
if
(
cardZone
)
{
qDebug
()
<<
"normal found"
;
cursorZone
=
cardZone
;
cursorZone
=
cardZone
;
}
if
(
!
cursorZone
)
if
(
!
cursorZone
)
return
;
return
;
currentZone
=
cursorZone
;
currentZone
=
cursorZone
;
...
...
cockatrice/src/deckview.cpp
View file @
4bf4bbea
...
@@ -70,14 +70,14 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
...
@@ -70,14 +70,14 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
AbstractCardItem
::
paint
(
painter
,
option
,
widget
);
AbstractCardItem
::
paint
(
painter
,
option
,
widget
);
painter
->
save
();
painter
->
save
();
QPen
pen
(
Qt
::
DotLine
);
QPen
pen
;
//
(Qt::DotLine);
pen
.
setWidth
(
2
);
pen
.
setWidth
(
3
);
if
(
originZone
==
"main"
)
if
(
originZone
==
"main"
)
pen
.
setColor
(
QColor
(
0
,
255
,
0
));
pen
.
setColor
(
QColor
(
0
,
255
,
0
));
else
else
pen
.
setColor
(
QColor
(
255
,
255
,
0
));
pen
.
setColor
(
QColor
(
255
,
0
,
0
));
painter
->
setPen
(
pen
);
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
();
painter
->
restore
();
}
}
...
...
cockatrice/src/remotedecklist_treewidget.cpp
View file @
4bf4bbea
...
@@ -75,6 +75,10 @@ RemoteDeckList_TreeModel::FileNode *RemoteDeckList_TreeModel::DirectoryNode::get
...
@@ -75,6 +75,10 @@ RemoteDeckList_TreeModel::FileNode *RemoteDeckList_TreeModel::DirectoryNode::get
RemoteDeckList_TreeModel
::
RemoteDeckList_TreeModel
(
Client
*
_client
,
QObject
*
parent
)
RemoteDeckList_TreeModel
::
RemoteDeckList_TreeModel
(
Client
*
_client
,
QObject
*
parent
)
:
QAbstractItemModel
(
parent
),
client
(
_client
)
:
QAbstractItemModel
(
parent
),
client
(
_client
)
{
{
QFileIconProvider
fip
;
dirIcon
=
fip
.
icon
(
QFileIconProvider
::
Folder
);
fileIcon
=
fip
.
icon
(
QFileIconProvider
::
File
);
root
=
new
DirectoryNode
;
root
=
new
DirectoryNode
;
refreshTree
();
refreshTree
();
}
}
...
@@ -118,7 +122,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
...
@@ -118,7 +122,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
}
}
}
}
case
Qt
::
DecorationRole
:
case
Qt
::
DecorationRole
:
return
index
.
column
()
==
0
?
QFileIconProvider
().
icon
(
QFileIconProvider
::
Folder
)
:
QVariant
();
return
index
.
column
()
==
0
?
dirIcon
:
QVariant
();
default:
return
QVariant
();
default:
return
QVariant
();
}
}
}
else
{
}
else
{
...
@@ -133,7 +137,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
...
@@ -133,7 +137,7 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
}
}
}
}
case
Qt
::
DecorationRole
:
case
Qt
::
DecorationRole
:
return
index
.
column
()
==
0
?
QF
ileIcon
Provider
().
icon
(
QFileIconProvider
::
File
)
:
QVariant
();
return
index
.
column
()
==
0
?
f
ileIcon
:
QVariant
();
case
Qt
::
TextAlignmentRole
:
case
Qt
::
TextAlignmentRole
:
return
index
.
column
()
==
1
?
Qt
::
AlignRight
:
Qt
::
AlignLeft
;
return
index
.
column
()
==
1
?
Qt
::
AlignRight
:
Qt
::
AlignLeft
;
default:
return
QVariant
();
default:
return
QVariant
();
...
...
cockatrice/src/remotedecklist_treewidget.h
View file @
4bf4bbea
...
@@ -58,6 +58,8 @@ private:
...
@@ -58,6 +58,8 @@ private:
Client
*
client
;
Client
*
client
;
DirectoryNode
*
root
;
DirectoryNode
*
root
;
QIcon
fileIcon
,
dirIcon
;
QModelIndex
nodeToIndex
(
Node
*
node
)
const
;
QModelIndex
nodeToIndex
(
Node
*
node
)
const
;
signals:
signals:
void
treeRefreshed
();
void
treeRefreshed
();
...
...
cockatrice/src/settingscache.cpp
View file @
4bf4bbea
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
SettingsCache
::
SettingsCache
()
SettingsCache
::
SettingsCache
()
{
{
settings
=
new
QSettings
;
settings
=
new
QSettings
(
this
)
;
lang
=
settings
->
value
(
"personal/lang"
).
toString
();
lang
=
settings
->
value
(
"personal/lang"
).
toString
();
...
@@ -15,9 +15,12 @@ SettingsCache::SettingsCache()
...
@@ -15,9 +15,12 @@ SettingsCache::SettingsCache()
tableBgPath
=
settings
->
value
(
"zonebg/table"
).
toString
();
tableBgPath
=
settings
->
value
(
"zonebg/table"
).
toString
();
playerBgPath
=
settings
->
value
(
"zonebg/playerarea"
).
toString
();
playerBgPath
=
settings
->
value
(
"zonebg/playerarea"
).
toString
();
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
0
).
toInt
();
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
false
).
toBool
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
1
).
toInt
();
doubleClickToPlay
=
settings
->
value
(
"interface/doubleclicktoplay"
,
true
).
toBool
();
economicGrid
=
settings
->
value
(
"table/economic"
,
0
).
toInt
();
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
)
void
SettingsCache
::
setLang
(
const
QString
&
_lang
)
...
...
cockatrice/src/zoneviewwidget.cpp
View file @
4bf4bbea
...
@@ -18,17 +18,14 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
...
@@ -18,17 +18,14 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
setFont
(
font
);
setFont
(
font
);
QGraphicsLinearLayout
*
vbox
=
new
QGraphicsLinearLayout
(
Qt
::
Vertical
);
QGraphicsLinearLayout
*
vbox
=
new
QGraphicsLinearLayout
(
Qt
::
Vertical
);
setLayout
(
vbox
);
if
(
numberCards
==
-
1
)
{
if
(
numberCards
==
-
1
)
{
sortByNameCheckBox
=
new
QCheckBox
;
sortByNameCheckBox
=
new
QCheckBox
;
sortByNameCheckBox
->
setChecked
(
settingsCache
->
getZoneViewSortByName
());
QGraphicsProxyWidget
*
sortByNameProxy
=
new
QGraphicsProxyWidget
;
QGraphicsProxyWidget
*
sortByNameProxy
=
new
QGraphicsProxyWidget
;
sortByNameProxy
->
setWidget
(
sortByNameCheckBox
);
sortByNameProxy
->
setWidget
(
sortByNameCheckBox
);
vbox
->
addItem
(
sortByNameProxy
);
vbox
->
addItem
(
sortByNameProxy
);
sortByTypeCheckBox
=
new
QCheckBox
;
sortByTypeCheckBox
=
new
QCheckBox
;
sortByTypeCheckBox
->
setChecked
(
settingsCache
->
getZoneViewSortByType
());
QGraphicsProxyWidget
*
sortByTypeProxy
=
new
QGraphicsProxyWidget
;
QGraphicsProxyWidget
*
sortByTypeProxy
=
new
QGraphicsProxyWidget
;
sortByTypeProxy
->
setWidget
(
sortByTypeCheckBox
);
sortByTypeProxy
->
setWidget
(
sortByTypeCheckBox
);
vbox
->
addItem
(
sortByTypeProxy
);
vbox
->
addItem
(
sortByTypeProxy
);
...
@@ -58,8 +55,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
...
@@ -58,8 +55,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC
if
(
sortByNameCheckBox
)
{
if
(
sortByNameCheckBox
)
{
connect
(
sortByNameCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
zone
,
SLOT
(
setSortByName
(
int
)));
connect
(
sortByNameCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
zone
,
SLOT
(
setSortByName
(
int
)));
connect
(
sortByTypeCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
zone
,
SLOT
(
setSortByType
(
int
)));
connect
(
sortByTypeCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
zone
,
SLOT
(
setSortByType
(
int
)));
sortByNameCheckBox
->
setChecked
(
settingsCache
->
getZoneViewSortByName
());
sortByTypeCheckBox
->
setChecked
(
settingsCache
->
getZoneViewSortByType
());
}
}
setLayout
(
vbox
);
retranslateUi
();
retranslateUi
();
}
}
...
@@ -77,12 +77,11 @@ void ZoneViewWidget::retranslateUi()
...
@@ -77,12 +77,11 @@ void ZoneViewWidget::retranslateUi()
void
ZoneViewWidget
::
resizeToZoneContents
()
void
ZoneViewWidget
::
resizeToZoneContents
()
{
{
QRectF
zoneRect
=
zone
->
getOptimumRect
();
QRectF
zoneRect
=
zone
->
getOptimumRect
();
qDebug
()
<<
"resizeToZone: w="
<<
zoneRect
.
width
()
<<
"h="
<<
zoneRect
.
height
();
QSizeF
newSize
(
zoneRect
.
width
()
+
10
,
zoneRect
.
height
()
+
extraHeight
+
10
);
qDebug
()
<<
"maxW="
<<
maximumWidth
()
<<
"maxH="
<<
maximumHeight
();
QSizeF
newSize
(
zoneRect
.
width
()
+
10
,
zoneRect
.
height
()
+
extraHeight
);
setMaximumSize
(
newSize
);
setMaximumSize
(
newSize
);
resize
(
newSize
);
resize
(
newSize
);
qDebug
()
<<
"w="
<<
size
().
width
()
<<
"h="
<<
size
().
height
();
if
(
layout
())
layout
()
->
invalidate
();
}
}
void
ZoneViewWidget
::
closeEvent
(
QCloseEvent
*
event
)
void
ZoneViewWidget
::
closeEvent
(
QCloseEvent
*
event
)
...
...
cockatrice/src/zoneviewzone.h
View file @
4bf4bbea
...
@@ -16,8 +16,6 @@ private:
...
@@ -16,8 +16,6 @@ private:
CardZone
*
origZone
;
CardZone
*
origZone
;
bool
sortByName
,
sortByType
;
bool
sortByName
,
sortByType
;
public:
public:
enum
{
Type
=
typeZoneView
};
int
type
()
const
{
return
Type
;
}
ZoneViewZone
(
Player
*
_p
,
CardZone
*
_origZone
,
int
_numberCards
=
-
1
,
QGraphicsItem
*
parent
=
0
);
ZoneViewZone
(
Player
*
_p
,
CardZone
*
_origZone
,
int
_numberCards
=
-
1
,
QGraphicsItem
*
parent
=
0
);
~
ZoneViewZone
();
~
ZoneViewZone
();
QRectF
boundingRect
()
const
;
QRectF
boundingRect
()
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment