mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-23 03:59:29 +00:00
Merge pull request 'MacOS: add touchbar support' (#121) from dsc/feather:macos-touchbar-submodule into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/121
This commit is contained in:
commit
df2ff26c0f
6 changed files with 54 additions and 1 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -7,3 +7,6 @@
|
||||||
[submodule "contrib/tor"]
|
[submodule "contrib/tor"]
|
||||||
path = contrib/tor
|
path = contrib/tor
|
||||||
url = https://git.torproject.org/tor.git
|
url = https://git.torproject.org/tor.git
|
||||||
|
[submodule "contrib/KDMacTouchBar"]
|
||||||
|
path = contrib/KDMacTouchBar
|
||||||
|
url = https://github.com/KDAB/KDMacTouchBar.git
|
||||||
|
|
|
@ -365,4 +365,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/KDMacTouchBar")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
1
contrib/KDMacTouchBar
Submodule
1
contrib/KDMacTouchBar
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 470c4316460bb8c3e23bfa37c79c8621ef3f1b4c
|
|
@ -201,6 +201,14 @@ target_link_libraries(feather
|
||||||
${QRENCODE_LIBRARY}
|
${QRENCODE_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_link_libraries(feather
|
||||||
|
KDMacTouchBar
|
||||||
|
)
|
||||||
|
target_include_directories(feather
|
||||||
|
PUBLIC ../contrib/KDMacTouchBar)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
target_link_libraries(feather
|
target_link_libraries(feather
|
||||||
Qt5::QSvgIconPlugin
|
Qt5::QSvgIconPlugin
|
||||||
|
|
|
@ -351,6 +351,14 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
|
||||||
// window title
|
// window title
|
||||||
connect(m_ctx, &AppContext::setTitle, this, &QMainWindow::setWindowTitle);
|
connect(m_ctx, &AppContext::setTitle, this, &QMainWindow::setWindowTitle);
|
||||||
|
|
||||||
|
// init touchbar
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
m_touchbar = new KDMacTouchBar(this);
|
||||||
|
m_touchbarActionWelcome = new QAction(QIcon(":/assets/images/feather.png"), "Welcome to Feather!");
|
||||||
|
m_touchbarWalletItems = {ui->actionSettings, ui->actionCalculator, ui->actionKeys, ui->actionDonate_to_Feather};
|
||||||
|
m_touchbarWizardItems = {m_touchbarActionWelcome};
|
||||||
|
#endif
|
||||||
|
|
||||||
// setup some UI
|
// setup some UI
|
||||||
this->initMain();
|
this->initMain();
|
||||||
this->initWidgets();
|
this->initWidgets();
|
||||||
|
@ -382,6 +390,7 @@ void MainWindow::initMain() {
|
||||||
this->show();
|
this->show();
|
||||||
m_wizard = this->createWizard(WalletWizard::Page_Menu);
|
m_wizard = this->createWizard(WalletWizard::Page_Menu);
|
||||||
m_wizard->show();
|
m_wizard->show();
|
||||||
|
this->touchbarShowWizard();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initMenu() {
|
void MainWindow::initMenu() {
|
||||||
|
@ -545,6 +554,20 @@ void MainWindow::onWalletClosed(WalletWizard::Page page) {
|
||||||
this->showWizard(page);
|
this->showWizard(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::touchbarShowWizard() {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
m_touchbar->clear();
|
||||||
|
for(auto* action: m_touchbarWizardItems) m_touchbar->addAction(action);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::touchbarShowWallet() {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
m_touchbar->clear();
|
||||||
|
for(auto* action: m_touchbarWalletItems) m_touchbar->addAction(action);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onWalletCreatedError(const QString &err) {
|
void MainWindow::onWalletCreatedError(const QString &err) {
|
||||||
Utils::showMessageBox("Wallet creation error", err, true);
|
Utils::showMessageBox("Wallet creation error", err, true);
|
||||||
this->showWizard(WalletWizard::Page_CreateWallet);
|
this->showWizard(WalletWizard::Page_CreateWallet);
|
||||||
|
@ -571,6 +594,7 @@ void MainWindow::onWalletOpenedError(const QString &err) {
|
||||||
QMessageBox::warning(this, "Wallet open error", err);
|
QMessageBox::warning(this, "Wallet open error", err);
|
||||||
this->setWindowTitle("Feather");
|
this->setWindowTitle("Feather");
|
||||||
this->showWizard(WalletWizard::Page_OpenWallet);
|
this->showWizard(WalletWizard::Page_OpenWallet);
|
||||||
|
this->touchbarShowWizard();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onWalletCreated(Wallet *wallet) {
|
void MainWindow::onWalletCreated(Wallet *wallet) {
|
||||||
|
@ -630,6 +654,8 @@ void MainWindow::onWalletOpened() {
|
||||||
connect(m_ctx->currentWallet->coins(), &Coins::coinThawed, [this]{
|
connect(m_ctx->currentWallet->coins(), &Coins::coinThawed, [this]{
|
||||||
m_ctx->storeWallet();
|
m_ctx->storeWallet();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->touchbarShowWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onBalanceUpdated(double balance, double unlocked, const QString &balance_str, const QString &unlocked_str) {
|
void MainWindow::onBalanceUpdated(double balance, double unlocked, const QString &balance_str, const QString &unlocked_str) {
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include "src/kdmactouchbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
@ -154,6 +158,8 @@ private:
|
||||||
void showNodeExhaustedMessage();
|
void showNodeExhaustedMessage();
|
||||||
void showWSNodeExhaustedMessage();
|
void showWSNodeExhaustedMessage();
|
||||||
void createUnsignedTxDialog(UnsignedTransaction *tx);
|
void createUnsignedTxDialog(UnsignedTransaction *tx);
|
||||||
|
void touchbarShowWizard();
|
||||||
|
void touchbarShowWallet();
|
||||||
|
|
||||||
WalletWizard *createWizard(WalletWizard::Page startPage);
|
WalletWizard *createWizard(WalletWizard::Page startPage);
|
||||||
|
|
||||||
|
@ -192,7 +198,12 @@ private:
|
||||||
SubaddressProxyModel *subaddressProxyModel;
|
SubaddressProxyModel *subaddressProxyModel;
|
||||||
TransactionHistoryModel *txHistModel;
|
TransactionHistoryModel *txHistModel;
|
||||||
CoinsModel *coinsModel;
|
CoinsModel *coinsModel;
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QAction *m_touchbarActionWelcome;
|
||||||
|
KDMacTouchBar *m_touchbar;
|
||||||
|
QList<QAction *> m_touchbarWalletItems;
|
||||||
|
QList<QAction *> m_touchbarWizardItems;
|
||||||
|
#endif
|
||||||
QSignalMapper *m_tabShowHideSignalMapper;
|
QSignalMapper *m_tabShowHideSignalMapper;
|
||||||
QMap<QString, ToggleTab*> m_tabShowHideMapper;
|
QMap<QString, ToggleTab*> m_tabShowHideMapper;
|
||||||
WalletWizard *m_wizard = nullptr;
|
WalletWizard *m_wizard = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue