added game filter dialog in GameSelector; switched all dialogs to QDialogButtonBox; issue #32 fixed

This commit is contained in:
Max-Wilhelm Bruker 2012-03-30 21:09:35 +02:00
parent facfc3cc52
commit 6b14b4e543
21 changed files with 310 additions and 116 deletions

View file

@ -1,6 +1,7 @@
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include "remotedecklist_treewidget.h"
#include "dlg_load_remote_deck.h"
#include "main.h"
@ -9,36 +10,27 @@ DlgLoadRemoteDeck::DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent)
: QDialog(parent), client(_client)
{
dirView = new RemoteDeckList_TreeWidget(client);
okButton = new QPushButton(tr("O&K"));
okButton->setDefault(true);
okButton->setAutoDefault(true);
okButton->setEnabled(false);
cancelButton = new QPushButton(tr("&Cancel"));
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch();
buttonLayout->addWidget(okButton);
buttonLayout->addWidget(cancelButton);
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(dirView);
mainLayout->addLayout(buttonLayout);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
setWindowTitle(tr("Load deck"));
setMinimumWidth(sizeHint().width());
resize(300, 500);
resize(400, 600);
connect(dirView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(currentItemChanged(const QModelIndex &, const QModelIndex &)));
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
void DlgLoadRemoteDeck::currentItemChanged(const QModelIndex &current, const QModelIndex & /*previous*/)
{
okButton->setEnabled(dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(dirView->getNode(current)));
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(dirView->getNode(current)));
}
int DlgLoadRemoteDeck::getDeckId() const