mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -04:00
Merge pull request #2810 from defnax/macos-guide
[macOS] Fixes and Guide updates
This commit is contained in:
commit
0c03e93a47
8 changed files with 147 additions and 11 deletions
|
@ -66,7 +66,6 @@ Install MacPort following this guide: [MacPort](http://guide.macports.org/#insta
|
||||||
$ sudo port -v selfupdate
|
$ sudo port -v selfupdate
|
||||||
$ sudo port install openssl
|
$ sudo port install openssl
|
||||||
$ sudo port install miniupnpc
|
$ sudo port install miniupnpc
|
||||||
$ sudo port install libmicrohttpd
|
|
||||||
|
|
||||||
For VOIP Plugin:
|
For VOIP Plugin:
|
||||||
|
|
||||||
|
@ -83,10 +82,13 @@ Install HomeBrew following this guide: [HomeBrew](http://brew.sh/)
|
||||||
|
|
||||||
$ brew install openssl
|
$ brew install openssl
|
||||||
$ brew install miniupnpc
|
$ brew install miniupnpc
|
||||||
$ brew install libmicrohttpd
|
|
||||||
$ brew install rapidjson
|
$ brew install rapidjson
|
||||||
$ brew install sqlcipher
|
$ brew install sqlcipher
|
||||||
|
|
||||||
|
#### Install CMake
|
||||||
|
|
||||||
|
$ brew install cmake
|
||||||
|
|
||||||
If you have error in linking, run this:
|
If you have error in linking, run this:
|
||||||
|
|
||||||
$sudo chown -R $(whoami) /usr/local/lib/pkgconfig
|
$sudo chown -R $(whoami) /usr/local/lib/pkgconfig
|
||||||
|
@ -101,7 +103,7 @@ For VOIP Plugin:
|
||||||
For FeedReader Plugin:
|
For FeedReader Plugin:
|
||||||
|
|
||||||
$ brew install libxslt
|
$ brew install libxslt
|
||||||
|
$ brew install libxml2
|
||||||
|
|
||||||
## Last Settings
|
## Last Settings
|
||||||
|
|
||||||
|
@ -153,6 +155,9 @@ alternative via Terminal
|
||||||
CONFIG+=release \
|
CONFIG+=release \
|
||||||
..
|
..
|
||||||
|
|
||||||
|
For FeedReader Plugin:
|
||||||
|
|
||||||
|
INCLUDEPATH += "/usr/local/opt/libxml2/include/libxml2"
|
||||||
|
|
||||||
With plugins:
|
With plugins:
|
||||||
|
|
||||||
|
@ -207,3 +212,13 @@ For Qt Creator -> QtCreator Projects -> Build -> Build Settings -> Build Steps -
|
||||||
./plugins/VOIP/lib/libVOIP.dylib \
|
./plugins/VOIP/lib/libVOIP.dylib \
|
||||||
./plugins/RetroChess/lib/libRetroChess.dylib \
|
./plugins/RetroChess/lib/libRetroChess.dylib \
|
||||||
./retroshare-gui/src/RetroShare.app/Contents/Resources/
|
./retroshare-gui/src/RetroShare.app/Contents/Resources/
|
||||||
|
|
||||||
|
### Compile Retroshare-Service & Webui with CMake
|
||||||
|
before you can compile overwrite the file "asio/include/asio/detail/config.hpp" here is a fix for macos [
|
||||||
|
asio fix](https://github.com/chriskohlhoff/asio/commit/68df16d560c68944809bb2947360fe8035e9ae0a)
|
||||||
|
|
||||||
|
$ cd retroshare-service
|
||||||
|
$ mkdir build-dir
|
||||||
|
$ cd build-dir
|
||||||
|
$ cmake -DRS_WEBUI=ON -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
$ make
|
||||||
|
|
|
@ -18,7 +18,7 @@ rm -rf obj
|
||||||
rm -rf qrc
|
rm -rf qrc
|
||||||
|
|
||||||
# This sets the CFBundleVersion & CFBundleShortVersionString string
|
# This sets the CFBundleVersion & CFBundleShortVersionString string
|
||||||
#/usr/libexec/PlistBuddy -c "Delete :CFBundleGetInfoString" retroshare.app/Contents/Info.plist
|
/usr/libexec/PlistBuddy -c "Delete :CFBundleGetInfoString" retroshare.app/Contents/Info.plist
|
||||||
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $RSVERSION" retroshare.app/Contents/Info.plist
|
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $RSVERSION" retroshare.app/Contents/Info.plist
|
||||||
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $RSVERSION" retroshare.app/Contents/Info.plist
|
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $RSVERSION" retroshare.app/Contents/Info.plist
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
#include <retroshare/rsplugin.h>
|
#include <retroshare/rsplugin.h>
|
||||||
#include <retroshare/rsconfig.h>
|
#include <retroshare/rsconfig.h>
|
||||||
|
|
||||||
|
#if defined(Q_OS_DARWIN)
|
||||||
|
#include "gui/common/MacDockIconHandler.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MESSENGER_WINDOW
|
#ifdef MESSENGER_WINDOW
|
||||||
#include "MessengerWindow.h"
|
#include "MessengerWindow.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -381,6 +385,7 @@ MainWindow::~MainWindow()
|
||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
delete menuBar;
|
delete menuBar;
|
||||||
delete dockMenu;
|
delete dockMenu;
|
||||||
|
MacDockIconHandler::cleanup();
|
||||||
#endif
|
#endif
|
||||||
// delete notifyMenu; // already deleted by the deletion of trayMenu
|
// delete notifyMenu; // already deleted by the deletion of trayMenu
|
||||||
StatisticsWindow::releaseInstance();
|
StatisticsWindow::releaseInstance();
|
||||||
|
@ -656,6 +661,15 @@ void MainWindow::createTrayIcon()
|
||||||
trayIcon->setContextMenu(trayMenu);
|
trayIcon->setContextMenu(trayMenu);
|
||||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||||
|
|
||||||
|
#if defined(Q_OS_DARWIN)
|
||||||
|
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
|
||||||
|
MacDockIconHandler* dockIconHandler = MacDockIconHandler::instance();
|
||||||
|
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, [this] {
|
||||||
|
show();
|
||||||
|
activateWindow();
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
createMenuBar();
|
createMenuBar();
|
||||||
#endif
|
#endif
|
||||||
|
@ -673,24 +687,27 @@ void MainWindow::createMenuBar()
|
||||||
actionMinimize->setShortcutContext(Qt::ApplicationShortcut);
|
actionMinimize->setShortcutContext(Qt::ApplicationShortcut);
|
||||||
actionMinimize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
actionMinimize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||||
actionMinimize->setShortcutVisibleInContextMenu(true);
|
actionMinimize->setShortcutVisibleInContextMenu(true);
|
||||||
connect(actionMinimize,SIGNAL(triggered()),this,SLOT(showMinimized())) ;
|
connect(actionMinimize,SIGNAL(triggered()),this,SLOT(minimizeWindow())) ;
|
||||||
|
|
||||||
|
actionCloseWindow = new QAction(tr("Close window"),this);
|
||||||
|
actionCloseWindow->setShortcutContext(Qt::ApplicationShortcut);
|
||||||
|
actionCloseWindow->setShortcut(QKeySequence::Close);
|
||||||
|
actionCloseWindow->setShortcutVisibleInContextMenu(true);
|
||||||
|
connect(actionCloseWindow,SIGNAL(triggered()),this,SLOT(closeWindow())) ;
|
||||||
|
|
||||||
menuBar = new QMenuBar(this);
|
menuBar = new QMenuBar(this);
|
||||||
QMenu *fileMenu = menuBar->addMenu("");
|
QMenu *fileMenu = menuBar->addMenu("");
|
||||||
fileMenu->addAction(actionMinimize);
|
fileMenu->addAction(actionMinimize);
|
||||||
|
fileMenu->addAction(actionCloseWindow);
|
||||||
|
|
||||||
dockMenu = new QMenu(this);
|
dockMenu = new QMenu(this);
|
||||||
dockMenu->setAsDockMenu();
|
dockMenu->setAsDockMenu();
|
||||||
dockMenu->addAction(tr("Open Messages"), this, SLOT(Mess()));
|
dockMenu->addAction(tr("Open Messages"), this, SLOT(showMess()));
|
||||||
dockMenu->addAction(tr("Bandwidth Graph"), this, SLOT(showBandwidthGraph()));
|
dockMenu->addAction(tr("Bandwidth Graph"), this, SLOT(showBandwidthGraph()));
|
||||||
dockMenu->addAction(tr("Statistics"), this, SLOT(showStatisticsWindow()));
|
dockMenu->addAction(tr("Statistics"), this, SLOT(showStatisticsWindow()));
|
||||||
dockMenu->addAction(tr("Options"), this, SLOT(showSettings()));
|
dockMenu->addAction(tr("Options"), this, SLOT(showSettings()));
|
||||||
dockMenu->addAction(tr("Help"), this, SLOT(showHelpDialog()));
|
dockMenu->addAction(tr("Help"), this, SLOT(showHelpDialog()));
|
||||||
|
|
||||||
dockMenu->addSeparator();
|
|
||||||
QObject::connect(dockMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
|
||||||
toggleVisibilityAction = dockMenu->addAction(tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
|
||||||
|
|
||||||
dockMenu->addSeparator();
|
dockMenu->addSeparator();
|
||||||
QMenu *statusMenu = dockMenu->addMenu(tr("Status"));
|
QMenu *statusMenu = dockMenu->addMenu(tr("Status"));
|
||||||
initializeStatusObject(statusMenu, true);
|
initializeStatusObject(statusMenu, true);
|
||||||
|
@ -698,6 +715,21 @@ void MainWindow::createMenuBar()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_DARWIN)
|
||||||
|
void MainWindow::minimizeWindow()
|
||||||
|
{
|
||||||
|
setWindowState(windowState() | Qt::WindowMinimized);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_DARWIN)
|
||||||
|
void MainWindow::closeWindow()
|
||||||
|
{
|
||||||
|
// On macOS window close is basically equivalent to window hide.
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::showBandwidthGraph()
|
void MainWindow::showBandwidthGraph()
|
||||||
{
|
{
|
||||||
if(_bandwidthGraph == NULL)
|
if(_bandwidthGraph == NULL)
|
||||||
|
|
|
@ -265,6 +265,11 @@ private slots:
|
||||||
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||||
void toggleVisibilitycontextmenu();
|
void toggleVisibilitycontextmenu();
|
||||||
|
|
||||||
|
#if defined(Q_OS_DARWIN)
|
||||||
|
void minimizeWindow();
|
||||||
|
void closeWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Toolbar fns. */
|
/** Toolbar fns. */
|
||||||
void addFriend();
|
void addFriend();
|
||||||
//void newRsCollection();
|
//void newRsCollection();
|
||||||
|
@ -333,6 +338,7 @@ private:
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *dockMenu;
|
QMenu *dockMenu;
|
||||||
QAction* actionMinimize;
|
QAction* actionMinimize;
|
||||||
|
QAction* actionCloseWindow;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
|
|
27
retroshare-gui/src/gui/common/MacDockIconHandler.h
Normal file
27
retroshare-gui/src/gui/common/MacDockIconHandler.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
||||||
|
// Distributed under the MIT software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#ifndef MACDOCKICONHANDLER_H
|
||||||
|
#define MACDOCKICONHANDLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
/** macOS-specific Dock icon handler.
|
||||||
|
*/
|
||||||
|
class MacDockIconHandler : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static MacDockIconHandler *instance();
|
||||||
|
static void cleanup();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void dockIconClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MacDockIconHandler();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MACDOCKICONHANDLER_H
|
53
retroshare-gui/src/gui/common/MacDockIconHandler.mm
Normal file
53
retroshare-gui/src/gui/common/MacDockIconHandler.mm
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright (c) 2011-2019 The Bitcoin Core developers
|
||||||
|
// Distributed under the MIT software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include "MacDockIconHandler.h"
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include <objc/runtime.h>
|
||||||
|
|
||||||
|
static MacDockIconHandler *s_instance = nullptr;
|
||||||
|
|
||||||
|
bool dockClickHandler(id self, SEL _cmd, ...) {
|
||||||
|
Q_UNUSED(self)
|
||||||
|
Q_UNUSED(_cmd)
|
||||||
|
|
||||||
|
Q_EMIT s_instance->dockIconClicked();
|
||||||
|
|
||||||
|
// Return NO (false) to suppress the default macOS actions
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupDockClickHandler() {
|
||||||
|
Class delClass = (Class)[[[NSApplication sharedApplication] delegate] class];
|
||||||
|
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:");
|
||||||
|
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:");
|
||||||
|
}
|
||||||
|
|
||||||
|
MacDockIconHandler::MacDockIconHandler() : QObject()
|
||||||
|
{
|
||||||
|
setupDockClickHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
MacDockIconHandler *MacDockIconHandler::instance()
|
||||||
|
{
|
||||||
|
if (!s_instance)
|
||||||
|
s_instance = new MacDockIconHandler();
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacDockIconHandler::cleanup()
|
||||||
|
{
|
||||||
|
delete s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force application activation on macOS. With Qt 5.5.1 this is required when
|
||||||
|
* an action in the Dock menu is triggered.
|
||||||
|
* TODO: Define a Qt version where it's no-longer necessary.
|
||||||
|
*/
|
||||||
|
void ForceActivation()
|
||||||
|
{
|
||||||
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
|
}
|
|
@ -109,7 +109,7 @@ void RshareSettings::initSettings()
|
||||||
setDefault(SETTING_STYLE, "GTK+");
|
setDefault(SETTING_STYLE, "GTK+");
|
||||||
#else
|
#else
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
setDefault(SETTING_STYLE, "macintosh (aqua)");
|
setDefault(SETTING_STYLE, "Fusion");
|
||||||
#else
|
#else
|
||||||
static QStringList styles = QStyleFactory::keys();
|
static QStringList styles = QStyleFactory::keys();
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
|
|
@ -304,6 +304,9 @@ macx {
|
||||||
|
|
||||||
#DEFINES *= MAC_IDLE # for idle feature
|
#DEFINES *= MAC_IDLE # for idle feature
|
||||||
CONFIG -= uitools
|
CONFIG -= uitools
|
||||||
|
|
||||||
|
OBJECTIVE_SOURCES += gui/common/MacDockIconHandler.mm
|
||||||
|
OBJECTIVE_HEADERS += gui/common/MacDockIconHandler.h
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################### FreeBSD ######################################
|
##################################### FreeBSD ######################################
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue