mirror of
https://github.com/feather-wallet/feather.git
synced 2025-03-12 09:37:47 +00:00
View: show/hide searchbar
This commit is contained in:
parent
91beff4411
commit
0ba485c9de
12 changed files with 73 additions and 2 deletions
|
@ -63,6 +63,15 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
|||
connect(ui->search, &QLineEdit::textChanged, this, &ContactsWidget::setSearchFilter);
|
||||
}
|
||||
|
||||
void ContactsWidget::setSearchbarVisible(bool visible) {
|
||||
ui->search->setVisible(visible);
|
||||
}
|
||||
|
||||
void ContactsWidget::focusSearchbar() {
|
||||
ui->search->setFocusPolicy(Qt::StrongFocus);
|
||||
ui->search->setFocus();
|
||||
}
|
||||
|
||||
void ContactsWidget::copyAddress() {
|
||||
QModelIndex index = ui->contacts->currentIndex();
|
||||
ModelUtils::copyColumn(&index, AddressBookModel::Address);
|
||||
|
|
|
@ -23,6 +23,9 @@ public:
|
|||
explicit ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr);
|
||||
~ContactsWidget() override;
|
||||
|
||||
void setSearchbarVisible(bool visible);
|
||||
void focusSearchbar();
|
||||
|
||||
public slots:
|
||||
void copyAddress();
|
||||
void copyName();
|
||||
|
|
|
@ -61,6 +61,15 @@ HistoryWidget::HistoryWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::setSearchbarVisible(bool visible) {
|
||||
ui->search->setVisible(visible);
|
||||
}
|
||||
|
||||
void HistoryWidget::focusSearchbar() {
|
||||
ui->search->setFocusPolicy(Qt::StrongFocus);
|
||||
ui->search->setFocus();
|
||||
}
|
||||
|
||||
void HistoryWidget::showContextMenu(const QPoint &point) {
|
||||
QModelIndex index = ui->history->indexAt(point);
|
||||
if (!index.isValid()) {
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
explicit HistoryWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr);
|
||||
~HistoryWidget() override;
|
||||
|
||||
void setSearchbarVisible(bool visible);
|
||||
void focusSearchbar();
|
||||
|
||||
public slots:
|
||||
void setSearchText(const QString &text);
|
||||
void resetModel();
|
||||
|
|
|
@ -248,6 +248,8 @@ void MainWindow::initMenu() {
|
|||
|
||||
// [View]
|
||||
m_tabShowHideSignalMapper = new QSignalMapper(this);
|
||||
connect(ui->actionShow_Searchbar, &QAction::toggled, this, &MainWindow::toggleSearchbar);
|
||||
ui->actionShow_Searchbar->setChecked(config()->get(Config::showSearchbar).toBool());
|
||||
|
||||
// Show/Hide Home
|
||||
connect(ui->actionShow_Home, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
|
||||
|
@ -325,6 +327,7 @@ void MainWindow::initMenu() {
|
|||
ui->actionShow_debug_info->setShortcut(QKeySequence("Ctrl+D"));
|
||||
ui->actionSettings->setShortcut(QKeySequence("Ctrl+Alt+S"));
|
||||
ui->actionUpdate_balance->setShortcut(QKeySequence("Ctrl+U"));
|
||||
ui->actionShow_Searchbar->setShortcut(QKeySequence("Ctrl+F"));
|
||||
}
|
||||
|
||||
void MainWindow::initHome() {
|
||||
|
@ -1420,6 +1423,22 @@ void MainWindow::updateRecentlyOpened(const QString &keysFile) {
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleSearchbar(bool visible) {
|
||||
config()->set(Config::showSearchbar, visible);
|
||||
|
||||
m_historyWidget->setSearchbarVisible(visible);
|
||||
m_receiveWidget->setSearchbarVisible(visible);
|
||||
m_contactsWidget->setSearchbarVisible(visible);
|
||||
|
||||
int currentTab = ui->tabWidget->currentIndex();
|
||||
if (currentTab == Tabs::HISTORY)
|
||||
m_historyWidget->focusSearchbar();
|
||||
else if (currentTab == Tabs::SEND)
|
||||
m_contactsWidget->focusSearchbar();
|
||||
else if (currentTab == Tabs::RECEIVE)
|
||||
m_receiveWidget->focusSearchbar();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@ private slots:
|
|||
void onDeviceError(const QString &error);
|
||||
void menuHwDeviceClicked();
|
||||
void onUpdatesAvailable(const QJsonObject &updates);
|
||||
void toggleSearchbar(bool enabled);
|
||||
|
||||
private:
|
||||
void initStatusBar();
|
||||
|
|
|
@ -461,6 +461,8 @@
|
|||
<addaction name="actionShow_calc"/>
|
||||
<addaction name="actionShow_Exchange"/>
|
||||
<addaction name="actionShow_XMRig"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShow_Searchbar"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuWallet"/>
|
||||
|
@ -767,6 +769,17 @@
|
|||
<string>Account</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShow_Searchbar">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Searchbar</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -53,12 +53,21 @@ ReceiveWidget::ReceiveWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
|||
connect(ui->btn_generateSubaddress, &QPushButton::clicked, this, &ReceiveWidget::generateSubaddress);
|
||||
|
||||
connect(ui->qrCode, &ClickableLabel::clicked, this, &ReceiveWidget::showQrCodeDialog);
|
||||
connect(ui->label_addressSearch, &QLineEdit::textChanged, this, &ReceiveWidget::setSearchFilter);
|
||||
connect(ui->search, &QLineEdit::textChanged, this, &ReceiveWidget::setSearchFilter);
|
||||
|
||||
connect(ui->check_showUsed, &QCheckBox::clicked, this, &ReceiveWidget::setShowUsedAddresses);
|
||||
connect(ui->check_showHidden, &QCheckBox::clicked, this, &ReceiveWidget::setShowHiddenAddresses);
|
||||
}
|
||||
|
||||
void ReceiveWidget::setSearchbarVisible(bool visible) {
|
||||
ui->search->setVisible(visible);
|
||||
}
|
||||
|
||||
void ReceiveWidget::focusSearchbar() {
|
||||
ui->search->setFocusPolicy(Qt::StrongFocus);
|
||||
ui->search->setFocus();
|
||||
}
|
||||
|
||||
void ReceiveWidget::copyAddress() {
|
||||
QModelIndex index = ui->addresses->currentIndex();
|
||||
ModelUtils::copyColumn(&index, SubaddressModel::Address);
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
explicit ReceiveWidget(QSharedPointer<AppContext> ctx, QWidget *parent = nullptr);
|
||||
~ReceiveWidget() override;
|
||||
|
||||
void setSearchbarVisible(bool visible);
|
||||
void focusSearchbar();
|
||||
|
||||
public slots:
|
||||
void copyAddress();
|
||||
void copyLabel();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="label_addressSearch">
|
||||
<widget class="QLineEdit" name="search">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
|
@ -46,6 +46,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||
{Config::showTabExchange, {QS("showTabExchange"), false}},
|
||||
{Config::showTabXMRig,{QS("showTabXMRig"), false}},
|
||||
{Config::showTabCalc,{QS("showTabCalc"), true}},
|
||||
{Config::showSearchbar,{QS("showSearchbar"), true}},
|
||||
|
||||
// Mining
|
||||
{Config::xmrigPath,{QS("xmrigPath"), ""}},
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
showTabExchange,
|
||||
showTabCalc,
|
||||
showTabXMRig,
|
||||
showSearchbar,
|
||||
|
||||
xmrigPath,
|
||||
xmrigPool,
|
||||
|
|
Loading…
Reference in a new issue