Fix macos build
This commit is contained in:
parent
c4e75dea65
commit
ada7325a04
2
3rdparty/qocoa/CMakeLists.txt
vendored
2
3rdparty/qocoa/CMakeLists.txt
vendored
@ -24,6 +24,7 @@ else()
|
||||
qprogressindicatorspinning_nonmac.cpp
|
||||
)
|
||||
set(RESOURCES
|
||||
qsearchfield_nonmac.qrc
|
||||
qprogressindicatorspinning_nonmac.qrc
|
||||
)
|
||||
qt5_add_resources(RESOURCES_SOURCES ${RESOURCES})
|
||||
@ -31,3 +32,4 @@ endif()
|
||||
|
||||
add_library(Qocoa STATIC ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES})
|
||||
target_link_libraries(Qocoa ${QT_LIBRARIES})
|
||||
|
||||
|
8
3rdparty/qocoa/README.md
vendored
8
3rdparty/qocoa/README.md
vendored
@ -16,7 +16,9 @@ make
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
[](https://travis-ci.org/MikeMcQuaid/Qocoa)
|
||||
|
||||
## 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).
|
||||
@ -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).
|
||||
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
|
||||

|
||||
|
3
3rdparty/qocoa/qbutton.h
vendored
3
3rdparty/qocoa/qbutton.h
vendored
@ -3,7 +3,6 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
|
||||
class QButtonPrivate;
|
||||
class QButton : public QWidget
|
||||
@ -24,7 +23,7 @@ public:
|
||||
RoundRect = 12,
|
||||
Recessed = 13,
|
||||
RoundedDisclosure = 14,
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#ifdef __MAC_10_7
|
||||
Inline = 15
|
||||
#endif
|
||||
};
|
||||
|
8
3rdparty/qocoa/qbutton_mac.mm
vendored
8
3rdparty/qocoa/qbutton_mac.mm
vendored
@ -37,7 +37,9 @@ public:
|
||||
switch(bezelStyle) {
|
||||
case QButton::Disclosure:
|
||||
case QButton::Circular:
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
#endif
|
||||
case QButton::RoundedDisclosure:
|
||||
case QButton::HelpButton:
|
||||
[nsButton setTitle:@""];
|
||||
@ -55,7 +57,7 @@ public:
|
||||
font = [NSFont fontWithName:@"Lucida Grande Bold" size:12];
|
||||
break;
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
||||
break;
|
||||
@ -112,7 +114,7 @@ public:
|
||||
qButton->setFixedHeight(22);
|
||||
qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
break;
|
||||
#ifdef MAC_OS_X_VERSION_10_7
|
||||
#ifdef __MAC_10_7
|
||||
case QButton::Inline:
|
||||
qButton->setMinimumWidth(10);
|
||||
qButton->setFixedHeight(16);
|
||||
@ -130,7 +132,7 @@ public:
|
||||
[nsButton setButtonType:NSMomentaryPushInButton];
|
||||
}
|
||||
|
||||
[nsButton setBezelStyle:bezelStyle];
|
||||
// [nsButton setBezelStyle:bezelStyle];
|
||||
}
|
||||
|
||||
void clicked()
|
||||
|
15
3rdparty/qocoa/qbutton_nonmac.cpp
vendored
15
3rdparty/qocoa/qbutton_nonmac.cpp
vendored
@ -20,19 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QAbstractButton>
|
||||
#include <QBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include "qbutton.h"
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "qbutton.h"
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class QButtonPrivate : public QObject
|
||||
{
|
||||
|
7
3rdparty/qocoa/qocoa_mac.h
vendored
7
3rdparty/qocoa/qocoa_mac.h
vendored
@ -20,10 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QBoxLayout>
|
||||
#include <QtMacExtras>
|
||||
#include <QMacCocoaViewContainer>
|
||||
|
||||
static inline NSString* fromQString(const QString &string)
|
||||
@ -42,11 +43,11 @@ static inline QString toQString(NSString *string)
|
||||
|
||||
static inline NSImage* fromQPixmap(const QPixmap &pixmap)
|
||||
{
|
||||
CGImageRef cgImage = pixmap.toMacCGImageRef();
|
||||
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
|
||||
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);
|
||||
QVBoxLayout *layout = new QVBoxLayout(parent);
|
||||
|
3
3rdparty/qocoa/qprogressindicatorspinning.h
vendored
3
3rdparty/qocoa/qprogressindicatorspinning.h
vendored
@ -17,7 +17,8 @@ public:
|
||||
Aqua = 12
|
||||
};
|
||||
|
||||
explicit QProgressIndicatorSpinning(QWidget *parent, Thickness thickness = Default);
|
||||
explicit QProgressIndicatorSpinning(QWidget *parent,
|
||||
Thickness thickness = Default);
|
||||
public slots:
|
||||
void animate(bool animate = true);
|
||||
private:
|
||||
|
@ -20,17 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMovie>
|
||||
#include <QPointer>
|
||||
#include <QSize>
|
||||
|
||||
#include "qprogressindicatorspinning.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
|
||||
class QProgressIndicatorSpinningPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
|
19
3rdparty/qocoa/qsearchfield.h
vendored
19
3rdparty/qocoa/qsearchfield.h
vendored
@ -2,22 +2,24 @@
|
||||
#define QSEARCHFIELD_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QMenu>
|
||||
|
||||
class QSearchFieldPrivate;
|
||||
class QSearchField : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true);
|
||||
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText);
|
||||
|
||||
public:
|
||||
explicit QSearchField(QWidget *parent);
|
||||
|
||||
QString text() const;
|
||||
QString placeholderText() const;
|
||||
void setFocus(Qt::FocusReason reason);
|
||||
void setFocus(Qt::FocusReason);
|
||||
void setMenu(QMenu *menu);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &text);
|
||||
@ -31,15 +33,16 @@ signals:
|
||||
void editingFinished();
|
||||
void returnPressed();
|
||||
|
||||
private slots:
|
||||
void popupMenu();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent*);
|
||||
void resizeEvent(QResizeEvent*);
|
||||
bool eventFilter(QObject*, QEvent*);
|
||||
|
||||
private:
|
||||
friend class QSearchFieldPrivate;
|
||||
QPointer <QSearchFieldPrivate> pimpl;
|
||||
|
||||
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText);
|
||||
};
|
||||
|
||||
#endif // QSEARCHFIELD_H
|
||||
|
124
3rdparty/qocoa/qsearchfield_mac.mm
vendored
124
3rdparty/qocoa/qsearchfield_mac.mm
vendored
@ -29,8 +29,8 @@ THE SOFTWARE.
|
||||
#import "AppKit/NSSearchField.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QKeyEvent>
|
||||
#include <QClipboard>
|
||||
|
||||
class QSearchFieldPrivate : public QObject
|
||||
{
|
||||
@ -95,6 +95,16 @@ public:
|
||||
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:
|
||||
(NSTextView *)textView doCommandBySelector:
|
||||
(SEL)commandSelector {
|
||||
@ -111,16 +121,6 @@ public:
|
||||
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
|
||||
|
||||
@interface QocoaSearchField : NSSearchField
|
||||
@ -129,14 +129,13 @@ public:
|
||||
|
||||
@implementation QocoaSearchField
|
||||
-(BOOL)performKeyEquivalent:(NSEvent*)event {
|
||||
|
||||
// First, check if we have the focus.
|
||||
// If no, it probably means this event isn't for us.
|
||||
NSResponder* firstResponder = [[NSApp keyWindow] firstResponder];
|
||||
if ([firstResponder isKindOfClass:[NSText class]] &&
|
||||
[(NSText*)firstResponder delegate] == self) {
|
||||
|
||||
if ([event type] == NSKeyDown && [event modifierFlags] & NSCommandKeyMask)
|
||||
if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand)
|
||||
{
|
||||
QString keyString = toQString([event characters]);
|
||||
if (keyString == "a") // Cmd+a
|
||||
@ -186,6 +185,25 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
|
||||
[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)
|
||||
{
|
||||
Q_ASSERT(pimpl);
|
||||
@ -194,10 +212,6 @@ void QSearchField::setText(const QString &text)
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
[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];
|
||||
}
|
||||
|
||||
@ -212,40 +226,6 @@ void QSearchField::setPlaceholderText(const QString &text)
|
||||
[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()
|
||||
{
|
||||
Q_ASSERT(pimpl);
|
||||
@ -274,12 +254,44 @@ QString QSearchField::text() const
|
||||
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)
|
||||
{
|
||||
QWidget::resizeEvent(resizeEvent);
|
||||
}
|
||||
|
||||
bool QSearchField::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
194
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
194
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
@ -20,39 +20,48 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
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 <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QStyle>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
class QSearchFieldPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineEdit, QToolButton *clearButton)
|
||||
: QObject(searchField), lineEdit(lineEdit), clearButton(clearButton) {}
|
||||
QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineEdit, QToolButton *clearButton, QToolButton *searchButton)
|
||||
: QObject(searchField), lineEdit(lineEdit), clearButton(clearButton), searchButton(searchButton) {}
|
||||
|
||||
int lineEditFrameWidth() const {
|
||||
return lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
}
|
||||
|
||||
int clearButtonPaddedWidth() const {
|
||||
return clearButton->width() + lineEditFrameWidth() * 2;
|
||||
}
|
||||
|
||||
int clearButtonPaddedHeight() const {
|
||||
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<QToolButton> clearButton;
|
||||
QPointer<QToolButton> searchButton;
|
||||
QPointer<QMenu> searchMenu;
|
||||
};
|
||||
|
||||
QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
|
||||
@ -67,29 +76,94 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
|
||||
connect(lineEdit, SIGNAL(textChanged(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);
|
||||
QIcon clearIcon = QIcon::fromTheme(QLatin1String("edit-clear"),
|
||||
QIcon(QLatin1String(":/Qocoa/qsearchfield_nonmac_clear.png")));
|
||||
clearButton->setIcon(clearIcon);
|
||||
clearButton->setIconSize(QSize(16, 16));
|
||||
clearButton->setStyleSheet("border: none; padding: 0px;");
|
||||
clearButton->resize(clearButton->sizeHint());
|
||||
clearButton->setIconSize(QSize(iconsize, iconsize));
|
||||
clearButton->setFixedSize(QSize(iconsize, iconsize));
|
||||
clearButton->setStyleSheet("border: none;");
|
||||
clearButton->hide();
|
||||
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()));
|
||||
const int width = frame_width + qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth());
|
||||
const int height = frame_width + qMax(lineEdit->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight());
|
||||
lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; } ")
|
||||
.arg(pimpl->searchButtonPaddedWidth())
|
||||
.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);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
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)
|
||||
@ -98,6 +172,8 @@ void QSearchField::setText(const QString &text)
|
||||
if (!(pimpl && pimpl->clearButton && pimpl->lineEdit))
|
||||
return;
|
||||
|
||||
pimpl->clearButton->setVisible(!text.isEmpty());
|
||||
|
||||
if (text != this->text())
|
||||
pimpl->lineEdit->setText(text);
|
||||
}
|
||||
@ -113,26 +189,6 @@ void QSearchField::setPlaceholderText(const QString &text)
|
||||
#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()
|
||||
{
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
@ -160,6 +216,30 @@ QString QSearchField::text() const
|
||||
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)
|
||||
{
|
||||
Q_ASSERT(pimpl && pimpl->clearButton && pimpl->lineEdit);
|
||||
@ -167,22 +247,10 @@ void QSearchField::resizeEvent(QResizeEvent *resizeEvent)
|
||||
return;
|
||||
|
||||
QWidget::resizeEvent(resizeEvent);
|
||||
const int x = pimpl->lineEditFrameWidth();
|
||||
const int x = width() - pimpl->clearButtonPaddedWidth();
|
||||
const int y = (height() - pimpl->clearButton->height())/2;
|
||||
pimpl->clearButton->move(x, y);
|
||||
}
|
||||
|
||||
bool QSearchField::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
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);
|
||||
pimpl->searchButton->move(pimpl->lineEditFrameWidth() * 2,
|
||||
(height() - pimpl->searchButton->height())/2);
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92)
|
||||
pkg_check_modules(LIBMTP libmtp>=1.0)
|
||||
pkg_check_modules(LIBPULSE libpulse)
|
||||
pkg_check_modules(LIBXML libxml-2.0)
|
||||
pkg_check_modules(LIBGLU REQUIRED glu)
|
||||
pkg_check_modules(IMOBILEDEVICE libimobiledevice-1.0)
|
||||
pkg_check_modules(USBMUXD libusbmuxd)
|
||||
pkg_check_modules(PLIST libplist)
|
||||
@ -125,19 +124,16 @@ if(DBUS_FOUND)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus)
|
||||
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
find_package(Qt5 COMPONENTS WebKitWidgets)
|
||||
endif(NOT APPLE)
|
||||
if(APPLE)
|
||||
if(NOT QT_MAC_USE_COCOA)
|
||||
message(FATAL_ERROR "Cocoa support is required")
|
||||
endif(NOT QT_MAC_USE_COCOA)
|
||||
endif(APPLE)
|
||||
find_package(Qt5 REQUIRED COMPONENTS MacExtras)
|
||||
endif()
|
||||
|
||||
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)
|
||||
elseif(UNIX AND X11_FOUND)
|
||||
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()
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml)
|
||||
endif()
|
||||
@ -179,7 +175,7 @@ if(LASTFM5_INCLUDE_DIRS AND LASTFM51_INCLUDE_DIRS)
|
||||
set(HAVE_LIBLASTFM1 ON)
|
||||
endif()
|
||||
|
||||
# CHROMAPRINT
|
||||
# CHECK INCLUDES
|
||||
CHECK_INCLUDE_FILES(chromaprint.h CHROMAPRINT_H)
|
||||
|
||||
# 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(${GLIBCONFIG_INCLUDE_DIRS})
|
||||
include_directories(${TAGLIB_INCLUDE_DIRS})
|
||||
|
||||
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_VERSION VERSION_GREATER 1.1.1)
|
||||
set(IMOBILEDEVICE_USES_UDIDS ON)
|
||||
|
2
dist/CMakeLists.txt
vendored
2
dist/CMakeLists.txt
vendored
@ -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.svg DESTINATION share/icons/hicolor/scalable/apps/)
|
||||
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)
|
||||
|
@ -239,7 +239,7 @@ QString LinuxDemangle(const QString &symbol) {
|
||||
}
|
||||
|
||||
QString DemangleSymbol(const QString &symbol) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
return DarwinDemangle(symbol);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
return LinuxDemangle(symbol);
|
||||
|
@ -785,13 +785,10 @@ optional_source(APPLE
|
||||
core/macsystemtrayicon.mm
|
||||
core/macscreensaver.cpp
|
||||
core/macfslistener.mm
|
||||
core/scoped_nsautorelease_pool.mm
|
||||
widgets/osd_mac.mm
|
||||
engine/osxdevicefinder.cpp
|
||||
device/macdevicelister.mm
|
||||
globalshortcuts/shortcutgrabber.mm
|
||||
globalshortcuts/macglobalshortcutbackend.mm
|
||||
globalshortcuts/globalshortcutgrabber.mm
|
||||
globalshortcuts/macglobalshortcutbackend.mm
|
||||
HEADERS
|
||||
core/mac_startup.h
|
||||
core/macsystemtrayicon.h
|
||||
@ -799,8 +796,6 @@ optional_source(APPLE
|
||||
core/macfslistener.h
|
||||
core/mac_utilities.h
|
||||
core/mac_delegate.h
|
||||
engine/osxdevicefinder.h
|
||||
device/macdevicelister.h
|
||||
globalshortcuts/macglobalshortcutbackend.h
|
||||
)
|
||||
|
||||
@ -965,7 +960,7 @@ endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
|
||||
|
||||
# Resource file for windows
|
||||
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)
|
||||
endif(WIN32)
|
||||
|
||||
@ -987,73 +982,55 @@ target_link_libraries(strawberry
|
||||
# macdeploy.py relies on the blob being built first.
|
||||
add_dependencies(strawberry strawberry-tagreader)
|
||||
|
||||
set_target_properties(strawberry PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST "../dist/Info.plist"
|
||||
)
|
||||
#set_target_properties(strawberry PROPERTIES
|
||||
#MACOSX_BUNDLE_INFO_PLIST "../dist/macos/Info.plist"
|
||||
#)
|
||||
|
||||
if (APPLE)
|
||||
install(FILES ../dist/strawberry.icns
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
install(FILES ../dist/qt.conf
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
install(FILES ../dist/sparkle_pub.pem
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
install(FILES ../dist/macos/strawberry.icns 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/macos/sparkle_pub.pem DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
|
||||
install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources")
|
||||
|
||||
if (HAVE_SPARKLE)
|
||||
install(DIRECTORY "${SPARKLE}/Versions/Current/Resources"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/Sparkle.framework")
|
||||
install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/Sparkle.framework")
|
||||
endif (HAVE_SPARKLE)
|
||||
|
||||
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist"
|
||||
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_QTNETWORK_LIBRARY_RELEASE}/Contents/Info.plist"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtNetwork.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_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")
|
||||
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist" 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_QTNETWORK_LIBRARY_RELEASE}/Contents/Info.plist" DESTINATION "${CMAKE_BINARY_DIR}/strawberry.app/Contents/Frameworks/QtNetwork.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_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
|
||||
POST_BUILD
|
||||
COMMAND
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../dist/macdeploy.py ${PROJECT_BINARY_DIR}/strawberry.app -f
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
#add_custom_command(TARGET strawberry
|
||||
# POST_BUILD
|
||||
# COMMAND
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/macdeploy.py ${PROJECT_BINARY_DIR}/strawberry.app -f
|
||||
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
#)
|
||||
|
||||
if (APPLE_DEVELOPER_ID)
|
||||
add_custom_target(
|
||||
sign
|
||||
COMMAND
|
||||
${PROJECT_SOURCE_DIR}/dist/codesign.py ${APPLE_DEVELOPER_ID} ${PROJECT_BINARY_DIR}/strawberry.app
|
||||
DEPENDS strawberry
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
#if (APPLE_DEVELOPER_ID)
|
||||
# add_custom_target(
|
||||
# sign
|
||||
# COMMAND
|
||||
# ${PROJECT_SOURCE_DIR}/dist/macos/codesign.py ${APPLE_DEVELOPER_ID} ${PROJECT_BINARY_DIR}/strawberry.app
|
||||
# DEPENDS strawberry
|
||||
# VERBATIM
|
||||
# )
|
||||
#endif()
|
||||
|
||||
|
||||
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
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/create-dmg.sh ${PROJECT_BINARY_DIR}/strawberry.app
|
||||
COMMAND ${CMAKE_COMMAND} -E rename
|
||||
${PROJECT_BINARY_DIR}/strawberry.dmg
|
||||
${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg
|
||||
DEPENDS strawberry
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
add_custom_target(dmg
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg)
|
||||
#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
|
||||
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/create-dmg.sh ${PROJECT_BINARY_DIR}/strawberry.app
|
||||
# COMMAND ${CMAKE_COMMAND} -E rename ${PROJECT_BINARY_DIR}/strawberry.dmg ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg
|
||||
# DEPENDS strawberry
|
||||
# WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
#)
|
||||
#add_custom_target(dmg
|
||||
# DEPENDS ${PROJECT_BINARY_DIR}/strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg)
|
||||
else (APPLE)
|
||||
install(TARGETS strawberry
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
install(TARGETS strawberry RUNTIME DESTINATION bin )
|
||||
endif (APPLE)
|
||||
|
@ -13,14 +13,6 @@
|
||||
#include <stdbool.h>
|
||||
#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 <QObject>
|
||||
#include <QWidget>
|
||||
|
@ -38,12 +38,12 @@
|
||||
#include "collectionmodel.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
|
||||
const char *Collection::kSongsTable = "songs";
|
||||
const char *Collection::kDirsTable = "directories";
|
||||
const char *Collection::kSubdirsTable = "subdirectories";
|
||||
const char *Collection::kFtsTable = "songs_fts";
|
||||
const char *SCollection::kSongsTable = "songs";
|
||||
const char *SCollection::kDirsTable = "directories";
|
||||
const char *SCollection::kSubdirsTable = "subdirectories";
|
||||
const char *SCollection::kFtsTable = "songs_fts";
|
||||
|
||||
Collection::Collection(Application *app, QObject *parent)
|
||||
SCollection::SCollection(Application *app, QObject *parent)
|
||||
: QObject(parent),
|
||||
app_(app),
|
||||
backend_(nullptr),
|
||||
@ -63,14 +63,14 @@ Collection::Collection(Application *app, QObject *parent)
|
||||
|
||||
}
|
||||
|
||||
Collection::~Collection() {
|
||||
SCollection::~SCollection() {
|
||||
|
||||
watcher_->deleteLater();
|
||||
watcher_thread_->exit();
|
||||
watcher_thread_->wait(5000 /* five seconds */);
|
||||
}
|
||||
|
||||
void Collection::Init() {
|
||||
void SCollection::Init() {
|
||||
|
||||
watcher_ = new CollectionWatcher;
|
||||
watcher_thread_ = new Thread(this);
|
||||
@ -98,26 +98,26 @@ void Collection::Init() {
|
||||
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 SCollection::ReloadSettings() {
|
||||
|
||||
void Collection::ReloadSettings() {
|
||||
|
||||
watcher_->ReloadSettingsAsync();
|
||||
|
||||
}
|
||||
|
||||
void Collection::Stopped() {
|
||||
void SCollection::Stopped() {
|
||||
|
||||
CurrentSongChanged(Song());
|
||||
}
|
||||
|
||||
void Collection::CurrentSongChanged(const Song &song) {
|
||||
void SCollection::CurrentSongChanged(const Song &song) {
|
||||
|
||||
TagReaderReply *reply = nullptr;
|
||||
|
||||
|
@ -36,12 +36,12 @@ class CollectionBackend;
|
||||
class CollectionModel;
|
||||
class CollectionWatcher;
|
||||
|
||||
class Collection : public QObject {
|
||||
class SCollection : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Collection(Application* app, QObject* parent);
|
||||
~Collection();
|
||||
SCollection(Application *app, QObject *parent);
|
||||
~SCollection();
|
||||
|
||||
static const char *kSongsTable;
|
||||
static const char *kDirsTable;
|
||||
|
@ -74,7 +74,7 @@ class ApplicationImpl {
|
||||
player_([=]() { return new Player(app, app); }),
|
||||
enginedevice_([=]() { return new EngineDevice(app); }),
|
||||
device_manager_([=]() { return new DeviceManager(app, app); }),
|
||||
collection_([=]() { return new Collection(app, app); }),
|
||||
collection_([=]() { return new SCollection(app, app); }),
|
||||
playlist_backend_([=]() {
|
||||
PlaylistBackend *backend = new PlaylistBackend(app, app);
|
||||
app->MoveToThread(backend, database_->thread());
|
||||
@ -107,7 +107,7 @@ class ApplicationImpl {
|
||||
Lazy<Player> player_;
|
||||
Lazy<EngineDevice> enginedevice_;
|
||||
Lazy<DeviceManager> device_manager_;
|
||||
Lazy<Collection> collection_;
|
||||
Lazy<SCollection> collection_;
|
||||
Lazy<PlaylistBackend> playlist_backend_;
|
||||
Lazy<PlaylistManager> playlist_manager_;
|
||||
Lazy<CoverProviders> cover_providers_;
|
||||
@ -183,7 +183,7 @@ DeviceManager *Application::device_manager() const {
|
||||
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 {
|
||||
return collection()->backend();
|
||||
|
@ -40,7 +40,7 @@ class Database;
|
||||
class EngineDevice;
|
||||
class Player;
|
||||
class Appearance;
|
||||
class Collection;
|
||||
class SCollection;
|
||||
class CollectionBackend;
|
||||
class CollectionModel;
|
||||
class PlaylistBackend;
|
||||
@ -67,15 +67,15 @@ class Application : public QObject {
|
||||
EngineDevice *enginedevice() const;
|
||||
DeviceManager *device_manager() const;
|
||||
|
||||
Collection *collection() const;
|
||||
|
||||
SCollection *collection() const;
|
||||
|
||||
PlaylistBackend *playlist_backend() const;
|
||||
PlaylistManager *playlist_manager() const;
|
||||
|
||||
CoverProviders *cover_providers() const;
|
||||
AlbumCoverLoader *album_cover_loader() const;
|
||||
CurrentArtLoader *current_art_loader() const;
|
||||
|
||||
|
||||
CollectionBackend *collection_backend() const;
|
||||
CollectionModel *collection_model() const;
|
||||
|
||||
|
@ -90,7 +90,7 @@ CommandlineOptions::CommandlineOptions(int argc, char* *argv)
|
||||
toggle_pretty_osd_(false),
|
||||
log_levels_(logging::kDefaultLogLevels) {
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
// Remove -psn_xxx option that Mac passes when opened from Finder.
|
||||
RemoveArg("-psn", 1);
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "filesystemwatcherinterface.h"
|
||||
#include "qtfslistener.h"
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
#include "macfslistener.h"
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@ FileSystemWatcherInterface::FileSystemWatcherInterface(QObject *parent)
|
||||
|
||||
FileSystemWatcherInterface *FileSystemWatcherInterface::Create(QObject *parent) {
|
||||
FileSystemWatcherInterface *ret;
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ret = new MacFSListener(parent);
|
||||
#else
|
||||
ret = new QtFSListener(parent);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "macglobalshortcutbackend.h"
|
||||
#include "globalshortcuts/macglobalshortcutbackend.h"
|
||||
|
||||
class PlatformInterface;
|
||||
@class SPMediaKeyTap;
|
||||
|
@ -43,18 +43,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "globalshortcuts.h"
|
||||
#include "mac_delegate.h"
|
||||
#include "mac_startup.h"
|
||||
#include "mac_utilities.h"
|
||||
#include "macglobalshortcutbackend.h"
|
||||
#include "utilities.h"
|
||||
#include "core/logging.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
|
||||
#import <Sparkle/SUUpdater.h>
|
||||
# import <Sparkle/SUUpdater.h>
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
|
@ -90,7 +90,7 @@ class MacSystemTrayIconPrivate {
|
||||
// This must be called after our custom NSApplicationDelegate has been set.
|
||||
[(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_];
|
||||
|
||||
ClearPlaying();
|
||||
ClearNowPlaying();
|
||||
}
|
||||
|
||||
void AddMenuItem(QAction* action) {
|
||||
@ -120,8 +120,8 @@ class MacSystemTrayIconPrivate {
|
||||
[dock_menu_ addItem:separator];
|
||||
}
|
||||
|
||||
void ShowPlaying(const QString& artist, const QString& title) {
|
||||
ClearPlaying(); // Makes sure the order is consistent.
|
||||
void ShowNowPlaying(const QString& artist, const QString& title) {
|
||||
ClearNowPlaying(); // Makes sure the order is consistent.
|
||||
[now_playing_artist_ setTitle:
|
||||
[[NSString alloc] initWithUTF8String: artist.toUtf8().constData()]];
|
||||
[now_playing_title_ setTitle:
|
||||
@ -131,7 +131,7 @@ class MacSystemTrayIconPrivate {
|
||||
artist.isEmpty() && title.isEmpty() ? HideItem(now_playing_) : ShowItem(now_playing_);
|
||||
}
|
||||
|
||||
void ClearPlaying() {
|
||||
void ClearNowPlaying() {
|
||||
// Hiding doesn't seem to work in the dock menu.
|
||||
HideItem(now_playing_);
|
||||
HideItem(now_playing_artist_);
|
||||
@ -200,10 +200,10 @@ void MacSystemTrayIcon::ActionChanged() {
|
||||
p_->ActionChanged(action);
|
||||
}
|
||||
|
||||
void MacSystemTrayIcon::ClearPlaying() {
|
||||
p_->ClearPlaying();
|
||||
void MacSystemTrayIcon::ClearNowPlaying() {
|
||||
p_->ClearNowPlaying();
|
||||
}
|
||||
|
||||
void MacSystemTrayIcon::SetPlaying(const Song& song, const QString& image_path) {
|
||||
p_->ShowPlaying(song.artist(), song.PrettyTitle());
|
||||
void MacSystemTrayIcon::SetNowPlaying(const Song& song, const QString& image_path) {
|
||||
p_->ShowNowPlaying(song.artist(), song.PrettyTitle());
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QStandardPaths>
|
||||
#include <QFileDevice>
|
||||
#include <QIODevice>
|
||||
#include <QByteArray>
|
||||
@ -48,7 +49,7 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
# include <sys/resource.h>
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
@ -90,13 +91,13 @@
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
// Do Mac specific startup to get media keys working.
|
||||
// This must go before QApplication initialisation.
|
||||
mac::MacMain();
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
QCoreApplication::setApplicationName("Strawberry");
|
||||
QCoreApplication::setOrganizationName("Strawberry");
|
||||
#else
|
||||
@ -142,7 +143,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
// Must happen after QCoreApplication::setOrganizationName().
|
||||
setenv("XDG_CONFIG_HOME", QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toLocal8Bit().constData(), 1);
|
||||
#endif
|
||||
@ -159,8 +160,8 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
QtSingleApplication a(argc, argv);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
QCoreApplication::setCollectionPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
|
||||
#ifdef Q_OS_MACOS
|
||||
QCoreApplication::setLibraryPaths(QStringList() << QCoreApplication::applicationDirPath() + "/../PlugIns");
|
||||
#endif
|
||||
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
@ -170,7 +171,7 @@ int main(int argc, char* argv[]) {
|
||||
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.
|
||||
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false);
|
||||
#else
|
||||
@ -217,9 +218,9 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Window
|
||||
MainWindow w(&app, tray_icon.get(), &osd, options);
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
mac::EnableFullScreen(w);
|
||||
#endif // Q_OS_DARWIN
|
||||
#endif // Q_OS_MACOS
|
||||
#ifdef HAVE_GIO
|
||||
ScanGIOModulePath();
|
||||
#endif
|
||||
|
@ -84,7 +84,7 @@
|
||||
#include "dialogs/trackselectiondialog.h"
|
||||
#include "dialogs/edittagdialog.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
#include "dialogs/organisedialog.h"
|
||||
# include "dialogs/organisedialog.h"
|
||||
#endif
|
||||
#include "widgets/fancytabwidget.h"
|
||||
#include "widgets/playingwidget.h"
|
||||
@ -127,13 +127,13 @@
|
||||
#include "settings/playlistsettingspage.h"
|
||||
#include "settings/settingsdialog.h"
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include "ui/macsystemtrayicon.h"
|
||||
#ifdef Q_OS_MACOS
|
||||
# include "core/macsystemtrayicon.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
// Non exported mac-specific function.
|
||||
void qt_mac_set_dock_menu(QMenu*);
|
||||
#ifdef Q_OS_MACOS
|
||||
// Non exported mac-specific function.
|
||||
void qt_mac_set_dock_menu(QMenu*);
|
||||
#endif
|
||||
|
||||
const char *MainWindow::kSettingsGroup = "MainWindow";
|
||||
@ -203,7 +203,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
|
||||
// Initialise the UI
|
||||
ui_->setupUi(this);
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->menu_help->menuAction()->setVisible(false);
|
||||
#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_unavailable);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->action_shuffle->setShortcut(QKeySequence());
|
||||
#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)));
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
mac::SetApplicationHandler(this);
|
||||
#endif
|
||||
// Tray icon
|
||||
@ -542,7 +542,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
// 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
|
||||
|
||||
#if (defined(Q_OS_DARWIN) && defined(HAVE_SPARKLE))
|
||||
#if (defined(Q_OS_MACOS) && defined(HAVE_SPARKLE))
|
||||
// Add check for updates item to application menu.
|
||||
QAction *check_updates = ui_->menu_tools->addAction(tr("Check for updates..."));
|
||||
check_updates->setMenuRole(QAction::ApplicationSpecificRole);
|
||||
@ -661,7 +661,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
ui_->playlist->view()->ReloadSettings();
|
||||
|
||||
|
||||
#ifndef Q_OS_DARWIN
|
||||
#ifndef Q_OS_MACOS
|
||||
QSettings settings;
|
||||
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||
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);
|
||||
show();
|
||||
}
|
||||
#else // Q_OS_DARWIN
|
||||
#else // Q_OS_MACOS
|
||||
// Always show mainwindow on startup on OS X.
|
||||
show();
|
||||
#endif
|
||||
@ -711,7 +711,7 @@ void MainWindow::ReloadSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
#ifndef Q_OS_DARWIN
|
||||
#ifndef Q_OS_MACOS
|
||||
|
||||
settings.beginGroup(BehaviourSettingsPage::kSettingsGroup);
|
||||
bool showtrayicon = settings.value("showtrayicon", true).toBool();
|
||||
@ -1694,7 +1694,7 @@ bool MainWindow::LoadUrl(const QString &url) {
|
||||
}
|
||||
|
||||
void MainWindow::CheckForUpdates() {
|
||||
#if defined(Q_OS_DARWIN)
|
||||
#if defined(Q_OS_MACOS)
|
||||
mac::CheckForUpdates();
|
||||
#endif
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "screensaver.h"
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
#include "macscreensaver.h"
|
||||
#endif
|
||||
|
||||
@ -51,7 +51,7 @@ Screensaver *Screensaver::GetScreensaver() {
|
||||
else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) {
|
||||
screensaver_ = new DBusScreensaver(kKdeService, kKdePath, kKdeInterface);
|
||||
}
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
#elif defined(Q_OS_MACOS)
|
||||
screensaver_ = new MacScreensaver();
|
||||
#endif
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ void StyleSheetLoader::UpdateStyleSheet(QWidget *widget) {
|
||||
ReplaceColor(&contents, "Link", p, QPalette::Link);
|
||||
ReplaceColor(&contents, "LinkVisited", p, QPalette::LinkVisited);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
contents.replace("darwin", "*");
|
||||
#endif
|
||||
|
||||
|
@ -30,8 +30,11 @@
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
|
||||
#include "qtsystemtrayicon.h"
|
||||
#include "systemtrayicon.h"
|
||||
#include "qtsystemtrayicon.h"
|
||||
#ifdef Q_OS_MACOS
|
||||
# include "macsystemtrayicon.h"
|
||||
#endif
|
||||
|
||||
SystemTrayIcon::SystemTrayIcon(QObject *parent)
|
||||
: QObject(parent),
|
||||
@ -103,7 +106,7 @@ void SystemTrayIcon::SetStopped() {
|
||||
}
|
||||
|
||||
SystemTrayIcon* SystemTrayIcon::CreateSystemTrayIcon(QObject *parent) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
return new MacSystemTrayIcon(parent);
|
||||
#else
|
||||
return new QtSystemTrayIcon(parent);
|
||||
|
@ -59,26 +59,27 @@
|
||||
#include <QtDebug>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include <sys/resource.h>
|
||||
#ifdef Q_OS_MACOS
|
||||
# include <sys/resource.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
#include <sys/statvfs.h>
|
||||
#elif defined(Q_OS_WIN32)
|
||||
#include <windows.h>
|
||||
# include <sys/statvfs.h>
|
||||
#elif defined(Q_OS_WIN)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include <QProcess>
|
||||
|
||||
#include "CoreServices/CoreServices.h"
|
||||
#include "IOKit/ps/IOPSKeys.h"
|
||||
#include "IOKit/ps/IOPowerSources.h"
|
||||
#elif defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_MACOS
|
||||
# include <QProcess>
|
||||
# include "CoreServices/CoreServices.h"
|
||||
# include "IOKit/ps/IOPSKeys.h"
|
||||
# include "IOKit/ps/IOPowerSources.h"
|
||||
#elif defined(Q_OS_WIN)
|
||||
#include <QProcess>
|
||||
#endif
|
||||
|
||||
@ -89,10 +90,10 @@
|
||||
#include "timeconstants.h"
|
||||
#include "application.h"
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include "mac_startup.h"
|
||||
#include "mac_utilities.h"
|
||||
#include "scoped_cftyperef.h"
|
||||
#ifdef Q_OS_MACOS
|
||||
# include "mac_startup.h"
|
||||
# include "mac_utilities.h"
|
||||
# include "scoped_cftyperef.h"
|
||||
#endif
|
||||
|
||||
namespace Utilities {
|
||||
@ -361,7 +362,7 @@ QString ColorToRgba(const QColor &c) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
qint32 GetMacVersion() {
|
||||
|
||||
SInt32 minor_version;
|
||||
@ -374,7 +375,7 @@ qint32 GetMacVersion() {
|
||||
void RevealFileInFinder(QString const &path) {
|
||||
QProcess::execute("/usr/bin/open", QStringList() << "-R" << path);
|
||||
}
|
||||
#endif // Q_OS_DARWIN
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void ShowFileInExplorer(QString const &path) {
|
||||
@ -398,7 +399,7 @@ void OpenInFileBrowser(const QList<QUrl> &urls) {
|
||||
if (dirs.contains(directory)) continue;
|
||||
dirs.insert(directory);
|
||||
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
|
||||
RevealFileInFinder(path);
|
||||
#elif defined(Q_OS_WIN32)
|
||||
@ -642,7 +643,7 @@ int SetThreadIOPriority(IoPriority priority) {
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
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);
|
||||
#else
|
||||
return 0;
|
||||
@ -752,7 +753,7 @@ void SetEnv(const char *key, const QString &value) {
|
||||
|
||||
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).
|
||||
struct rlimit limit;
|
||||
getrlimit(RLIMIT_NOFILE, &limit);
|
||||
|
@ -105,7 +105,7 @@ void CddaLister::UpdateDeviceFreeSpace(const QString&) {}
|
||||
void CddaLister::Init() {
|
||||
|
||||
cdio_init();
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
if (!cdio_have_driver(DRIVER_OSX)) {
|
||||
qLog(Error) << "libcdio was compiled without support for OS X!";
|
||||
}
|
||||
@ -121,7 +121,7 @@ void CddaLister::Init() {
|
||||
if (device_info.isSymLink()) {
|
||||
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
|
||||
if (!device.contains(QRegExp("^/dev/rdisk[0-9]$"))) {
|
||||
continue;
|
||||
|
@ -68,7 +68,7 @@
|
||||
# include "cddadevice.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP)
|
||||
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
||||
# include "macdevicelister.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIBGPOD
|
||||
@ -220,7 +220,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
|
||||
connected_devices_model_->setSourceModel(this);
|
||||
|
||||
// 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);
|
||||
#endif
|
||||
#ifdef HAVE_DEVICEKIT
|
||||
@ -232,7 +232,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
|
||||
#ifdef HAVE_GIO
|
||||
AddLister(new GioLister);
|
||||
#endif
|
||||
#if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP)
|
||||
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
||||
AddLister(new MacDeviceLister);
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
# include "pulsedevicefinder.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
# include "osxdevicefinder.h"
|
||||
#endif
|
||||
|
||||
@ -63,7 +63,7 @@ void EngineDevice::Init() {
|
||||
#ifdef HAVE_LIBPULSE
|
||||
device_finders.append(new PulseDeviceFinder);
|
||||
#endif
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
device_finders.append(new OsxDeviceFinder);
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
|
@ -106,8 +106,8 @@ GstEngine::GstEngine(TaskManager *task_manager)
|
||||
|
||||
ReloadSettings();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
QDir resources_dir(mac::GetResourcesPath());
|
||||
#ifdef Q_OS_MACOS___ // FIXME
|
||||
QDir resources_dir(mac::getResourcesPath());
|
||||
QString ca_cert_path = resources_dir.filePath("cacert.pem");
|
||||
GError *error = nullptr;
|
||||
tls_database_ = g_tls_file_database_new(ca_cert_path.toUtf8().data(), &error);
|
||||
@ -121,7 +121,7 @@ GstEngine::~GstEngine() {
|
||||
|
||||
current_pipeline_.reset();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
g_object_unref(tls_database_);
|
||||
#endif
|
||||
}
|
||||
@ -428,14 +428,14 @@ void GstEngine::SetEnvironment() {
|
||||
QString registry_filename;
|
||||
|
||||
// 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";
|
||||
plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer";
|
||||
#elif defined(Q_OS_WIN32)
|
||||
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
|
||||
#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());
|
||||
#endif
|
||||
|
||||
@ -451,7 +451,7 @@ void GstEngine::SetEnvironment() {
|
||||
Utilities::SetEnv("GST_REGISTRY", registry_filename);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/../PlugIns/gio-modules");
|
||||
#endif
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
class TaskManager;
|
||||
class GstEnginePipeline;
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
struct _GTlsDatabase;
|
||||
typedef struct _GTlsDatabase GTlsDatabase;
|
||||
#endif
|
||||
@ -111,7 +111,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
||||
void AddBufferConsumer(GstBufferConsumer *consumer);
|
||||
void RemoveBufferConsumer(GstBufferConsumer *consumer);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
GTlsDatabase *tls_database() const { return tls_database_; }
|
||||
#endif
|
||||
|
||||
@ -202,6 +202,10 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
||||
bool have_new_buffer_;
|
||||
int scope_chunks_;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
GTlsDatabase* tls_database_;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif /* GSTENGINE_H */
|
||||
|
@ -513,7 +513,7 @@ void GstEnginePipeline::TaskEnterCallback(GstTask *, GThread *, gpointer) {
|
||||
|
||||
// Bump the priority of the thread only on OS X
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
sched_param param;
|
||||
memset(¶m, 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")) {
|
||||
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, "ssl-use-system-ca-file", false, nullptr);
|
||||
g_object_set(element, "ssl-strict", TRUE, nullptr);
|
||||
|
@ -425,7 +425,7 @@ void XineEngine::SetEnvironment() {
|
||||
putenv(QString("XINE_PLUGIN_PATH=" + QCoreApplication::applicationDirPath() + "/xine-plugins").toLatin1().constData());
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
setenv("XINE_PLUGIN_PATH", QString(QCoreApplication::applicationDirPath() + "/../PlugIns/xine").toLatin1().constData(), 1);
|
||||
#endif
|
||||
|
||||
|
@ -69,14 +69,14 @@ void GlobalShortcutGrabber::hideEvent(QHideEvent *e) {
|
||||
}
|
||||
|
||||
void GlobalShortcutGrabber::grabKeyboard() {
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
SetupMacEventHandler();
|
||||
#endif
|
||||
QDialog::grabKeyboard();
|
||||
}
|
||||
|
||||
void GlobalShortcutGrabber::releaseKeyboard() {
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
TeardownMacEventHandler();
|
||||
#endif
|
||||
QDialog::releaseKeyboard();
|
||||
|
@ -33,7 +33,11 @@
|
||||
#include "globalshortcuts.h"
|
||||
#include "globalshortcutbackend.h"
|
||||
#include "gnomeglobalshortcutbackend.h"
|
||||
#include "qxtglobalshortcutbackend.h"
|
||||
#ifndef Q_OS_MACOS
|
||||
# include "qxtglobalshortcutbackend.h"
|
||||
#else
|
||||
# include "macglobalshortcutbackend.h"
|
||||
#endif
|
||||
#include "settings/shortcutssettingspage.h"
|
||||
|
||||
GlobalShortcuts::GlobalShortcuts(QWidget *parent)
|
||||
@ -66,7 +70,7 @@ GlobalShortcuts::GlobalShortcuts(QWidget *parent)
|
||||
// Create backends - these do the actual shortcut registration
|
||||
gnome_backend_ = new GnomeGlobalShortcutBackend(this);
|
||||
|
||||
#ifndef Q_OS_DARWIN
|
||||
#ifndef Q_OS_MACOS
|
||||
system_backend_ = new QxtGlobalShortcutBackend(this);
|
||||
#else
|
||||
system_backend_ = new MacGlobalShortcutBackend(this);
|
||||
|
@ -36,13 +36,13 @@
|
||||
#include <QtDebug>
|
||||
|
||||
#include "config.h"
|
||||
#include "core/globalshortcuts.h"
|
||||
#include "globalshortcuts.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mac_startup.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#import "core/mac_utilities.h"
|
||||
#import "mac/SBSystemPreferences.h"
|
||||
#import "core/SBSystemPreferences.h"
|
||||
|
||||
class MacGlobalShortcutBackendPrivate : boost::noncopyable {
|
||||
public:
|
||||
@ -88,10 +88,8 @@ bool MacGlobalShortcutBackend::DoRegister() {
|
||||
// Always enable media keys.
|
||||
mac::SetShortcutHandler(this);
|
||||
|
||||
for (const GlobalShortcuts::Shortcut& shortcut :
|
||||
manager_->shortcuts().values()) {
|
||||
shortcuts_[shortcut.action->shortcut()] = shortcut.action;
|
||||
}
|
||||
for (const GlobalShortcuts::Shortcut& shortcut : manager_->shortcuts().values()) {
|
||||
shortcuts_[shortcut.action->shortcut()] = shortcut.action;
|
||||
}
|
||||
|
||||
return p_->Register();
|
||||
@ -134,29 +132,26 @@ bool MacGlobalShortcutBackend::IsAccessibilityEnabled() const {
|
||||
}
|
||||
|
||||
void MacGlobalShortcutBackend::ShowAccessibilityDialog() {
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(
|
||||
NSPreferencePanesDirectory, NSSystemDomainMask, YES);
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSSystemDomainMask, YES);
|
||||
if ([paths count] == 1) {
|
||||
SBSystemPreferencesApplication* system_prefs = [SBApplication
|
||||
applicationWithBundleIdentifier:@"com.apple.systempreferences"];
|
||||
[system_prefs activate];
|
||||
|
||||
SBElementArray* panes = [system_prefs panes];
|
||||
SBSystemPreferencesPane* security_pane = nil;
|
||||
for (SBSystemPreferencesPane* pane : panes) {
|
||||
if ([[pane id] isEqualToString:@"com.apple.preference.security"]) {
|
||||
security_pane = pane;
|
||||
break;
|
||||
}
|
||||
SBElementArray* panes = [system_prefs panes];
|
||||
SBSystemPreferencesPane* security_pane = nil;
|
||||
for (SBSystemPreferencesPane* pane : panes) {
|
||||
if ([[pane id] isEqualToString:@"com.apple.preference.security"]) {
|
||||
security_pane = pane;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[system_prefs setCurrentPane:security_pane];
|
||||
|
||||
SBElementArray* anchors = [security_pane anchors];
|
||||
for (SBSystemPreferencesAnchor* anchor : anchors) {
|
||||
if ([[anchor name] isEqualToString:@"Privacy_Accessibility"]) {
|
||||
[anchor reveal];
|
||||
}
|
||||
SBElementArray* anchors = [security_pane anchors];
|
||||
for (SBSystemPreferencesAnchor* anchor : anchors) {
|
||||
if ([[anchor name] isEqualToString:@"Privacy_Accessibility"]) {
|
||||
[anchor reveal];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)) {
|
||||
// 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.
|
||||
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);
|
||||
else
|
||||
InsertSongItems<SongPlaylistItem>(song_data->songs, row, play_now, enqueue_now);
|
||||
@ -955,7 +955,7 @@ void Playlist::InsertSongsOrCollectionItems(const SongList &songs, int pos, bool
|
||||
}
|
||||
|
||||
void Playlist::UpdateItems(const SongList &songs) {
|
||||
|
||||
|
||||
qLog(Debug) << "Updating playlist with new tracks' info";
|
||||
// We first convert our songs list into a linked list (a 'real' list), because removals are faster with QLinkedList.
|
||||
// Next, we walk through the list of playlist's items then the list of songs
|
||||
|
@ -70,9 +70,9 @@
|
||||
#include "playlist/playlist.h"
|
||||
#include "playlistdelegates.h"
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
#include "core/mac_utilities.h"
|
||||
#endif // Q_OS_DARWIN
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
const int QueuedItemDelegate::kQueueBoxBorder = 1;
|
||||
const int QueuedItemDelegate::kQueueBoxCornerRadius = 3;
|
||||
@ -484,7 +484,7 @@ void SongSourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
||||
QPixmap pixmap = LookupPixmap(url, option_copy.decorationSize);
|
||||
|
||||
float device_pixel_ratio = 1.0f;
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
QWidget *parent_widget = reinterpret_cast<QWidget*>(parent());
|
||||
device_pixel_ratio = mac::GetDevicePixelRatio(parent_widget);
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ PlaylistItem* PlaylistItem::NewFromType(const QString &type) {
|
||||
|
||||
PlaylistItem* PlaylistItem::NewFromSongsTable(const QString &table, const Song &song) {
|
||||
|
||||
if (table == Collection::kSongsTable)
|
||||
if (table == SCollection::kSongsTable)
|
||||
return new CollectionPlaylistItem(song);
|
||||
|
||||
qLog(Warning) << "Invalid PlaylistItem songs table:" << table;
|
||||
|
@ -186,7 +186,7 @@ PlaylistView::PlaylistView(QWidget *parent)
|
||||
|
||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
#endif
|
||||
// For fading
|
||||
@ -523,7 +523,7 @@ void PlaylistView::keyPressEvent(QKeyEvent *event) {
|
||||
else if (event == QKeySequence::Delete) {
|
||||
RemoveSelected(false);
|
||||
event->accept();
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
}
|
||||
else if (event->key() == Qt::Key_Backspace) {
|
||||
RemoveSelected(false);
|
||||
|
@ -43,9 +43,9 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog) : SettingsP
|
||||
|
||||
connect(ui_->checkbox_showtrayicon, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool)));
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->checkbox_showtrayicon->setEnabled(false);
|
||||
ui_->startup_group->setEnabled(false);
|
||||
ui_->groupbox_startup->setEnabled(false);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_startupgroup">
|
||||
<widget class="QGroupBox" name="groupbox_startup">
|
||||
<property name="title">
|
||||
<string>When Strawberry starts</string>
|
||||
</property>
|
||||
@ -60,14 +60,14 @@
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radiobutton_alwaysshow">
|
||||
<property name="text">
|
||||
<string>Always show the main window</string>
|
||||
<string>Always show the &main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radiobutton_alwayshide">
|
||||
<property name="text">
|
||||
<string>Always hide the main window</string>
|
||||
<string>Alwa&ys hide the main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -175,7 +175,7 @@ void NotificationsSettingsPage::Load() {
|
||||
ui_->notifications_custom_text2->setText(s.value("CustomText2").toString());
|
||||
s.endGroup();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->notifications_options->setEnabled(ui_->notifications_pretty->isChecked());
|
||||
#endif
|
||||
|
||||
@ -339,7 +339,7 @@ void NotificationsSettingsPage::NotificationTypeChanged() {
|
||||
ui_->notifications_pretty_group->setEnabled(pretty);
|
||||
ui_->notifications_custom_text_group->setEnabled(enabled);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->notifications_options->setEnabled(pretty);
|
||||
#endif
|
||||
ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked()));
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <QRadioButton>
|
||||
|
||||
#include "core/iconloader.h"
|
||||
#include "core/utilities.h"
|
||||
#include "globalshortcuts/globalshortcutgrabber.h"
|
||||
#include "globalshortcuts/globalshortcuts.h"
|
||||
#include "settingspage.h"
|
||||
@ -119,11 +120,11 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
}
|
||||
|
||||
ui_->mac_container->setVisible(!manager->IsMacAccessibilityEnabled());
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
qint32 mac_version = Utilities::GetMacVersion();
|
||||
ui_->mac_label->setVisible(mac_version < 9);
|
||||
ui_->mac_label_mavericks->setVisible(mac_version >= 9);
|
||||
#endif // Q_OS_DARWIN
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ void OSD::ShowMessage(const QString &summary, const QString &message, const QStr
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef Q_OS_DARWIN
|
||||
#ifndef Q_OS_MACOS
|
||||
case TrayPopup:
|
||||
tray_icon_->ShowPopup(summary, message, timeout_msec_);
|
||||
break;
|
||||
@ -324,7 +324,7 @@ QString OSD::ReplaceVariable(const QString &variable, const Song &song) {
|
||||
// We need different strings depending on notification type
|
||||
switch (behaviour_) {
|
||||
case Native:
|
||||
#ifdef Q_OS_DARWIN
|
||||
#ifdef Q_OS_MACOS
|
||||
return "\n";
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
|
@ -297,7 +297,6 @@ void StatusView::UpdateSong() {
|
||||
|
||||
const QueryOptions opt;
|
||||
CollectionBackend::AlbumList albumlist;
|
||||
Engine::EngineType enginetype = app_->player()->engine()->type();
|
||||
|
||||
label_playing_top_->setText("");
|
||||
label_playing_text_->setText("");
|
||||
@ -314,9 +313,9 @@ void StatusView::UpdateSong() {
|
||||
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());
|
||||
|
||||
if (enginetype != Engine::EngineType::None) {
|
||||
if (app_->player()->engine() && app_->player()->engine()->type() != Engine::EngineType::None) {
|
||||
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 />");
|
||||
|
Loading…
x
Reference in New Issue
Block a user