HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent) { HistoryManager *history = setHistory; if (!history) history = BrowserApplication::historyManager(); setupUi(this); tree->setUniformRowHeights(true); tree->setSelectionBehavior(QAbstractItemView::SelectRows); tree->setTextElideMode(Qt::ElideMiddle); QAbstractItemModel *model = history->historyTreeModel(); TreeProxyModel *proxyModel = new TreeProxyModel(this); connect(search, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString))); connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne())); connect(removeAllButton, SIGNAL(clicked()), history, SLOT(clear())); proxyModel->setSourceModel(model); tree->setModel(proxyModel); tree->setExpanded(proxyModel->index(0, 0), true); tree->setAlternatingRowColors(true); QFontMetrics fm(font()); int header = fm.width(QLatin1Char('m')) * 40; tree->header()->resizeSection(0, header); tree->header()->setStretchLastSection(true); connect(tree, SIGNAL(activated(QModelIndex)), this, SLOT(open())); tree->setContextMenuPolicy(Qt::CustomContextMenu); connect(tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint))); }
WhatsHotWidget::WhatsHotWidget( QWidget* parent ) : QWidget( parent ) , ui( new Ui::WhatsHotWidget ) , m_sortedProxy( 0 ) , m_workerThread( 0 ) { ui->setupUi( this ); ui->albumsView->setFrameShape( QFrame::NoFrame ); ui->albumsView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); TomahawkUtils::unmarginLayout( layout() ); TomahawkUtils::unmarginLayout( ui->stackLeft->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout_2->layout() ); TomahawkUtils::unmarginLayout( ui->breadCrumbLeft->layout() ); TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); m_crumbModelLeft = new QStandardItemModel( this ); m_sortedProxy = new QSortFilterProxyModel( this ); m_sortedProxy->setDynamicSortFilter( true ); m_sortedProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); ui->breadCrumbLeft->setRootIcon( QPixmap( RESPATH "images/charts.png" ) ); connect( ui->breadCrumbLeft, SIGNAL( activateIndex( QModelIndex ) ), SLOT( leftCrumbIndexChanged(QModelIndex) ) ); ui->tracksViewLeft->setFrameShape( QFrame::NoFrame ); ui->tracksViewLeft->setAttribute( Qt::WA_MacShowFocusRect, 0 ); ui->tracksViewLeft->overlay()->setEnabled( false ); ui->tracksViewLeft->setHeaderHidden( true ); ui->tracksViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); TreeProxyModel* artistsProxy = new TreeProxyModel( ui->artistsViewLeft ); artistsProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); artistsProxy->setDynamicSortFilter( true ); ui->artistsViewLeft->setProxyModel( artistsProxy ); ui->artistsViewLeft->setFrameShape( QFrame::NoFrame ); ui->artistsViewLeft->setAttribute( Qt::WA_MacShowFocusRect, 0 ); ui->artistsViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->artistsViewLeft->header()->setVisible( true ); m_playlistInterface = Tomahawk::playlistinterface_ptr( new ChartsPlaylistInterface( this ) ); m_workerThread = new QThread( this ); m_workerThread->start(); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); QTimer::singleShot( 0, this, SLOT( fetchData() ) ); }
WhatsHotWidget::WhatsHotWidget( QWidget* parent ) : QWidget( parent ) , ui( new Ui::WhatsHotWidget ) , m_sortedProxy( 0 ) , m_workerThread( 0 ) { ui->setupUi( this ); TomahawkUtils::unmarginLayout( layout() ); TomahawkUtils::unmarginLayout( ui->stackLeft->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout_2->layout() ); TomahawkUtils::unmarginLayout( ui->breadCrumbLeft->layout() ); TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); m_crumbModelLeft = new QStandardItemModel( this ); m_sortedProxy = new QSortFilterProxyModel( this ); m_sortedProxy->setDynamicSortFilter( true ); m_sortedProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); ui->breadCrumbLeft->setRootIcon( QPixmap( RESPATH "images/charts.png" ) ); connect( ui->breadCrumbLeft, SIGNAL( activateIndex( QModelIndex ) ), SLOT( leftCrumbIndexChanged(QModelIndex) ) ); ui->tracksViewLeft->setHeaderHidden( true ); ui->tracksViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); PlaylistChartItemDelegate* del = new PlaylistChartItemDelegate( ui->tracksViewLeft, ui->tracksViewLeft->proxyModel() ); connect( del, SIGNAL( updateRequest( QModelIndex ) ), ui->tracksViewLeft, SLOT( update( QModelIndex ) ) ); ui->tracksViewLeft->setItemDelegate( del ); ui->tracksViewLeft->setUniformRowHeights( false ); TreeProxyModel* artistsProxy = new TreeProxyModel( ui->artistsViewLeft ); artistsProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); artistsProxy->setDynamicSortFilter( true ); ui->artistsViewLeft->setProxyModel( artistsProxy ); ui->artistsViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->artistsViewLeft->header()->setVisible( true ); m_playlistInterface = Tomahawk::playlistinterface_ptr( new ChartsPlaylistInterface( this ) ); m_workerThread = new QThread( this ); m_workerThread->start(); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); }
WhatsHotWidget::WhatsHotWidget( QWidget* parent ) : QWidget( parent ) , ui( new Ui::WhatsHotWidget ) , m_sortedProxy( 0 ) , m_workerThread( 0 ) , m_spinner( 0 ) , m_loading( true ) { ui->setupUi( this ); TomahawkUtils::unmarginLayout( layout() ); TomahawkUtils::unmarginLayout( ui->stackLeft->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout->layout() ); TomahawkUtils::unmarginLayout( ui->horizontalLayout_2->layout() ); TomahawkUtils::unmarginLayout( ui->breadCrumbLeft->layout() ); TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); m_crumbModelLeft = new QStandardItemModel( this ); m_sortedProxy = new QSortFilterProxyModel( this ); m_sortedProxy->setDynamicSortFilter( true ); m_sortedProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); ui->breadCrumbLeft->setRootIcon( TomahawkUtils::defaultPixmap( TomahawkUtils::Charts, TomahawkUtils::Original ) ); connect( ui->breadCrumbLeft, SIGNAL( activateIndex( QModelIndex ) ), SLOT( leftCrumbIndexChanged( QModelIndex ) ) ); ui->tracksViewLeft->setHeaderHidden( true ); ui->tracksViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); PlaylistChartItemDelegate* del = new PlaylistChartItemDelegate( ui->tracksViewLeft, ui->tracksViewLeft->proxyModel() ); ui->tracksViewLeft->setPlaylistItemDelegate( del ); ui->tracksViewLeft->setUniformRowHeights( false ); TreeProxyModel* artistsProxy = new TreeProxyModel( ui->artistsViewLeft ); artistsProxy->setFilterCaseSensitivity( Qt::CaseInsensitive ); artistsProxy->setDynamicSortFilter( true ); ui->artistsViewLeft->setProxyModel( artistsProxy ); ui->artistsViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->artistsViewLeft->header()->setVisible( true ); m_workerThread = new QThread( this ); m_workerThread->start(); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) ); // Read last viewed charts, to be used as defaults m_currentVIds = TomahawkSettings::instance()->lastChartIds(); tDebug( LOGVERBOSE ) << "Re-loading last chartIds:" << m_currentVIds; MetaPlaylistInterface* mpl = new MetaPlaylistInterface(); mpl->addChildInterface( ui->tracksViewLeft->playlistInterface() ); mpl->addChildInterface( ui->artistsViewLeft->proxyModel()->playlistInterface() ); mpl->addChildInterface( ui->albumsView->playlistInterface() ); m_playlistInterface = playlistinterface_ptr( mpl ); // Lets have a spinner until loaded ui->breadCrumbLeft->setVisible( false ); ui->stackLeft->setCurrentIndex( 2 ); m_spinner = new AnimatedSpinner( ui->albumsView ); m_spinner->fadeIn(); }