{
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);
// 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){
}
void ContactsWidget::setSearchbarVisible(bool visible) {
- ui->search->setVisible(visible);
+ ui->frame_search->setVisible(visible);
}
void ContactsWidget::focusSearchbar() {
<x>0</x>
<y>0</y>
<width>914</width>
- <height>763</height>
+ <height>384</height>
</rect>
</property>
<property name="windowTitle">
<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">
</item>
</layout>
</widget>
- <resources/>
+ <resources>
+ <include location="assets.qrc"/>
+ </resources>
<connections/>
</ui>
// [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);
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()) {
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() != "") {
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();
MainWindow::~MainWindow() {
qDebug() << "~MainWindow" << QThread::currentThreadId();
-}
\ No newline at end of file
+}
</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>
</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">
<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>
<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>
<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>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<x>0</x>
<y>0</y>
<width>977</width>
- <height>27</height>
+ <height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
</property>
<addaction name="actionPlaceholderBegin"/>
<addaction name="actionShow_Coins"/>
+ <addaction name="actionShow_Contacts"/>
<addaction name="actionPlaceholderEnd"/>
<addaction name="separator"/>
<addaction name="actionShow_Searchbar"/>
<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>