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
62dc3a7c
Commit
62dc3a7c
authored
Aug 08, 2015
by
woogerboy21
Browse files
Merge pull request #1342 from marcofernandezheras/CardInfoLayout
Deck Editor layout
parents
ba90d84a
e9e75961
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/cardframe.cpp
View file @
62dc3a7c
...
...
@@ -7,39 +7,52 @@
#include
"cardinfotext.h"
#include
"settingscache.h"
#include
<QSplitter>
#include
<QVBoxLayout>
CardFrame
::
CardFrame
(
int
width
,
int
height
,
const
QString
&
cardName
,
QWidget
*
parent
)
CardFrame
::
CardFrame
(
const
QString
&
cardName
,
QWidget
*
parent
)
:
QTabWidget
(
parent
),
info
(
0
),
cardTextOnly
(
false
)
{
setFixedWidth
(
width
);
setMinimumHeight
(
height
);
setContentsMargins
(
3
,
3
,
3
,
3
);
pic
=
new
CardInfoPicture
(
width
-
6
);
pic
=
new
CardInfoPicture
();
pic
->
setObjectName
(
"pic"
);
text
=
new
CardInfoText
();
text
->
setObjectName
(
"text"
);
tab1
=
new
QWidget
(
this
);
tab2
=
new
QWidget
(
this
);
tab3
=
new
QWidget
(
this
);
tab1
->
setObjectName
(
"tab1"
);
tab2
->
setObjectName
(
"tab2"
);
tab3
->
setObjectName
(
"tab3"
);
insertTab
(
ImageOnlyView
,
tab1
,
QString
());
insertTab
(
TextOnlyView
,
tab2
,
QString
());
insertTab
(
ImageAndTextView
,
tab3
,
QString
());
connect
(
this
,
SIGNAL
(
currentChanged
(
int
)),
this
,
SLOT
(
setViewMode
(
int
)));
tab1Layout
=
new
QVBoxLayout
();
tab1Layout
->
setObjectName
(
"tab1Layout"
);
tab1Layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
tab1Layout
->
setSpacing
(
0
);
tab1
->
setLayout
(
tab1Layout
);
tab2Layout
=
new
QVBoxLayout
();
tab2Layout
->
setObjectName
(
"tab2Layout"
);
tab2Layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
tab2Layout
->
setSpacing
(
0
);
tab2
->
setLayout
(
tab2Layout
);
splitter
=
new
QSplitter
();
splitter
->
setObjectName
(
"splitter"
);
splitter
->
setOrientation
(
Qt
::
Vertical
);
tab3Layout
=
new
QVBoxLayout
();
tab3Layout
->
setObjectName
(
"tab3Layout"
);
tab3Layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
tab3Layout
->
setSpacing
(
0
);
tab3Layout
->
addWidget
(
splitter
);
tab3
->
setLayout
(
tab3Layout
);
setViewMode
(
settingsCache
->
getCardInfoViewMode
());
...
...
@@ -67,8 +80,8 @@ void CardFrame::setViewMode(int mode)
tab2Layout
->
addWidget
(
text
);
break
;
case
ImageAndTextView
:
tab3Layout
->
addWidget
(
pic
);
tab3Layout
->
addWidget
(
text
);
splitter
->
addWidget
(
pic
);
splitter
->
addWidget
(
text
);
break
;
}
...
...
cockatrice/src/cardframe.h
View file @
62dc3a7c
...
...
@@ -8,6 +8,7 @@ class CardInfo;
class
CardInfoPicture
;
class
CardInfoText
;
class
QVBoxLayout
;
class
QSplitter
;
class
CardFrame
:
public
QTabWidget
{
Q_OBJECT
...
...
@@ -19,11 +20,11 @@ private:
bool
cardTextOnly
;
QWidget
*
tab1
,
*
tab2
,
*
tab3
;
QVBoxLayout
*
tab1Layout
,
*
tab2Layout
,
*
tab3Layout
;
QSplitter
*
splitter
;
public:
enum
ViewMode
{
ImageOnlyView
,
TextOnlyView
,
ImageAndTextView
};
CardFrame
(
int
width
,
int
height
,
const
QString
&
cardName
=
QString
(),
CardFrame
(
const
QString
&
cardName
=
QString
(),
QWidget
*
parent
=
0
);
void
retranslateUi
();
public
slots
:
...
...
cockatrice/src/cardinfopicture.cpp
View file @
62dc3a7c
...
...
@@ -8,14 +8,12 @@
#include
"carddatabase.h"
#include
"main.h"
CardInfoPicture
::
CardInfoPicture
(
int
width
,
QWidget
*
parent
)
CardInfoPicture
::
CardInfoPicture
(
QWidget
*
parent
)
:
QWidget
(
parent
),
info
(
0
),
pixmapDirty
(
true
)
{
setFixedWidth
(
width
);
setMinimumHeight
(
100
);
setMaximumHeight
(
width
/
(
qreal
)
CARD_WIDTH
*
(
qreal
)
CARD_HEIGHT
);
}
void
CardInfoPicture
::
setCard
(
CardInfo
*
card
)
...
...
cockatrice/src/cardinfopicture.h
View file @
62dc3a7c
...
...
@@ -15,7 +15,7 @@ private:
bool
pixmapDirty
;
public:
CardInfoPicture
(
int
width
,
QWidget
*
parent
=
0
);
CardInfoPicture
(
QWidget
*
parent
=
0
);
protected:
void
resizeEvent
(
QResizeEvent
*
event
);
void
paintEvent
(
QPaintEvent
*
);
...
...
cockatrice/src/filterbuilder.cpp
View file @
62dc3a7c
...
...
@@ -11,6 +11,7 @@ FilterBuilder::FilterBuilder(QWidget *parent)
:
QWidget
(
parent
)
{
filterCombo
=
new
QComboBox
;
filterCombo
->
setObjectName
(
"filterCombo"
);
for
(
int
i
=
0
;
i
<
CardFilter
::
AttrEnd
;
i
++
)
filterCombo
->
addItem
(
tr
(
CardFilter
::
attrName
(
static_cast
<
CardFilter
::
Attr
>
(
i
))),
...
...
@@ -18,6 +19,7 @@ FilterBuilder::FilterBuilder(QWidget *parent)
);
typeCombo
=
new
QComboBox
;
typeCombo
->
setObjectName
(
"typeCombo"
);
for
(
int
i
=
0
;
i
<
CardFilter
::
TypeEnd
;
i
++
)
typeCombo
->
addItem
(
tr
(
CardFilter
::
typeName
(
static_cast
<
CardFilter
::
Type
>
(
i
))),
...
...
@@ -25,12 +27,15 @@ FilterBuilder::FilterBuilder(QWidget *parent)
);
QPushButton
*
ok
=
new
QPushButton
(
QIcon
(
":/resources/increment.svg"
),
QString
());
ok
->
setObjectName
(
"ok"
);
ok
->
setMaximumSize
(
20
,
20
);
edit
=
new
QLineEdit
;
edit
->
setObjectName
(
"edit"
);
edit
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
);
QGridLayout
*
layout
=
new
QGridLayout
;
layout
->
setObjectName
(
"layout"
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
addWidget
(
typeCombo
,
0
,
0
,
1
,
2
);
...
...
cockatrice/src/main.cpp
View file @
62dc3a7c
...
...
@@ -223,8 +223,8 @@ int main(int argc, char *argv[])
generateClientID
();
//generate the users client id
qDebug
()
<<
"ClientID In Cache: "
<<
settingsCache
->
getClientID
();
ui
.
show
();
qDebug
(
"main(): ui.show() finished"
);
ui
.
show
Maximized
();
qDebug
(
"main(): ui.show
Maximized
() finished"
);
app
.
exec
();
}
...
...
cockatrice/src/settingscache.cpp
View file @
62dc3a7c
#include
"settingscache.h"
#include
<QSettings>
#if QT_VERSION >= 0x050000
#include
<QStandardPaths>
#else
#include
<QDesktopServices>
#endif
QString
SettingsCache
::
getLayoutsSettingsPath
()
{
QString
file
=
""
;
#ifndef PORTABLE_BUILD
#if QT_VERSION >= 0x050000
file
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
DataLocation
);
#else
file
=
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DataLocation
);
#endif
file
.
append
(
"/settings/layouts/"
);
#endif
return
file
;
}
SettingsCache
::
SettingsCache
()
{
...
...
@@ -97,6 +118,16 @@ SettingsCache::SettingsCache()
spectatorsCanSeeEverything
=
settings
->
value
(
"game/spectatorscanseeeverything"
,
false
).
toBool
();
clientID
=
settings
->
value
(
"personal/clientid"
,
"notset"
).
toString
();
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
deckEditorLayoutState
=
layout_settings
.
value
(
"layouts/deckEditor_state"
).
toByteArray
();
deckEditorGeometry
=
layout_settings
.
value
(
"layouts/deckEditor_geometry"
).
toByteArray
();
deckEditorCardSize
=
layout_settings
.
value
(
"layouts/deckEditor_CardSize"
,
QSize
(
250
,
500
)).
toSize
();
deckEditorFilterSize
=
layout_settings
.
value
(
"layouts/deckEditor_FilterSize"
,
QSize
(
250
,
250
)).
toSize
();
deckEditorDeckSize
=
layout_settings
.
value
(
"layouts/deckEditor_DeckSize"
,
QSize
(
250
,
360
)).
toSize
();
}
void
SettingsCache
::
setCardInfoViewMode
(
const
int
_viewMode
)
{
...
...
@@ -462,6 +493,56 @@ QStringList SettingsCache::getCountries() const
return
countries
;
}
void
SettingsCache
::
setDeckEditorLayoutState
(
const
QByteArray
&
value
)
{
deckEditorLayoutState
=
value
;
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
layout_settings
.
setValue
(
"layouts/deckEditor_state"
,
value
);
}
void
SettingsCache
::
setDeckEditorGeometry
(
const
QByteArray
&
value
)
{
deckEditorGeometry
=
value
;
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
layout_settings
.
setValue
(
"layouts/deckEditor_geometry"
,
value
);
}
void
SettingsCache
::
setDeckEditorCardSize
(
const
QSize
&
value
)
{
deckEditorCardSize
=
value
;
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
layout_settings
.
setValue
(
"layouts/deckEditor_CardSize"
,
value
);
}
void
SettingsCache
::
setDeckEditorDeckSize
(
const
QSize
&
value
)
{
deckEditorDeckSize
=
value
;
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
layout_settings
.
setValue
(
"layouts/deckEditor_DeckSize"
,
value
);
}
void
SettingsCache
::
setDeckEditorFilterSize
(
const
QSize
&
value
)
{
deckEditorFilterSize
=
value
;
QString
file
=
getLayoutsSettingsPath
();
file
.
append
(
"deckLayout.ini"
);
QSettings
layout_settings
(
file
,
QSettings
::
IniFormat
);
layout_settings
.
setValue
(
"layouts/deckEditor_FilterSize"
,
value
);
}
void
SettingsCache
::
setGameDescription
(
const
QString
_gameDescription
)
{
gameDescription
=
_gameDescription
;
...
...
cockatrice/src/settingscache.h
View file @
62dc3a7c
...
...
@@ -2,6 +2,7 @@
#define SETTINGSCACHE_H
#include
<QObject>
#include
<QSize>
#include
<QStringList>
// the falbacks are used for cards without a muid
...
...
@@ -99,6 +100,10 @@ private:
bool
spectatorsCanTalk
;
bool
spectatorsCanSeeEverything
;
int
keepalive
;
QByteArray
deckEditorLayoutState
,
deckEditorGeometry
;
QSize
deckEditorFilterSize
,
deckEditorDeckSize
,
deckEditorCardSize
;
QString
getLayoutsSettingsPath
();
public:
SettingsCache
();
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
...
...
@@ -172,6 +177,17 @@ public:
int
getKeepAlive
()
const
{
return
keepalive
;
}
void
setClientID
(
QString
clientID
);
QString
getClientID
()
{
return
clientID
;
}
QByteArray
getDeckEditorLayoutState
()
const
{
return
deckEditorLayoutState
;
}
void
setDeckEditorLayoutState
(
const
QByteArray
&
value
);
QByteArray
getDeckEditorGeometry
()
const
{
return
deckEditorGeometry
;
}
void
setDeckEditorGeometry
(
const
QByteArray
&
value
);
QSize
getDeckEditorCardSize
()
const
{
return
deckEditorCardSize
;
}
void
setDeckEditorCardSize
(
const
QSize
&
value
);
QSize
getDeckEditorDeckSize
()
const
{
return
deckEditorDeckSize
;
}
void
setDeckEditorDeckSize
(
const
QSize
&
value
);
QSize
getDeckEditorFilterSize
()
const
{
return
deckEditorFilterSize
;
}
void
setDeckEditorFilterSize
(
const
QSize
&
value
);
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
...
...
cockatrice/src/tab_deck_editor.cpp
View file @
62dc3a7c
This diff is collapsed.
Click to expand it.
cockatrice/src/tab_deck_editor.h
View file @
62dc3a7c
...
...
@@ -20,6 +20,10 @@ class FilterTreeModel;
class
FilterBuilder
;
class
CardInfo
;
class
QGroupBox
;
class
QHBoxLayout
;
class
QPushButton
;
class
QMainWindow
;
class
QDockWidget
;
class
SearchLineEdit
:
public
QLineEdit
{
private:
...
...
@@ -73,6 +77,12 @@ class TabDeckEditor : public Tab {
void
filterViewCustomContextMenu
(
const
QPoint
&
point
);
void
filterRemove
(
QAction
*
action
);
void
setPriceTagFeatureEnabled
(
int
enabled
);
bool
eventFilter
(
QObject
*
o
,
QEvent
*
e
);
void
loadLayout
();
void
restartLayout
();
void
freeDocksSize
();
private:
CardInfo
*
currentCardInfo
()
const
;
void
addCardHelper
(
QString
zoneName
);
...
...
@@ -99,14 +109,25 @@ private:
QLabel
*
hashLabel
;
FilterTreeModel
*
filterModel
;
QTreeView
*
filterView
;
Q
GroupBox
*
filterBox
;
Q
Widget
*
filterBox
;
QMenu
*
deckMenu
,
*
dbMenu
;
QAction
*
aNewDeck
,
*
aLoadDeck
,
*
aSaveDeck
,
*
aSaveDeckAs
,
*
aLoadDeckFromClipboard
,
*
aSaveDeckToClipboard
,
*
aPrintDeck
,
*
aAnalyzeDeck
,
*
aClose
,
*
aOpenCustomFolder
;
QAction
*
aEditSets
,
*
aEditTokens
,
*
aClearFilterAll
,
*
aClearFilterOne
;
QAction
*
aAddCard
,
*
aAddCardToSideboard
,
*
aRemoveCard
,
*
aIncrement
,
*
aDecrement
;
// *aUpdatePrices;
QAction
*
aResetLayout
;
bool
modified
;
QMainWindow
*
MainWindow
;
QVBoxLayout
*
centralFrame
;
QHBoxLayout
*
searchLayout
;
QPushButton
*
btnFilter
;
QPushButton
*
btnDeck
;
QPushButton
*
btnCard
;
QDockWidget
*
cardInfoDock
;
QDockWidget
*
deckDock
;
QDockWidget
*
filterDock
;
QWidget
*
centralWidget
;
public:
TabDeckEditor
(
TabSupervisor
*
_tabSupervisor
,
QWidget
*
parent
=
0
);
~
TabDeckEditor
();
...
...
@@ -115,6 +136,13 @@ public:
void
setDeck
(
DeckLoader
*
_deckLoader
);
void
setModified
(
bool
_windowModified
);
bool
confirmClose
();
void
createShowHideDocksButtons
();
void
createDeckDock
();
void
createCardInfoDock
();
void
createFiltersDock
();
void
createMenus
();
void
createCentralFrame
();
public
slots
:
void
closeRequest
();
void
checkFirstRunDetected
();
...
...
cockatrice/src/tab_game.cpp
View file @
62dc3a7c
...
...
@@ -282,7 +282,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
gameView
=
new
GameView
(
scene
);
gameView
->
hide
();
cardInfo
=
new
CardFrame
(
250
,
372
);
cardInfo
=
new
CardFrame
();
playerListWidget
=
new
PlayerListWidget
(
0
,
0
,
this
);
playerListWidget
->
setFocusPolicy
(
Qt
::
NoFocus
);
...
...
@@ -396,7 +396,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
gameView
=
new
GameView
(
scene
);
gameView
->
hide
();
cardInfo
=
new
CardFrame
(
250
,
372
);
cardInfo
=
new
CardFrame
();
playerListWidget
=
new
PlayerListWidget
(
tabSupervisor
,
clients
.
first
(),
this
);
playerListWidget
->
setFocusPolicy
(
Qt
::
NoFocus
);
connect
(
playerListWidget
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)),
this
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)));
...
...
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