mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
* Fixed TWK-261 - Make "show offline sources" a checkable option, and save its value in settings.
This commit is contained in:
@@ -447,6 +447,17 @@ TomahawkSettings::setVerboseNotifications( bool notifications )
|
|||||||
setValue( "ui/notifications/verbose", notifications );
|
setValue( "ui/notifications/verbose", notifications );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TomahawkSettings::showOfflineSources() const
|
||||||
|
{
|
||||||
|
return value( "collection/sources/showoffline", false ).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkSettings::setShowOfflineSources( bool show )
|
||||||
|
{
|
||||||
|
setValue( "collection/sources/showoffline", show );
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray
|
QByteArray
|
||||||
TomahawkSettings::playlistColumnSizes( const QString& playlistid ) const
|
TomahawkSettings::playlistColumnSizes( const QString& playlistid ) const
|
||||||
|
@@ -71,6 +71,10 @@ public:
|
|||||||
bool verboseNotifications() const;
|
bool verboseNotifications() const;
|
||||||
void setVerboseNotifications( bool notifications );
|
void setVerboseNotifications( bool notifications );
|
||||||
|
|
||||||
|
// Collection Stuff
|
||||||
|
bool showOfflineSources() const;
|
||||||
|
void setShowOfflineSources( bool show );
|
||||||
|
|
||||||
/// Playlist stuff
|
/// Playlist stuff
|
||||||
QByteArray playlistColumnSizes( const QString& playlistid ) const;
|
QByteArray playlistColumnSizes( const QString& playlistid ) const;
|
||||||
void setPlaylistColumnSizes( const QString& playlistid, const QByteArray& state );
|
void setPlaylistColumnSizes( const QString& playlistid, const QByteArray& state );
|
||||||
|
@@ -44,21 +44,12 @@ SourcesProxyModel::SourcesProxyModel( SourcesModel* model, QObject* parent )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourcesProxyModel::showOfflineSources()
|
SourcesProxyModel::showOfflineSources( bool offlineSourcesShown )
|
||||||
{
|
{
|
||||||
m_filtered = false;
|
m_filtered = !offlineSourcesShown;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
SourcesProxyModel::hideOfflineSources()
|
|
||||||
{
|
|
||||||
m_filtered = true;
|
|
||||||
invalidateFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SourcesProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
|
SourcesProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
|
||||||
{
|
{
|
||||||
|
@@ -31,8 +31,7 @@ public:
|
|||||||
explicit SourcesProxyModel( SourcesModel* model, QObject* parent = 0 );
|
explicit SourcesProxyModel( SourcesModel* model, QObject* parent = 0 );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showOfflineSources();
|
void showOfflineSources( bool offlineSourcesShown );
|
||||||
void hideOfflineSources();
|
|
||||||
|
|
||||||
void selectRequested( const QModelIndex& );
|
void selectRequested( const QModelIndex& );
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "sourcetree/items/collectionitem.h"
|
#include "sourcetree/items/collectionitem.h"
|
||||||
#include "audio/audioengine.h"
|
#include "audio/audioengine.h"
|
||||||
#include "sourceplaylistinterface.h"
|
#include "sourceplaylistinterface.h"
|
||||||
|
#include "tomahawksettings.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -110,7 +111,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
|||||||
connect( this, SIGNAL( expanded( QModelIndex ) ), this, SLOT( onItemExpanded( QModelIndex ) ) );
|
connect( this, SIGNAL( expanded( QModelIndex ) ), this, SLOT( onItemExpanded( QModelIndex ) ) );
|
||||||
// connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );
|
// connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );
|
||||||
|
|
||||||
hideOfflineSources();
|
showOfflineSources( TomahawkSettings::instance()->showOfflineSources() );
|
||||||
|
|
||||||
// Light-blue sourcetree on osx
|
// Light-blue sourcetree on osx
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
@@ -199,19 +200,11 @@ SourceTreeView::setupMenus()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::showOfflineSources()
|
SourceTreeView::showOfflineSources( bool offlineSourcesShown )
|
||||||
{
|
{
|
||||||
m_proxyModel->showOfflineSources();
|
m_proxyModel->showOfflineSources( offlineSourcesShown );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
SourceTreeView::hideOfflineSources()
|
|
||||||
{
|
|
||||||
m_proxyModel->hideOfflineSources();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::onItemActivated( const QModelIndex& index )
|
SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
|
@@ -38,8 +38,7 @@ public:
|
|||||||
explicit SourceTreeView( QWidget* parent = 0 );
|
explicit SourceTreeView( QWidget* parent = 0 );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showOfflineSources();
|
void showOfflineSources( bool offlineSourcesShown );
|
||||||
void hideOfflineSources();
|
|
||||||
|
|
||||||
void renamePlaylist();
|
void renamePlaylist();
|
||||||
signals:
|
signals:
|
||||||
|
@@ -206,6 +206,9 @@ TomahawkWindow::setupSideBar()
|
|||||||
ui->splitter->setStretchFactor( 1, 3 );
|
ui->splitter->setStretchFactor( 1, 3 );
|
||||||
ui->splitter->setCollapsible( 1, false );
|
ui->splitter->setCollapsible( 1, false );
|
||||||
ui->splitter->setHandleWidth( 1 );
|
ui->splitter->setHandleWidth( 1 );
|
||||||
|
|
||||||
|
ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -298,8 +301,7 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() ));
|
connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() ));
|
||||||
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
||||||
connect( ui->actionExit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
|
connect( ui->actionExit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
|
||||||
connect( ui->actionHideOfflineSources, SIGNAL( triggered() ), m_sourcetree, SLOT( hideOfflineSources() ) );
|
connect( ui->actionShowOfflineSources, SIGNAL( triggered() ), SLOT( showOfflineSources() ) );
|
||||||
connect( ui->actionShowOfflineSources, SIGNAL( triggered() ), m_sourcetree, SLOT( showOfflineSources() ) );
|
|
||||||
|
|
||||||
connect( ui->actionPlay, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) );
|
connect( ui->actionPlay, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) );
|
||||||
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||||
@@ -474,6 +476,13 @@ TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::showOfflineSources()
|
||||||
|
{
|
||||||
|
m_sourcetree->showOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
||||||
|
TomahawkSettings::instance()->setShowOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::loadSpiff()
|
TomahawkWindow::loadSpiff()
|
||||||
|
@@ -71,6 +71,7 @@ public slots:
|
|||||||
void rescanCollectionManually();
|
void rescanCollectionManually();
|
||||||
void pluginMenuAdded(QMenu*);
|
void pluginMenuAdded(QMenu*);
|
||||||
void pluginMenuRemoved(QMenu*);
|
void pluginMenuRemoved(QMenu*);
|
||||||
|
void showOfflineSources();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSipConnected();
|
void onSipConnected();
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1000</width>
|
<width>1000</width>
|
||||||
<height>20</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuSettings">
|
<widget class="QMenu" name="menuSettings">
|
||||||
@@ -56,7 +56,6 @@
|
|||||||
<addaction name="actionRescanCollection"/>
|
<addaction name="actionRescanCollection"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionShowOfflineSources"/>
|
<addaction name="actionShowOfflineSources"/>
|
||||||
<addaction name="actionHideOfflineSources"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -164,6 +163,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionShowOfflineSources">
|
<action name="actionShowOfflineSources">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show Offline Sources</string>
|
<string>Show Offline Sources</string>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user