Fix macos build

This commit is contained in:
Jonas Kvinge
2018-07-01 22:26:46 +02:00
parent c4e75dea65
commit ada7325a04
51 changed files with 453 additions and 399 deletions

View File

@@ -24,6 +24,7 @@ else()
qprogressindicatorspinning_nonmac.cpp qprogressindicatorspinning_nonmac.cpp
) )
set(RESOURCES set(RESOURCES
qsearchfield_nonmac.qrc
qprogressindicatorspinning_nonmac.qrc qprogressindicatorspinning_nonmac.qrc
) )
qt5_add_resources(RESOURCES_SOURCES ${RESOURCES}) qt5_add_resources(RESOURCES_SOURCES ${RESOURCES})
@@ -31,3 +32,4 @@ endif()
add_library(Qocoa STATIC ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES}) add_library(Qocoa STATIC ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES})
target_link_libraries(Qocoa ${QT_LIBRARIES}) target_link_libraries(Qocoa ${QT_LIBRARIES})

View File

@@ -16,7 +16,9 @@ make
``` ```
## Status ## Status
Qocoa classes are currently provided for NSButton, a spinning NSProgressIndicator and NSSearchField. There is a [TODO list](https://github.com/mikemcquaid/Qocoa/blob/master/TODO.md) for classes I hope to implement. I'm not personally working on this any more but will accept pull-requests.
[![Build Status](https://travis-ci.org/MikeMcQuaid/Qocoa.svg?branch=master)](https://travis-ci.org/MikeMcQuaid/Qocoa)
## Usage ## Usage
For each class you want to use copy the [`qocoa_mac.h`](https://github.com/mikemcquaid/Qocoa/blob/master/qocoa_mac.h), `$CLASS.h`, `$CLASS_mac.*` and `$CLASS_nonmac.*` files into your source tree and add them to your buildsystem. Examples are provided for [CMake](https://github.com/mikemcquaid/Qocoa/blob/master/CMakeLists.txt) and [QMake](https://github.com/mikemcquaid/Qocoa/blob/master/Qocoa.pro). For each class you want to use copy the [`qocoa_mac.h`](https://github.com/mikemcquaid/Qocoa/blob/master/qocoa_mac.h), `$CLASS.h`, `$CLASS_mac.*` and `$CLASS_nonmac.*` files into your source tree and add them to your buildsystem. Examples are provided for [CMake](https://github.com/mikemcquaid/Qocoa/blob/master/CMakeLists.txt) and [QMake](https://github.com/mikemcquaid/Qocoa/blob/master/Qocoa.pro).
@@ -28,7 +30,9 @@ For each class you want to use copy the [`qocoa_mac.h`](https://github.com/mikem
Qocoa is licensed under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). Qocoa is licensed under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
The full license text is available in [LICENSE.txt](https://github.com/mikemcquaid/Qocoa/blob/master/LICENSE.txt). The full license text is available in [LICENSE.txt](https://github.com/mikemcquaid/Qocoa/blob/master/LICENSE.txt).
The icons are taken from the [Oxygen Project](http://www.oxygen-icons.org/) and are licensed under the [Creative Commons Attribution-ShareAlike 3.0 License](http://creativecommons.org/licenses/by-sa/3.0/). Magnifier and EditClear icons taken from [QtCreator](http://qt-project.org/) and are licensed under the [LGPL](http://www.gnu.org/copyleft/lesser.html).
Other icons are taken from the [Oxygen Project](http://www.oxygen-icons.org/) and are licensed under the [Creative Commons Attribution-ShareAlike 3.0 License](http://creativecommons.org/licenses/by-sa/3.0/).
## Gallery ## Gallery
![Qocoa Gallery](https://github.com/mikemcquaid/Qocoa/raw/master/gallery.png) ![Qocoa Gallery](https://github.com/mikemcquaid/Qocoa/raw/master/gallery.png)

View File

@@ -3,7 +3,6 @@
#include <QWidget> #include <QWidget>
#include <QPointer> #include <QPointer>
#include <QString>
class QButtonPrivate; class QButtonPrivate;
class QButton : public QWidget class QButton : public QWidget
@@ -24,7 +23,7 @@ public:
RoundRect = 12, RoundRect = 12,
Recessed = 13, Recessed = 13,
RoundedDisclosure = 14, RoundedDisclosure = 14,
#ifdef MAC_OS_X_VERSION_10_7 #ifdef __MAC_10_7
Inline = 15 Inline = 15
#endif #endif
}; };

View File

@@ -37,7 +37,9 @@ public:
switch(bezelStyle) { switch(bezelStyle) {
case QButton::Disclosure: case QButton::Disclosure:
case QButton::Circular: case QButton::Circular:
#ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
#endif
case QButton::RoundedDisclosure: case QButton::RoundedDisclosure:
case QButton::HelpButton: case QButton::HelpButton:
[nsButton setTitle:@""]; [nsButton setTitle:@""];
@@ -55,7 +57,7 @@ public:
font = [NSFont fontWithName:@"Lucida Grande Bold" size:12]; font = [NSFont fontWithName:@"Lucida Grande Bold" size:12];
break; break;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
break; break;
@@ -112,7 +114,7 @@ public:
qButton->setFixedHeight(22); qButton->setFixedHeight(22);
qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
break; break;
#ifdef MAC_OS_X_VERSION_10_7 #ifdef __MAC_10_7
case QButton::Inline: case QButton::Inline:
qButton->setMinimumWidth(10); qButton->setMinimumWidth(10);
qButton->setFixedHeight(16); qButton->setFixedHeight(16);
@@ -130,7 +132,7 @@ public:
[nsButton setButtonType:NSMomentaryPushInButton]; [nsButton setButtonType:NSMomentaryPushInButton];
} }
[nsButton setBezelStyle:bezelStyle]; // [nsButton setBezelStyle:bezelStyle];
} }
void clicked() void clicked()

View File

@@ -20,19 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <QtGlobal> #include "qbutton.h"
#include <QObject>
#include <QWidget>
#include <QPointer>
#include <QString>
#include <QPixmap>
#include <QAbstractButton>
#include <QBoxLayout>
#include <QPushButton>
#include <QToolBar> #include <QToolBar>
#include <QToolButton> #include <QToolButton>
#include <QPushButton>
#include "qbutton.h" #include <QVBoxLayout>
class QButtonPrivate : public QObject class QButtonPrivate : public QObject
{ {

View File

@@ -20,10 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <AppKit/NSImage.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <QByteArray>
#include <QString> #include <QString>
#include <QBoxLayout> #include <QBoxLayout>
#include <QtMacExtras>
#include <QMacCocoaViewContainer> #include <QMacCocoaViewContainer>
static inline NSString* fromQString(const QString &string) static inline NSString* fromQString(const QString &string)
@@ -42,11 +43,11 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap) static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{ {
CGImageRef cgImage = pixmap.toMacCGImageRef(); CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize]; return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
} }
static inline void setupLayout(void *cocoaView, QWidget *parent) static inline void setupLayout(NSView *cocoaView, QWidget *parent)
{ {
parent->setAttribute(Qt::WA_NativeWindow); parent->setAttribute(Qt::WA_NativeWindow);
QVBoxLayout *layout = new QVBoxLayout(parent); QVBoxLayout *layout = new QVBoxLayout(parent);

View File

@@ -17,7 +17,8 @@ public:
Aqua = 12 Aqua = 12
}; };
explicit QProgressIndicatorSpinning(QWidget *parent, Thickness thickness = Default); explicit QProgressIndicatorSpinning(QWidget *parent,
Thickness thickness = Default);
public slots: public slots:
void animate(bool animate = true); void animate(bool animate = true);
private: private:

View File

@@ -20,17 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <QtGlobal>
#include <QObject>
#include <QWidget>
#include <QBoxLayout>
#include <QLabel>
#include <QMovie>
#include <QPointer>
#include <QSize>
#include "qprogressindicatorspinning.h" #include "qprogressindicatorspinning.h"
#include <QVBoxLayout>
#include <QMovie>
#include <QLabel>
class QProgressIndicatorSpinningPrivate : public QObject class QProgressIndicatorSpinningPrivate : public QObject
{ {
public: public:

View File

@@ -2,22 +2,24 @@
#define QSEARCHFIELD_H #define QSEARCHFIELD_H
#include <QWidget> #include <QWidget>
#include <QObject>
#include <QPointer> #include <QPointer>
#include <QString> #include <QMenu>
#include <QEvent>
#include <QResizeEvent>
class QSearchFieldPrivate; class QSearchFieldPrivate;
class QSearchField : public QWidget class QSearchField : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true);
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText);
public: public:
explicit QSearchField(QWidget *parent); explicit QSearchField(QWidget *parent);
QString text() const; QString text() const;
QString placeholderText() const; QString placeholderText() const;
void setFocus(Qt::FocusReason reason); void setFocus(Qt::FocusReason);
void setMenu(QMenu *menu);
public slots: public slots:
void setText(const QString &text); void setText(const QString &text);
@@ -31,15 +33,16 @@ signals:
void editingFinished(); void editingFinished();
void returnPressed(); void returnPressed();
private slots:
void popupMenu();
protected: protected:
void changeEvent(QEvent*);
void resizeEvent(QResizeEvent*); void resizeEvent(QResizeEvent*);
bool eventFilter(QObject*, QEvent*);
private: private:
friend class QSearchFieldPrivate; friend class QSearchFieldPrivate;
QPointer <QSearchFieldPrivate> pimpl; QPointer <QSearchFieldPrivate> pimpl;
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText);
}; };
#endif // QSEARCHFIELD_H #endif // QSEARCHFIELD_H

View File

@@ -29,8 +29,8 @@ THE SOFTWARE.
#import "AppKit/NSSearchField.h" #import "AppKit/NSSearchField.h"
#include <QApplication> #include <QApplication>
#include <QClipboard>
#include <QKeyEvent> #include <QKeyEvent>
#include <QClipboard>
class QSearchFieldPrivate : public QObject class QSearchFieldPrivate : public QObject
{ {
@@ -95,6 +95,16 @@ public:
pimpl->textDidChange(toQString([[notification object] stringValue])); pimpl->textDidChange(toQString([[notification object] stringValue]));
} }
-(void)controlTextDidEndEditing:(NSNotification*)notification {
Q_UNUSED(notification);
// No Q_ASSERT here as it is called on destruction.
if (pimpl)
pimpl->textDidEndEditing();
if ([[[notification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
pimpl->returnPressed();
}
-(BOOL)control: (NSControl *)control textView: -(BOOL)control: (NSControl *)control textView:
(NSTextView *)textView doCommandBySelector: (NSTextView *)textView doCommandBySelector:
(SEL)commandSelector { (SEL)commandSelector {
@@ -111,16 +121,6 @@ public:
return NO; return NO;
} }
-(void)controlTextDidEndEditing:(NSNotification*)notification {
// No Q_ASSERT here as it is called on destruction.
if (!pimpl) return;
pimpl->textDidEndEditing();
if ([[[notification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
pimpl->returnPressed();
}
@end @end
@interface QocoaSearchField : NSSearchField @interface QocoaSearchField : NSSearchField
@@ -129,14 +129,13 @@ public:
@implementation QocoaSearchField @implementation QocoaSearchField
-(BOOL)performKeyEquivalent:(NSEvent*)event { -(BOOL)performKeyEquivalent:(NSEvent*)event {
// First, check if we have the focus. // First, check if we have the focus.
// If no, it probably means this event isn't for us. // If no, it probably means this event isn't for us.
NSResponder* firstResponder = [[NSApp keyWindow] firstResponder]; NSResponder* firstResponder = [[NSApp keyWindow] firstResponder];
if ([firstResponder isKindOfClass:[NSText class]] && if ([firstResponder isKindOfClass:[NSText class]] &&
[(NSText*)firstResponder delegate] == self) { [(NSText*)firstResponder delegate] == self) {
if ([event type] == NSKeyDown && [event modifierFlags] & NSCommandKeyMask) if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand)
{ {
QString keyString = toQString([event characters]); QString keyString = toQString([event characters]);
if (keyString == "a") // Cmd+a if (keyString == "a") // Cmd+a
@@ -186,6 +185,25 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
[pool drain]; [pool drain];
} }
void QSearchField::setMenu(QMenu *menu)
{
Q_ASSERT(pimpl);
if (!pimpl)
return;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
NSMenu *nsMenu = menu->macMenu();
#else
NSMenu *nsMenu = menu->toNSMenu();
#endif
[[pimpl->nsSearchField cell] setSearchMenuTemplate:nsMenu];
}
void QSearchField::popupMenu()
{
}
void QSearchField::setText(const QString &text) void QSearchField::setText(const QString &text)
{ {
Q_ASSERT(pimpl); Q_ASSERT(pimpl);
@@ -194,10 +212,6 @@ void QSearchField::setText(const QString &text)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[pimpl->nsSearchField setStringValue:fromQString(text)]; [pimpl->nsSearchField setStringValue:fromQString(text)];
if (!text.isEmpty()) {
[pimpl->nsSearchField selectText:pimpl->nsSearchField];
[[pimpl->nsSearchField currentEditor] setSelectedRange:NSMakeRange([[pimpl->nsSearchField stringValue] length], 0)];
}
[pool drain]; [pool drain];
} }
@@ -212,40 +226,6 @@ void QSearchField::setPlaceholderText(const QString &text)
[pool drain]; [pool drain];
} }
QString QSearchField::placeholderText() const {
Q_ASSERT(pimpl);
NSString* placeholder = [[pimpl->nsSearchField cell] placeholderString];
return toQString(placeholder);
}
void QSearchField::setFocus(Qt::FocusReason reason)
{
/* Do nothing: we were previously using makeFirstResponder on search field, but
* that resulted in having the text being selected (and I didn't find any way to
* deselect it) which would result in the user erasing the first letter he just
* typed, after using setText (e.g. if the user typed a letter while having
* focus on the playlist, which means we call setText and give focus to the
* search bar).
* Instead now the focus will take place when calling selectText in setText.
* This obviously breaks the purpose of this function, but we never call only
* setFocus on a search box in Clementine (i.e. without a call to setText
* shortly after).
*/
// Q_ASSERT(pimpl);
// if (!pimpl)
// return;
// if ([pimpl->nsSearchField acceptsFirstResponder]) {
// [[pimpl->nsSearchField window] makeFirstResponder: pimpl->nsSearchField];
// }
}
void QSearchField::setFocus()
{
setFocus(Qt::OtherFocusReason);
}
void QSearchField::clear() void QSearchField::clear()
{ {
Q_ASSERT(pimpl); Q_ASSERT(pimpl);
@@ -274,12 +254,44 @@ QString QSearchField::text() const
return toQString([pimpl->nsSearchField stringValue]); return toQString([pimpl->nsSearchField stringValue]);
} }
QString QSearchField::placeholderText() const
{
Q_ASSERT(pimpl);
if (!pimpl)
return QString();
return toQString([[pimpl->nsSearchField cell] placeholderString]);
}
void QSearchField::setFocus(Qt::FocusReason)
{
Q_ASSERT(pimpl);
if (!pimpl)
return;
if ([pimpl->nsSearchField acceptsFirstResponder])
[[pimpl->nsSearchField window] makeFirstResponder: pimpl->nsSearchField];
}
void QSearchField::setFocus()
{
setFocus(Qt::OtherFocusReason);
}
void QSearchField::changeEvent(QEvent* event)
{
if (event->type() == QEvent::EnabledChange) {
Q_ASSERT(pimpl);
if (!pimpl)
return;
const bool enabled = isEnabled();
[pimpl->nsSearchField setEnabled: enabled];
}
QWidget::changeEvent(event);
}
void QSearchField::resizeEvent(QResizeEvent *resizeEvent) void QSearchField::resizeEvent(QResizeEvent *resizeEvent)
{ {
QWidget::resizeEvent(resizeEvent); QWidget::resizeEvent(resizeEvent);
} }
bool QSearchField::eventFilter(QObject *o, QEvent *e)
{
return QWidget::eventFilter(o, e);
}

View File

@@ -20,39 +20,48 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <QtGlobal>
#include <QObject>
#include <QWidget>
#include <QApplication>
#include <QPointer>
#include <QString>
#include <QIcon>
#include <QSize>
#include <QStyle>
#include <QLineEdit>
#include <QBoxLayout>
#include <QToolButton>
#include <QtEvents>
#include "../../src/core/iconloader.h"
#include "qsearchfield.h" #include "qsearchfield.h"
#include <QLineEdit>
#include <QVBoxLayout>
#include <QToolButton>
#include <QStyle>
#include <QApplication>
#include <QDesktopWidget>
#include <QDir>
#include <QDebug>
class QSearchFieldPrivate : public QObject class QSearchFieldPrivate : public QObject
{ {
public: public:
QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineEdit, QToolButton *clearButton) QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineEdit, QToolButton *clearButton, QToolButton *searchButton)
: QObject(searchField), lineEdit(lineEdit), clearButton(clearButton) {} : QObject(searchField), lineEdit(lineEdit), clearButton(clearButton), searchButton(searchButton) {}
int lineEditFrameWidth() const { int lineEditFrameWidth() const {
return lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); return lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
} }
int clearButtonPaddedWidth() const { int clearButtonPaddedWidth() const {
return clearButton->width() + lineEditFrameWidth() * 2; return clearButton->width() + lineEditFrameWidth() * 2;
} }
int clearButtonPaddedHeight() const { int clearButtonPaddedHeight() const {
return clearButton->height() + lineEditFrameWidth() * 2; return clearButton->height() + lineEditFrameWidth() * 2;
} }
int searchButtonPaddedWidth() const {
return searchButton->width() + lineEditFrameWidth() * 2;
}
int searchButtonPaddedHeight() const {
return searchButton->height() + lineEditFrameWidth() * 2;
}
QPointer<QLineEdit> lineEdit; QPointer<QLineEdit> lineEdit;
QPointer<QToolButton> clearButton; QPointer<QToolButton> clearButton;
QPointer<QToolButton> searchButton;
QPointer<QMenu> searchMenu;
}; };
QSearchField::QSearchField(QWidget *parent) : QWidget(parent) QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
@@ -67,29 +76,94 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
connect(lineEdit, SIGNAL(textChanged(QString)), connect(lineEdit, SIGNAL(textChanged(QString)),
this, SLOT(setText(QString))); this, SLOT(setText(QString)));
QIcon clearIcon(IconLoader::Load("edit-clear-locationbar-ltr")); int iconsize = style()->pixelMetric(QStyle::PM_SmallIconSize);
QToolButton *clearButton = new QToolButton(this); QToolButton *clearButton = new QToolButton(this);
QIcon clearIcon = QIcon::fromTheme(QLatin1String("edit-clear"),
QIcon(QLatin1String(":/Qocoa/qsearchfield_nonmac_clear.png")));
clearButton->setIcon(clearIcon); clearButton->setIcon(clearIcon);
clearButton->setIconSize(QSize(16, 16)); clearButton->setIconSize(QSize(iconsize, iconsize));
clearButton->setStyleSheet("border: none; padding: 0px;"); clearButton->setFixedSize(QSize(iconsize, iconsize));
clearButton->resize(clearButton->sizeHint()); clearButton->setStyleSheet("border: none;");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
pimpl = new QSearchFieldPrivate(this, lineEdit, clearButton); QToolButton *searchButton = new QToolButton(this);
QIcon searchIcon = QIcon(QLatin1String(":/Qocoa/qsearchfield_nonmac_magnifier.png"));
searchButton->setIcon(searchIcon);
searchButton->setIconSize(QSize(iconsize, iconsize));
searchButton->setFixedSize(QSize(iconsize, iconsize));
searchButton->setStyleSheet("border: none;");
searchButton->setPopupMode(QToolButton::InstantPopup);
searchButton->setEnabled(false);
connect(searchButton, SIGNAL(clicked()), this, SLOT(popupMenu()));
const int frame_width = lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); pimpl = new QSearchFieldPrivate(this, lineEdit, clearButton, searchButton);
lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; } ").arg(clearButton->width())); lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; } ")
const int width = frame_width + qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth()); .arg(pimpl->searchButtonPaddedWidth())
const int height = frame_width + qMax(lineEdit->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight()); .arg(pimpl->clearButtonPaddedWidth()));
const int width = qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth() + pimpl->searchButtonPaddedWidth());
const int height = qMax(lineEdit->minimumSizeHint().height(),
qMax(pimpl->clearButtonPaddedHeight(),
pimpl->searchButtonPaddedHeight()));
lineEdit->setMinimumSize(width, height); lineEdit->setMinimumSize(width, height);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(lineEdit); layout->addWidget(lineEdit);
}
lineEdit->installEventFilter(this); void QSearchField::setMenu(QMenu *menu)
{
Q_ASSERT(pimpl);
if (!pimpl)
return;
pimpl->searchMenu = menu;
QIcon searchIcon = menu ? QIcon(QLatin1String(":/Qocoa/qsearchfield_nonmac_magnifier_menu.png"))
: QIcon(QLatin1String(":/Qocoa/qsearchfield_nonmac_magnifier.png"));
pimpl->searchButton->setIcon(searchIcon);
pimpl->searchButton->setEnabled(isEnabled() && menu);
}
void QSearchField::popupMenu()
{
Q_ASSERT(pimpl);
if (!pimpl)
return;
if (pimpl->searchMenu) {
const QRect screenRect = qApp->desktop()->availableGeometry(pimpl->searchButton);
const QSize sizeHint = pimpl->searchMenu->sizeHint();
const QRect rect = pimpl->searchButton->rect();
const int x = pimpl->searchButton->isRightToLeft()
? rect.right() - sizeHint.width()
: rect.left();
const int y = pimpl->searchButton->mapToGlobal(QPoint(0, rect.bottom())).y() + sizeHint.height() <= screenRect.height()
? rect.bottom()
: rect.top() - sizeHint.height();
QPoint point = pimpl->searchButton->mapToGlobal(QPoint(x, y));
point.rx() = qMax(screenRect.left(), qMin(point.x(), screenRect.right() - sizeHint.width()));
point.ry() += 1;
pimpl->searchMenu->popup(point);
}
}
void QSearchField::changeEvent(QEvent* event)
{
if (event->type() == QEvent::EnabledChange) {
Q_ASSERT(pimpl);
if (!pimpl)
return;
const bool enabled = isEnabled();
pimpl->searchButton->setEnabled(enabled && pimpl->searchMenu);
pimpl->lineEdit->setEnabled(enabled);
pimpl->clearButton->setEnabled(enabled);
}
QWidget::changeEvent(event);
} }
void QSearchField::setText(const QString &text) void QSearchField::setText(const QString &text)
@@ -98,6 +172,8 @@ void QSearchField::setText(const QString &text)
if (!(pimpl && pimpl->clearButton && pimpl->lineEdit)) if (!(pimpl && pimpl->clearButton && pimpl->lineEdit))
return; return;
pimpl->clearButton->setVisible(!text.isEmpty());
if (text != this->text()) if (text != this->text())
pimpl->lineEdit->setText(text); pimpl->lineEdit->setText(text);
} }
@@ -113,26 +189,6 @@ void QSearchField::setPlaceholderText(const QString &text)
#endif #endif
} }
QString QSearchField::placeholderText() const {
#if QT_VERSION >= 0x040700
return pimpl->lineEdit->placeholderText();
#else
return QString();
#endif
}
void QSearchField::setFocus(Qt::FocusReason reason)
{
Q_ASSERT(pimpl && pimpl->lineEdit);
if (pimpl && pimpl->lineEdit)
pimpl->lineEdit->setFocus(reason);
}
void QSearchField::setFocus()
{
setFocus(Qt::OtherFocusReason);
}
void QSearchField::clear() void QSearchField::clear()
{ {
Q_ASSERT(pimpl && pimpl->lineEdit); Q_ASSERT(pimpl && pimpl->lineEdit);
@@ -160,6 +216,30 @@ QString QSearchField::text() const
return pimpl->lineEdit->text(); return pimpl->lineEdit->text();
} }
QString QSearchField::placeholderText() const {
Q_ASSERT(pimpl && pimpl->lineEdit);
if (!(pimpl && pimpl->lineEdit))
return QString();
#if QT_VERSION >= 0x040700
return pimpl->lineEdit->placeholderText();
#else
return QString();
#endif
}
void QSearchField::setFocus(Qt::FocusReason reason)
{
Q_ASSERT(pimpl && pimpl->lineEdit);
if (pimpl && pimpl->lineEdit)
pimpl->lineEdit->setFocus(reason);
}
void QSearchField::setFocus()
{
setFocus(Qt::OtherFocusReason);
}
void QSearchField::resizeEvent(QResizeEvent *resizeEvent) void QSearchField::resizeEvent(QResizeEvent *resizeEvent)
{ {
Q_ASSERT(pimpl && pimpl->clearButton && pimpl->lineEdit); Q_ASSERT(pimpl && pimpl->clearButton && pimpl->lineEdit);
@@ -167,22 +247,10 @@ void QSearchField::resizeEvent(QResizeEvent *resizeEvent)
return; return;
QWidget::resizeEvent(resizeEvent); QWidget::resizeEvent(resizeEvent);
const int x = pimpl->lineEditFrameWidth(); const int x = width() - pimpl->clearButtonPaddedWidth();
const int y = (height() - pimpl->clearButton->height())/2; const int y = (height() - pimpl->clearButton->height())/2;
pimpl->clearButton->move(x, y); pimpl->clearButton->move(x, y);
}
bool QSearchField::eventFilter(QObject *o, QEvent *e) pimpl->searchButton->move(pimpl->lineEditFrameWidth() * 2,
{ (height() - pimpl->searchButton->height())/2);
if (pimpl && pimpl->lineEdit && o == pimpl->lineEdit) {
// Forward some lineEdit events to QSearchField (only those we need for
// now, but some might be added later if needed)
switch (e->type()) {
case QEvent::FocusIn:
case QEvent::FocusOut:
QApplication::sendEvent(this, e);
break;
}
}
return QWidget::eventFilter(o, e);
} }

View File

@@ -106,7 +106,6 @@ pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92)
pkg_check_modules(LIBMTP libmtp>=1.0) pkg_check_modules(LIBMTP libmtp>=1.0)
pkg_check_modules(LIBPULSE libpulse) pkg_check_modules(LIBPULSE libpulse)
pkg_check_modules(LIBXML libxml-2.0) pkg_check_modules(LIBXML libxml-2.0)
pkg_check_modules(LIBGLU REQUIRED glu)
pkg_check_modules(IMOBILEDEVICE libimobiledevice-1.0) pkg_check_modules(IMOBILEDEVICE libimobiledevice-1.0)
pkg_check_modules(USBMUXD libusbmuxd) pkg_check_modules(USBMUXD libusbmuxd)
pkg_check_modules(PLIST libplist) pkg_check_modules(PLIST libplist)
@@ -125,19 +124,16 @@ if(DBUS_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus)
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION) get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
endif() endif()
if(NOT APPLE)
find_package(Qt5 COMPONENTS WebKitWidgets)
endif(NOT APPLE)
if(APPLE) if(APPLE)
if(NOT QT_MAC_USE_COCOA) find_package(Qt5 REQUIRED COMPONENTS MacExtras)
message(FATAL_ERROR "Cocoa support is required") endif()
endif(NOT QT_MAC_USE_COCOA)
endif(APPLE)
if(UNIX AND X11_FOUND AND DBUS_FOUND) if(UNIX AND X11_FOUND AND DBUS_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras Qt5::DBus) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras Qt5::DBus)
elseif(UNIX AND X11_FOUND) elseif(UNIX AND X11_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras)
elseif(APPLE)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::MacExtras)
else() else()
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml)
endif() endif()
@@ -179,7 +175,7 @@ if(LASTFM5_INCLUDE_DIRS AND LASTFM51_INCLUDE_DIRS)
set(HAVE_LIBLASTFM1 ON) set(HAVE_LIBLASTFM1 ON)
endif() endif()
# CHROMAPRINT # CHECK INCLUDES
CHECK_INCLUDE_FILES(chromaprint.h CHROMAPRINT_H) CHECK_INCLUDE_FILES(chromaprint.h CHROMAPRINT_H)
# Use system sha2 if it's available # Use system sha2 if it's available
@@ -340,6 +336,7 @@ add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
include_directories(${GLIB_INCLUDE_DIRS}) include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GLIBCONFIG_INCLUDE_DIRS}) include_directories(${GLIBCONFIG_INCLUDE_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS})
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_VERSION VERSION_GREATER 1.1.1) if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_VERSION VERSION_GREATER 1.1.1)
set(IMOBILEDEVICE_USES_UDIDS ON) set(IMOBILEDEVICE_USES_UDIDS ON)

2
dist/CMakeLists.txt vendored
View File

@@ -10,5 +10,5 @@ if (UNIX)
install(FILES ../data/icons/128x128/strawberry.png DESTINATION share/icons/hicolor/128x128/apps/) install(FILES ../data/icons/128x128/strawberry.png DESTINATION share/icons/hicolor/128x128/apps/)
install(FILES ../data/icons/128x128/strawberry.svg DESTINATION share/icons/hicolor/scalable/apps/) install(FILES ../data/icons/128x128/strawberry.svg DESTINATION share/icons/hicolor/scalable/apps/)
install(FILES strawberry.desktop DESTINATION share/applications) install(FILES strawberry.desktop DESTINATION share/applications)
install(FILES strawberry.1 strawberry-tagreader.1 DESTINATION share/man/man1) install(FILES strawberry.1 unix/strawberry-tagreader.1 DESTINATION share/man/man1)
endif (UNIX) endif (UNIX)

View File

@@ -239,7 +239,7 @@ QString LinuxDemangle(const QString &symbol) {
} }
QString DemangleSymbol(const QString &symbol) { QString DemangleSymbol(const QString &symbol) {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
return DarwinDemangle(symbol); return DarwinDemangle(symbol);
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
return LinuxDemangle(symbol); return LinuxDemangle(symbol);

View File

@@ -785,13 +785,10 @@ optional_source(APPLE
core/macsystemtrayicon.mm core/macsystemtrayicon.mm
core/macscreensaver.cpp core/macscreensaver.cpp
core/macfslistener.mm core/macfslistener.mm
core/scoped_nsautorelease_pool.mm
widgets/osd_mac.mm widgets/osd_mac.mm
engine/osxdevicefinder.cpp engine/osxdevicefinder.cpp
device/macdevicelister.mm
globalshortcuts/shortcutgrabber.mm
globalshortcuts/macglobalshortcutbackend.mm
globalshortcuts/globalshortcutgrabber.mm globalshortcuts/globalshortcutgrabber.mm
globalshortcuts/macglobalshortcutbackend.mm
HEADERS HEADERS
core/mac_startup.h core/mac_startup.h
core/macsystemtrayicon.h core/macsystemtrayicon.h
@@ -799,8 +796,6 @@ optional_source(APPLE
core/macfslistener.h core/macfslistener.h
core/mac_utilities.h core/mac_utilities.h
core/mac_delegate.h core/mac_delegate.h
engine/osxdevicefinder.h
device/macdevicelister.h
globalshortcuts/macglobalshortcutbackend.h globalshortcuts/macglobalshortcutbackend.h
) )
@@ -965,7 +960,7 @@ endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
# Resource file for windows # Resource file for windows
if(WIN32) if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc)
set(STRAWBERRY-WIN32-RESOURCES windres.rc) set(STRAWBERRY-WIN32-RESOURCES windres.rc)
endif(WIN32) endif(WIN32)
@@ -987,73 +982,55 @@ target_link_libraries(strawberry
# macdeploy.py relies on the blob being built first. # macdeploy.py relies on the blob being built first.
add_dependencies(strawberry strawberry-tagreader) add_dependencies(strawberry strawberry-tagreader)
set_target_properties(strawberry PROPERTIES #set_target_properties(strawberry PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "../dist/Info.plist" #MACOSX_BUNDLE_INFO_PLIST "../dist/macos/Info.plist"
) #)
if (APPLE) if (APPLE)
install(FILES ../dist/strawberry.icns install(FILES ../dist/macos/strawberry.icns DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources") install(FILES ../dist/macos/qt.conf DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(FILES ../dist/qt.conf install(FILES ../dist/macos/sparkle_pub.pem DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(FILES ../dist/sparkle_pub.pem
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/" install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
if (HAVE_SPARKLE) if (HAVE_SPARKLE)
install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/Sparkle.framework")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/Sparkle.framework")
endif (HAVE_SPARKLE) endif (HAVE_SPARKLE)
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist" install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtCore.framework/Versions/4/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtCore.framework/Versions/4/Resources") install(FILES "${QT_QTGUI_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtGui.framework/Versions/4/Resources")
install(FILES "${QT_QTGUI_LIBRARY_RELEASE}/Contents/Info.plist" install(FILES "${QT_QTNETWORK_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtNetwork.framework/Versions/4/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtGui.framework/Versions/4/Resources") install(FILES "${QT_QTOPENGL_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtOpenGL.framework/Versions/4/Resources")
install(FILES "${QT_QTNETWORK_LIBRARY_RELEASE}/Contents/Info.plist" install(FILES "${QT_QTSQL_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSql.framework/Versions/4/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtNetwork.framework/Versions/4/Resources") install(FILES "${QT_QTSVG_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSvg.framework/Versions/4/Resources")
install(FILES "${QT_QTOPENGL_LIBRARY_RELEASE}/Contents/Info.plist" install(FILES "${QT_QTXML_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtXml.framework/Versions/4/Resources")
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtOpenGL.framework/Versions/4/Resources")
install(FILES "${QT_QTSQL_LIBRARY_RELEASE}/Contents/Info.plist"
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSql.framework/Versions/4/Resources")
install(FILES "${QT_QTSVG_LIBRARY_RELEASE}/Contents/Info.plist"
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtSvg.framework/Versions/4/Resources")
install(FILES "${QT_QTXML_LIBRARY_RELEASE}/Contents/Info.plist"
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtXml.framework/Versions/4/Resources")
add_custom_command(TARGET strawberry #add_custom_command(TARGET strawberry
POST_BUILD # POST_BUILD
COMMAND # COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/strawberry.app -f # ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/macdeploy.py ${PROJECT_BINARY_DIR}/strawberry.app -f
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} # WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
) #)
if (APPLE_DEVELOPER_ID) #if (APPLE_DEVELOPER_ID)
add_custom_target( # add_custom_target(
sign # sign
COMMAND # COMMAND
${PROJECT_SOURCE_DIR}/dist/codesign.py ${APPLE_DEVELOPER_ID} ${PROJECT_BINARY_DIR}/strawberry.app # ${PROJECT_SOURCE_DIR}/dist/macos/codesign.py ${APPLE_DEVELOPER_ID} ${PROJECT_BINARY_DIR}/strawberry.app
DEPENDS strawberry # DEPENDS strawberry
VERBATIM # VERBATIM
) # )
endif() #endif()
#add_custom_command(
add_custom_command( # OUTPUT ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/strawberry-$#{STRAWBERRY_VERSION_PACKAGE}.dmg
OUTPUT ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg # COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/create-dmg.sh ${PROJECT_BINARY_DIR}/strawberry.app
${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg # COMMAND ${CMAKE_COMMAND} -E rename ${PROJECT_BINARY_DIR}/strawberry.dmg ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/create-dmg.sh ${PROJECT_BINARY_DIR}/strawberry.app # DEPENDS strawberry
COMMAND ${CMAKE_COMMAND} -E rename # WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/strawberry.dmg #)
${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg #add_custom_target(dmg
DEPENDS strawberry # DEPENDS ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg)
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
add_custom_target(dmg
DEPENDS ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg)
else (APPLE) else (APPLE)
install(TARGETS strawberry install(TARGETS strawberry RUNTIME DESTINATION bin )
RUNTIME DESTINATION bin
)
endif (APPLE) endif (APPLE)

View File

@@ -13,14 +13,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <vector> #include <vector>
#ifdef Q_OS_MACOS
#include <OpenGL/gl.h> //included for convenience
#include <OpenGL/glu.h> //included for convenience
#else
#include <GL/gl.h> //included for convenience
#include <GL/glu.h> //included for convenience
#endif
#include <QtGlobal> #include <QtGlobal>
#include <QObject> #include <QObject>
#include <QWidget> #include <QWidget>

View File

@@ -38,12 +38,12 @@
#include "collectionmodel.h" #include "collectionmodel.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
const char *Collection::kSongsTable = "songs"; const char *SCollection::kSongsTable = "songs";
const char *Collection::kDirsTable = "directories"; const char *SCollection::kDirsTable = "directories";
const char *Collection::kSubdirsTable = "subdirectories"; const char *SCollection::kSubdirsTable = "subdirectories";
const char *Collection::kFtsTable = "songs_fts"; const char *SCollection::kFtsTable = "songs_fts";
Collection::Collection(Application *app, QObject *parent) SCollection::SCollection(Application *app, QObject *parent)
: QObject(parent), : QObject(parent),
app_(app), app_(app),
backend_(nullptr), backend_(nullptr),
@@ -63,14 +63,14 @@ Collection::Collection(Application *app, QObject *parent)
} }
Collection::~Collection() { SCollection::~SCollection() {
watcher_->deleteLater(); watcher_->deleteLater();
watcher_thread_->exit(); watcher_thread_->exit();
watcher_thread_->wait(5000 /* five seconds */); watcher_thread_->wait(5000 /* five seconds */);
} }
void Collection::Init() { void SCollection::Init() {
watcher_ = new CollectionWatcher; watcher_ = new CollectionWatcher;
watcher_thread_ = new Thread(this); watcher_thread_ = new Thread(this);
@@ -98,26 +98,26 @@ void Collection::Init() {
backend_->LoadDirectoriesAsync(); backend_->LoadDirectoriesAsync();
} }
void Collection::IncrementalScan() { watcher_->IncrementalScanAsync(); } void SCollection::IncrementalScan() { watcher_->IncrementalScanAsync(); }
void Collection::FullScan() { watcher_->FullScanAsync(); } void SCollection::FullScan() { watcher_->FullScanAsync(); }
void Collection::PauseWatcher() { watcher_->SetRescanPausedAsync(true); } void SCollection::PauseWatcher() { watcher_->SetRescanPausedAsync(true); }
void Collection::ResumeWatcher() { watcher_->SetRescanPausedAsync(false); } void SCollection::ResumeWatcher() { watcher_->SetRescanPausedAsync(false); }
void Collection::ReloadSettings() { void SCollection::ReloadSettings() {
watcher_->ReloadSettingsAsync(); watcher_->ReloadSettingsAsync();
} }
void Collection::Stopped() { void SCollection::Stopped() {
CurrentSongChanged(Song()); CurrentSongChanged(Song());
} }
void Collection::CurrentSongChanged(const Song &song) { void SCollection::CurrentSongChanged(const Song &song) {
TagReaderReply *reply = nullptr; TagReaderReply *reply = nullptr;

View File

@@ -36,12 +36,12 @@ class CollectionBackend;
class CollectionModel; class CollectionModel;
class CollectionWatcher; class CollectionWatcher;
class Collection : public QObject { class SCollection : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Collection(Application* app, QObject* parent); SCollection(Application *app, QObject *parent);
~Collection(); ~SCollection();
static const char *kSongsTable; static const char *kSongsTable;
static const char *kDirsTable; static const char *kDirsTable;

View File

@@ -74,7 +74,7 @@ class ApplicationImpl {
player_([=]() { return new Player(app, app); }), player_([=]() { return new Player(app, app); }),
enginedevice_([=]() { return new EngineDevice(app); }), enginedevice_([=]() { return new EngineDevice(app); }),
device_manager_([=]() { return new DeviceManager(app, app); }), device_manager_([=]() { return new DeviceManager(app, app); }),
collection_([=]() { return new Collection(app, app); }), collection_([=]() { return new SCollection(app, app); }),
playlist_backend_([=]() { playlist_backend_([=]() {
PlaylistBackend *backend = new PlaylistBackend(app, app); PlaylistBackend *backend = new PlaylistBackend(app, app);
app->MoveToThread(backend, database_->thread()); app->MoveToThread(backend, database_->thread());
@@ -107,7 +107,7 @@ class ApplicationImpl {
Lazy<Player> player_; Lazy<Player> player_;
Lazy<EngineDevice> enginedevice_; Lazy<EngineDevice> enginedevice_;
Lazy<DeviceManager> device_manager_; Lazy<DeviceManager> device_manager_;
Lazy<Collection> collection_; Lazy<SCollection> collection_;
Lazy<PlaylistBackend> playlist_backend_; Lazy<PlaylistBackend> playlist_backend_;
Lazy<PlaylistManager> playlist_manager_; Lazy<PlaylistManager> playlist_manager_;
Lazy<CoverProviders> cover_providers_; Lazy<CoverProviders> cover_providers_;
@@ -183,7 +183,7 @@ DeviceManager *Application::device_manager() const {
return p_->device_manager_.get(); return p_->device_manager_.get();
} }
Collection *Application::collection() const { return p_->collection_.get(); } SCollection *Application::collection() const { return p_->collection_.get(); }
CollectionBackend *Application::collection_backend() const { CollectionBackend *Application::collection_backend() const {
return collection()->backend(); return collection()->backend();

View File

@@ -40,7 +40,7 @@ class Database;
class EngineDevice; class EngineDevice;
class Player; class Player;
class Appearance; class Appearance;
class Collection; class SCollection;
class CollectionBackend; class CollectionBackend;
class CollectionModel; class CollectionModel;
class PlaylistBackend; class PlaylistBackend;
@@ -67,7 +67,7 @@ class Application : public QObject {
EngineDevice *enginedevice() const; EngineDevice *enginedevice() const;
DeviceManager *device_manager() const; DeviceManager *device_manager() const;
Collection *collection() const; SCollection *collection() const;
PlaylistBackend *playlist_backend() const; PlaylistBackend *playlist_backend() const;
PlaylistManager *playlist_manager() const; PlaylistManager *playlist_manager() const;

View File

@@ -90,7 +90,7 @@ CommandlineOptions::CommandlineOptions(int argc, char* *argv)
toggle_pretty_osd_(false), toggle_pretty_osd_(false),
log_levels_(logging::kDefaultLogLevels) { log_levels_(logging::kDefaultLogLevels) {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Remove -psn_xxx option that Mac passes when opened from Finder. // Remove -psn_xxx option that Mac passes when opened from Finder.
RemoveArg("-psn", 1); RemoveArg("-psn", 1);
#endif #endif

View File

@@ -25,7 +25,7 @@
#include "filesystemwatcherinterface.h" #include "filesystemwatcherinterface.h"
#include "qtfslistener.h" #include "qtfslistener.h"
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include "macfslistener.h" #include "macfslistener.h"
#endif #endif
@@ -34,7 +34,7 @@ FileSystemWatcherInterface::FileSystemWatcherInterface(QObject *parent)
FileSystemWatcherInterface *FileSystemWatcherInterface::Create(QObject *parent) { FileSystemWatcherInterface *FileSystemWatcherInterface::Create(QObject *parent) {
FileSystemWatcherInterface *ret; FileSystemWatcherInterface *ret;
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ret = new MacFSListener(parent); ret = new MacFSListener(parent);
#else #else
ret = new QtFSListener(parent); ret = new QtFSListener(parent);

View File

@@ -1,7 +1,7 @@
#import <AppKit/NSApplication.h> #import <AppKit/NSApplication.h>
#include "config.h" #include "config.h"
#include "macglobalshortcutbackend.h" #include "globalshortcuts/macglobalshortcutbackend.h"
class PlatformInterface; class PlatformInterface;
@class SPMediaKeyTap; @class SPMediaKeyTap;

View File

@@ -43,18 +43,18 @@
#include "config.h" #include "config.h"
#include "globalshortcuts.h"
#include "mac_delegate.h" #include "mac_delegate.h"
#include "mac_startup.h" #include "mac_startup.h"
#include "mac_utilities.h" #include "mac_utilities.h"
#include "macglobalshortcutbackend.h"
#include "utilities.h" #include "utilities.h"
#include "core/logging.h"
#include "scoped_cftyperef.h" #include "scoped_cftyperef.h"
#include "scoped_nsautorelease_pool.h" #include "core/logging.h"
#include "core/scoped_nsautorelease_pool.h"
#include "globalshortcuts/globalshortcuts.h"
#include "globalshortcuts/macglobalshortcutbackend.h"
#ifdef HAVE_SPARKLE #ifdef HAVE_SPARKLE
#import <Sparkle/SUUpdater.h> # import <Sparkle/SUUpdater.h>
#endif #endif
#include <QApplication> #include <QApplication>

View File

@@ -90,7 +90,7 @@ class MacSystemTrayIconPrivate {
// This must be called after our custom NSApplicationDelegate has been set. // This must be called after our custom NSApplicationDelegate has been set.
[(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_]; [(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_];
ClearPlaying(); ClearNowPlaying();
} }
void AddMenuItem(QAction* action) { void AddMenuItem(QAction* action) {
@@ -120,8 +120,8 @@ class MacSystemTrayIconPrivate {
[dock_menu_ addItem:separator]; [dock_menu_ addItem:separator];
} }
void ShowPlaying(const QString& artist, const QString& title) { void ShowNowPlaying(const QString& artist, const QString& title) {
ClearPlaying(); // Makes sure the order is consistent. ClearNowPlaying(); // Makes sure the order is consistent.
[now_playing_artist_ setTitle: [now_playing_artist_ setTitle:
[[NSString alloc] initWithUTF8String: artist.toUtf8().constData()]]; [[NSString alloc] initWithUTF8String: artist.toUtf8().constData()]];
[now_playing_title_ setTitle: [now_playing_title_ setTitle:
@@ -131,7 +131,7 @@ class MacSystemTrayIconPrivate {
artist.isEmpty() && title.isEmpty() ? HideItem(now_playing_) : ShowItem(now_playing_); artist.isEmpty() && title.isEmpty() ? HideItem(now_playing_) : ShowItem(now_playing_);
} }
void ClearPlaying() { void ClearNowPlaying() {
// Hiding doesn't seem to work in the dock menu. // Hiding doesn't seem to work in the dock menu.
HideItem(now_playing_); HideItem(now_playing_);
HideItem(now_playing_artist_); HideItem(now_playing_artist_);
@@ -200,10 +200,10 @@ void MacSystemTrayIcon::ActionChanged() {
p_->ActionChanged(action); p_->ActionChanged(action);
} }
void MacSystemTrayIcon::ClearPlaying() { void MacSystemTrayIcon::ClearNowPlaying() {
p_->ClearPlaying(); p_->ClearNowPlaying();
} }
void MacSystemTrayIcon::SetPlaying(const Song& song, const QString& image_path) { void MacSystemTrayIcon::SetNowPlaying(const Song& song, const QString& image_path) {
p_->ShowPlaying(song.artist(), song.PrettyTitle()); p_->ShowNowPlaying(song.artist(), song.PrettyTitle());
} }

View File

@@ -31,6 +31,7 @@
#include <QtGlobal> #include <QtGlobal>
#include <QObject> #include <QObject>
#include <QCoreApplication> #include <QCoreApplication>
#include <QStandardPaths>
#include <QFileDevice> #include <QFileDevice>
#include <QIODevice> #include <QIODevice>
#include <QByteArray> #include <QByteArray>
@@ -48,7 +49,7 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
# include <sys/resource.h> # include <sys/resource.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
#endif #endif
@@ -90,13 +91,13 @@
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Do Mac specific startup to get media keys working. // Do Mac specific startup to get media keys working.
// This must go before QApplication initialisation. // This must go before QApplication initialisation.
mac::MacMain(); mac::MacMain();
#endif #endif
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) #if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
QCoreApplication::setApplicationName("Strawberry"); QCoreApplication::setApplicationName("Strawberry");
QCoreApplication::setOrganizationName("Strawberry"); QCoreApplication::setOrganizationName("Strawberry");
#else #else
@@ -142,7 +143,7 @@ int main(int argc, char* argv[]) {
} }
} }
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Must happen after QCoreApplication::setOrganizationName(). // Must happen after QCoreApplication::setOrganizationName().
setenv("XDG_CONFIG_HOME", QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toLocal8Bit().constData(), 1); setenv("XDG_CONFIG_HOME", QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toLocal8Bit().constData(), 1);
#endif #endif
@@ -159,8 +160,8 @@ int main(int argc, char* argv[]) {
QtSingleApplication a(argc, argv); QtSingleApplication a(argc, argv);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
QCoreApplication::setCollectionPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns"); QCoreApplication::setLibraryPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
#endif #endif
a.setQuitOnLastWindowClosed(false); a.setQuitOnLastWindowClosed(false);
@@ -170,7 +171,7 @@ int main(int argc, char* argv[]) {
return 0; return 0;
} }
#ifndef Q_OS_DARWIN #ifndef Q_OS_MACOS
// Gnome on Ubuntu has menu icons disabled by default. I think that's a bad idea, and makes some menus in Strawberry look confusing. // Gnome on Ubuntu has menu icons disabled by default. I think that's a bad idea, and makes some menus in Strawberry look confusing.
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false); QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false);
#else #else
@@ -217,9 +218,9 @@ int main(int argc, char* argv[]) {
// Window // Window
MainWindow w(&app, tray_icon.get(), &osd, options); MainWindow w(&app, tray_icon.get(), &osd, options);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
mac::EnableFullScreen(w); mac::EnableFullScreen(w);
#endif // Q_OS_DARWIN #endif // Q_OS_MACOS
#ifdef HAVE_GIO #ifdef HAVE_GIO
ScanGIOModulePath(); ScanGIOModulePath();
#endif #endif

View File

@@ -84,7 +84,7 @@
#include "dialogs/trackselectiondialog.h" #include "dialogs/trackselectiondialog.h"
#include "dialogs/edittagdialog.h" #include "dialogs/edittagdialog.h"
#ifdef HAVE_GSTREAMER #ifdef HAVE_GSTREAMER
#include "dialogs/organisedialog.h" # include "dialogs/organisedialog.h"
#endif #endif
#include "widgets/fancytabwidget.h" #include "widgets/fancytabwidget.h"
#include "widgets/playingwidget.h" #include "widgets/playingwidget.h"
@@ -127,13 +127,13 @@
#include "settings/playlistsettingspage.h" #include "settings/playlistsettingspage.h"
#include "settings/settingsdialog.h" #include "settings/settingsdialog.h"
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include "ui/macsystemtrayicon.h" # include "core/macsystemtrayicon.h"
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Non exported mac-specific function. // Non exported mac-specific function.
void qt_mac_set_dock_menu(QMenu*); void qt_mac_set_dock_menu(QMenu*);
#endif #endif
const char *MainWindow::kSettingsGroup = "MainWindow"; const char *MainWindow::kSettingsGroup = "MainWindow";
@@ -203,7 +203,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
// Initialise the UI // Initialise the UI
ui_->setupUi(this); ui_->setupUi(this);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ui_->menu_help->menuAction()->setVisible(false); ui_->menu_help->menuAction()->setVisible(false);
#endif #endif
@@ -511,7 +511,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
playlist_menu_->addAction(ui_->action_remove_duplicates); playlist_menu_->addAction(ui_->action_remove_duplicates);
playlist_menu_->addAction(ui_->action_remove_unavailable); playlist_menu_->addAction(ui_->action_remove_unavailable);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ui_->action_shuffle->setShortcut(QKeySequence()); ui_->action_shuffle->setShortcut(QKeySequence());
#endif #endif
@@ -525,7 +525,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), playlist_copy_to_device_, SLOT(setDisabled(bool))); connect(app_->device_manager()->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)), playlist_copy_to_device_, SLOT(setDisabled(bool)));
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
mac::SetApplicationHandler(this); mac::SetApplicationHandler(this);
#endif #endif
// Tray icon // Tray icon
@@ -542,7 +542,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
// Windows 7 thumbbar buttons // Windows 7 thumbbar buttons
thumbbar_->SetActions(QList<QAction*>() << ui_->action_previous_track << ui_->action_play_pause << ui_->action_stop << ui_->action_next_track << nullptr); // spacer thumbbar_->SetActions(QList<QAction*>() << ui_->action_previous_track << ui_->action_play_pause << ui_->action_stop << ui_->action_next_track << nullptr); // spacer
#if (defined(Q_OS_DARWIN) && defined(HAVE_SPARKLE)) #if (defined(Q_OS_MACOS) && defined(HAVE_SPARKLE))
// Add check for updates item to application menu. // Add check for updates item to application menu.
QAction *check_updates = ui_->menu_tools->addAction(tr("Check for updates...")); QAction *check_updates = ui_->menu_tools->addAction(tr("Check for updates..."));
check_updates->setMenuRole(QAction::ApplicationSpecificRole); check_updates->setMenuRole(QAction::ApplicationSpecificRole);
@@ -661,7 +661,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
ui_->playlist->view()->ReloadSettings(); ui_->playlist->view()->ReloadSettings();
#ifndef Q_OS_DARWIN #ifndef Q_OS_MACOS
QSettings settings; QSettings settings;
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup); settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
StartupBehaviour behaviour = StartupBehaviour(settings.value("startupbehaviour", Startup_Remember).toInt()); StartupBehaviour behaviour = StartupBehaviour(settings.value("startupbehaviour", Startup_Remember).toInt());
@@ -682,7 +682,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
settings_.setValue("hidden", false); settings_.setValue("hidden", false);
show(); show();
} }
#else // Q_OS_DARWIN #else // Q_OS_MACOS
// Always show mainwindow on startup on OS X. // Always show mainwindow on startup on OS X.
show(); show();
#endif #endif
@@ -711,7 +711,7 @@ void MainWindow::ReloadSettings() {
QSettings settings; QSettings settings;
#ifndef Q_OS_DARWIN #ifndef Q_OS_MACOS
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup); settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
bool showtrayicon = settings.value("showtrayicon", true).toBool(); bool showtrayicon = settings.value("showtrayicon", true).toBool();
@@ -1694,7 +1694,7 @@ bool MainWindow::LoadUrl(const QString &url) {
} }
void MainWindow::CheckForUpdates() { void MainWindow::CheckForUpdates() {
#if defined(Q_OS_DARWIN) #if defined(Q_OS_MACOS)
mac::CheckForUpdates(); mac::CheckForUpdates();
#endif #endif
} }

View File

@@ -29,7 +29,7 @@
#include "screensaver.h" #include "screensaver.h"
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include "macscreensaver.h" #include "macscreensaver.h"
#endif #endif
@@ -51,7 +51,7 @@ Screensaver *Screensaver::GetScreensaver() {
else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) { else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) {
screensaver_ = new DBusScreensaver(kKdeService, kKdePath, kKdeInterface); screensaver_ = new DBusScreensaver(kKdeService, kKdePath, kKdeInterface);
} }
#elif defined(Q_OS_DARWIN) #elif defined(Q_OS_MACOS)
screensaver_ = new MacScreensaver(); screensaver_ = new MacScreensaver();
#endif #endif
} }

View File

@@ -87,7 +87,7 @@ void StyleSheetLoader::UpdateStyleSheet(QWidget *widget) {
ReplaceColor(&contents, "Link", p, QPalette::Link); ReplaceColor(&contents, "Link", p, QPalette::Link);
ReplaceColor(&contents, "LinkVisited", p, QPalette::LinkVisited); ReplaceColor(&contents, "LinkVisited", p, QPalette::LinkVisited);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
contents.replace("darwin", "*"); contents.replace("darwin", "*");
#endif #endif

View File

@@ -30,8 +30,11 @@
#include <QRect> #include <QRect>
#include <QVector> #include <QVector>
#include "qtsystemtrayicon.h"
#include "systemtrayicon.h" #include "systemtrayicon.h"
#include "qtsystemtrayicon.h"
#ifdef Q_OS_MACOS
# include "macsystemtrayicon.h"
#endif
SystemTrayIcon::SystemTrayIcon(QObject *parent) SystemTrayIcon::SystemTrayIcon(QObject *parent)
: QObject(parent), : QObject(parent),
@@ -103,7 +106,7 @@ void SystemTrayIcon::SetStopped() {
} }
SystemTrayIcon* SystemTrayIcon::CreateSystemTrayIcon(QObject *parent) { SystemTrayIcon* SystemTrayIcon::CreateSystemTrayIcon(QObject *parent) {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
return new MacSystemTrayIcon(parent); return new MacSystemTrayIcon(parent);
#else #else
return new QtSystemTrayIcon(parent); return new QtSystemTrayIcon(parent);

View File

@@ -59,26 +59,27 @@
#include <QtDebug> #include <QtDebug>
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <unistd.h> # include <unistd.h>
#include <sys/syscall.h> # include <sys/syscall.h>
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include <sys/resource.h> # include <sys/resource.h>
# include <sys/sysctl.h>
# include <sys/param.h>
#endif #endif
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
#include <sys/statvfs.h> # include <sys/statvfs.h>
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN)
#include <windows.h> # include <windows.h>
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include <QProcess> # include <QProcess>
# include "CoreServices/CoreServices.h"
#include "CoreServices/CoreServices.h" # include "IOKit/ps/IOPSKeys.h"
#include "IOKit/ps/IOPSKeys.h" # include "IOKit/ps/IOPowerSources.h"
#include "IOKit/ps/IOPowerSources.h" #elif defined(Q_OS_WIN)
#elif defined(Q_OS_WIN32)
#include <QProcess> #include <QProcess>
#endif #endif
@@ -89,10 +90,10 @@
#include "timeconstants.h" #include "timeconstants.h"
#include "application.h" #include "application.h"
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include "mac_startup.h" # include "mac_startup.h"
#include "mac_utilities.h" # include "mac_utilities.h"
#include "scoped_cftyperef.h" # include "scoped_cftyperef.h"
#endif #endif
namespace Utilities { namespace Utilities {
@@ -361,7 +362,7 @@ QString ColorToRgba(const QColor &c) {
} }
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
qint32 GetMacVersion() { qint32 GetMacVersion() {
SInt32 minor_version; SInt32 minor_version;
@@ -374,7 +375,7 @@ qint32 GetMacVersion() {
void RevealFileInFinder(QString const &path) { void RevealFileInFinder(QString const &path) {
QProcess::execute("/usr/bin/open", QStringList() << "-R" << path); QProcess::execute("/usr/bin/open", QStringList() << "-R" << path);
} }
#endif // Q_OS_DARWIN #endif // Q_OS_MACOS
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void ShowFileInExplorer(QString const &path) { void ShowFileInExplorer(QString const &path) {
@@ -398,7 +399,7 @@ void OpenInFileBrowser(const QList<QUrl> &urls) {
if (dirs.contains(directory)) continue; if (dirs.contains(directory)) continue;
dirs.insert(directory); dirs.insert(directory);
qLog(Debug) << path; qLog(Debug) << path;
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Revealing multiple files in the finder only opens one window, so it also makes sense to reveal at most one per directory // Revealing multiple files in the finder only opens one window, so it also makes sense to reveal at most one per directory
RevealFileInFinder(path); RevealFileInFinder(path);
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
@@ -642,7 +643,7 @@ int SetThreadIOPriority(IoPriority priority) {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
return syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, GetThreadId(), 4 | priority << IOPRIO_CLASS_SHIFT); return syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, GetThreadId(), 4 | priority << IOPRIO_CLASS_SHIFT);
#elif defined(Q_OS_DARWIN) #elif defined(Q_OS_MACOS)
return setpriority(PRIO_DARWIN_THREAD, 0, priority == IOPRIO_CLASS_IDLE ? PRIO_DARWIN_BG : 0); return setpriority(PRIO_DARWIN_THREAD, 0, priority == IOPRIO_CLASS_IDLE ? PRIO_DARWIN_BG : 0);
#else #else
return 0; return 0;
@@ -752,7 +753,7 @@ void SetEnv(const char *key, const QString &value) {
void IncreaseFDLimit() { void IncreaseFDLimit() {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Bump the soft limit for the number of file descriptors from the default of 256 to the maximum (usually 10240). // Bump the soft limit for the number of file descriptors from the default of 256 to the maximum (usually 10240).
struct rlimit limit; struct rlimit limit;
getrlimit(RLIMIT_NOFILE, &limit); getrlimit(RLIMIT_NOFILE, &limit);

View File

@@ -105,7 +105,7 @@ void CddaLister::UpdateDeviceFreeSpace(const QString&) {}
void CddaLister::Init() { void CddaLister::Init() {
cdio_init(); cdio_init();
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
if (!cdio_have_driver(DRIVER_OSX)) { if (!cdio_have_driver(DRIVER_OSX)) {
qLog(Error) << "libcdio was compiled without support for OS X!"; qLog(Error) << "libcdio was compiled without support for OS X!";
} }
@@ -121,7 +121,7 @@ void CddaLister::Init() {
if (device_info.isSymLink()) { if (device_info.isSymLink()) {
device = device_info.symLinkTarget(); device = device_info.symLinkTarget();
} }
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
// Every track is detected as a separate device on Darwin. The raw disk looks like /dev/rdisk1 // Every track is detected as a separate device on Darwin. The raw disk looks like /dev/rdisk1
if (!device.contains(QRegExp("^/dev/rdisk[0-9]$"))) { if (!device.contains(QRegExp("^/dev/rdisk[0-9]$"))) {
continue; continue;

View File

@@ -68,7 +68,7 @@
# include "cddadevice.h" # include "cddadevice.h"
#endif #endif
#if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP) #if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
# include "macdevicelister.h" # include "macdevicelister.h"
#endif #endif
#ifdef HAVE_LIBGPOD #ifdef HAVE_LIBGPOD
@@ -220,7 +220,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
connected_devices_model_->setSourceModel(this); connected_devices_model_->setSourceModel(this);
// CD devices are detected via the DiskArbitration framework instead on Darwin. // CD devices are detected via the DiskArbitration framework instead on Darwin.
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER) && !defined(Q_OS_DARWIN) #if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER) && !defined(Q_OS_MACOS)
AddLister(new CddaLister); AddLister(new CddaLister);
#endif #endif
#ifdef HAVE_DEVICEKIT #ifdef HAVE_DEVICEKIT
@@ -232,7 +232,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
#ifdef HAVE_GIO #ifdef HAVE_GIO
AddLister(new GioLister); AddLister(new GioLister);
#endif #endif
#if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP) #if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
AddLister(new MacDeviceLister); AddLister(new MacDeviceLister);
#endif #endif

View File

@@ -38,7 +38,7 @@
# include "pulsedevicefinder.h" # include "pulsedevicefinder.h"
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
# include "osxdevicefinder.h" # include "osxdevicefinder.h"
#endif #endif
@@ -63,7 +63,7 @@ void EngineDevice::Init() {
#ifdef HAVE_LIBPULSE #ifdef HAVE_LIBPULSE
device_finders.append(new PulseDeviceFinder); device_finders.append(new PulseDeviceFinder);
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
device_finders.append(new OsxDeviceFinder); device_finders.append(new OsxDeviceFinder);
#endif #endif
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32

View File

@@ -106,8 +106,8 @@ GstEngine::GstEngine(TaskManager *task_manager)
ReloadSettings(); ReloadSettings();
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS___ // FIXME
QDir resources_dir(mac::GetResourcesPath()); QDir resources_dir(mac::getResourcesPath());
QString ca_cert_path = resources_dir.filePath("cacert.pem"); QString ca_cert_path = resources_dir.filePath("cacert.pem");
GError *error = nullptr; GError *error = nullptr;
tls_database_ = g_tls_file_database_new(ca_cert_path.toUtf8().data(), &error); tls_database_ = g_tls_file_database_new(ca_cert_path.toUtf8().data(), &error);
@@ -121,7 +121,7 @@ GstEngine::~GstEngine() {
current_pipeline_.reset(); current_pipeline_.reset();
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
g_object_unref(tls_database_); g_object_unref(tls_database_);
#endif #endif
} }
@@ -428,14 +428,14 @@ void GstEngine::SetEnvironment() {
QString registry_filename; QString registry_filename;
// On windows and mac we bundle the gstreamer plugins with strawberry // On windows and mac we bundle the gstreamer plugins with strawberry
#if defined(Q_OS_DARWIN) #if defined(Q_OS_MACOS)
scanner_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner"; scanner_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner";
plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer"; plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer";
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins"); plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
#endif #endif
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) #if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
registry_filename = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion()); registry_filename = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion());
#endif #endif
@@ -451,7 +451,7 @@ void GstEngine::SetEnvironment() {
Utilities::SetEnv("GST_REGISTRY", registry_filename); Utilities::SetEnv("GST_REGISTRY", registry_filename);
} }
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules"); Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules");
#endif #endif

View File

@@ -49,7 +49,7 @@
class TaskManager; class TaskManager;
class GstEnginePipeline; class GstEnginePipeline;
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
struct _GTlsDatabase; struct _GTlsDatabase;
typedef struct _GTlsDatabase GTlsDatabase; typedef struct _GTlsDatabase GTlsDatabase;
#endif #endif
@@ -111,7 +111,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
void AddBufferConsumer(GstBufferConsumer *consumer); void AddBufferConsumer(GstBufferConsumer *consumer);
void RemoveBufferConsumer(GstBufferConsumer *consumer); void RemoveBufferConsumer(GstBufferConsumer *consumer);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
GTlsDatabase *tls_database() const { return tls_database_; } GTlsDatabase *tls_database() const { return tls_database_; }
#endif #endif
@@ -202,6 +202,10 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
bool have_new_buffer_; bool have_new_buffer_;
int scope_chunks_; int scope_chunks_;
#ifdef Q_OS_MACOS
GTlsDatabase* tls_database_;
#endif
}; };
#endif /* GSTENGINE_H */ #endif /* GSTENGINE_H */

View File

@@ -513,7 +513,7 @@ void GstEnginePipeline::TaskEnterCallback(GstTask *, GThread *, gpointer) {
// Bump the priority of the thread only on OS X // Bump the priority of the thread only on OS X
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
sched_param param; sched_param param;
memset(&param, 0, sizeof(param)); memset(&param, 0, sizeof(param));
@@ -835,7 +835,7 @@ void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *pspec,
if (g_object_class_find_property(G_OBJECT_GET_CLASS(element), "user-agent")) { if (g_object_class_find_property(G_OBJECT_GET_CLASS(element), "user-agent")) {
QString user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion()); g_object_set(element, "user-agent", user_agent.toUtf8().constData(), nullptr); QString user_agent = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion()); g_object_set(element, "user-agent", user_agent.toUtf8().constData(), nullptr);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
g_object_set(element, "tls-database", instance->engine_->tls_database(), nullptr); g_object_set(element, "tls-database", instance->engine_->tls_database(), nullptr);
g_object_set(element, "ssl-use-system-ca-file", false, nullptr); g_object_set(element, "ssl-use-system-ca-file", false, nullptr);
g_object_set(element, "ssl-strict", TRUE, nullptr); g_object_set(element, "ssl-strict", TRUE, nullptr);

View File

@@ -425,7 +425,7 @@ void XineEngine::SetEnvironment() {
putenv(QString("XINE_PLUGIN_PATH=" + QCoreApplication::applicationDirPath() + "/xine-plugins").toLatin1().constData()); putenv(QString("XINE_PLUGIN_PATH=" + QCoreApplication::applicationDirPath() + "/xine-plugins").toLatin1().constData());
#endif #endif
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
setenv("XINE_PLUGIN_PATH", QString(QCoreApplication::applicationDirPath() + "/../PlugIns/xine").toLatin1().constData(), 1); setenv("XINE_PLUGIN_PATH", QString(QCoreApplication::applicationDirPath() + "/../PlugIns/xine").toLatin1().constData(), 1);
#endif #endif

View File

@@ -69,14 +69,14 @@ void GlobalShortcutGrabber::hideEvent(QHideEvent *e) {
} }
void GlobalShortcutGrabber::grabKeyboard() { void GlobalShortcutGrabber::grabKeyboard() {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
SetupMacEventHandler(); SetupMacEventHandler();
#endif #endif
QDialog::grabKeyboard(); QDialog::grabKeyboard();
} }
void GlobalShortcutGrabber::releaseKeyboard() { void GlobalShortcutGrabber::releaseKeyboard() {
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
TeardownMacEventHandler(); TeardownMacEventHandler();
#endif #endif
QDialog::releaseKeyboard(); QDialog::releaseKeyboard();

View File

@@ -33,7 +33,11 @@
#include "globalshortcuts.h" #include "globalshortcuts.h"
#include "globalshortcutbackend.h" #include "globalshortcutbackend.h"
#include "gnomeglobalshortcutbackend.h" #include "gnomeglobalshortcutbackend.h"
#include "qxtglobalshortcutbackend.h" #ifndef Q_OS_MACOS
# include "qxtglobalshortcutbackend.h"
#else
# include "macglobalshortcutbackend.h"
#endif
#include "settings/shortcutssettingspage.h" #include "settings/shortcutssettingspage.h"
GlobalShortcuts::GlobalShortcuts(QWidget *parent) GlobalShortcuts::GlobalShortcuts(QWidget *parent)
@@ -66,7 +70,7 @@ GlobalShortcuts::GlobalShortcuts(QWidget *parent)
// Create backends - these do the actual shortcut registration // Create backends - these do the actual shortcut registration
gnome_backend_ = new GnomeGlobalShortcutBackend(this); gnome_backend_ = new GnomeGlobalShortcutBackend(this);
#ifndef Q_OS_DARWIN #ifndef Q_OS_MACOS
system_backend_ = new QxtGlobalShortcutBackend(this); system_backend_ = new QxtGlobalShortcutBackend(this);
#else #else
system_backend_ = new MacGlobalShortcutBackend(this); system_backend_ = new MacGlobalShortcutBackend(this);

View File

@@ -36,13 +36,13 @@
#include <QtDebug> #include <QtDebug>
#include "config.h" #include "config.h"
#include "core/globalshortcuts.h" #include "globalshortcuts.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/mac_startup.h" #include "core/mac_startup.h"
#include "core/utilities.h" #include "core/utilities.h"
#import "core/mac_utilities.h" #import "core/mac_utilities.h"
#import "mac/SBSystemPreferences.h" #import "core/SBSystemPreferences.h"
class MacGlobalShortcutBackendPrivate : boost::noncopyable { class MacGlobalShortcutBackendPrivate : boost::noncopyable {
public: public:
@@ -88,10 +88,8 @@ bool MacGlobalShortcutBackend::DoRegister() {
// Always enable media keys. // Always enable media keys.
mac::SetShortcutHandler(this); mac::SetShortcutHandler(this);
for (const GlobalShortcuts::Shortcut& shortcut : for (const GlobalShortcuts::Shortcut& shortcut : manager_->shortcuts().values()) {
manager_->shortcuts().values()) { shortcuts_[shortcut.action->shortcut()] = shortcut.action;
shortcuts_[shortcut.action->shortcut()] = shortcut.action;
}
} }
return p_->Register(); return p_->Register();
@@ -134,29 +132,26 @@ bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const {
} }
void MacGlobalShortcutBackend::ShowAccessibilityDialog() { void MacGlobalShortcutBackend::ShowAccessibilityDialog() {
NSArray* paths = NSSearchPathForDirectoriesInDomains( NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSSystemDomainMask, YES);
NSPreferencePanesDirectory, NSSystemDomainMask, YES);
if ([paths count] == 1) { if ([paths count] == 1) {
SBSystemPreferencesApplication* system_prefs = [SBApplication SBSystemPreferencesApplication* system_prefs = [SBApplication
applicationWithBundleIdentifier:@"com.apple.systempreferences"]; applicationWithBundleIdentifier:@"com.apple.systempreferences"];
[system_prefs activate]; [system_prefs activate];
SBElementArray* panes = [system_prefs panes]; SBElementArray* panes = [system_prefs panes];
SBSystemPreferencesPane* security_pane = nil; SBSystemPreferencesPane* security_pane = nil;
for (SBSystemPreferencesPane* pane : panes) { for (SBSystemPreferencesPane* pane : panes) {
if ([[pane id] isEqualToString:@"com.apple.preference.security"]) { if ([[pane id] isEqualToString:@"com.apple.preference.security"]) {
security_pane = pane; security_pane = pane;
break; break;
}
} }
} }
[system_prefs setCurrentPane:security_pane]; [system_prefs setCurrentPane:security_pane];
SBElementArray* anchors = [security_pane anchors]; SBElementArray* anchors = [security_pane anchors];
for (SBSystemPreferencesAnchor* anchor : anchors) { for (SBSystemPreferencesAnchor* anchor : anchors) {
if ([[anchor name] isEqualToString:@"Privacy_Accessibility"]) { if ([[anchor name] isEqualToString:@"Privacy_Accessibility"]) {
[anchor reveal]; [anchor reveal];
}
} }
} }
} }

View File

@@ -648,7 +648,7 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro
if (const SongMimeData *song_data = qobject_cast<const SongMimeData*>(data)) { if (const SongMimeData *song_data = qobject_cast<const SongMimeData*>(data)) {
// Dragged from a collection // Dragged from a collection
// We want to check if these songs are from the actual local file backend, if they are we treat them differently. // We want to check if these songs are from the actual local file backend, if they are we treat them differently.
if (song_data->backend && song_data->backend->songs_table() == Collection::kSongsTable) if (song_data->backend && song_data->backend->songs_table() == SCollection::kSongsTable)
InsertSongItems<CollectionPlaylistItem>(song_data->songs, row, play_now, enqueue_now); InsertSongItems<CollectionPlaylistItem>(song_data->songs, row, play_now, enqueue_now);
else else
InsertSongItems<SongPlaylistItem>(song_data->songs, row, play_now, enqueue_now); InsertSongItems<SongPlaylistItem>(song_data->songs, row, play_now, enqueue_now);

View File

@@ -70,9 +70,9 @@
#include "playlist/playlist.h" #include "playlist/playlist.h"
#include "playlistdelegates.h" #include "playlistdelegates.h"
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
#include "core/mac_utilities.h" #include "core/mac_utilities.h"
#endif // Q_OS_DARWIN #endif // Q_OS_MACOS
const int QueuedItemDelegate::kQueueBoxBorder = 1; const int QueuedItemDelegate::kQueueBoxBorder = 1;
const int QueuedItemDelegate::kQueueBoxCornerRadius = 3; const int QueuedItemDelegate::kQueueBoxCornerRadius = 3;
@@ -484,7 +484,7 @@ void SongSourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
QPixmap pixmap = LookupPixmap(url, option_copy.decorationSize); QPixmap pixmap = LookupPixmap(url, option_copy.decorationSize);
float device_pixel_ratio = 1.0f; float device_pixel_ratio = 1.0f;
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
QWidget *parent_widget = reinterpret_cast<QWidget*>(parent()); QWidget *parent_widget = reinterpret_cast<QWidget*>(parent());
device_pixel_ratio = mac::GetDevicePixelRatio(parent_widget); device_pixel_ratio = mac::GetDevicePixelRatio(parent_widget);
#endif #endif

View File

@@ -53,7 +53,7 @@ PlaylistItem* PlaylistItem::NewFromType(const QString &type) {
PlaylistItem* PlaylistItem::NewFromSongsTable(const QString &table, const Song &song) { PlaylistItem* PlaylistItem::NewFromSongsTable(const QString &table, const Song &song) {
if (table == Collection::kSongsTable) if (table == SCollection::kSongsTable)
return new CollectionPlaylistItem(song); return new CollectionPlaylistItem(song);
qLog(Warning) << "Invalid PlaylistItem songs table:" << table; qLog(Warning) << "Invalid PlaylistItem songs table:" << table;

View File

@@ -186,7 +186,7 @@ PlaylistView::PlaylistView(QWidget *parent)
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
#endif #endif
// For fading // For fading
@@ -523,7 +523,7 @@ void PlaylistView::keyPressEvent(QKeyEvent *event) {
else if (event == QKeySequence::Delete) { else if (event == QKeySequence::Delete) {
RemoveSelected(false); RemoveSelected(false);
event->accept(); event->accept();
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
} }
else if (event->key() == Qt::Key_Backspace) { else if (event->key() == Qt::Key_Backspace) {
RemoveSelected(false); RemoveSelected(false);

View File

@@ -43,9 +43,9 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog) : SettingsP
connect(ui_->checkbox_showtrayicon, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool))); connect(ui_->checkbox_showtrayicon, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool)));
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ui_->checkbox_showtrayicon->setEnabled(false); ui_->checkbox_showtrayicon->setEnabled(false);
ui_->startup_group->setEnabled(false); ui_->groupbox_startup->setEnabled(false);
#endif #endif
} }

View File

@@ -52,7 +52,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupbox_startupgroup"> <widget class="QGroupBox" name="groupbox_startup">
<property name="title"> <property name="title">
<string>When Strawberry starts</string> <string>When Strawberry starts</string>
</property> </property>
@@ -60,14 +60,14 @@
<item> <item>
<widget class="QRadioButton" name="radiobutton_alwaysshow"> <widget class="QRadioButton" name="radiobutton_alwaysshow">
<property name="text"> <property name="text">
<string>Always show the main window</string> <string>Always show the &amp;main window</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="radiobutton_alwayshide"> <widget class="QRadioButton" name="radiobutton_alwayshide">
<property name="text"> <property name="text">
<string>Always hide the main window</string> <string>Alwa&amp;ys hide the main window</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -175,7 +175,7 @@ void NotificationsSettingsPage::Load() {
ui_->notifications_custom_text2->setText(s.value("CustomText2").toString()); ui_->notifications_custom_text2->setText(s.value("CustomText2").toString());
s.endGroup(); s.endGroup();
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ui_->notifications_options->setEnabled(ui_->notifications_pretty->isChecked()); ui_->notifications_options->setEnabled(ui_->notifications_pretty->isChecked());
#endif #endif
@@ -339,7 +339,7 @@ void NotificationsSettingsPage::NotificationTypeChanged() {
ui_->notifications_pretty_group->setEnabled(pretty); ui_->notifications_pretty_group->setEnabled(pretty);
ui_->notifications_custom_text_group->setEnabled(enabled); ui_->notifications_custom_text_group->setEnabled(enabled);
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
ui_->notifications_options->setEnabled(pretty); ui_->notifications_options->setEnabled(pretty);
#endif #endif
ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked())); ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked()));

View File

@@ -38,6 +38,7 @@
#include <QRadioButton> #include <QRadioButton>
#include "core/iconloader.h" #include "core/iconloader.h"
#include "core/utilities.h"
#include "globalshortcuts/globalshortcutgrabber.h" #include "globalshortcuts/globalshortcutgrabber.h"
#include "globalshortcuts/globalshortcuts.h" #include "globalshortcuts/globalshortcuts.h"
#include "settingspage.h" #include "settingspage.h"
@@ -119,11 +120,11 @@ void GlobalShortcutsSettingsPage::Load() {
} }
ui_->mac_container->setVisible(!manager->IsMacAccessibilityEnabled()); ui_->mac_container->setVisible(!manager->IsMacAccessibilityEnabled());
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
qint32 mac_version = Utilities::GetMacVersion(); qint32 mac_version = Utilities::GetMacVersion();
ui_->mac_label->setVisible(mac_version < 9); ui_->mac_label->setVisible(mac_version < 9);
ui_->mac_label_mavericks->setVisible(mac_version >= 9); ui_->mac_label_mavericks->setVisible(mac_version >= 9);
#endif // Q_OS_DARWIN #endif // Q_OS_MACOS
} }

View File

@@ -220,7 +220,7 @@ void OSD::ShowMessage(const QString &summary, const QString &message, const QStr
} }
break; break;
#ifndef Q_OS_DARWIN #ifndef Q_OS_MACOS
case TrayPopup: case TrayPopup:
tray_icon_->ShowPopup(summary, message, timeout_msec_); tray_icon_->ShowPopup(summary, message, timeout_msec_);
break; break;
@@ -324,7 +324,7 @@ QString OSD::ReplaceVariable(const QString &variable, const Song &song) {
// We need different strings depending on notification type // We need different strings depending on notification type
switch (behaviour_) { switch (behaviour_) {
case Native: case Native:
#ifdef Q_OS_DARWIN #ifdef Q_OS_MACOS
return "\n"; return "\n";
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX

View File

@@ -297,7 +297,6 @@ void StatusView::UpdateSong() {
const QueryOptions opt; const QueryOptions opt;
CollectionBackend::AlbumList albumlist; CollectionBackend::AlbumList albumlist;
Engine::EngineType enginetype = app_->player()->engine()->type();
label_playing_top_->setText(""); label_playing_top_->setText("");
label_playing_text_->setText(""); label_playing_text_->setText("");
@@ -314,9 +313,9 @@ void StatusView::UpdateSong() {
html += QString("Bitrate: %1 kbps<br />\n").arg(metadata_.bitrate()); html += QString("Bitrate: %1 kbps<br />\n").arg(metadata_.bitrate());
html += QString("Samplerate: %1 hz / %2 bit<br />\n").arg(metadata_.samplerate()).arg(metadata_.bitdepth()); html += QString("Samplerate: %1 hz / %2 bit<br />\n").arg(metadata_.samplerate()).arg(metadata_.bitdepth());
if (enginetype != Engine::EngineType::None) { if (app_->player()->engine() && app_->player()->engine()->type() != Engine::EngineType::None) {
html += QString("<br />"); html += QString("<br />");
html += QString("Engine: %1<br />").arg(EngineName(enginetype)); html += QString("Engine: %1<br />").arg(EngineDescription(app_->player()->engine()->type()));
} }
html += QString("<br />"); html += QString("<br />");