diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp
index 92239b99a..999372fdc 100644
--- a/src/SettingsDialog.cpp
+++ b/src/SettingsDialog.cpp
@@ -54,6 +54,7 @@
#include "accounts/AccountFactoryWrapper.h"
#include "accounts/spotify/SpotifyAccount.h"
#include "thirdparty/Qocoa/qtoolbartabdialog.h"
+#include "thirdparty/Qocoa/qbutton.h"
#include "ui_ProxyDialog.h"
#include "ui_Settings_Accounts.h"
@@ -81,18 +82,12 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_collectionWidgetUi->setupUi( m_collectionWidget );
m_advancedWidgetUi->setupUi( m_advancedWidget );
+ m_accountsWidgetUi->accountsFilterCombo->setFocusPolicy( Qt::NoFocus );
+
m_dialog = new QToolbarTabDialog;
TomahawkSettings* s = TomahawkSettings::instance();
-// TomahawkUtils::unmarginLayout( layout() );
-// TomahawkUtils::unmarginLayout( ui->horizontalLayout );
-
-//#ifdef Q_WS_X11
-// ui->stackedWidget->setContentsMargins( 4, 4, 4, 4 );
-//#else
-// ui->stackedWidget->setContentsMargins( 4, 4, 4, 0 );
-//#endif
m_advancedWidgetUi->checkBoxReporter->setChecked( s->crashReporterEnabled() );
m_advancedWidgetUi->checkBoxHttp->setChecked( s->httpEnabled() );
@@ -125,6 +120,8 @@ SettingsDialog::SettingsDialog(QObject *parent )
p->setFixedSize( 0, 0 );
#endif
+ m_accountsWidgetUi->installFromFileBtn->setText( tr( "Install from file" ) );
+
// Accounts
AccountDelegate* accountDelegate = new AccountDelegate( this );
m_accountsWidgetUi->accountsView->setItemDelegate( accountDelegate );
@@ -201,9 +198,16 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_advancedWidget->setMinimumSize( m_advancedWidget->sizeHint() );
m_accountsWidget->setMinimumWidth( 500 );
#else
- m_accountsWidget->setMinimumSize( 500, 350 );
- m_collectionWidget->setMinimumHeight( m_collectionWidget->sizeHint().height() + 20 );
- m_advancedWidget->setMinimumHeight( m_advancedWidget->sizeHint().height() + 4 );
+ m_accountsWidget->setContentsMargins( 6, 6, 6, 6 );
+ m_accountsWidgetUi->horizontalLayout->setContentsMargins( 0, 0, 0, 0 );
+ m_accountsWidgetUi->installFromFileBtn->setContentsMargins( -4, 0, 0, 0 );
+ m_accountsWidget->setMinimumSize( 550, 400 );
+
+ m_collectionWidget->setContentsMargins( 6, 6, 6, 6 );
+ m_collectionWidget->setMinimumHeight( m_collectionWidgetUi->verticalLayout->sizeHint().height() + 20 );
+
+ m_advancedWidget->setContentsMargins( 6, 6, 6, 6 );
+ m_advancedWidget->setMinimumHeight( m_advancedWidgetUi->verticalLayout->sizeHint().height() );
#endif
// NOW PLAYING
diff --git a/src/Settings_Accounts.ui b/src/Settings_Accounts.ui
index bea5d27b2..d0a0bd4ec 100644
--- a/src/Settings_Accounts.ui
+++ b/src/Settings_Accounts.ui
@@ -6,8 +6,8 @@
0
0
- 405
- 347
+ 553
+ 439
@@ -20,9 +20,12 @@
-
-
-
-
- Install from file...
+
+
+
+ 0
+ 0
+
@@ -66,6 +69,14 @@
+
+
+ QButton
+ QWidget
+ thirdparty/Qocoa/QButton.h
+ 1
+
+
diff --git a/src/Settings_Collection.ui b/src/Settings_Collection.ui
index a8899f57c..6579d2d51 100644
--- a/src/Settings_Collection.ui
+++ b/src/Settings_Collection.ui
@@ -6,8 +6,8 @@
0
0
- 423
- 388
+ 403
+ 370
diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt
index 7cb8b637a..ecec610b1 100644
--- a/src/libtomahawk/CMakeLists.txt
+++ b/src/libtomahawk/CMakeLists.txt
@@ -391,6 +391,7 @@ IF( APPLE )
SET( libSources ${libSources}
utils/TomahawkUtils_Mac.mm
mac/FileHelpers.mm
+ thirdparty/Qocoa/qbutton_mac.mm
thirdparty/Qocoa/qsearchfield_mac.mm
thirdparty/Qocoa/qtoolbartabdialog_mac.mm
widgets/SourceTreePopupDialog_mac.mm )
@@ -409,7 +410,7 @@ IF( APPLE )
/System/Library/Frameworks/Security.framework
)
ELSE( APPLE )
- SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qsearchfield.cpp thirdparty/Qocoa/qtoolbartabdialog.cpp )
+ SET( libGuiSources ${libGuiSources} thirdparty/Qocoa/qbutton.cpp thirdparty/Qocoa/qsearchfield.cpp thirdparty/Qocoa/qtoolbartabdialog.cpp )
ENDIF( APPLE )
IF(LIBLASTFM_FOUND)
diff --git a/src/libtomahawk/thirdparty/Qocoa/qbutton.cpp b/src/libtomahawk/thirdparty/Qocoa/qbutton.cpp
new file mode 100644
index 000000000..0a79e2baf
--- /dev/null
+++ b/src/libtomahawk/thirdparty/Qocoa/qbutton.cpp
@@ -0,0 +1,89 @@
+/*
+Copyright (C) 2011 by Mike McQuaid
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#include "qbutton.h"
+
+#include
+#include
+#include
+#include
+
+class QButtonPrivate : public QObject
+{
+public:
+ QButtonPrivate(QButton *button, QAbstractButton *abstractButton)
+ : QObject(button), abstractButton(abstractButton) {}
+ QPointer abstractButton;
+};
+
+QButton::QButton(QWidget *parent, BezelStyle) : QWidget(parent)
+{
+ QAbstractButton *button = 0;
+ if (qobject_cast(parent))
+ button = new QToolButton(this);
+ else
+ button = new QPushButton(this);
+ connect(button, SIGNAL(clicked()),
+ this, SIGNAL(clicked()));
+ pimpl = new QButtonPrivate(this, button);
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setMargin(0);
+ layout->addWidget(button);
+}
+
+void QButton::setText(const QString &text)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ pimpl->abstractButton->setText(text);
+}
+
+void QButton::setImage(const QPixmap &image)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ pimpl->abstractButton->setIcon(image);
+}
+
+void QButton::setChecked(bool checked)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ pimpl->abstractButton->setChecked(checked);
+}
+
+void QButton::setCheckable(bool checkable)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ pimpl->abstractButton->setCheckable(checkable);
+}
+
+bool QButton::isChecked()
+{
+ Q_ASSERT(pimpl);
+ if (!pimpl)
+ return false;
+
+ return pimpl->abstractButton->isChecked();
+}
diff --git a/src/libtomahawk/thirdparty/Qocoa/qbutton.h b/src/libtomahawk/thirdparty/Qocoa/qbutton.h
new file mode 100644
index 000000000..591c37ffc
--- /dev/null
+++ b/src/libtomahawk/thirdparty/Qocoa/qbutton.h
@@ -0,0 +1,51 @@
+#ifndef QBUTTON_H
+#define QBUTTON_H
+
+#include
+#include
+
+#include "DllMacro.h"
+
+class QButtonPrivate;
+class DLLEXPORT QButton : public QWidget
+{
+ Q_OBJECT
+public:
+ // Matches NSBezelStyle
+ enum BezelStyle {
+ Rounded = 1,
+ RegularSquare = 2,
+ Disclosure = 5,
+ ShadowlessSquare = 6,
+ Circular = 7,
+ TexturedSquare = 8,
+ HelpButton = 9,
+ SmallSquare = 10,
+ TexturedRounded = 11,
+ RoundRect = 12,
+ Recessed = 13,
+ RoundedDisclosure = 14,
+#ifdef __MAC_10_7
+ Inline = 15
+#endif
+ };
+
+ explicit QButton(QWidget *parent, BezelStyle bezelStyle = Rounded);
+
+public slots:
+ void setText(const QString &text);
+ void setImage(const QPixmap &image);
+ void setChecked(bool checked);
+
+public:
+ void setCheckable(bool checkable);
+ bool isChecked();
+
+signals:
+ void clicked(bool checked = false);
+
+private:
+ friend class QButtonPrivate;
+ QPointer pimpl;
+};
+#endif // QBUTTON_H
diff --git a/src/libtomahawk/thirdparty/Qocoa/qbutton_mac.mm b/src/libtomahawk/thirdparty/Qocoa/qbutton_mac.mm
new file mode 100644
index 000000000..9dfdf9672
--- /dev/null
+++ b/src/libtomahawk/thirdparty/Qocoa/qbutton_mac.mm
@@ -0,0 +1,232 @@
+/*
+Copyright (C) 2011 by Mike McQuaid
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#include "qbutton.h"
+
+#include "qocoa_mac.h"
+
+#import "Foundation/NSAutoreleasePool.h"
+#import "AppKit/NSButton.h"
+#import "AppKit/NSFont.h"
+
+class QButtonPrivate : public QObject
+{
+public:
+ QButtonPrivate(QButton *qButton, NSButton *nsButton, QButton::BezelStyle bezelStyle)
+ : QObject(qButton), qButton(qButton), nsButton(nsButton)
+ {
+ switch(bezelStyle) {
+ case QButton::Disclosure:
+ case QButton::Circular:
+#ifdef __MAC_10_7
+ case QButton::Inline:
+#endif
+ case QButton::RoundedDisclosure:
+ case QButton::HelpButton:
+ [nsButton setTitle:@""];
+ default:
+ break;
+ }
+
+ NSFont* font = 0;
+ switch(bezelStyle) {
+ case QButton::RoundRect:
+ font = [NSFont fontWithName:@"Lucida Grande" size:12];
+ break;
+
+ case QButton::Recessed:
+ font = [NSFont fontWithName:@"Lucida Grande Bold" size:12];
+ break;
+
+#ifdef __MAC_10_7
+ case QButton::Inline:
+ font = [NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
+ break;
+#endif
+
+ default:
+ font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
+ break;
+ }
+ [nsButton setFont:font];
+
+ switch(bezelStyle) {
+ case QButton::Rounded:
+ qButton->setMinimumWidth(40);
+ qButton->setFixedHeight(24);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ break;
+ case QButton::RegularSquare:
+ case QButton::TexturedSquare:
+ qButton->setMinimumSize(14, 23);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ break;
+ case QButton::ShadowlessSquare:
+ qButton->setMinimumSize(5, 25);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ break;
+ case QButton::SmallSquare:
+ qButton->setMinimumSize(4, 21);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ break;
+ case QButton::TexturedRounded:
+ qButton->setMinimumSize(10, 22);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ break;
+ case QButton::RoundRect:
+ case QButton::Recessed:
+ qButton->setMinimumWidth(16);
+ qButton->setFixedHeight(18);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ break;
+ case QButton::Disclosure:
+ qButton->setMinimumWidth(13);
+ qButton->setFixedHeight(13);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ break;
+ case QButton::Circular:
+ qButton->setMinimumSize(16, 16);
+ qButton->setMaximumHeight(40);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ break;
+ case QButton::HelpButton:
+ case QButton::RoundedDisclosure:
+ qButton->setMinimumWidth(22);
+ qButton->setFixedHeight(22);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ break;
+#ifdef __MAC_10_7
+ case QButton::Inline:
+ qButton->setMinimumWidth(10);
+ qButton->setFixedHeight(16);
+ qButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ break;
+#endif
+ }
+
+ switch(bezelStyle) {
+ case QButton::Recessed:
+ [nsButton setButtonType:NSPushOnPushOffButton];
+ case QButton::Disclosure:
+ [nsButton setButtonType:NSOnOffButton];
+ default:
+ [nsButton setButtonType:NSMomentaryPushInButton];
+ }
+
+ [nsButton setBezelStyle:bezelStyle];
+ }
+
+ void clicked()
+ {
+ emit qButton->clicked(qButton->isChecked());
+ }
+
+ ~QButtonPrivate() {
+ [[nsButton target] release];
+ [nsButton setTarget:nil];
+ }
+
+ QButton *qButton;
+ NSButton *nsButton;
+};
+
+@interface QButtonTarget : NSObject
+{
+@public
+ QPointer pimpl;
+}
+-(void)clicked;
+@end
+
+@implementation QButtonTarget
+-(void)clicked {
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ pimpl->clicked();
+}
+@end
+
+QButton::QButton(QWidget *parent, BezelStyle bezelStyle) : QWidget(parent)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSButton *button = [[NSButton alloc] init];
+ pimpl = new QButtonPrivate(this, button, bezelStyle);
+
+ QButtonTarget *target = [[QButtonTarget alloc] init];
+ target->pimpl = pimpl;
+ [button setTarget:target];
+
+ [button setAction:@selector(clicked)];
+
+ setupLayout(button, this);
+
+ [button release];
+
+ [pool drain];
+}
+
+void QButton::setText(const QString &text)
+{
+ Q_ASSERT(pimpl);
+ if (!pimpl)
+ return;
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [pimpl->nsButton setTitle:fromQString(text)];
+ [pool drain];
+}
+
+void QButton::setImage(const QPixmap &image)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ [pimpl->nsButton setImage:fromQPixmap(image)];
+}
+
+void QButton::setChecked(bool checked)
+{
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ [pimpl->nsButton setState:checked];
+}
+
+void QButton::setCheckable(bool checkable)
+{
+ const NSInteger cellMask = checkable ? NSChangeBackgroundCellMask : NSNoCellMask;
+
+ Q_ASSERT(pimpl);
+ if (pimpl)
+ [[pimpl->nsButton cell] setShowsStateBy:cellMask];
+}
+
+bool QButton::isChecked()
+{
+ Q_ASSERT(pimpl);
+ if (!pimpl)
+ return false;
+
+ return [pimpl->nsButton state];
+}
+
+#include "moc_qbutton.cpp"
+