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
fefb6fc6
Commit
fefb6fc6
authored
Aug 30, 2014
by
Yuki Izumi
Browse files
Add sideboard helpers.
parent
2aeecc60
Changes
4
Show whitespace changes
Inline
Side-by-side
cockatrice/src/keysignals.cpp
View file @
fefb6fc6
...
@@ -56,6 +56,10 @@ bool KeySignals::eventFilter(QObject * /*object*/, QEvent *event) {
...
@@ -56,6 +56,10 @@ bool KeySignals::eventFilter(QObject * /*object*/, QEvent *event) {
&&
kevent
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
)
)
&&
kevent
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
)
)
emit
onCtrlAltRBracket
();
emit
onCtrlAltRBracket
();
break
;
case
Qt
::
Key_S
:
emit
onS
();
break
;
break
;
default:
default:
return
false
;
return
false
;
...
...
cockatrice/src/keysignals.h
View file @
fefb6fc6
...
@@ -18,6 +18,7 @@ signals:
...
@@ -18,6 +18,7 @@ signals:
void
onCtrlAltEqual
();
void
onCtrlAltEqual
();
void
onCtrlAltLBracket
();
void
onCtrlAltLBracket
();
void
onCtrlAltRBracket
();
void
onCtrlAltRBracket
();
void
onS
();
protected:
protected:
virtual
bool
eventFilter
(
QObject
*
,
QEvent
*
event
);
virtual
bool
eventFilter
(
QObject
*
,
QEvent
*
event
);
...
...
cockatrice/src/tab_deck_editor.cpp
View file @
fefb6fc6
...
@@ -141,6 +141,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
...
@@ -141,6 +141,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
#endif
#endif
deckView
->
installEventFilter
(
&
deckViewKeySignals
);
deckView
->
installEventFilter
(
&
deckViewKeySignals
);
connect
(
deckView
->
selectionModel
(),
SIGNAL
(
currentRowChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)),
this
,
SLOT
(
updateCardInfoRight
(
const
QModelIndex
&
,
const
QModelIndex
&
)));
connect
(
deckView
->
selectionModel
(),
SIGNAL
(
currentRowChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)),
this
,
SLOT
(
updateCardInfoRight
(
const
QModelIndex
&
,
const
QModelIndex
&
)));
connect
(
deckView
,
SIGNAL
(
doubleClicked
(
const
QModelIndex
&
)),
this
,
SLOT
(
actSwapCard
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onS
()),
this
,
SLOT
(
actSwapCard
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onEnter
()),
this
,
SLOT
(
actIncrement
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onEnter
()),
this
,
SLOT
(
actIncrement
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onCtrlAltEqual
()),
this
,
SLOT
(
actIncrement
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onCtrlAltEqual
()),
this
,
SLOT
(
actIncrement
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onCtrlAltMinus
()),
this
,
SLOT
(
actDecrement
()));
connect
(
&
deckViewKeySignals
,
SIGNAL
(
onCtrlAltMinus
()),
this
,
SLOT
(
actDecrement
()));
...
@@ -571,6 +573,27 @@ void TabDeckEditor::addCardHelper(QString zoneName)
...
@@ -571,6 +573,27 @@ void TabDeckEditor::addCardHelper(QString zoneName)
setModified
(
true
);
setModified
(
true
);
}
}
void
TabDeckEditor
::
actSwapCard
()
{
const
QModelIndex
currentIndex
=
deckView
->
selectionModel
()
->
currentIndex
();
if
(
!
currentIndex
.
isValid
())
return
;
const
QString
cardName
=
currentIndex
.
sibling
(
currentIndex
.
row
(),
1
).
data
().
toString
();
const
QModelIndex
gparent
=
currentIndex
.
parent
().
parent
();
if
(
!
gparent
.
isValid
())
return
;
const
QString
zoneName
=
gparent
.
sibling
(
gparent
.
row
(),
1
).
data
().
toString
();
actDecrement
();
const
QString
otherZoneName
=
zoneName
==
"Maindeck"
?
"side"
:
"main"
;
QModelIndex
newCardIndex
=
deckModel
->
addCard
(
cardName
,
otherZoneName
);
recursiveExpand
(
newCardIndex
);
deckView
->
setCurrentIndex
(
newCardIndex
);
setModified
(
true
);
}
void
TabDeckEditor
::
actAddCard
()
void
TabDeckEditor
::
actAddCard
()
{
{
addCardHelper
(
"main"
);
addCardHelper
(
"main"
);
...
...
cockatrice/src/tab_deck_editor.h
View file @
fefb6fc6
...
@@ -53,6 +53,7 @@ private slots:
...
@@ -53,6 +53,7 @@ private slots:
void
actClearSearch
();
void
actClearSearch
();
void
actSwapCard
();
void
actAddCard
();
void
actAddCard
();
void
actAddCardToSideboard
();
void
actAddCardToSideboard
();
void
actRemoveCard
();
void
actRemoveCard
();
...
...
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