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
c8d59eec
Commit
c8d59eec
authored
Aug 21, 2015
by
marco
Browse files
Refactred settings to use settingscache & ini files
parent
9c28cdd1
Changes
29
Hide whitespace changes
Inline
Side-by-side
cockatrice/CMakeLists.txt
View file @
c8d59eec
...
@@ -98,6 +98,12 @@ SET(cockatrice_SOURCES
...
@@ -98,6 +98,12 @@ SET(cockatrice_SOURCES
src/sequenceEdit/sequenceedit.cpp
src/sequenceEdit/sequenceedit.cpp
src/sequenceEdit/shortcutstab.cpp
src/sequenceEdit/shortcutstab.cpp
src/lineeditcompleter.cpp
src/lineeditcompleter.cpp
src/settings/settingsmanager.cpp
src/settings/carddatabasesettings.cpp
src/settings/serverssettings.cpp
src/settings/messagesettings.cpp
src/settings/gamefilterssettings.cpp
src/settings/layoutssettings.cpp
${
VERSION_STRING_CPP
}
${
VERSION_STRING_CPP
}
)
)
...
...
cockatrice/src/carddatabase.cpp
View file @
c8d59eec
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#include
<QDirIterator>
#include
<QDirIterator>
#include
<QFile>
#include
<QFile>
#include
<QTextStream>
#include
<QTextStream>
#include
<QSettings>
#include
<QSvgRenderer>
#include
<QSvgRenderer>
#include
<QPainter>
#include
<QPainter>
#include
<QUrl>
#include
<QUrl>
...
@@ -50,46 +49,29 @@ QString CardSet::getCorrectedShortName() const
...
@@ -50,46 +49,29 @@ QString CardSet::getCorrectedShortName() const
return
invalidFileNames
.
contains
(
shortName
)
?
shortName
+
"_"
:
shortName
;
return
invalidFileNames
.
contains
(
shortName
)
?
shortName
+
"_"
:
shortName
;
}
}
void
CardSet
::
setSortKey
(
unsigned
int
_sortKey
)
void
CardSet
::
loadSetOptions
(
)
{
{
sortKey
=
_sortKey
;
sortKey
=
settingsCache
->
cardDatabase
().
getSortKey
(
shortName
);
enabled
=
settingsCache
->
cardDatabase
().
isEnabled
(
shortName
);
QSettings
settings
;
isknown
=
settingsCache
->
cardDatabase
().
isKnown
(
shortName
);
settings
.
beginGroup
(
"sets"
);
settings
.
beginGroup
(
shortName
);
settings
.
setValue
(
"sortkey"
,
sortKey
);
}
}
void
CardSet
::
loadSetOptions
(
)
void
CardSet
::
setSortKey
(
unsigned
int
_sortKey
)
{
{
QSettings
settings
;
sortKey
=
_sortKey
;
settings
.
beginGroup
(
"sets"
);
settingsCache
->
cardDatabase
().
setSortKey
(
shortName
,
_sortKey
);
settings
.
beginGroup
(
shortName
);
sortKey
=
settings
.
value
(
"sortkey"
,
0
).
toInt
();
enabled
=
settings
.
value
(
"enabled"
,
false
).
toBool
();
isknown
=
settings
.
value
(
"isknown"
,
false
).
toBool
();
// qDebug() << "load set" << shortName << "key" << sortKey;
}
}
void
CardSet
::
setEnabled
(
bool
_enabled
)
void
CardSet
::
setEnabled
(
bool
_enabled
)
{
{
enabled
=
_enabled
;
enabled
=
_enabled
;
settingsCache
->
cardDatabase
().
setEnabled
(
shortName
,
_enabled
);
QSettings
settings
;
settings
.
beginGroup
(
"sets"
);
settings
.
beginGroup
(
shortName
);
settings
.
setValue
(
"enabled"
,
enabled
);
}
}
void
CardSet
::
setIsKnown
(
bool
_isknown
)
void
CardSet
::
setIsKnown
(
bool
_isknown
)
{
{
isknown
=
_isknown
;
isknown
=
_isknown
;
settingsCache
->
cardDatabase
().
setIsKnown
(
shortName
,
_isknown
);
QSettings
settings
;
settings
.
beginGroup
(
"sets"
);
settings
.
beginGroup
(
shortName
);
settings
.
setValue
(
"isknown"
,
isknown
);
}
}
class
SetList
::
KeyCompareFunctor
{
class
SetList
::
KeyCompareFunctor
{
...
@@ -1253,4 +1235,4 @@ bool CardDatabase::hasDetectedFirstRun()
...
@@ -1253,4 +1235,4 @@ bool CardDatabase::hasDetectedFirstRun()
}
}
return
false
;
return
false
;
}
}
\ No newline at end of file
cockatrice/src/dlg_connect.cpp
View file @
c8d59eec
#include
<QSettings>
#include
<QLabel>
#include
<QLabel>
#include
<QCheckBox>
#include
<QCheckBox>
#include
<QComboBox>
#include
<QComboBox>
...
@@ -11,25 +10,23 @@
...
@@ -11,25 +10,23 @@
#include
<QKeyEvent>
#include
<QKeyEvent>
#include
<iostream>
#include
<iostream>
#include
"dlg_connect.h"
#include
"dlg_connect.h"
#include
"settingscache.h"
DlgConnect
::
DlgConnect
(
QWidget
*
parent
)
DlgConnect
::
DlgConnect
(
QWidget
*
parent
)
:
QDialog
(
parent
)
:
QDialog
(
parent
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
previousHostButton
=
new
QRadioButton
(
tr
(
"Previous Host"
),
this
);
previousHostButton
=
new
QRadioButton
(
tr
(
"Previous Host"
),
this
);
previousHosts
=
new
QComboBox
(
this
);
previousHosts
=
new
QComboBox
(
this
);
previousHosts
->
installEventFilter
(
new
DeleteHighlightedItemWhenShiftDelPressedEventFilter
);
previousHosts
->
installEventFilter
(
new
DeleteHighlightedItemWhenShiftDelPressedEventFilter
);
QStringList
previousHostList
=
settings
.
value
(
"previoushosts"
).
toStringList
();
QStringList
previousHostList
=
settingsCache
->
servers
().
getPreviousHostList
();
if
(
previousHostList
.
isEmpty
())
{
if
(
previousHostList
.
isEmpty
())
{
previousHostList
<<
"cockatrice.woogerworks.com"
;
previousHostList
<<
"cockatrice.woogerworks.com"
;
previousHostList
<<
"vps.poixen.com"
;
previousHostList
<<
"vps.poixen.com"
;
previousHostList
<<
"chickatrice.net"
;
previousHostList
<<
"chickatrice.net"
;
}
}
previousHosts
->
addItems
(
previousHostList
);
previousHosts
->
addItems
(
previousHostList
);
previousHosts
->
setCurrentIndex
(
settings
.
value
(
"p
revioushostindex
"
).
toInt
());
previousHosts
->
setCurrentIndex
(
settings
Cache
->
servers
().
getP
revioushostindex
());
newHostButton
=
new
QRadioButton
(
tr
(
"New Host"
),
this
);
newHostButton
=
new
QRadioButton
(
tr
(
"New Host"
),
this
);
...
@@ -39,28 +36,28 @@ DlgConnect::DlgConnect(QWidget *parent)
...
@@ -39,28 +36,28 @@ DlgConnect::DlgConnect(QWidget *parent)
hostLabel
->
setBuddy
(
hostEdit
);
hostLabel
->
setBuddy
(
hostEdit
);
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portEdit
=
new
QLineEdit
(
settings
.
value
(
"port"
,
"4747"
).
toString
(
));
portEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getPort
(
"4747"
));
portLabel
->
setBuddy
(
portEdit
);
portLabel
->
setBuddy
(
portEdit
);
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameEdit
=
new
QLineEdit
(
settings
.
value
(
"p
layer
n
ame
"
,
"Player"
)
.
toString
()
);
playernameEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getP
layer
N
ame
(
"Player"
));
playernameLabel
->
setBuddy
(
playernameEdit
);
playernameLabel
->
setBuddy
(
playernameEdit
);
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordEdit
=
new
QLineEdit
(
settings
.
value
(
"password"
).
toString
());
passwordEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getPassword
());
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
savePasswordCheckBox
=
new
QCheckBox
(
tr
(
"&Save password"
));
savePasswordCheckBox
=
new
QCheckBox
(
tr
(
"&Save password"
));
savePasswordCheckBox
->
setChecked
(
settings
.
value
(
"s
ave
_p
assword
"
,
1
).
toInt
());
savePasswordCheckBox
->
setChecked
(
settings
Cache
->
servers
().
getS
ave
P
assword
());
autoConnectCheckBox
=
new
QCheckBox
(
tr
(
"A&uto connect at start"
));
autoConnectCheckBox
=
new
QCheckBox
(
tr
(
"A&uto connect at start"
));
if
(
savePasswordCheckBox
->
isChecked
())
if
(
savePasswordCheckBox
->
isChecked
())
{
{
autoConnectCheckBox
->
setChecked
(
settings
.
value
(
"a
uto
_c
onnect
"
,
0
).
toInt
());
autoConnectCheckBox
->
setChecked
(
settings
Cache
->
servers
().
getA
uto
C
onnect
());
autoConnectCheckBox
->
setEnabled
(
true
);
autoConnectCheckBox
->
setEnabled
(
true
);
}
else
{
}
else
{
settings
.
setValue
(
"a
uto
_c
onnect
"
,
0
);
settings
Cache
->
servers
().
setA
uto
C
onnect
(
0
);
autoConnectCheckBox
->
setChecked
(
0
);
autoConnectCheckBox
->
setChecked
(
0
);
autoConnectCheckBox
->
setEnabled
(
false
);
autoConnectCheckBox
->
setEnabled
(
false
);
}
}
...
@@ -98,7 +95,7 @@ DlgConnect::DlgConnect(QWidget *parent)
...
@@ -98,7 +95,7 @@ DlgConnect::DlgConnect(QWidget *parent)
connect
(
previousHostButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
previousHostSelected
(
bool
)));
connect
(
previousHostButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
previousHostSelected
(
bool
)));
connect
(
newHostButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
newHostSelected
(
bool
)));
connect
(
newHostButton
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
newHostSelected
(
bool
)));
if
(
settings
.
value
(
"p
revious
h
ost
l
ogin
"
,
1
).
toInt
())
if
(
settings
Cache
->
servers
().
getP
revious
H
ost
L
ogin
())
previousHostButton
->
setChecked
(
true
);
previousHostButton
->
setChecked
(
true
);
else
else
newHostButton
->
setChecked
(
true
);
newHostButton
->
setChecked
(
true
);
...
@@ -133,14 +130,12 @@ void DlgConnect::passwordSaved(int state)
...
@@ -133,14 +130,12 @@ void DlgConnect::passwordSaved(int state)
void
DlgConnect
::
actOk
()
void
DlgConnect
::
actOk
()
{
{
QSettings
settings
;
settingsCache
->
servers
().
setPort
(
portEdit
->
text
());
settings
.
beginGroup
(
"server"
);
settingsCache
->
servers
().
setPlayerName
(
playernameEdit
->
text
());
settings
.
setValue
(
"port"
,
portEdit
->
text
());
settingsCache
->
servers
().
setPassword
(
savePasswordCheckBox
->
isChecked
()
?
passwordEdit
->
text
()
:
QString
());
settings
.
setValue
(
"playername"
,
playernameEdit
->
text
());
settingsCache
->
servers
().
setSavePassword
(
savePasswordCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"password"
,
savePasswordCheckBox
->
isChecked
()
?
passwordEdit
->
text
()
:
QString
());
settingsCache
->
servers
().
setAutoConnect
(
autoConnectCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"save_password"
,
savePasswordCheckBox
->
isChecked
()
?
1
:
0
);
settingsCache
->
servers
().
setPreviousHostLogin
(
previousHostButton
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"auto_connect"
,
autoConnectCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"previoushostlogin"
,
previousHostButton
->
isChecked
()
?
1
:
0
);
QStringList
hostList
;
QStringList
hostList
;
if
(
newHostButton
->
isChecked
())
if
(
newHostButton
->
isChecked
())
...
@@ -151,9 +146,8 @@ void DlgConnect::actOk()
...
@@ -151,9 +146,8 @@ void DlgConnect::actOk()
if
(
!
previousHosts
->
itemText
(
i
).
trimmed
().
isEmpty
())
if
(
!
previousHosts
->
itemText
(
i
).
trimmed
().
isEmpty
())
hostList
<<
previousHosts
->
itemText
(
i
);
hostList
<<
previousHosts
->
itemText
(
i
);
settings
.
setValue
(
"previoushosts"
,
hostList
);
settingsCache
->
servers
().
setPreviousHostList
(
hostList
);
settings
.
setValue
(
"previoushostindex"
,
previousHosts
->
currentIndex
());
settingsCache
->
servers
().
setPrevioushostindex
(
previousHosts
->
currentIndex
());
settings
.
endGroup
();
accept
();
accept
();
}
}
...
@@ -165,12 +159,8 @@ QString DlgConnect::getHost() const {
...
@@ -165,12 +159,8 @@ QString DlgConnect::getHost() const {
void
DlgConnect
::
actCancel
()
void
DlgConnect
::
actCancel
()
{
{
QSettings
settings
;
settingsCache
->
servers
().
setSavePassword
(
savePasswordCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
beginGroup
(
"server"
);
settingsCache
->
servers
().
setAutoConnect
(
autoConnectCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"save_password"
,
savePasswordCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
setValue
(
"auto_connect"
,
autoConnectCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
endGroup
();
reject
();
reject
();
}
}
...
...
cockatrice/src/dlg_edit_password.cpp
View file @
c8d59eec
...
@@ -3,21 +3,19 @@
...
@@ -3,21 +3,19 @@
#include
<QHBoxLayout>
#include
<QHBoxLayout>
#include
<QLabel>
#include
<QLabel>
#include
<QMessageBox>
#include
<QMessageBox>
#include
<QSettings>
#include
"settingscache.h"
#include
"dlg_edit_password.h"
#include
"dlg_edit_password.h"
DlgEditPassword
::
DlgEditPassword
(
QWidget
*
parent
)
DlgEditPassword
::
DlgEditPassword
(
QWidget
*
parent
)
:
QDialog
(
parent
)
:
QDialog
(
parent
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
oldPasswordLabel
=
new
QLabel
(
tr
(
"Old password:"
));
oldPasswordLabel
=
new
QLabel
(
tr
(
"Old password:"
));
oldPasswordEdit
=
new
QLineEdit
();
oldPasswordEdit
=
new
QLineEdit
();
if
(
settings
.
value
(
"s
ave
_p
assword
"
,
1
).
toInt
())
if
(
settings
Cache
->
servers
().
getS
ave
P
assword
())
oldPasswordEdit
->
setText
(
settings
.
value
(
"password"
).
toString
());
oldPasswordEdit
->
setText
(
settings
Cache
->
servers
().
getPassword
());
oldPasswordLabel
->
setBuddy
(
oldPasswordEdit
);
oldPasswordLabel
->
setBuddy
(
oldPasswordEdit
);
oldPasswordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
oldPasswordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
...
@@ -62,12 +60,8 @@ void DlgEditPassword::actOk()
...
@@ -62,12 +60,8 @@ void DlgEditPassword::actOk()
return
;
return
;
}
}
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
// always save the password so it will be picked up by the connect dialog
// always save the password so it will be picked up by the connect dialog
settings
.
setValue
(
"password"
,
newPasswordEdit
->
text
());
settingsCache
->
servers
().
setPassword
(
newPasswordEdit
->
text
());
settings
.
endGroup
();
accept
();
accept
();
}
}
...
...
cockatrice/src/dlg_edit_user.cpp
View file @
c8d59eec
#include
<QSettings>
#include
<QLabel>
#include
<QLabel>
#include
<QGridLayout>
#include
<QGridLayout>
#include
<QHBoxLayout>
#include
<QHBoxLayout>
...
...
cockatrice/src/dlg_filter_games.cpp
View file @
c8d59eec
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#include
<QVBoxLayout>
#include
<QVBoxLayout>
#include
<QGridLayout>
#include
<QGridLayout>
#include
<QDialogButtonBox>
#include
<QDialogButtonBox>
#include
<QSettings>
#include
<QCryptographicHash>
#include
<QCryptographicHash>
DlgFilterGames
::
DlgFilterGames
(
const
QMap
<
int
,
QString
>
&
_allGameTypes
,
const
GamesProxyModel
*
_gamesProxyModel
,
QWidget
*
parent
)
DlgFilterGames
::
DlgFilterGames
(
const
QMap
<
int
,
QString
>
&
_allGameTypes
,
const
GamesProxyModel
*
_gamesProxyModel
,
QWidget
*
parent
)
...
@@ -17,9 +16,6 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
...
@@ -17,9 +16,6 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes, const Ga
allGameTypes
(
_allGameTypes
),
allGameTypes
(
_allGameTypes
),
gamesProxyModel
(
_gamesProxyModel
)
gamesProxyModel
(
_gamesProxyModel
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"filter_games"
);
unavailableGamesVisibleCheckBox
=
new
QCheckBox
(
tr
(
"Show &unavailable games"
));
unavailableGamesVisibleCheckBox
=
new
QCheckBox
(
tr
(
"Show &unavailable games"
));
unavailableGamesVisibleCheckBox
->
setChecked
(
gamesProxyModel
->
getUnavailableGamesVisible
());
unavailableGamesVisibleCheckBox
->
setChecked
(
gamesProxyModel
->
getUnavailableGamesVisible
());
...
...
cockatrice/src/dlg_register.cpp
View file @
c8d59eec
#include
<QSettings>
#include
<QLabel>
#include
<QLabel>
#include
<QCheckBox>
#include
<QCheckBox>
#include
<QGridLayout>
#include
<QGridLayout>
...
@@ -14,23 +13,20 @@
...
@@ -14,23 +13,20 @@
DlgRegister
::
DlgRegister
(
QWidget
*
parent
)
DlgRegister
::
DlgRegister
(
QWidget
*
parent
)
:
QDialog
(
parent
)
:
QDialog
(
parent
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
hostLabel
=
new
QLabel
(
tr
(
"&Host:"
));
hostLabel
=
new
QLabel
(
tr
(
"&Host:"
));
hostEdit
=
new
QLineEdit
(
settings
.
value
(
"h
ostname
"
,
"cockatrice.woogerworks.com"
)
.
toString
()
);
hostEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getH
ostname
(
"cockatrice.woogerworks.com"
));
hostLabel
->
setBuddy
(
hostEdit
);
hostLabel
->
setBuddy
(
hostEdit
);
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portEdit
=
new
QLineEdit
(
settings
.
value
(
"port"
,
"4747"
).
toString
(
));
portEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getPort
(
"4747"
));
portLabel
->
setBuddy
(
portEdit
);
portLabel
->
setBuddy
(
portEdit
);
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameEdit
=
new
QLineEdit
(
settings
.
value
(
"p
layer
n
ame
"
,
"Player"
)
.
toString
()
);
playernameEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getP
layer
N
ame
(
"Player"
));
playernameLabel
->
setBuddy
(
playernameEdit
);
playernameLabel
->
setBuddy
(
playernameEdit
);
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordEdit
=
new
QLineEdit
(
settings
.
value
(
"password"
).
toString
());
passwordEdit
=
new
QLineEdit
(
settings
Cache
->
servers
().
getPassword
());
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
...
@@ -119,14 +115,11 @@ void DlgRegister::actOk()
...
@@ -119,14 +115,11 @@ void DlgRegister::actOk()
return
;
return
;
}
}
QSettings
settings
;
settingsCache
->
servers
().
setHostName
(
hostEdit
->
text
());
settings
.
beginGroup
(
"server"
);
settingsCache
->
servers
().
setPort
(
portEdit
->
text
());
settings
.
setValue
(
"hostname"
,
hostEdit
->
text
());
settingsCache
->
servers
().
setPlayerName
(
playernameEdit
->
text
());
settings
.
setValue
(
"port"
,
portEdit
->
text
());
settings
.
setValue
(
"playername"
,
playernameEdit
->
text
());
// always save the password so it will be picked up by the connect dialog
// always save the password so it will be picked up by the connect dialog
settings
.
setValue
(
"password"
,
passwordEdit
->
text
());
settingsCache
->
servers
().
setPassword
(
passwordEdit
->
text
());
settings
.
endGroup
();
accept
();
accept
();
}
}
...
...
cockatrice/src/dlg_settings.cpp
View file @
c8d59eec
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
#include
<QToolBar>
#include
<QToolBar>
#include
<QTranslator>
#include
<QTranslator>
#include
<QAction>
#include
<QAction>
#include
<QSettings>
#include
<QApplication>
#include
<QApplication>
#include
<QInputDialog>
#include
<QInputDialog>
#include
<QSpinBox>
#include
<QSpinBox>
...
@@ -632,12 +631,11 @@ MessagesSettingsPage::MessagesSettingsPage()
...
@@ -632,12 +631,11 @@ MessagesSettingsPage::MessagesSettingsPage()
highlightGroupBox
=
new
QGroupBox
;
highlightGroupBox
=
new
QGroupBox
;
highlightGroupBox
->
setLayout
(
highlightNotice
);
highlightGroupBox
->
setLayout
(
highlightNotice
);
QSettings
settings
;
messageList
=
new
QListWidget
;
messageList
=
new
QListWidget
;
settings
.
beginGroup
(
"messages"
);
int
count
=
settings
.
value
(
"count"
,
0
).
toI
nt
();
int
count
=
settings
Cache
->
messages
().
getCou
nt
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
for
(
int
i
=
0
;
i
<
count
;
i
++
)
messageList
->
addItem
(
settings
.
value
(
QString
(
"msg%1"
).
arg
(
i
)).
toString
(
));
messageList
->
addItem
(
settings
Cache
->
messages
().
getMessageAt
(
i
));
aAdd
=
new
QAction
(
this
);
aAdd
=
new
QAction
(
this
);
aAdd
->
setIcon
(
QIcon
(
":/resources/increment.svg"
));
aAdd
->
setIcon
(
QIcon
(
":/resources/increment.svg"
));
...
@@ -709,11 +707,9 @@ void MessagesSettingsPage::updateHighlightPreview() {
...
@@ -709,11 +707,9 @@ void MessagesSettingsPage::updateHighlightPreview() {
void
MessagesSettingsPage
::
storeSettings
()
void
MessagesSettingsPage
::
storeSettings
()
{
{
QSettings
settings
;
settingsCache
->
messages
().
setCount
(
messageList
->
count
());
settings
.
beginGroup
(
"messages"
);
settings
.
setValue
(
"count"
,
messageList
->
count
());
for
(
int
i
=
0
;
i
<
messageList
->
count
();
i
++
)
for
(
int
i
=
0
;
i
<
messageList
->
count
();
i
++
)
settings
.
setValue
(
QString
(
"msg%1"
).
arg
(
i
)
,
messageList
->
item
(
i
)
->
text
());
settings
Cache
->
messages
().
setMessageAt
(
i
,
messageList
->
item
(
i
)
->
text
());
}
}
void
MessagesSettingsPage
::
actAdd
()
void
MessagesSettingsPage
::
actAdd
()
...
...
cockatrice/src/gamesmodel.cpp
View file @
c8d59eec
#include
"gamesmodel.h"
#include
"gamesmodel.h"
#include
"pb/serverinfo_game.pb.h"
#include
"pb/serverinfo_game.pb.h"
#include
"pixmapgenerator.h"
#include
"pixmapgenerator.h"
#include
"settingscache.h"
#include
<QDebug>
#include
<QDebug>
#include
<QIcon>
#include
<QIcon>
#include
<QStringList>
#include
<QStringList>
#include
<QDateTime>
#include
<QDateTime>
#include
<QSettings>
#include
<QCryptographicHash>
enum
GameListColumn
{
ROOM
,
CREATED
,
DESCRIPTION
,
CREATOR
,
GAME_TYPE
,
RESTRICTIONS
,
PLAYERS
,
SPECTATORS
};
enum
GameListColumn
{
ROOM
,
CREATED
,
DESCRIPTION
,
CREATOR
,
GAME_TYPE
,
RESTRICTIONS
,
PLAYERS
,
SPECTATORS
};
...
@@ -283,19 +283,17 @@ void GamesProxyModel::resetFilterParameters()
...
@@ -283,19 +283,17 @@ void GamesProxyModel::resetFilterParameters()
void
GamesProxyModel
::
loadFilterParameters
(
const
QMap
<
int
,
QString
>
&
allGameTypes
)
void
GamesProxyModel
::
loadFilterParameters
(
const
QMap
<
int
,
QString
>
&
allGameTypes
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"filter_games"
);
unavailableGamesVisible
=
settings
.
value
(
"u
navailable
_g
ames
_v
isible
"
,
false
).
toBool
();
unavailableGamesVisible
=
settings
Cache
->
gameFilters
().
isU
navailable
G
ames
V
isible
();
showPasswordProtectedGames
=
settings
.
value
(
"s
how
_p
assword
_p
rotected
_g
ames
"
,
true
).
toBool
();
showPasswordProtectedGames
=
settings
Cache
->
gameFilters
().
isS
how
P
assword
P
rotected
G
ames
();
gameNameFilter
=
settings
.
value
(
"g
ame
_n
ame
_f
ilter
"
,
""
).
toString
();
gameNameFilter
=
settings
Cache
->
gameFilters
().
getG
ame
N
ame
F
ilter
();
maxPlayersFilterMin
=
settings
.
value
(
"min_players"
,
1
).
toInt
();
maxPlayersFilterMin
=
settings
Cache
->
gameFilters
().
getMinPlayers
();
maxPlayersFilterMax
=
settings
.
value
(
"max_players"
,
DEFAULT_MAX_PLAYERS_MAX
).
toInt
();
maxPlayersFilterMax
=
settings
Cache
->
gameFilters
().
getMaxPlayers
();
QMapIterator
<
int
,
QString
>
gameTypesIterator
(
allGameTypes
);
QMapIterator
<
int
,
QString
>
gameTypesIterator
(
allGameTypes
);
while
(
gameTypesIterator
.
hasNext
())
{
while
(
gameTypesIterator
.
hasNext
())
{
gameTypesIterator
.
next
();
gameTypesIterator
.
next
();
if
(
settings
.
value
(
"game_type/"
+
hash
GameType
(
gameTypesIterator
.
value
())
,
false
).
toBool
())
{
if
(
settings
Cache
->
gameFilters
().
is
GameType
Enabled
(
gameTypesIterator
.
value
())
)
{
gameTypeFilter
.
insert
(
gameTypesIterator
.
key
());
gameTypeFilter
.
insert
(
gameTypesIterator
.
key
());
}
}
}
}
...
@@ -305,28 +303,19 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
...
@@ -305,28 +303,19 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
void
GamesProxyModel
::
saveFilterParameters
(
const
QMap
<
int
,
QString
>
&
allGameTypes
)
void
GamesProxyModel
::
saveFilterParameters
(
const
QMap
<
int
,
QString
>
&
allGameTypes
)
{
{
QSettings
settings
;
settingsCache
->
gameFilters
().
setUnavailableGamesVisible
(
unavailableGamesVisible
);
settings
.
beginGroup
(
"filter_games"
);
settingsCache
->
gameFilters
().
setShowPasswordProtectedGames
(
showPasswordProtectedGames
);
settingsCache
->
gameFilters
().
setGameNameFilter
(
gameNameFilter
);
settings
.
setValue
(
"unavailable_games_visible"
,
unavailableGamesVisible
);
settings
.
setValue
(
"show_password_protected_games"
,
showPasswordProtectedGames
);
settings
.
setValue
(
"game_name_filter"
,
gameNameFilter
);
QMapIterator
<
int
,
QString
>
gameTypeIterator
(
allGameTypes
);
QMapIterator
<
int
,
QString
>
gameTypeIterator
(
allGameTypes
);
while
(
gameTypeIterator
.
hasNext
())
{
while
(
gameTypeIterator
.
hasNext
())
{
gameTypeIterator
.
next
();
gameTypeIterator
.
next
();
bool
enabled
=
gameTypeFilter
.
contains
(
gameTypeIterator
.
key
());
settings
.
setValue
(
settingsCache
->
gameFilters
().
setGameTypeEnabled
(
gameTypeIterator
.
value
(),
enabled
);
"game_type/"
+
hashGameType
(
gameTypeIterator
.
value
()),
gameTypeFilter
.
contains
(
gameTypeIterator
.
key
())
);
}
}
settings
.
setValue
(
"min_p
layers
"
,
maxPlayersFilterMin
);
settings
Cache
->
gameFilters
().
setMinP
layers
(
maxPlayersFilterMin
);
settings
.
setValue
(
"max_p
layers
"
,
maxPlayersFilterMax
);
settings
Cache
->
gameFilters
().
setMaxP
layers
(
maxPlayersFilterMax
);
}
}
bool
GamesProxyModel
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
/*sourceParent*/
)
const
bool
GamesProxyModel
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
/*sourceParent*/
)
const
...
@@ -367,7 +356,3 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
...
@@ -367,7 +356,3 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return
true
;
return
true
;
}
}
QString
GamesProxyModel
::
hashGameType
(
const
QString
&
gameType
)
const
{
return
QCryptographicHash
::
hash
(
gameType
.
toUtf8
(),
QCryptographicHash
::
Md5
).
toHex
();
}
cockatrice/src/gamesmodel.h
View file @
c8d59eec
...
@@ -52,13 +52,7 @@ private:
...
@@ -52,13 +52,7 @@ private:
QSet
<
int
>
gameTypeFilter
;
QSet
<
int
>
gameTypeFilter
;
int
maxPlayersFilterMin
,
maxPlayersFilterMax
;
int
maxPlayersFilterMin
,
maxPlayersFilterMax
;
static
const
int
DEFAULT_MAX_PLAYERS_MAX
=
99
;
static
const
int
DEFAULT_MAX_PLAYERS_MAX
=
99
;
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString
hashGameType
(
const
QString
&
gameType
)
const
;
public:
public:
GamesProxyModel
(
QObject
*
parent
=
0
,
ServerInfo_User
*
_ownUser
=
0
);
GamesProxyModel
(
QObject
*
parent
=
0
,
ServerInfo_User
*
_ownUser
=
0
);
...
...
cockatrice/src/main.cpp
View file @
c8d59eec
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
#include
<QTranslator>
#include
<QTranslator>
#include
<QLibraryInfo>
#include
<QLibraryInfo>
#include
<QDateTime>
#include
<QDateTime>
#include
<QSettings>
#include
<QIcon>
#include
<QIcon>
#include
<QDir>
#include
<QDir>
#include
<QDesktopServices>
#include
<QDesktopServices>
...
...
cockatrice/src/player.cpp
View file @
c8d59eec
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include
"color.h"
#include
"color.h"
#include
"deck_loader.h"
#include
"deck_loader.h"
#include
"main.h"
#include
"main.h"
#include
<QSettings>
#include
<QPainter>
#include
<QPainter>
#include
<QMenu>
#include
<QMenu>
#include
<QDebug>
#include
<QDebug>
...
@@ -832,12 +831,10 @@ void Player::initSayMenu()
...
@@ -832,12 +831,10 @@ void Player::initSayMenu()
{
{
sayMenu
->
clear
();
sayMenu
->
clear
();
QSettings
settings
;
int
count
=
settingsCache
->
messages
().
getCount
();
settings
.
beginGroup
(
"messages"
);
int
count
=
settings
.
value
(
"count"
,
0
).
toInt
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
QAction
*
newAction
=
new
QAction
(
settings
.
value
(
QString
(
"msg%1"
).
arg
(
i
)).
toString
(
),
this
);
QAction
*
newAction
=
new
QAction
(
settings
Cache
->
messages
().
getMessageAt
(
i
),
this
);
if
(
i
<=
10
){
if
(
i
<=
10
){
newAction
->
setShortcut
(
QKeySequence
(
"Ctrl+"
+
QString
::
number
((
i
+
1
)
%
10
)));
newAction
->
setShortcut
(
QKeySequence
(
"Ctrl+"
+
QString
::
number
((
i
+
1
)
%
10
)));
}
}
...
...
cockatrice/src/settings/carddatabasesettings.cpp
0 → 100644
View file @
c8d59eec
#include
"carddatabasesettings.h"
CardDatabaseSettings
::
CardDatabaseSettings
(
QString
settingPath
,
QObject
*
parent
)
:
SettingsManager
(
settingPath
+
"cardDatabase.ini"
,
parent
)
{
}
void
CardDatabaseSettings
::
setSortKey
(
QString
shortName
,
unsigned
int
sortKey
)
{
setValue
(
sortKey
,
"sortkey"
,
"sets"
,
shortName
);
}
void
CardDatabaseSettings
::
setEnabled
(
QString
shortName
,
bool
enabled
)
{
setValue
(
enabled
,
"enabled"
,
"sets"
,
shortName
);
}
void
CardDatabaseSettings
::
setIsKnown
(
QString
shortName
,
bool
isknown
)
{
setValue
(
isknown
,
"isknown"
,
"sets"
,
shortName
);
}
unsigned
int
CardDatabaseSettings
::
getSortKey
(
QString
shortName
)
{
return
getValue
(
"sortkey"
,
"sets"
,
shortName
).
toUInt
();
}
bool
CardDatabaseSettings
::
isEnabled
(
QString
shortName
)
{
return
getValue
(
"enabled"
,
"sets"
,
shortName
).
toBool
();
}
bool
CardDatabaseSettings
::
isKnown
(
QString
shortName
)
{
return
getValue
(
"isknown"
,
"sets"
,
shortName
).
toBool
();
}
cockatrice/src/settings/carddatabasesettings.h
0 → 100644
View file @
c8d59eec
#ifndef CARDDATABASESETTINGS_H
#define CARDDATABASESETTINGS_H
#include
"settingsmanager.h"
#include
<QObject>
#include
<QVariant>
#include
<QSettings>
class
CardDatabaseSettings
:
public
SettingsManager
{
Q_OBJECT
friend
class
SettingsCache
;
public:
void
setSortKey
(
QString
shortName
,
unsigned
int
sortKey
);
void
setEnabled
(
QString
shortName
,
bool
enabled
);
void
setIsKnown
(
QString
shortName
,
bool
isknown
);
unsigned
int
getSortKey
(
QString
shortName
);
bool
isEnabled
(
QString
shortName
);
bool
isKnown
(
QString
shortName
);
signals:
public
slots
:
private:
CardDatabaseSettings
(
QString
settingPath
,
QObject
*
parent
=
0
);
CardDatabaseSettings
(
const
CardDatabaseSettings
&
/*other*/
);
CardDatabaseSettings
(
CardDatabaseSettings
&
/*other*/
);
CardDatabaseSettings
(
volatile
const
CardDatabaseSettings
&
/*other*/
);
CardDatabaseSettings
(
volatile
CardDatabaseSettings
&
/*other*/
);
};
#endif // CARDDATABASESETTINGS_H
cockatrice/src/settings/gamefilterssettings.cpp
0 → 100644
View file @
c8d59eec
#include
"gamefilterssettings.h"
#include
<QCryptographicHash>
GameFiltersSettings
::
GameFiltersSettings
(
QString
settingPath
,
QObject
*
parent
)
:
SettingsManager
(
settingPath
+
"gamefilters.ini"
,
parent
)
{
}
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString
GameFiltersSettings
::
hashGameType
(
const
QString
&
gameType
)
const
{
return
QCryptographicHash
::
hash
(
gameType
.
toUtf8
(),
QCryptographicHash
::
Md5
).
toHex
();
}
void
GameFiltersSettings
::
setUnavailableGamesVisible
(
bool
enabled
)
{
setValue
(
enabled
,
"unavailable_games_visible"
,
"filter_games"
);
}
bool
GameFiltersSettings
::
isUnavailableGamesVisible
()
{
QVariant
previous
=
getValue
(
"unavailable_games_visible"
,
"filter_games"
);
return
previous
==
QVariant
()
?
false
:
previous
.
toBool
();
}
void
GameFiltersSettings
::
setShowPasswordProtectedGames
(
bool
show
)
{
setValue
(
show
,
"show_password_protected_games"
,
"filter_games"
);
}
bool
GameFiltersSettings
::
isShowPasswordProtectedGames
()
{
QVariant
previous
=
getValue
(
"show_password_protected_games"
,
"filter_games"
);
return
previous
==
QVariant
()
?
true
:
previous
.
toBool
();
}
void
GameFiltersSettings
::
setGameNameFilter
(
QString
gameName
)
{
setValue
(
gameName
,
"game_name_filter"
,
"filter_games"
);
}
QString
GameFiltersSettings
::
getGameNameFilter
()
{
return
getValue
(
"game_name_filter"
,
"filter_games"
).
toString
();
}
void
GameFiltersSettings
::
setMinPlayers
(
int
min
)
{
setValue
(
min
,
"min_players"
,
"filter_games"
);
}
int
GameFiltersSettings
::
getMinPlayers
()
{
QVariant
previous
=
getValue
(
"min_players"
,
"filter_games"
);
return
previous
==
QVariant
()
?
1
:
previous
.
toInt
();
}
void
GameFiltersSettings
::
setMaxPlayers
(
int
max
)
{
setValue
(
max
,
"max_players"
,
"filter_games"
);
}
int
GameFiltersSettings
::
getMaxPlayers
()
{
QVariant
previous
=
getValue
(
"max_players"
,
"filter_games"
);
return
previous
==
QVariant
()
?
99
:
previous
.
toInt
();
}
void
GameFiltersSettings
::
setGameTypeEnabled
(
QString
gametype
,
bool
enabled
)
{
setValue
(
enabled
,
"game_type/"
+
hashGameType
(
gametype
),
"filter_games"
);
}
void
GameFiltersSettings
::
setGameHashedTypeEnabled
(
QString
gametypeHASHED
,
bool
enabled
)
{
setValue
(
enabled
,
gametypeHASHED
,
"filter_games"
);
}
bool
GameFiltersSettings
::
isGameTypeEnabled
(
QString
gametype
)
{
QVariant
previous
=
getValue
(
"game_type/"
+
hashGameType
(
gametype
),
"filter_games"
);
return
previous
==
QVariant
()
?
false
:
previous
.
toBool
();
}
cockatrice/src/settings/gamefilterssettings.h
0 → 100644
View file @
c8d59eec
#ifndef GAMEFILTERSSETTINGS_H
#define GAMEFILTERSSETTINGS_H
#include
"settingsmanager.h"
class
GameFiltersSettings
:
public
SettingsManager
{
Q_OBJECT
friend
class
SettingsCache
;
public:
bool
isUnavailableGamesVisible
();
bool
isShowPasswordProtectedGames
();
QString
getGameNameFilter
();
int
getMinPlayers
();
int
getMaxPlayers
();
bool
isGameTypeEnabled
(
QString
gametype
);
void
setUnavailableGamesVisible
(
bool
enabled
);
void
setShowPasswordProtectedGames
(
bool
show
);
void
setGameNameFilter
(
QString
gameName
);
void
setMinPlayers
(
int
min
);
void
setMaxPlayers
(
int
max
);
void
setGameTypeEnabled
(
QString
gametype
,
bool
enabled
);
void
setGameHashedTypeEnabled
(
QString
gametypeHASHED
,
bool
enabled
);
signals:
public
slots
:
private:
GameFiltersSettings
(
QString
settingPath
,
QObject
*
parent
=
0
);
GameFiltersSettings
(
const
GameFiltersSettings
&
/*other*/
);
GameFiltersSettings
(
GameFiltersSettings
&
/*other*/
);
GameFiltersSettings
(
volatile
const
GameFiltersSettings
&
/*other*/
);
GameFiltersSettings
(
volatile
GameFiltersSettings
&
/*other*/
);
QString
hashGameType
(
const
QString
&
gameType
)
const
;
};
#endif // GAMEFILTERSSETTINGS_H
cockatrice/src/settings/layoutssettings.cpp
0 → 100644
View file @
c8d59eec
#include
"layoutssettings.h"
LayoutsSettings
::
LayoutsSettings
(
QString
settingPath
,
QObject
*
parent
)
:
SettingsManager
(
settingPath
+
"layouts.ini"
,
parent
)
{
}
const
QByteArray
LayoutsSettings
::
getDeckEditorLayoutState
()
{
return
getValue
(
"layouts/deckEditor_state"
).
toByteArray
();
}
void
LayoutsSettings
::
setDeckEditorLayoutState
(
const
QByteArray
&
value
)
{
setValue
(
value
,
"layouts/deckEditor_state"
);
}
const
QByteArray
LayoutsSettings
::
getDeckEditorGeometry
()
{
return
getValue
(
"layouts/deckEditor_geometry"
).
toByteArray
();
}
void
LayoutsSettings
::
setDeckEditorGeometry
(
const
QByteArray
&
value
)
{
setValue
(
value
,
"layouts/deckEditor_geometry"
);
}
const
QSize
LayoutsSettings
::
getDeckEditorCardSize
()
{
QVariant
previous
=
getValue
(
"layouts/deckEditor_CardSize"
);
return
previous
==
QVariant
()
?
QSize
(
250
,
500
)
:
previous
.
toSize
();
}
void
LayoutsSettings
::
setDeckEditorCardSize
(
const
QSize
&
value
)
{
setValue
(
value
,
"layouts/deckEditor_CardSize"
);
}
const
QSize
LayoutsSettings
::
getDeckEditorDeckSize
()
{
QVariant
previous
=
getValue
(
"layouts/deckEditor_DeckSize"
);
return
previous
==
QVariant
()
?
QSize
(
250
,
360
)
:
previous
.
toSize
();
}
void
LayoutsSettings
::
setDeckEditorDeckSize
(
const
QSize
&
value
)
{
setValue
(
value
,
"layouts/deckEditor_DeckSize"
);
}
const
QSize
LayoutsSettings
::
getDeckEditorFilterSize
()
{
QVariant
previous
=
getValue
(
"layouts/deckEditor_FilterSize"
);
return
previous
==
QVariant
()
?
QSize
(
250
,
250
)
:
previous
.
toSize
();
}
void
LayoutsSettings
::
setDeckEditorFilterSize
(
const
QSize
&
value
)
{
setValue
(
value
,
"layouts/deckEditor_FilterSize"
);
}
cockatrice/src/settings/layoutssettings.h
0 → 100644
View file @
c8d59eec
#ifndef LAYOUTSSETTINGS_H
#define LAYOUTSSETTINGS_H
#include
"settingsmanager.h"
#include
<QSize>
class
LayoutsSettings
:
public
SettingsManager
{
Q_OBJECT
friend
class
SettingsCache
;
public:
void
setDeckEditorLayoutState
(
const
QByteArray
&
value
);
void
setDeckEditorGeometry
(
const
QByteArray
&
value
);
void
setDeckEditorCardSize
(
const
QSize
&
value
);
void
setDeckEditorDeckSize
(
const
QSize
&
value
);
void
setDeckEditorFilterSize
(
const
QSize
&
value
);
const
QByteArray
getDeckEditorLayoutState
();
const
QByteArray
getDeckEditorGeometry
();
const
QSize
getDeckEditorCardSize
();
const
QSize
getDeckEditorDeckSize
();
const
QSize
getDeckEditorFilterSize
();
signals:
public
slots
:
private:
LayoutsSettings
(
QString
settingPath
,
QObject
*
parent
=
0
);
LayoutsSettings
(
const
LayoutsSettings
&
/*other*/
);
LayoutsSettings
(
LayoutsSettings
&
/*other*/
);
LayoutsSettings
(
volatile
const
LayoutsSettings
&
/*other*/
);
LayoutsSettings
(
volatile
LayoutsSettings
&
/*other*/
);
};
#endif // LAYOUTSSETTINGS_H
cockatrice/src/settings/messagesettings.cpp
0 → 100644
View file @
c8d59eec
#include
"messagesettings.h"
MessageSettings
::
MessageSettings
(
QString
settingPath
,
QObject
*
parent
)
:
SettingsManager
(
settingPath
+
"messages.ini"
,
parent
)
{
}
QString
MessageSettings
::
getMessageAt
(
int
index
)
{
return
getValue
(
QString
(
"msg%1"
).
arg
(
index
),
"messages"
).
toString
();
}
int
MessageSettings
::
getCount
()
{
return
getValue
(
"count"
,
"messages"
).
toInt
();
}
void
MessageSettings
::
setCount
(
int
count
)
{
setValue
(
count
,
"count"
,
"messages"
);
}
void
MessageSettings
::
setMessageAt
(
int
index
,
QString
message
)
{
setValue
(
message
,
QString
(
"msg%1"
).
arg
(
index
),
"messages"
);
}
cockatrice/src/settings/messagesettings.h
0 → 100644
View file @
c8d59eec
#ifndef MESSAGESETTINGS_H
#define MESSAGESETTINGS_H
#include
"settingsmanager.h"
class
MessageSettings
:
public
SettingsManager
{
Q_OBJECT
friend
class
SettingsCache
;
public:
int
getCount
();
QString
getMessageAt
(
int
index
);
void
setCount
(
int
count
);
void
setMessageAt
(
int
index
,
QString
message
);
signals:
public
slots
:
private:
MessageSettings
(
QString
settingPath
,
QObject
*
parent
=
0
);
MessageSettings
(
const
MessageSettings
&
/*other*/
);
MessageSettings
(
MessageSettings
&
/*other*/
);
MessageSettings
(
volatile
const
MessageSettings
&
/*other*/
);
MessageSettings
(
volatile
MessageSettings
&
/*other*/
);
};
#endif // MESSAGESETTINGS_H
Prev
1
2
Next
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