initial commit for settings dialog, unfinished
This commit is contained in:
parent
84f06503c6
commit
f703004b6c
10 changed files with 261 additions and 118 deletions
|
@ -16,5 +16,9 @@ QT += network svg
|
||||||
#QTPLUGIN += qjpeg
|
#QTPLUGIN += qjpeg
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += src/counter.h src/gameselector.h src/dlg_creategame.h src/dlg_connect.h src/gamesmodel.h src/client.h src/window_main.h src/servergame.h src/servereventdata.h src/zonelist.h src/cardzone.h src/player.h src/cardlist.h src/carditem.h src/tablezone.h src/handzone.h src/playerlist.h src/game.h src/carddatabase.h src/gameview.h src/decklistmodel.h src/dlg_startgame.h src/cardinfowidget.h src/messagelogwidget.h src/serverzonecard.h src/zoneviewzone.h src/zoneviewwidget.h src/libraryzone.h src/pilezone.h src/carddragitem.h src/zoneviewlayout.h src/playerarea.h src/carddatabasemodel.h src/window_deckeditor.h src/decklist.h setsmodel.h src/window_sets.h src/dlg_editmessages.h src/abstractgraphicsitem.h
|
HEADERS += src/counter.h src/gameselector.h src/dlg_creategame.h src/dlg_connect.h src/gamesmodel.h src/client.h src/window_main.h src/servergame.h src/servereventdata.h src/zonelist.h src/cardzone.h src/player.h src/cardlist.h src/carditem.h src/tablezone.h src/handzone.h src/playerlist.h src/game.h src/carddatabase.h src/gameview.h src/decklistmodel.h src/dlg_startgame.h src/cardinfowidget.h src/messagelogwidget.h src/serverzonecard.h src/zoneviewzone.h src/zoneviewwidget.h src/libraryzone.h src/pilezone.h src/carddragitem.h src/zoneviewlayout.h src/playerarea.h src/carddatabasemodel.h src/window_deckeditor.h src/decklist.h setsmodel.h src/window_sets.h src/abstractgraphicsitem.h src/dlg_settings.h
|
||||||
SOURCES += src/counter.cpp src/gameselector.cpp src/dlg_creategame.cpp src/dlg_connect.cpp src/client.cpp src/main.cpp src/window_main.cpp src/servereventdata.cpp src/gamesmodel.cpp src/player.cpp src/cardzone.cpp src/zonelist.cpp src/cardlist.cpp src/carditem.cpp src/tablezone.cpp src/handzone.cpp src/playerlist.cpp src/game.cpp src/carddatabase.cpp src/gameview.cpp src/decklistmodel.cpp src/dlg_startgame.cpp src/cardinfowidget.cpp src/messagelogwidget.cpp src/zoneviewzone.cpp src/zoneviewwidget.cpp src/libraryzone.cpp src/pilezone.cpp src/carddragitem.cpp src/zoneviewlayout.cpp src/playerarea.cpp src/carddatabasemodel.cpp src/window_deckeditor.cpp src/decklist.cpp src/setsmodel.cpp src/window_sets.cpp src/dlg_editmessages.cpp src/abstractgraphicsitem.cpp
|
SOURCES += src/counter.cpp src/gameselector.cpp src/dlg_creategame.cpp src/dlg_connect.cpp src/client.cpp src/main.cpp src/window_main.cpp src/servereventdata.cpp src/gamesmodel.cpp src/player.cpp src/cardzone.cpp src/zonelist.cpp src/cardlist.cpp src/carditem.cpp src/tablezone.cpp src/handzone.cpp src/playerlist.cpp src/game.cpp src/carddatabase.cpp src/gameview.cpp src/decklistmodel.cpp src/dlg_startgame.cpp src/cardinfowidget.cpp src/messagelogwidget.cpp src/zoneviewzone.cpp src/zoneviewwidget.cpp src/libraryzone.cpp src/pilezone.cpp src/carddragitem.cpp src/zoneviewlayout.cpp src/playerarea.cpp src/carddatabasemodel.cpp src/window_deckeditor.cpp src/decklist.cpp src/setsmodel.cpp src/window_sets.cpp src/abstractgraphicsitem.cpp src/dlg_settings.cpp
|
||||||
|
TRANSLATIONS += \
|
||||||
|
translations/cockatrice_de.ts \
|
||||||
|
translations/cockatrice_en.ts
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
<qresource>
|
<qresource>
|
||||||
<file alias="back.svg">resources/back.svg</file>
|
<file alias="back.svg">resources/back.svg</file>
|
||||||
|
|
||||||
|
<file>translations/cockatrice_de.qm</file>
|
||||||
|
<file>translations/cockatrice_en.qm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
#include <QtGui>
|
|
||||||
#include "dlg_editmessages.h"
|
|
||||||
|
|
||||||
DlgEditMessages::DlgEditMessages(QWidget *parent)
|
|
||||||
: QDialog(parent)
|
|
||||||
{
|
|
||||||
aAdd = new QAction(tr("Add"), this);
|
|
||||||
connect(aAdd, SIGNAL(triggered()), this, SLOT(actAdd()));
|
|
||||||
aRemove = new QAction(tr("Remove"), this);
|
|
||||||
connect(aRemove, SIGNAL(triggered()), this, SLOT(actRemove()));
|
|
||||||
|
|
||||||
messageList = new QListWidget;
|
|
||||||
QToolBar *messageToolBar = new QToolBar;
|
|
||||||
messageToolBar->setOrientation(Qt::Vertical);
|
|
||||||
messageToolBar->addAction(aAdd);
|
|
||||||
messageToolBar->addAction(aRemove);
|
|
||||||
|
|
||||||
QSettings settings;
|
|
||||||
settings.beginGroup("messages");
|
|
||||||
int count = settings.value("count", 0).toInt();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
messageList->addItem(settings.value(QString("msg%1").arg(i)).toString());
|
|
||||||
|
|
||||||
QHBoxLayout *listLayout = new QHBoxLayout;
|
|
||||||
listLayout->addWidget(messageList);
|
|
||||||
listLayout->addWidget(messageToolBar);
|
|
||||||
|
|
||||||
cancelButton = new QPushButton(tr("&Cancel"));
|
|
||||||
okButton = new QPushButton(tr("O&K"));
|
|
||||||
okButton->setAutoDefault(true);
|
|
||||||
|
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
|
||||||
buttonLayout->addStretch();
|
|
||||||
buttonLayout->addWidget(cancelButton);
|
|
||||||
buttonLayout->addWidget(okButton);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addLayout(listLayout);
|
|
||||||
mainLayout->addLayout(buttonLayout);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
setWindowTitle(tr("Edit messages"));
|
|
||||||
setMinimumWidth(sizeHint().width());
|
|
||||||
resize(300, 300);
|
|
||||||
|
|
||||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
|
||||||
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DlgEditMessages::storeSettings()
|
|
||||||
{
|
|
||||||
QSettings settings;
|
|
||||||
settings.beginGroup("messages");
|
|
||||||
settings.setValue("count", messageList->count());
|
|
||||||
for (int i = 0; i < messageList->count(); i++)
|
|
||||||
settings.setValue(QString("msg%1").arg(i), messageList->item(i)->text());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DlgEditMessages::actAdd()
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
QString msg = QInputDialog::getText(this, tr("Add message"), QString("Message:"), QLineEdit::Normal, QString(), &ok);
|
|
||||||
if (ok) {
|
|
||||||
messageList->addItem(msg);
|
|
||||||
storeSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DlgEditMessages::actRemove()
|
|
||||||
{
|
|
||||||
if (messageList->currentItem()) {
|
|
||||||
delete messageList->takeItem(messageList->currentRow());
|
|
||||||
storeSettings();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef DLG_EDITMESSAGES_H
|
|
||||||
#define DLG_EDITMESSAGES_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
class QListWidget;
|
|
||||||
class QPushButton;
|
|
||||||
|
|
||||||
class DlgEditMessages: public QDialog {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
DlgEditMessages(QWidget *parent = 0);
|
|
||||||
private slots:
|
|
||||||
void actAdd();
|
|
||||||
void actRemove();
|
|
||||||
private:
|
|
||||||
QListWidget *messageList;
|
|
||||||
QAction *aAdd, *aRemove;
|
|
||||||
QPushButton *cancelButton, *okButton;
|
|
||||||
|
|
||||||
void storeSettings();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
187
cockatrice/src/dlg_settings.cpp
Normal file
187
cockatrice/src/dlg_settings.cpp
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include "dlg_settings.h"
|
||||||
|
|
||||||
|
GeneralSettingsPage::GeneralSettingsPage()
|
||||||
|
{
|
||||||
|
QGroupBox *personalGroupBox = new QGroupBox(tr("Personal settings"));
|
||||||
|
QLabel *languageLabel = new QLabel(tr("Language:"));
|
||||||
|
QComboBox *languageBox = new QComboBox;
|
||||||
|
|
||||||
|
QStringList qmFiles = findQmFiles();
|
||||||
|
for (int i = 0; i < qmFiles.size(); i++)
|
||||||
|
languageBox->addItem(languageName(qmFiles[i]), qmFiles[i]);
|
||||||
|
|
||||||
|
QGridLayout *personalGrid = new QGridLayout;
|
||||||
|
personalGrid->addWidget(languageLabel, 0, 0);
|
||||||
|
personalGrid->addWidget(languageBox, 0, 1);
|
||||||
|
personalGroupBox->setLayout(personalGrid);
|
||||||
|
|
||||||
|
QGroupBox *pathsGroupBox = new QGroupBox(tr("Paths"));
|
||||||
|
QLabel *deckPathLabel = new QLabel(tr("Decks directory:"));
|
||||||
|
QLineEdit *deckPathEdit = new QLineEdit;
|
||||||
|
QLabel *picsPathLabel = new QLabel(tr("Pictures directory:"));
|
||||||
|
QLineEdit *picsPathEdit = new QLineEdit;
|
||||||
|
QLabel *cardDatabasePathLabel = new QLabel(tr("Path to card database:"));
|
||||||
|
QLineEdit *cardDatabasePathEdit = new QLineEdit;
|
||||||
|
|
||||||
|
QGridLayout *pathsGrid = new QGridLayout;
|
||||||
|
pathsGrid->addWidget(deckPathLabel, 0, 0);
|
||||||
|
pathsGrid->addWidget(deckPathEdit, 0, 1);
|
||||||
|
pathsGrid->addWidget(picsPathLabel, 1, 0);
|
||||||
|
pathsGrid->addWidget(picsPathEdit, 1, 1);
|
||||||
|
pathsGrid->addWidget(cardDatabasePathLabel, 2, 0);
|
||||||
|
pathsGrid->addWidget(cardDatabasePathEdit, 2, 1);
|
||||||
|
pathsGroupBox->setLayout(pathsGrid);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(personalGroupBox);
|
||||||
|
mainLayout->addWidget(pathsGroupBox);
|
||||||
|
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList GeneralSettingsPage::findQmFiles()
|
||||||
|
{
|
||||||
|
QDir dir(":/translations");
|
||||||
|
QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name);
|
||||||
|
QMutableStringListIterator i(fileNames);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
i.setValue(dir.filePath(i.value()));
|
||||||
|
}
|
||||||
|
return fileNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeneralSettingsPage::languageName(const QString &qmFile)
|
||||||
|
{
|
||||||
|
QTranslator translator;
|
||||||
|
translator.load(qmFile);
|
||||||
|
|
||||||
|
return translator.translate("GeneralSettingsPage", "English");
|
||||||
|
}
|
||||||
|
|
||||||
|
AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MessagesSettingsPage::MessagesSettingsPage()
|
||||||
|
{
|
||||||
|
aAdd = new QAction(tr("Add"), this);
|
||||||
|
connect(aAdd, SIGNAL(triggered()), this, SLOT(actAdd()));
|
||||||
|
aRemove = new QAction(tr("Remove"), this);
|
||||||
|
connect(aRemove, SIGNAL(triggered()), this, SLOT(actRemove()));
|
||||||
|
|
||||||
|
messageList = new QListWidget;
|
||||||
|
QToolBar *messageToolBar = new QToolBar;
|
||||||
|
messageToolBar->setOrientation(Qt::Vertical);
|
||||||
|
messageToolBar->addAction(aAdd);
|
||||||
|
messageToolBar->addAction(aRemove);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
settings.beginGroup("messages");
|
||||||
|
int count = settings.value("count", 0).toInt();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
messageList->addItem(settings.value(QString("msg%1").arg(i)).toString());
|
||||||
|
|
||||||
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
|
mainLayout->addWidget(messageList);
|
||||||
|
mainLayout->addWidget(messageToolBar);
|
||||||
|
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::storeSettings()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.beginGroup("messages");
|
||||||
|
settings.setValue("count", messageList->count());
|
||||||
|
for (int i = 0; i < messageList->count(); i++)
|
||||||
|
settings.setValue(QString("msg%1").arg(i), messageList->item(i)->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::actAdd()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString msg = QInputDialog::getText(this, tr("Add message"), tr("Message:"), QLineEdit::Normal, QString(), &ok);
|
||||||
|
if (ok) {
|
||||||
|
messageList->addItem(msg);
|
||||||
|
storeSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesSettingsPage::actRemove()
|
||||||
|
{
|
||||||
|
if (messageList->currentItem()) {
|
||||||
|
delete messageList->takeItem(messageList->currentRow());
|
||||||
|
storeSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DlgSettings::DlgSettings()
|
||||||
|
: QDialog()
|
||||||
|
{
|
||||||
|
contentsWidget = new QListWidget;
|
||||||
|
contentsWidget->setViewMode(QListView::IconMode);
|
||||||
|
contentsWidget->setIconSize(QSize(96, 84));
|
||||||
|
contentsWidget->setMovement(QListView::Static);
|
||||||
|
contentsWidget->setMaximumWidth(128);
|
||||||
|
contentsWidget->setSpacing(12);
|
||||||
|
|
||||||
|
pagesWidget = new QStackedWidget;
|
||||||
|
pagesWidget->addWidget(new GeneralSettingsPage);
|
||||||
|
pagesWidget->addWidget(new AppearanceSettingsPage);
|
||||||
|
pagesWidget->addWidget(new MessagesSettingsPage);
|
||||||
|
|
||||||
|
QPushButton *closeButton = new QPushButton(tr("&Close"));
|
||||||
|
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
|
|
||||||
|
createIcons();
|
||||||
|
contentsWidget->setCurrentRow(0);
|
||||||
|
|
||||||
|
QHBoxLayout *hboxLayout = new QHBoxLayout;
|
||||||
|
hboxLayout->addWidget(contentsWidget);
|
||||||
|
hboxLayout->addWidget(pagesWidget, 1);
|
||||||
|
|
||||||
|
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
||||||
|
buttonsLayout->addStretch(1);
|
||||||
|
buttonsLayout->addWidget(closeButton);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(hboxLayout);
|
||||||
|
mainLayout->addStretch(1);
|
||||||
|
mainLayout->addSpacing(12);
|
||||||
|
mainLayout->addLayout(buttonsLayout);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
setWindowTitle(tr("Settings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgSettings::createIcons()
|
||||||
|
{
|
||||||
|
QListWidgetItem *generalButton = new QListWidgetItem(contentsWidget);
|
||||||
|
generalButton->setText(tr("General"));
|
||||||
|
generalButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
generalButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
QListWidgetItem *appearanceButton = new QListWidgetItem(contentsWidget);
|
||||||
|
appearanceButton->setText(tr("Appearance"));
|
||||||
|
appearanceButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
appearanceButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
QListWidgetItem *messagesButton = new QListWidgetItem(contentsWidget);
|
||||||
|
messagesButton->setText(tr("Messages"));
|
||||||
|
messagesButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
messagesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
connect(contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem *)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgSettings::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if (!current)
|
||||||
|
current = previous;
|
||||||
|
|
||||||
|
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
||||||
|
}
|
51
cockatrice/src/dlg_settings.h
Normal file
51
cockatrice/src/dlg_settings.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef DLG_SETTINGS_H
|
||||||
|
#define DLG_SETTINGS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class QListWidget;
|
||||||
|
class QListWidgetItem;
|
||||||
|
class QStackedWidget;
|
||||||
|
|
||||||
|
class GeneralSettingsPage : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
GeneralSettingsPage();
|
||||||
|
private:
|
||||||
|
QStringList findQmFiles();
|
||||||
|
QString languageName(const QString &qmFile);
|
||||||
|
};
|
||||||
|
|
||||||
|
class AppearanceSettingsPage : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
AppearanceSettingsPage();
|
||||||
|
};
|
||||||
|
|
||||||
|
class MessagesSettingsPage : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MessagesSettingsPage();
|
||||||
|
private slots:
|
||||||
|
void actAdd();
|
||||||
|
void actRemove();
|
||||||
|
private:
|
||||||
|
QListWidget *messageList;
|
||||||
|
QAction *aAdd, *aRemove;
|
||||||
|
|
||||||
|
void storeSettings();
|
||||||
|
};
|
||||||
|
|
||||||
|
class DlgSettings : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DlgSettings();
|
||||||
|
public slots:
|
||||||
|
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
private:
|
||||||
|
QListWidget *contentsWidget;
|
||||||
|
QStackedWidget *pagesWidget;
|
||||||
|
void createIcons();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -10,7 +10,6 @@
|
||||||
#include "handzone.h"
|
#include "handzone.h"
|
||||||
#include "carddatabase.h"
|
#include "carddatabase.h"
|
||||||
#include "dlg_startgame.h"
|
#include "dlg_startgame.h"
|
||||||
#include "dlg_editmessages.h"
|
|
||||||
#include "playerarea.h"
|
#include "playerarea.h"
|
||||||
#include "counter.h"
|
#include "counter.h"
|
||||||
|
|
||||||
|
@ -54,9 +53,6 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
||||||
aCreateToken->setShortcut(tr("Ctrl+T"));
|
aCreateToken->setShortcut(tr("Ctrl+T"));
|
||||||
connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken()));
|
connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken()));
|
||||||
|
|
||||||
aEditMessages = new QAction(tr("&Edit messages..."), this);
|
|
||||||
connect(aEditMessages, SIGNAL(triggered()), this, SLOT(actEditMessages()));
|
|
||||||
|
|
||||||
actionsMenu->addAction(aUntapAll);
|
actionsMenu->addAction(aUntapAll);
|
||||||
actionsMenu->addSeparator();
|
actionsMenu->addSeparator();
|
||||||
actionsMenu->addAction(aDecLife);
|
actionsMenu->addAction(aDecLife);
|
||||||
|
@ -115,8 +111,6 @@ Game::~Game()
|
||||||
void Game::initSayMenu()
|
void Game::initSayMenu()
|
||||||
{
|
{
|
||||||
sayMenu->clear();
|
sayMenu->clear();
|
||||||
sayMenu->addAction(aEditMessages);
|
|
||||||
sayMenu->addSeparator();
|
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("messages");
|
settings.beginGroup("messages");
|
||||||
|
@ -325,13 +319,6 @@ void Game::actCreateToken()
|
||||||
client->createToken("table", cardname, QString(), 0, 0);
|
client->createToken("table", cardname, QString(), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::actEditMessages()
|
|
||||||
{
|
|
||||||
DlgEditMessages dlg;
|
|
||||||
if (dlg.exec())
|
|
||||||
initSayMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::showCardMenu(QPoint p)
|
void Game::showCardMenu(QPoint p)
|
||||||
{
|
{
|
||||||
cardMenu->exec(p);
|
cardMenu->exec(p);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Game : public QObject {
|
||||||
private:
|
private:
|
||||||
QMenu *actionsMenu, *sayMenu, *cardMenu;
|
QMenu *actionsMenu, *sayMenu, *cardMenu;
|
||||||
QAction *aTap, *aUntap, *aDoesntUntap, *aFlip, *aAddCounter, *aRemoveCounter, *aSetCounters,
|
QAction *aTap, *aUntap, *aDoesntUntap, *aFlip, *aAddCounter, *aRemoveCounter, *aSetCounters,
|
||||||
*aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aShuffle, *aDraw, *aDrawCards, *aRollDice, *aCreateToken, *aEditMessages;
|
*aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aShuffle, *aDraw, *aDrawCards, *aRollDice, *aCreateToken;
|
||||||
DlgStartGame *dlgStartGame;
|
DlgStartGame *dlgStartGame;
|
||||||
|
|
||||||
CardDatabase *db;
|
CardDatabase *db;
|
||||||
|
@ -37,7 +37,6 @@ private slots:
|
||||||
void actDrawCards();
|
void actDrawCards();
|
||||||
void actRollDice();
|
void actRollDice();
|
||||||
void actCreateToken();
|
void actCreateToken();
|
||||||
void actEditMessages();
|
|
||||||
|
|
||||||
void showCardMenu(QPoint p);
|
void showCardMenu(QPoint p);
|
||||||
void actDoesntUntap();
|
void actDoesntUntap();
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "window_main.h"
|
#include "window_main.h"
|
||||||
#include "dlg_connect.h"
|
#include "dlg_connect.h"
|
||||||
|
#include "dlg_settings.h"
|
||||||
#include "gameselector.h"
|
#include "gameselector.h"
|
||||||
#include "window_deckeditor.h"
|
#include "window_deckeditor.h"
|
||||||
#include "cardinfowidget.h"
|
#include "cardinfowidget.h"
|
||||||
|
@ -130,6 +131,12 @@ void MainWindow::actFullScreen(bool checked)
|
||||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::actSettings()
|
||||||
|
{
|
||||||
|
DlgSettings dlg;
|
||||||
|
dlg.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::actExit()
|
void MainWindow::actExit()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
@ -193,6 +200,8 @@ void MainWindow::createActions()
|
||||||
aFullScreen->setShortcut(tr("Ctrl+F"));
|
aFullScreen->setShortcut(tr("Ctrl+F"));
|
||||||
aFullScreen->setCheckable(true);
|
aFullScreen->setCheckable(true);
|
||||||
connect(aFullScreen, SIGNAL(toggled(bool)), this, SLOT(actFullScreen(bool)));
|
connect(aFullScreen, SIGNAL(toggled(bool)), this, SLOT(actFullScreen(bool)));
|
||||||
|
aSettings = new QAction(tr("&Settings..."), this);
|
||||||
|
connect(aSettings, SIGNAL(triggered()), this, SLOT(actSettings()));
|
||||||
aExit = new QAction(tr("&Exit"), this);
|
aExit = new QAction(tr("&Exit"), this);
|
||||||
connect(aExit, SIGNAL(triggered()), this, SLOT(actExit()));
|
connect(aExit, SIGNAL(triggered()), this, SLOT(actExit()));
|
||||||
|
|
||||||
|
@ -215,6 +224,8 @@ void MainWindow::createMenus()
|
||||||
gameMenu->addSeparator();
|
gameMenu->addSeparator();
|
||||||
gameMenu->addAction(aFullScreen);
|
gameMenu->addAction(aFullScreen);
|
||||||
gameMenu->addSeparator();
|
gameMenu->addSeparator();
|
||||||
|
gameMenu->addAction(aSettings);
|
||||||
|
gameMenu->addSeparator();
|
||||||
gameMenu->addAction(aExit);
|
gameMenu->addAction(aExit);
|
||||||
|
|
||||||
actionsMenu = menuBar()->addMenu(tr("&Actions"));
|
actionsMenu = menuBar()->addMenu(tr("&Actions"));
|
||||||
|
|
|
@ -56,6 +56,7 @@ private slots:
|
||||||
void actLeaveGame();
|
void actLeaveGame();
|
||||||
void actDeckEditor();
|
void actDeckEditor();
|
||||||
void actFullScreen(bool checked);
|
void actFullScreen(bool checked);
|
||||||
|
void actSettings();
|
||||||
void actExit();
|
void actExit();
|
||||||
|
|
||||||
void updateSceneSize();
|
void updateSceneSize();
|
||||||
|
@ -66,7 +67,7 @@ private:
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
QMenu *gameMenu, *actionsMenu, *cardMenu;
|
QMenu *gameMenu, *actionsMenu, *cardMenu;
|
||||||
QAction *aConnect, *aDisconnect, *aRestartGame, *aLeaveGame, *aDeckEditor, *aFullScreen, *aExit;
|
QAction *aConnect, *aDisconnect, *aRestartGame, *aLeaveGame, *aDeckEditor, *aFullScreen, *aSettings, *aExit;
|
||||||
QAction *aCloseMostRecentZoneView;
|
QAction *aCloseMostRecentZoneView;
|
||||||
QVBoxLayout *viewLayout;
|
QVBoxLayout *viewLayout;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue