mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 04:43:56 -07:00
Took 19 minutes Took 22 seconds Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
#include "dlg_load_remote_deck.h"
|
|
|
|
#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h"
|
|
#include "../main.h"
|
|
|
|
#include <QDialogButtonBox>
|
|
#include <QHBoxLayout>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
|
|
DlgLoadRemoteDeck::DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent) : QDialog(parent), client(_client)
|
|
{
|
|
dirView = new RemoteDeckList_TreeWidget(client);
|
|
dirView->refreshTree();
|
|
|
|
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgLoadRemoteDeck::accept);
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgLoadRemoteDeck::reject);
|
|
|
|
auto *mainLayout = new QVBoxLayout;
|
|
mainLayout->addWidget(dirView);
|
|
mainLayout->addWidget(buttonBox);
|
|
|
|
setLayout(mainLayout);
|
|
|
|
setWindowTitle(tr("Load deck"));
|
|
setMinimumWidth(sizeHint().width());
|
|
resize(400, 600);
|
|
|
|
connect(dirView->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
|
&DlgLoadRemoteDeck::currentItemChanged);
|
|
}
|
|
|
|
void DlgLoadRemoteDeck::currentItemChanged(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
|
{
|
|
buttonBox->button(QDialogButtonBox::Ok)
|
|
->setEnabled(dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(dirView->getNode(current)));
|
|
}
|
|
|
|
int DlgLoadRemoteDeck::getDeckId() const
|
|
{
|
|
return dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(
|
|
dirView->getNode(dirView->selectionModel()->currentIndex()))
|
|
->getId();
|
|
}
|