receivecoinsdialog.h raw

   1  // Copyright (c) 2011-2021 The Limenka developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  #ifndef LIMENKA_QT_RECEIVECOINSDIALOG_H
   6  #define LIMENKA_QT_RECEIVECOINSDIALOG_H
   7  
   8  #include <qt/guiutil.h>
   9  
  10  #include <QDialog>
  11  #include <QHeaderView>
  12  #include <QItemSelection>
  13  #include <QKeyEvent>
  14  #include <QMenu>
  15  #include <QPoint>
  16  #include <QSortFilterProxyModel>
  17  #include <QVariant>
  18  
  19  class PlatformStyle;
  20  class WalletModel;
  21  
  22  namespace Ui {
  23      class ReceiveCoinsDialog;
  24  }
  25  
  26  QT_BEGIN_NAMESPACE
  27  class QModelIndex;
  28  QT_END_NAMESPACE
  29  
  30  /** Dialog for requesting payment of limenkas */
  31  class ReceiveCoinsDialog : public QDialog
  32  {
  33      Q_OBJECT
  34  
  35  public:
  36      enum ColumnWidths {
  37          DATE_COLUMN_WIDTH = 130,
  38          LABEL_COLUMN_WIDTH = 120,
  39          AMOUNT_MINIMUM_COLUMN_WIDTH = 180,
  40          MINIMUM_COLUMN_WIDTH = 130
  41      };
  42  
  43      explicit ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
  44      ~ReceiveCoinsDialog();
  45  
  46      void setModel(WalletModel *model);
  47  
  48  public Q_SLOTS:
  49      void clear();
  50      void reject() override;
  51      void accept() override;
  52  
  53  private:
  54      Ui::ReceiveCoinsDialog *ui;
  55      GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer{nullptr};
  56      QSortFilterProxyModel* m_sort_proxy;
  57      WalletModel* model{nullptr};
  58      QMenu *contextMenu;
  59      QAction* copyLabelAction;
  60      QAction* copyMessageAction;
  61      QAction* copyAmountAction;
  62      const PlatformStyle *platformStyle;
  63  
  64      // Returns QModelIndex in source model
  65      QModelIndexList SelectedRows();
  66      void copyColumnToClipboard(int column);
  67      void ShowReceiveRequestDialogForItem(const QModelIndex& index);
  68      virtual void resizeEvent(QResizeEvent *event) override;
  69  
  70  private Q_SLOTS:
  71      void on_receiveButton_clicked();
  72      void on_showRequestButton_clicked();
  73      void on_removeRequestButton_clicked();
  74      void on_recentRequestsView_doubleClicked(const QModelIndex &index);
  75      void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
  76      void updateDisplayUnit();
  77      void updateFontForMoney();
  78      void showMenu(const QPoint &point);
  79      void copyURI();
  80      void copyAddress();
  81      void copyLabel();
  82      void copyMessage();
  83      void copyAmount();
  84  };
  85  
  86  #endif // LIMENKA_QT_RECEIVECOINSDIALOG_H
  87