mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-25 12:05:54 +00:00
macOS: add basic menubar support
This commit is contained in:
parent
02ae14fd6b
commit
9fc617956d
9 changed files with 80 additions and 2 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
||||||
- name: install monero dependencies
|
- name: install monero dependencies
|
||||||
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler
|
run: sudo apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler
|
||||||
- name: install monero gui dependencies
|
- name: install monero gui dependencies
|
||||||
run: sudo apt -y install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev libgcrypt20-dev xvfb
|
run: sudo apt -y install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-platform qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev libgcrypt20-dev xvfb
|
||||||
- name: build
|
- name: build
|
||||||
run: DEV_MODE=ON make release -j3
|
run: DEV_MODE=ON make release -j3
|
||||||
- name: test qml
|
- name: test qml
|
||||||
|
|
|
@ -299,6 +299,7 @@ list(APPEND QT5_LIBRARIES
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
set(QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/folderlistmodel)
|
set(QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/folderlistmodel)
|
||||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/settings)
|
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/settings)
|
||||||
|
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/Qt/labs/platform)
|
||||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects)
|
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects)
|
||||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects/private)
|
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtGraphicalEffects/private)
|
||||||
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtMultimedia)
|
list(APPEND QT5_EXTRA_PATHS ${QT5_PKG_CONFIG_Qt5Qml_PREFIX}/qml/QtMultimedia)
|
||||||
|
@ -324,6 +325,7 @@ if(STATIC)
|
||||||
dialogsprivateplugin
|
dialogsprivateplugin
|
||||||
qmlfolderlistmodelplugin
|
qmlfolderlistmodelplugin
|
||||||
qmlsettingsplugin
|
qmlsettingsplugin
|
||||||
|
qtlabsplatformplugin
|
||||||
qmlxmllistmodelplugin
|
qmlxmllistmodelplugin
|
||||||
qquicklayoutsplugin
|
qquicklayoutsplugin
|
||||||
modelsplugin
|
modelsplugin
|
||||||
|
|
|
@ -208,7 +208,7 @@ The following instructions will fetch Qt from your distribution's repositories i
|
||||||
|
|
||||||
- For Ubuntu 17.10+
|
- For Ubuntu 17.10+
|
||||||
|
|
||||||
`sudo apt install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev`
|
`sudo apt install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-platform qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev`
|
||||||
|
|
||||||
- For Gentoo
|
- For Gentoo
|
||||||
|
|
||||||
|
|
56
components/MenuBar.qml
Normal file
56
components/MenuBar.qml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright (c) 2014-2019, The Monero Project
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
// materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
// used to endorse or promote products derived from this software without specific
|
||||||
|
// prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
import Qt.labs.platform 1.0 as PlatformLabs
|
||||||
|
import "." as MoneroComponents
|
||||||
|
|
||||||
|
PlatformLabs.MenuBar {
|
||||||
|
PlatformLabs.Menu {
|
||||||
|
title: qsTr("File")
|
||||||
|
PlatformLabs.MenuItem {
|
||||||
|
enabled: appWindow.viewState === "normal"
|
||||||
|
text: qsTr("Close Wallet")
|
||||||
|
onTriggered: appWindow.showWizard()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlatformLabs.Menu {
|
||||||
|
title: qsTr("View")
|
||||||
|
PlatformLabs.MenuItem {
|
||||||
|
text: MoneroComponents.Style.blackTheme ? qsTr("Light Theme") : qsTr("Dark Theme")
|
||||||
|
onTriggered: {
|
||||||
|
MoneroComponents.Style.blackTheme = !MoneroComponents.Style.blackTheme;
|
||||||
|
persistentSettings.blackTheme = MoneroComponents.Style.blackTheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlatformLabs.MenuItem {
|
||||||
|
text: qsTr("Change Language")
|
||||||
|
onTriggered: appWindow.toggleLanguageView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
2
main.qml
2
main.qml
|
@ -2360,6 +2360,8 @@ ApplicationWindow {
|
||||||
dragMargin: 0
|
dragMargin: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MoneroComponents.MenuBar { }
|
||||||
|
|
||||||
Network {
|
Network {
|
||||||
id: network
|
id: network
|
||||||
proxyAddress: persistentSettings.getProxyAddress()
|
proxyAddress: persistentSettings.getProxyAddress()
|
||||||
|
|
1
qml.qrc
1
qml.qrc
|
@ -45,6 +45,7 @@
|
||||||
<file>images/prevMonth.png</file>
|
<file>images/prevMonth.png</file>
|
||||||
<file>images/prevMonth@2x.png</file>
|
<file>images/prevMonth@2x.png</file>
|
||||||
<file>components/TitleBar.qml</file>
|
<file>components/TitleBar.qml</file>
|
||||||
|
<file>components/MenuBar.qml</file>
|
||||||
<file>images/resize.png</file>
|
<file>images/resize.png</file>
|
||||||
<file>images/resize@2x.png</file>
|
<file>images/resize@2x.png</file>
|
||||||
<file>images/resizeHovered.png</file>
|
<file>images/resizeHovered.png</file>
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
#include "qt/KeysFiles.h"
|
#include "qt/KeysFiles.h"
|
||||||
#include "qt/MoneroSettings.h"
|
#include "qt/MoneroSettings.h"
|
||||||
#include "qt/NetworkAccessBlockingFactory.h"
|
#include "qt/NetworkAccessBlockingFactory.h"
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include "qt/macoshelper.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// IOS exclusions
|
// IOS exclusions
|
||||||
#ifndef Q_OS_IOS
|
#ifndef Q_OS_IOS
|
||||||
|
@ -133,6 +136,7 @@ Q_IMPORT_PLUGIN(QtQuickControls1Plugin)
|
||||||
Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin)
|
Q_IMPORT_PLUGIN(QtQuick2DialogsPlugin)
|
||||||
Q_IMPORT_PLUGIN(QmlFolderListModelPlugin)
|
Q_IMPORT_PLUGIN(QmlFolderListModelPlugin)
|
||||||
Q_IMPORT_PLUGIN(QmlSettingsPlugin)
|
Q_IMPORT_PLUGIN(QmlSettingsPlugin)
|
||||||
|
Q_IMPORT_PLUGIN(QtLabsPlatformPlugin)
|
||||||
Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin)
|
Q_IMPORT_PLUGIN(QtQuick2DialogsPrivatePlugin)
|
||||||
Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin)
|
Q_IMPORT_PLUGIN(QtQuick2PrivateWidgetsPlugin)
|
||||||
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
|
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
|
||||||
|
@ -178,6 +182,10 @@ int main(int argc, char *argv[])
|
||||||
if(qgetenv("QMLSCENE_DEVICE") == "softwarecontext")
|
if(qgetenv("QMLSCENE_DEVICE") == "softwarecontext")
|
||||||
isOpenGL = false;
|
isOpenGL = false;
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// macOS window tabbing is not supported
|
||||||
|
MacOSHelper::disableWindowTabbing();
|
||||||
|
#endif
|
||||||
// disable "QApplication: invalid style override passed" warning
|
// disable "QApplication: invalid style override passed" warning
|
||||||
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
|
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
static bool openFolderAndSelectItem(const QUrl &path);
|
static bool openFolderAndSelectItem(const QUrl &path);
|
||||||
static QPixmap screenshot();
|
static QPixmap screenshot();
|
||||||
static QString bundlePath();
|
static QString bundlePath();
|
||||||
|
static void disableWindowTabbing();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MACOSHELPER_H
|
#endif //MACOSHELPER_H
|
||||||
|
|
|
@ -41,6 +41,14 @@
|
||||||
|
|
||||||
#include "ScopeGuard.h"
|
#include "ScopeGuard.h"
|
||||||
|
|
||||||
|
void MacOSHelper::disableWindowTabbing()
|
||||||
|
{
|
||||||
|
#ifdef __MAC_10_12
|
||||||
|
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
|
||||||
|
[NSWindow setAllowsAutomaticWindowTabbing: NO];
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool MacOSHelper::isCapsLock()
|
bool MacOSHelper::isCapsLock()
|
||||||
{
|
{
|
||||||
#ifdef __MAC_10_12
|
#ifdef __MAC_10_12
|
||||||
|
|
Loading…
Reference in a new issue