1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 14:28:24 +01:00

Move libtomahawk-widgets to src/libtomahawk-widgets from a libtomahawk subdir

This commit is contained in:
Dominik Schmidt 2013-07-01 00:34:48 +02:00
parent 4ec651c378
commit c1d999c6a3
23 changed files with 229 additions and 96 deletions

View File

@ -21,7 +21,9 @@ function(tomahawk_add_library)
set(target ${LIBRARY_NAME})
# qt stuff
include_directories(${CMAKE_CURRENT_LIST_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(LIBRARY_UI)
qt_wrap_ui(LIBRARY_UI_SOURCES ${LIBRARY_UI})
list(APPEND LIBRARY_SOURCES ${LIBRARY_UI_SOURCES})

View File

@ -5,14 +5,18 @@ setup_qt()
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libtomahawk )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libtomahawk )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_LIST_DIR} )
# library
add_subdirectory(libtomahawk)
add_subdirectory( libtomahawk )
add_subdirectory( libtomahawk-widgets )
# plugins
add_subdirectory(accounts)
add_subdirectory(infoplugins)
add_subdirectory( accounts )
add_subdirectory( infoplugins )
# application
add_subdirectory(tomahawk)
add_subdirectory(crashreporter)
add_subdirectory( tomahawk )
add_subdirectory( crashreporter )

View File

@ -2,11 +2,19 @@
set(TOMAHAWK_WIDGETS_LIBRARY_TARGET tomahawk-widgets)
list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES
PlaylistDelegate.cpp
PlaylistWidget.cpp
# ViewPages
Dashboard.cpp
NetworkActivityWidget.cpp
SocialPlaylistWidget.cpp
)
list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI
Dashboard.ui
NetworkActivityWidget.ui
SocialPlaylistWidget.ui
)
tomahawk_add_library(${TOMAHAWK_WIDGETS_LIBRARY_TARGET}

View File

@ -24,10 +24,10 @@
#include "ViewManager.h"
#include "SourceList.h"
#include "TomahawkSettings.h"
#include "RecentPlaylistsModel.h"
#include "RecentlyPlayedPlaylistsModel.h"
#include "widgets/RecentPlaylistsModel.h"
#include "widgets/RecentlyPlayedPlaylistsModel.h"
#include "MetaPlaylistInterface.h"
#include "PlaylistDelegate.h"
#include "audio/AudioEngine.h"
#include "playlist/AlbumModel.h"
#include "playlist/RecentlyPlayedModel.h"
@ -421,36 +421,3 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
painter->restore();
}
PlaylistWidget::PlaylistWidget( QWidget* parent )
: QListView( parent )
{
m_overlay = new OverlayWidget( this );
new LoadingSpinner( this );
}
void
PlaylistWidget::setModel( QAbstractItemModel* model )
{
QListView::setModel( model );
connect( model, SIGNAL( modelReset() ), SLOT( verifySize() ) );
connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ) );
connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) );
emit modelChanged();
verifySize();
}
void
PlaylistWidget::verifySize()
{
if ( !model() )
return;
if ( model()->rowCount() > 0 )
setFixedHeight( model()->rowCount() * itemDelegate()->sizeHint( QStyleOptionViewItem(), model()->index( 0, 0 ) ).height() + frameWidth() * 2 );
}

View File

@ -32,7 +32,7 @@
#include "utils/TomahawkUtilsGui.h"
#include "DllMacro.h"
#include "WidgetsDllMacro.h"
class AlbumModel;
class RecentlyPlayedModel;
@ -49,44 +49,7 @@ namespace Tomahawk
namespace Widgets
{
class DLLEXPORT PlaylistDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PlaylistDelegate()
{
}
protected:
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
};
class DLLEXPORT PlaylistWidget : public QListView
{
Q_OBJECT
public:
PlaylistWidget( QWidget* parent = 0 );
OverlayWidget* overlay() const { return m_overlay; }
virtual void setModel( QAbstractItemModel* model );
signals:
void modelChanged();
private slots:
void verifySize();
private:
OverlayWidget* m_overlay;
};
class DLLEXPORT Dashboard : public QWidget, public Tomahawk::ViewPage
class TOMAHAWK_WIDGETS_EXPORT Dashboard : public QWidget, public Tomahawk::ViewPage
{
Q_OBJECT

View File

@ -298,7 +298,7 @@
<customwidget>
<class>Tomahawk::Widgets::PlaylistWidget</class>
<extends>QListWidget</extends>
<header>widgets/Dashboard.h</header>
<header>PlaylistWidget.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@ -0,0 +1,20 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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 "PlaylistDelegate.h"

View File

@ -0,0 +1,51 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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 TOMAHAWK_WIDGETS_PLAYLISTDELEGATE_H
#define TOMAHAWK_WIDGETS_PLAYLISTDELEGATE_H
#include <QStyledItemDelegate>
#include "WidgetsDllMacro.h"
namespace Tomahawk
{
namespace Widgets
{
class TOMAHAWK_WIDGETS_EXPORT PlaylistDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PlaylistDelegate()
{
}
protected:
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
};
} // Widgets
} // Tomahawk
#endif // TOMAHAWK_WIDGETS_PLAYLISTDELEGATE_H

View File

@ -0,0 +1,58 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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 "PlaylistWidget.h"
#include "utils/AnimatedSpinner.h"
using namespace Tomahawk;
using namespace Tomahawk::Widgets;
PlaylistWidget::PlaylistWidget( QWidget* parent )
: QListView( parent )
{
m_overlay = new OverlayWidget( this );
new LoadingSpinner( this );
}
void
PlaylistWidget::setModel( QAbstractItemModel* model )
{
QListView::setModel( model );
connect( model, SIGNAL( modelReset() ), SLOT( verifySize() ) );
connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ) );
connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) );
emit modelChanged();
verifySize();
}
void
PlaylistWidget::verifySize()
{
if ( !model() )
return;
if ( model()->rowCount() > 0 )
setFixedHeight( model()->rowCount() * itemDelegate()->sizeHint( QStyleOptionViewItem(), model()->index( 0, 0 ) ).height() + frameWidth() * 2 );
}

View File

@ -0,0 +1,60 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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 TOMAHAWK_WIDGETS_PLAYLISTWIDGET_H
#define TOMAHAWK_WIDGETS_PLAYLISTWIDGET_H
#include "widgets/OverlayWidget.h"
#include <QListView>
#include "WidgetsDllMacro.h"
namespace Tomahawk
{
namespace Widgets
{
class TOMAHAWK_WIDGETS_EXPORT PlaylistWidget : public QListView
{
Q_OBJECT
public:
PlaylistWidget( QWidget* parent = 0 );
OverlayWidget* overlay() const { return m_overlay; }
virtual void setModel( QAbstractItemModel* model );
signals:
void modelChanged();
private slots:
void verifySize();
private:
OverlayWidget* m_overlay;
};
}; // Widgets
}; // Tomahawk
#endif // TOMAHAWK_WIDGETS_PLAYLISTWIDGET_H

View File

@ -30,6 +30,8 @@
#include "database/DatabaseCommand_GenericSelect.h"
#include "widgets/OverlayWidget.h"
#include "utils/TomahawkUtilsGui.h"
using namespace Tomahawk;
QString SocialPlaylistWidget::s_popularAlbumsQuery = "SELECT * from album";

View File

@ -99,7 +99,7 @@
<customwidget>
<class>Tomahawk::Widgets::PlaylistWidget</class>
<extends>QListWidget</extends>
<header>widgets/Dashboard.h</header>
<header>PlaylistWidget.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@ -142,7 +142,6 @@ set( libGuiSources
widgets/SearchWidget.cpp
widgets/SeekSlider.cpp
widgets/PlaylistTypeSelectorDialog.cpp
widgets/Dashboard.cpp
widgets/HistoryWidget.cpp
widgets/WhatsHotWidget.cpp
widgets/NewReleasesWidget.cpp
@ -157,7 +156,6 @@ set( libGuiSources
widgets/ToggleButton.cpp
widgets/FadingPixmap.cpp
widgets/PlayableCover.cpp
widgets/SocialPlaylistWidget.cpp
widgets/SourceTreePopupDialog.cpp
widgets/infowidgets/SourceInfoWidget.cpp
widgets/infowidgets/ArtistInfoWidget.cpp
@ -374,10 +372,8 @@ set( libUI ${libUI}
widgets/PlaylistTypeSelectorDialog.ui
widgets/NewPlaylistWidget.ui
widgets/SearchWidget.ui
widgets/Dashboard.ui
widgets/WhatsHotWidget.ui
widgets/NewReleasesWidget.ui
widgets/SocialPlaylistWidget.ui
widgets/infowidgets/SourceInfoWidget.ui
widgets/infowidgets/ArtistInfoWidget.ui
widgets/infowidgets/AlbumInfoWidget.ui
@ -522,8 +518,6 @@ TARGET_LINK_LIBRARIES( tomahawklib
${LINK_LIBRARIES}
)
add_subdirectory( widgets )
INSTALL( TARGETS tomahawklib
EXPORT TomahawkLibraryDepends
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@ -93,7 +93,7 @@ private:
};
class LoadingSpinner : public AnimatedSpinner
class DLLEXPORT LoadingSpinner : public AnimatedSpinner
{
Q_OBJECT

View File

@ -20,14 +20,16 @@
#ifndef RECENTLPLAYLISTSMODEL_H
#define RECENTLPLAYLISTSMODEL_H
#include <QModelIndex>
#include <QTimer>
#include "Playlist.h"
#include "Source.h"
#include "database/DatabaseCommand_LoadAllSortedPlaylists.h"
class RecentPlaylistsModel : public QAbstractListModel
#include <QModelIndex>
#include <QTimer>
#include "DllMacro.h"
class DLLEXPORT RecentPlaylistsModel : public QAbstractListModel
{
Q_OBJECT
public:

View File

@ -20,6 +20,9 @@
#include "sourcetree/SourcesModel.h"
#include <libtomahawk-widgets/NetworkActivityWidget.h>
#include <libtomahawk-widgets/Dashboard.h>
#include "sourcetree/items/ScriptCollectionItem.h"
#include "sourcetree/items/SourceTreeItem.h"
#include "sourcetree/items/SourceItem.h"
@ -33,8 +36,6 @@
#include "collection/Collection.h"
#include "Source.h"
#include "ViewManager.h"
#include "widgets/NetworkActivityWidget.h"
#include "widgets/Dashboard.h"
#include "GlobalActionManager.h"
#include "DropJob.h"
#include "items/PlaylistItems.h"

View File

@ -21,6 +21,8 @@
#include "SourceItem.h"
#include <libtomahawk-widgets/SocialPlaylistWidget.h>
#include "CategoryItems.h"
#include "database/Database.h"
#include "DropJob.h"
@ -31,7 +33,6 @@
#include "LovedTracksItem.h"
#include "Source.h"
#include "SourceList.h"
#include "widgets/SocialPlaylistWidget.h"
#include "playlist/FlexibleView.h"
#include "playlist/PlaylistView.h"
#include "playlist/RecentlyAddedModel.h"