Browse Source

WIP: Able to see the content of the selected namespace.

kevaview
Just Wonder 5 years ago
parent
commit
16bab4654a
  1. 6
      src/qt/kevadialog.cpp
  2. 1
      src/qt/kevadialog.h
  3. 38
      src/qt/kevamynamespacesdialog.cpp
  4. 11
      src/qt/kevamynamespacesdialog.h
  5. 2
      src/qt/kevanewnamespacedialog.h

6
src/qt/kevadialog.cpp

@ -95,6 +95,12 @@ void KevaDialog::setModel(WalletModel *_model) @@ -95,6 +95,12 @@ void KevaDialog::setModel(WalletModel *_model)
}
}
void KevaDialog::showNamespace(QString ns)
{
ui->nameSpace->setText(ns);
on_showContent_clicked();
}
KevaDialog::~KevaDialog()
{
delete ui;

1
src/qt/kevadialog.h

@ -43,6 +43,7 @@ public: @@ -43,6 +43,7 @@ public:
~KevaDialog();
void setModel(WalletModel *model);
void showNamespace(QString ns);
public Q_SLOTS:
void clear();

38
src/qt/kevamynamespacesdialog.cpp

@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
#include <qt/forms/ui_kevamynamespacesdialog.h>
#include <qt/kevanamespacemodel.h>
#include <qt/kevadialog.h>
#include <QPushButton>
#include <QModelIndex>
KevaMyNamespacesDialog::KevaMyNamespacesDialog(QWidget *parent) :
@ -14,6 +16,9 @@ KevaMyNamespacesDialog::KevaMyNamespacesDialog(QWidget *parent) : @@ -14,6 +16,9 @@ KevaMyNamespacesDialog::KevaMyNamespacesDialog(QWidget *parent) :
ui(new Ui::KevaMyNamespacesDialog)
{
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
}
void KevaMyNamespacesDialog::setModel(WalletModel *_model)
@ -35,16 +40,37 @@ void KevaMyNamespacesDialog::setModel(WalletModel *_model) @@ -35,16 +40,37 @@ void KevaMyNamespacesDialog::setModel(WalletModel *_model)
//tableView->setColumnWidth(KevaNamespaceModel::Name, NAME_COLUMN_WIDTH);
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
connect(tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(namespaceView_selectionChanged()));
}
}
void KevaMyNamespacesDialog::accept()
void KevaMyNamespacesDialog::namespaceView_selectionChanged()
{
bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty();
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
if (enable) {
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
} else {
QModelIndex empty;
selectedIndex = empty;
}
}
void KevaMyNamespacesDialog::apply()
{
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaNamespaceModel::Id);
QString idStr = idIdx.data(Qt::DisplayRole).toString();
KevaDialog* dialog = (KevaDialog*)this->parentWidget();
dialog->showNamespace(idStr);
QDialog::close();
}
void KevaMyNamespacesDialog::reject()
{
// Create the namespace here.
QDialog::accept();
QDialog::reject();
}
KevaMyNamespacesDialog::~KevaMyNamespacesDialog()

11
src/qt/kevamynamespacesdialog.h

@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
#include <QString>
#include <QDialog>
#include <QItemSelection>
#include <QAbstractItemView>
class WalletModel;
@ -31,12 +33,19 @@ class KevaMyNamespacesDialog : public QDialog @@ -31,12 +33,19 @@ class KevaMyNamespacesDialog : public QDialog
public:
explicit KevaMyNamespacesDialog(QWidget *parent = 0);
~KevaMyNamespacesDialog();
void accept();
void setModel(WalletModel *_model);
public Q_SLOTS:
void apply();
void reject();
private Q_SLOTS:
void namespaceView_selectionChanged();
private:
Ui::KevaMyNamespacesDialog *ui;
WalletModel *model;
QModelIndex selectedIndex;
};
#endif // BITCOIN_QT_KEVAMYNMAESPACESDIALOG_H

2
src/qt/kevanewnamespacedialog.h

@ -23,6 +23,8 @@ class KevaNewNamespaceDialog : public QDialog @@ -23,6 +23,8 @@ class KevaNewNamespaceDialog : public QDialog
public:
explicit KevaNewNamespaceDialog(QWidget *parent = 0);
~KevaNewNamespaceDialog();
public Q_SLOTS:
void accept();
private:

Loading…
Cancel
Save