mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
provide a way for accounts to show an about widget, and show it for spotify
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
|
||||||
*
|
|
||||||
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
|
||||||
*
|
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Tomahawk is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "AboutDialog.h"
|
|
||||||
|
|
||||||
#include "ui_AboutDialog.h"
|
|
||||||
|
|
||||||
#include "utils/tomahawkutils.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
AboutDialog::AboutDialog( QWidget* parent )
|
|
||||||
: QDialog( parent )
|
|
||||||
, m_ui( new Ui::AboutDialog )
|
|
||||||
{
|
|
||||||
m_ui->setupUi( this );
|
|
||||||
|
|
||||||
const QString version = TomahawkUtils::appFriendlyVersion();
|
|
||||||
QString debugHash;
|
|
||||||
#ifdef DEBUG_BUILD
|
|
||||||
debugHash = QString( "<br />(%1)" ).arg( qApp->applicationVersion() );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_ui->titleLabel->setText( m_ui->titleLabel->text().arg( version ).arg( debugHash ) );
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
|
||||||
*
|
|
||||||
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
|
||||||
*
|
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Tomahawk is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ABOUTDIALOG_H
|
|
||||||
#define ABOUTDIALOG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class AboutDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class AboutDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit AboutDialog( QWidget* parent = 0 );
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::AboutDialog* m_ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ABOUTDIALOG_H
|
|
@@ -1,190 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AboutDialog</class>
|
|
||||||
<widget class="QDialog" name="AboutDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>428</width>
|
|
||||||
<height>247</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Dialog</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="margin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="../resources.qrc">:/data/icons/tomahawk-icon-64x64.png</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="titleLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string><h2>Tomahawk %1%2<br/></h2></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Copyright 2010 - 2012
|
|
||||||
Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
|
||||||
|
|
||||||
Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz,
|
|
||||||
Alejandro Wainzinger, Hugo Lindström, Michael Zanetti, Harald Sitter
|
|
||||||
and Steve Robertson</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>12</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="spotifyBlurb">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="spotifyLogo">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>64</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="../resources.qrc">:/data/images/spotifycore-logo.png</pixmap>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>9</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>This product uses SPOTIFY(R) CORE but is not endorsed, certified or otherwise approved in any way by Spotify. Spotify is the registered trade mark of the Spotify Group.</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources>
|
|
||||||
<include location="../resources.qrc"/>
|
|
||||||
<include location="../../../../../../../resources.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>AboutDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>AboutDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@@ -90,7 +90,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
|||||||
AccountFactoryWrapper.cpp
|
AccountFactoryWrapper.cpp
|
||||||
AccountFactoryWrapperDelegate.cpp
|
AccountFactoryWrapperDelegate.cpp
|
||||||
SocialWidget.cpp
|
SocialWidget.cpp
|
||||||
AboutDialog.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
IF( WITH_BREAKPAD )
|
IF( WITH_BREAKPAD )
|
||||||
@@ -110,7 +109,6 @@ SET( tomahawkUI ${tomahawkUI}
|
|||||||
LoadXSPFDialog.ui
|
LoadXSPFDialog.ui
|
||||||
AccountFactoryWrapper.ui
|
AccountFactoryWrapper.ui
|
||||||
SocialWidget.ui
|
SocialWidget.ui
|
||||||
AboutDialog.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
|
@@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
using namespace Accounts;
|
using namespace Accounts;
|
||||||
@@ -444,6 +446,29 @@ SpotifyAccount::configurationWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QWidget*
|
||||||
|
SpotifyAccount::aboutWidget()
|
||||||
|
{
|
||||||
|
if ( m_aboutWidget.isNull() )
|
||||||
|
{
|
||||||
|
QWidget* w = new QWidget();
|
||||||
|
w->hide();
|
||||||
|
|
||||||
|
QHBoxLayout* l = new QHBoxLayout( w );
|
||||||
|
QLabel* pm = new QLabel( w );
|
||||||
|
pm->setPixmap( QPixmap( RESPATH "images/spotifycore-logo" ) );
|
||||||
|
QLabel* text = new QLabel( "This product uses SPOTIFY(R) CORE but is not endorsed, certified or otherwise approved in any way by Spotify. Spotify is the registered trade mark of the Spotify Group.", w );
|
||||||
|
text->setWordWrap( true );
|
||||||
|
l->addWidget( pm );
|
||||||
|
l->addWidget( text );
|
||||||
|
w->setLayout( l );
|
||||||
|
m_aboutWidget = QWeakPointer< QWidget >( w );
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_aboutWidget.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpotifyAccount::saveConfig()
|
SpotifyAccount::saveConfig()
|
||||||
{
|
{
|
||||||
|
@@ -81,6 +81,7 @@ public:
|
|||||||
|
|
||||||
virtual QPixmap icon() const;
|
virtual QPixmap icon() const;
|
||||||
virtual QWidget* configurationWidget();
|
virtual QWidget* configurationWidget();
|
||||||
|
virtual QWidget* aboutWidget();
|
||||||
virtual void saveConfig();
|
virtual void saveConfig();
|
||||||
|
|
||||||
virtual QWidget* aclWidget() { return 0; }
|
virtual QWidget* aclWidget() { return 0; }
|
||||||
@@ -119,6 +120,7 @@ private:
|
|||||||
void setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync );
|
void setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync );
|
||||||
|
|
||||||
QWeakPointer<SpotifyAccountConfig> m_configWidget;
|
QWeakPointer<SpotifyAccountConfig> m_configWidget;
|
||||||
|
QWeakPointer<QWidget> m_aboutWidget;
|
||||||
QWeakPointer<ScriptResolver> m_spotifyResolver;
|
QWeakPointer<ScriptResolver> m_spotifyResolver;
|
||||||
|
|
||||||
QMap<QString, QPair<QObject*, QString> > m_qidToSlotMap;
|
QMap<QString, QPair<QObject*, QString> > m_qidToSlotMap;
|
||||||
|
@@ -16,11 +16,13 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "delegateconfigwrapper.h"
|
#include "delegateconfigwrapper.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
|
||||||
DelegateConfigWrapper::DelegateConfigWrapper( QWidget* conf, const QString& title, QWidget* parent, Qt::WindowFlags flags )
|
DelegateConfigWrapper::DelegateConfigWrapper( QWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags )
|
||||||
: QDialog( parent, flags )
|
: QDialog( parent, flags )
|
||||||
, m_widget( conf )
|
, m_widget( conf )
|
||||||
|
, m_aboutW( aboutWidget )
|
||||||
, m_deleted( false )
|
, m_deleted( false )
|
||||||
{
|
{
|
||||||
m_widget->setWindowFlags( Qt::Sheet );
|
m_widget->setWindowFlags( Qt::Sheet );
|
||||||
@@ -32,10 +34,24 @@ DelegateConfigWrapper::DelegateConfigWrapper( QWidget* conf, const QString& titl
|
|||||||
v->setContentsMargins( 0, 0, 0, 0 );
|
v->setContentsMargins( 0, 0, 0, 0 );
|
||||||
v->addWidget( m_widget );
|
v->addWidget( m_widget );
|
||||||
|
|
||||||
m_buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this );
|
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok | QDialogButtonBox::Cancel;
|
||||||
|
if ( m_aboutW )
|
||||||
|
{
|
||||||
|
m_aboutW->hide();
|
||||||
|
buttons |= QDialogButtonBox::Help;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buttons = new QDialogButtonBox( buttons, Qt::Horizontal, this );
|
||||||
m_okButton = m_buttons->button( QDialogButtonBox::Ok );
|
m_okButton = m_buttons->button( QDialogButtonBox::Ok );
|
||||||
connect( m_buttons, SIGNAL( clicked( QAbstractButton*) ), this, SLOT( closed( QAbstractButton* ) ) );
|
connect( m_buttons, SIGNAL( clicked( QAbstractButton*) ), this, SLOT( closed( QAbstractButton* ) ) );
|
||||||
connect( this, SIGNAL( rejected() ), this, SLOT( rejected() ) );
|
connect( this, SIGNAL( rejected() ), this, SLOT( rejected() ) );
|
||||||
|
|
||||||
|
if ( m_aboutW )
|
||||||
|
{
|
||||||
|
connect( m_buttons->button( QDialogButtonBox::Help ), SIGNAL( clicked( bool ) ), this, SLOT( aboutClicked( bool ) ) );
|
||||||
|
m_buttons->button( QDialogButtonBox::Help )->setText( tr( "About" ) );
|
||||||
|
}
|
||||||
|
|
||||||
v->addWidget( m_buttons );
|
v->addWidget( m_buttons );
|
||||||
|
|
||||||
setLayout( v );
|
setLayout( v );
|
||||||
@@ -73,12 +89,16 @@ DelegateConfigWrapper::toggleOkButton( bool dataError )
|
|||||||
void
|
void
|
||||||
DelegateConfigWrapper::closed( QAbstractButton* b )
|
DelegateConfigWrapper::closed( QAbstractButton* b )
|
||||||
{
|
{
|
||||||
|
QDialogButtonBox* buttons = qobject_cast< QDialogButtonBox* >( sender() );
|
||||||
|
|
||||||
|
if ( buttons->standardButton( b ) == QDialogButtonBox::Help )
|
||||||
|
return;
|
||||||
|
|
||||||
// let the config widget live to see another day
|
// let the config widget live to see another day
|
||||||
layout()->removeWidget( m_widget );
|
layout()->removeWidget( m_widget );
|
||||||
m_widget->setParent( 0 );
|
m_widget->setParent( 0 );
|
||||||
m_widget->setVisible( false );
|
m_widget->setVisible( false );
|
||||||
|
|
||||||
QDialogButtonBox* buttons = qobject_cast< QDialogButtonBox* >( sender() );
|
|
||||||
if ( buttons->standardButton( b ) == QDialogButtonBox::Ok )
|
if ( buttons->standardButton( b ) == QDialogButtonBox::Ok )
|
||||||
done( QDialog::Accepted );
|
done( QDialog::Accepted );
|
||||||
else if ( b == m_deleteButton )
|
else if ( b == m_deleteButton )
|
||||||
@@ -112,3 +132,27 @@ DelegateConfigWrapper::updateSizeHint()
|
|||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DelegateConfigWrapper::aboutClicked( bool )
|
||||||
|
{
|
||||||
|
Q_ASSERT( m_aboutW );
|
||||||
|
m_aboutW->show();
|
||||||
|
|
||||||
|
QDialog d( this );
|
||||||
|
d.setWindowTitle( tr( "About this Account" ) );
|
||||||
|
QVBoxLayout* v = new QVBoxLayout( &d );
|
||||||
|
v->addWidget( m_aboutW );
|
||||||
|
QDialogButtonBox* bbox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal, &d );
|
||||||
|
v->addWidget( bbox );
|
||||||
|
|
||||||
|
d.setLayout( v );
|
||||||
|
connect( bbox, SIGNAL( clicked( QAbstractButton* ) ), &d, SLOT( accept() ) );
|
||||||
|
d.exec();
|
||||||
|
v->removeWidget( m_aboutW );
|
||||||
|
|
||||||
|
m_aboutW->setParent( 0 );
|
||||||
|
m_aboutW->hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ class DelegateConfigWrapper : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DelegateConfigWrapper( QWidget* conf, const QString& title, QWidget* parent, Qt::WindowFlags flags = 0 );
|
DelegateConfigWrapper( QWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags = 0 );
|
||||||
|
|
||||||
~DelegateConfigWrapper() {}
|
~DelegateConfigWrapper() {}
|
||||||
|
|
||||||
@@ -37,8 +37,7 @@ public:
|
|||||||
bool deleted() const { return m_deleted; }
|
bool deleted() const { return m_deleted; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleOkButton( bool dataError )
|
void toggleOkButton( bool dataError );
|
||||||
;
|
|
||||||
void closed( QAbstractButton* b );
|
void closed( QAbstractButton* b );
|
||||||
|
|
||||||
// we get a rejected() signal emitted if the user presses escape (and no clicked() signal )
|
// we get a rejected() signal emitted if the user presses escape (and no clicked() signal )
|
||||||
@@ -49,9 +48,12 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void closedWithDelete();
|
void closedWithDelete();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void aboutClicked( bool );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDialogButtonBox* m_buttons;
|
QDialogButtonBox* m_buttons;
|
||||||
QWidget* m_widget;
|
QWidget* m_widget, *m_aboutW;
|
||||||
QPushButton *m_okButton, *m_deleteButton;
|
QPushButton *m_okButton, *m_deleteButton;
|
||||||
bool m_deleted;
|
bool m_deleted;
|
||||||
};
|
};
|
||||||
|
@@ -83,6 +83,8 @@ public:
|
|||||||
* Configuration widgets can have a "dataError( bool )" signal to enable/disable the OK button in their wrapper dialogs.
|
* Configuration widgets can have a "dataError( bool )" signal to enable/disable the OK button in their wrapper dialogs.
|
||||||
*/
|
*/
|
||||||
virtual QWidget* configurationWidget() = 0;
|
virtual QWidget* configurationWidget() = 0;
|
||||||
|
virtual QWidget* aboutWidget() { return 0; }
|
||||||
|
|
||||||
virtual void saveConfig() {} // called when the widget has been edited. save values from config widget, call sync() to write to disk account generic settings
|
virtual void saveConfig() {} // called when the widget has been edited. save values from config widget, call sync() to write to disk account generic settings
|
||||||
|
|
||||||
QVariantHash credentials() const { QMutexLocker locker( &m_mutex ); return m_credentials; }
|
QVariantHash credentials() const { QMutexLocker locker( &m_mutex ); return m_credentials; }
|
||||||
|
@@ -73,7 +73,6 @@
|
|||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
#include "LoadXSPFDialog.h"
|
#include "LoadXSPFDialog.h"
|
||||||
#include <actioncollection.h>
|
#include <actioncollection.h>
|
||||||
#include "AboutDialog.h"
|
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
using namespace Accounts;
|
using namespace Accounts;
|
||||||
@@ -742,8 +741,21 @@ TomahawkWindow::setWindowTitle( const QString& title )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::showAboutTomahawk()
|
TomahawkWindow::showAboutTomahawk()
|
||||||
{
|
{
|
||||||
AboutDialog diag( this );
|
QString head, desc;
|
||||||
diag.exec();
|
|
||||||
|
#ifdef DEBUG_BUILD
|
||||||
|
head = tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>" )
|
||||||
|
.arg( TomahawkUtils::appFriendlyVersion() )
|
||||||
|
.arg( qApp->applicationVersion() );
|
||||||
|
#else
|
||||||
|
head = tr( "<h2><b>Tomahawk %1</h2>" )
|
||||||
|
.arg( TomahawkUtils::appFriendlyVersion() );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
desc = tr( "Copyright 2010 - 2012<br/>Christian Muehlhaeuser <muesli@tomahawk-player.org><br/><br/>"
|
||||||
|
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindström, Michael Zanetti, Harald Sitter and Steve Robertson" );
|
||||||
|
|
||||||
|
QMessageBox::about( this, tr( "About Tomahawk" ), head + desc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -96,9 +96,9 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget*
|
|||||||
bool added = false;
|
bool added = false;
|
||||||
if( account->configurationWidget() )
|
if( account->configurationWidget() )
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// on osx a sheet needs to be non-modal
|
// on osx a sheet needs to be non-modal
|
||||||
DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), QString("%1 Config" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet );
|
DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), account->aboutWidget(), QString("%1 Config" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet );
|
||||||
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) );
|
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) );
|
||||||
|
|
||||||
UtilsObject* obj = new UtilsObject( dialog );
|
UtilsObject* obj = new UtilsObject( dialog );
|
||||||
@@ -108,8 +108,8 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget*
|
|||||||
QObject::connect( account->configurationWidget(), SIGNAL( dataError( bool ) ), dialog, SLOT( toggleOkButton( bool ) ), Qt::UniqueConnection );
|
QObject::connect( account->configurationWidget(), SIGNAL( dataError( bool ) ), dialog, SLOT( toggleOkButton( bool ) ), Qt::UniqueConnection );
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
#else
|
#else
|
||||||
DelegateConfigWrapper dialog( account->configurationWidget(), QString("%1 Config" ).arg( account->accountFriendlyName() ), parent );
|
DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QString("%1 Config" ).arg( account->accountFriendlyName() ), parent );
|
||||||
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
||||||
|
|
||||||
if( account->configurationWidget()->metaObject()->indexOfSignal( "dataError(bool)" ) > -1 )
|
if( account->configurationWidget()->metaObject()->indexOfSignal( "dataError(bool)" ) > -1 )
|
||||||
@@ -122,7 +122,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget*
|
|||||||
added = false;
|
added = false;
|
||||||
|
|
||||||
handleAccountAdded( account, added );
|
handleAccountAdded( account, added );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -137,8 +137,8 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s
|
|||||||
{
|
{
|
||||||
if( account->configurationWidget() )
|
if( account->configurationWidget() )
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
DelegateConfigWrapper dialog( account->configurationWidget(), QString("%1 Configuration" ).arg( account->accountFriendlyName() ), parent );
|
DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QString("%1 Configuration" ).arg( account->accountFriendlyName() ), parent );
|
||||||
dialog.setShowDelete( showDelete );
|
dialog.setShowDelete( showDelete );
|
||||||
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
||||||
int ret = dialog.exec();
|
int ret = dialog.exec();
|
||||||
@@ -151,9 +151,9 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s
|
|||||||
// send changed config to resolver
|
// send changed config to resolver
|
||||||
account->saveConfig();
|
account->saveConfig();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// on osx a sheet needs to be non-modal
|
// on osx a sheet needs to be non-modal
|
||||||
DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), QString("%1 Configuration" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet );
|
DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), account->aboutWidget(), QString("%1 Configuration" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet );
|
||||||
dialog->setShowDelete( showDelete );
|
dialog->setShowDelete( showDelete );
|
||||||
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) );
|
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) );
|
||||||
UtilsObject* obj = new UtilsObject( dialog );
|
UtilsObject* obj = new UtilsObject( dialog );
|
||||||
@@ -162,7 +162,7 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s
|
|||||||
QObject::connect( dialog, SIGNAL( closedWithDelete() ), obj, SLOT( accountConfigDelete() ) );
|
QObject::connect( dialog, SIGNAL( closedWithDelete() ), obj, SLOT( accountConfigDelete() ) );
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user