mirror of
https://github.com/feather-wallet/feather.git
synced 2025-04-24 05:08:12 +00:00
move contacts to separate tab
This commit is contained in:
parent
1a402d2a05
commit
69419171b7
4 changed files with 105 additions and 45 deletions
|
@ -22,11 +22,6 @@ ContactsWidget::ContactsWidget(Wallet *wallet, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_btn_addContact = new QPushButton(this);
|
||||
m_btn_addContact->setIcon(icons()->icon("register.svg"));
|
||||
ui->searchLayout->addWidget(m_btn_addContact, 0, Qt::AlignRight);
|
||||
connect(m_btn_addContact, &QPushButton::clicked, [this]{this->newContact();});
|
||||
|
||||
m_model = m_wallet->addressBookModel();
|
||||
m_proxyModel = new AddressBookProxyModel;
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
|
@ -40,9 +35,14 @@ ContactsWidget::ContactsWidget(Wallet *wallet, QWidget *parent)
|
|||
// header context menu
|
||||
ui->contacts->header()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_headerMenu = new QMenu(this);
|
||||
m_headerMenu->addAction("New contact", [this] {
|
||||
this->newContact();
|
||||
});
|
||||
m_showFullAddressesAction = m_headerMenu->addAction("Show full addresses", this, &ContactsWidget::setShowFullAddresses);
|
||||
m_showFullAddressesAction->setCheckable(true);
|
||||
|
||||
ui->btn_options->setMenu(m_headerMenu);
|
||||
|
||||
connect(ui->contacts->header(), &QHeaderView::customContextMenuRequested, this, &ContactsWidget::showHeaderMenu);
|
||||
|
||||
connect(ui->contacts, &QTreeView::doubleClicked, [this](QModelIndex index){
|
||||
|
@ -78,7 +78,7 @@ ContactsWidget::ContactsWidget(Wallet *wallet, QWidget *parent)
|
|||
}
|
||||
|
||||
void ContactsWidget::setSearchbarVisible(bool visible) {
|
||||
ui->search->setVisible(visible);
|
||||
ui->frame_search->setVisible(visible);
|
||||
}
|
||||
|
||||
void ContactsWidget::focusSearchbar() {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>914</width>
|
||||
<height>763</height>
|
||||
<height>384</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -30,15 +30,49 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="searchLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search">
|
||||
<property name="placeholderText">
|
||||
<string>Search contacts...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QFrame" name="frame_search">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search">
|
||||
<property name="placeholderText">
|
||||
<string>Search...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn_options">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="assets.qrc">
|
||||
<normaloff>:/assets/images/preferences.svg</normaloff>:/assets/images/preferences.svg</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::ToolButtonPopupMode::InstantPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="contacts">
|
||||
|
@ -58,6 +92,8 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="assets.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -230,9 +230,6 @@ void MainWindow::initWidgets() {
|
|||
// [Send]
|
||||
m_sendWidget = new SendWidget(m_wallet, this);
|
||||
ui->sendWidgetLayout->addWidget(m_sendWidget);
|
||||
// --------------
|
||||
m_contactsWidget = new ContactsWidget(m_wallet, this);
|
||||
ui->contactsWidgetLayout->addWidget(m_contactsWidget);
|
||||
|
||||
// [Receive]
|
||||
m_receiveWidget = new ReceiveWidget(m_wallet, this);
|
||||
|
@ -241,14 +238,19 @@ void MainWindow::initWidgets() {
|
|||
m_historyWidget->setSearchText(text);
|
||||
ui->tabWidget->setCurrentIndex(this->findTab("History"));
|
||||
});
|
||||
connect(m_contactsWidget, &ContactsWidget::fill, [this](const QString &address, const QString &description){
|
||||
m_sendWidget->fill(address, description, 0, true);
|
||||
});
|
||||
|
||||
// [Coins]
|
||||
m_coinsWidget = new CoinsWidget(m_wallet, this);
|
||||
ui->coinsWidgetLayout->addWidget(m_coinsWidget);
|
||||
|
||||
// [Contacts]
|
||||
m_contactsWidget = new ContactsWidget(m_wallet, this);
|
||||
ui->contactsWidgetLayout->addWidget(m_contactsWidget);
|
||||
connect(m_contactsWidget, &ContactsWidget::fill, [this](const QString &address, const QString &description){
|
||||
m_sendWidget->fill(address, description, 0, true);
|
||||
ui->tabWidget->setCurrentIndex(this->findTab("Send"));
|
||||
});
|
||||
|
||||
// [Plugins..]
|
||||
for (auto* plugin : m_plugins) {
|
||||
if (!plugin->hasParent()) {
|
||||
|
@ -332,6 +334,11 @@ void MainWindow::initMenu() {
|
|||
m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, this);
|
||||
m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins");
|
||||
|
||||
// Show/Hide Contacts
|
||||
connect(ui->actionShow_Contacts, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
|
||||
m_tabShowHideMapper["Contacts"] = new ToggleTab(ui->tabContacts, "Contacts", "Contacts", ui->actionShow_Contacts, this);
|
||||
m_tabShowHideSignalMapper->setMapping(ui->actionShow_Contacts, "Contacts");
|
||||
|
||||
// Show/Hide Plugins..
|
||||
for (const auto &plugin : m_plugins) {
|
||||
if (plugin->parent() != "") {
|
||||
|
@ -1968,7 +1975,7 @@ void MainWindow::toggleSearchbar(bool visible) {
|
|||
int currentTab = ui->tabWidget->currentIndex();
|
||||
if (currentTab == this->findTab("History"))
|
||||
m_historyWidget->focusSearchbar();
|
||||
else if (currentTab == this->findTab("Send"))
|
||||
else if (currentTab == this->findTab("Contacts"))
|
||||
m_contactsWidget->focusSearchbar();
|
||||
else if (currentTab == this->findTab("Receive"))
|
||||
m_receiveWidget->focusSearchbar();
|
||||
|
@ -1987,4 +1994,4 @@ int MainWindow::findTab(const QString &title) {
|
|||
|
||||
MainWindow::~MainWindow() {
|
||||
qDebug() << "~MainWindow" << QThread::currentThreadId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,20 +113,17 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="minimumSize">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="contactsWidgetLayout"/>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -158,15 +155,29 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabContacts">
|
||||
<attribute name="icon">
|
||||
<iconset resource="assets.qrc">
|
||||
<normaloff>:/assets/images/tab_contacts.png</normaloff>:/assets/images/tab_contacts.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Contacts</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="contactsWidgetLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_coinControl">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::Shape::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="topMargin">
|
||||
|
@ -181,7 +192,7 @@
|
|||
<string>Coin control active: </string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -332,10 +343,10 @@
|
|||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -368,10 +379,10 @@
|
|||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -393,7 +404,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -429,7 +440,7 @@
|
|||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -469,7 +480,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>977</width>
|
||||
<height>27</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -575,6 +586,7 @@
|
|||
</property>
|
||||
<addaction name="actionPlaceholderBegin"/>
|
||||
<addaction name="actionShow_Coins"/>
|
||||
<addaction name="actionShow_Contacts"/>
|
||||
<addaction name="actionPlaceholderEnd"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShow_Searchbar"/>
|
||||
|
@ -945,6 +957,11 @@
|
|||
<string>Import descriptions from CSV</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShow_Contacts">
|
||||
<property name="text">
|
||||
<string>Show Contacts</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
Loading…
Reference in a new issue