mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge branch 'RetroShare:master' into macos-guide
This commit is contained in:
commit
1374d4520f
@ -28,6 +28,7 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
#include <QMenuBar>
|
||||
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
@ -377,6 +378,10 @@ MainWindow::~MainWindow()
|
||||
delete sysTrayStatus;
|
||||
delete trayIcon;
|
||||
delete trayMenu;
|
||||
#if defined(Q_OS_DARWIN)
|
||||
delete menuBar;
|
||||
delete dockMenu;
|
||||
#endif
|
||||
// delete notifyMenu; // already deleted by the deletion of trayMenu
|
||||
StatisticsWindow::releaseInstance();
|
||||
|
||||
@ -651,10 +656,48 @@ void MainWindow::createTrayIcon()
|
||||
trayIcon->setContextMenu(trayMenu);
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
createMenuBar();
|
||||
#endif
|
||||
|
||||
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason)));
|
||||
trayIcon->show();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
/** Creates a new menubar for macOS */
|
||||
void MainWindow::createMenuBar()
|
||||
{
|
||||
/* Mac users sure like their shortcuts. */
|
||||
actionMinimize = new QAction(tr("Minimize"),this);
|
||||
actionMinimize->setShortcutContext(Qt::ApplicationShortcut);
|
||||
actionMinimize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||
actionMinimize->setShortcutVisibleInContextMenu(true);
|
||||
connect(actionMinimize,SIGNAL(triggered()),this,SLOT(showMinimized())) ;
|
||||
|
||||
menuBar = new QMenuBar(this);
|
||||
QMenu *fileMenu = menuBar->addMenu("");
|
||||
fileMenu->addAction(actionMinimize);
|
||||
|
||||
dockMenu = new QMenu(this);
|
||||
dockMenu->setAsDockMenu();
|
||||
dockMenu->addAction(tr("Open Messages"), this, SLOT(Mess()));
|
||||
dockMenu->addAction(tr("Bandwidth Graph"), this, SLOT(showBandwidthGraph()));
|
||||
dockMenu->addAction(tr("Statistics"), this, SLOT(showStatisticsWindow()));
|
||||
dockMenu->addAction(tr("Options"), this, SLOT(showSettings()));
|
||||
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();
|
||||
QMenu *statusMenu = dockMenu->addMenu(tr("Status"));
|
||||
initializeStatusObject(statusMenu, true);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::showBandwidthGraph()
|
||||
{
|
||||
if(_bandwidthGraph == NULL)
|
||||
@ -1220,7 +1263,11 @@ void MainWindow::updateMenu()
|
||||
|
||||
void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
||||
{
|
||||
#if defined(Q_OS_DARWIN)
|
||||
if (e == QSystemTrayIcon::DoubleClick) {
|
||||
#else
|
||||
if (e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||
#endif
|
||||
if (isHidden() || isMinimized()) {
|
||||
show();
|
||||
if (isMinimized()) {
|
||||
|
@ -308,6 +308,10 @@ private:
|
||||
void initStackedPage();
|
||||
void addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage *, QPair<QAction *, QListWidgetItem *> > > *notify);
|
||||
void createTrayIcon();
|
||||
#if defined(Q_OS_DARWIN)
|
||||
/** Creates a default menubar on Mac */
|
||||
void createMenuBar();
|
||||
#endif
|
||||
void createNotifyIcons();
|
||||
static MainWindow *_instance;
|
||||
|
||||
@ -324,6 +328,13 @@ private:
|
||||
|
||||
QString nameAndLocation;
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
/** The menubar (Mac OS X only). */
|
||||
QMenuBar *menuBar;
|
||||
QMenu *dockMenu;
|
||||
QAction* actionMinimize;
|
||||
#endif
|
||||
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QMenu *notifyMenu;
|
||||
QMenu *trayMenu;
|
||||
|
BIN
retroshare-service/src/logo.icns
Normal file
BIN
retroshare-service/src/logo.icns
Normal file
Binary file not shown.
@ -70,6 +70,10 @@ macx {
|
||||
#QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
|
||||
LIBS += -lz
|
||||
#LIBS += -lssl -lcrypto -lz -lgpgme -lgpg-error -lassuan
|
||||
RC_FILE = $$files($$PWD/logo.icns)
|
||||
mac_icon.files = $$files($$PWD/logo.icns)
|
||||
mac_icon.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += mac_icon
|
||||
|
||||
for(lib, LIB_DIR):exists($$lib/libminiupnpc.a){ LIBS += $$lib/libminiupnpc.a}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user