feather/src/CoinsWidget.h
2022-05-24 15:18:43 +02:00

92 lines
2.2 KiB
C++

// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
#ifndef FEATHER_COINSWIDGET_H
#define FEATHER_COINSWIDGET_H
#include <QMenu>
#include <QWidget>
#include <QSvgWidget>
#include "appcontext.h"
#include "model/CoinsModel.h"
#include "model/CoinsProxyModel.h"
#include "libwalletqt/Coins.h"
namespace Ui {
class CoinsWidget;
}
class CoinsWidget : public QWidget
{
Q_OBJECT
public:
explicit CoinsWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr);
void setModel(CoinsModel * model, Coins * coins);
~CoinsWidget() override;
void setSpendSelected(const QStringList &pubkeys);
signals:
void spendSelectedChanged(const QStringList &pubkeys);
public slots:
void setSearchbarVisible(bool visible);
void focusSearchbar();
private slots:
void showHeaderMenu(const QPoint& position);
void setShowSpent(bool show);
void freezeAllSelected();
void thawAllSelected();
void spendSelected();
void viewOutput();
void onSweepOutputs();
void setSearchFilter(const QString &filter);
void editLabel();
private:
void freezeCoins(QStringList &pubkeys);
void thawCoins(QStringList &pubkeys);
void selectCoins(const QStringList &pubkeys);
enum copyField {
PubKey = 0,
KeyImage,
TxID,
Address,
Label,
Height,
Amount
};
QScopedPointer<Ui::CoinsWidget> ui;
QSharedPointer<AppContext> m_ctx;
QMenu *m_contextMenu;
QMenu *m_headerMenu;
QMenu *m_copyMenu;
QAction *m_spendAction;
QAction *m_showSpentAction;
QAction *m_freezeOutputAction;
QAction *m_freezeAllSelectedAction;
QAction *m_thawOutputAction;
QAction *m_thawAllSelectedAction;
QAction *m_viewOutputAction;
QAction *m_sweepOutputAction;
QAction *m_sweepOutputsAction;
QAction *m_editLabelAction;
Coins *m_coins;
CoinsModel * m_model;
CoinsProxyModel * m_proxyModel;
void showContextMenu(const QPoint & point);
void copy(copyField field);
CoinsInfo* currentEntry();
QVector<CoinsInfo*> currentEntries();
QStringList selectedPubkeys();
};
#endif //FEATHER_COINSWIDGET_H