1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

Add skeleton What's New page

This commit is contained in:
Uwe L. Korn 2014-06-06 14:29:07 +01:00
parent 076c65e1f8
commit 6c26659030
4 changed files with 371 additions and 0 deletions

View File

@ -0,0 +1,10 @@
tomahawk_add_plugin(whatsnew_0_8
TYPE viewpage
EXPORT_MACRO TOMAHAWK_VIEWPAGE_EXPORT_PRO
SOURCES
WhatsNew_0_8.cpp
UI
WhatsNewWidget_0_8.ui
LINK_LIBRARIES
tomahawk-widgets
)

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WhatsNewWidget_0_8</class>
<widget class="QWidget" name="WhatsNewWidget_0_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>965</width>
<height>616</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>16</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>16</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="trackFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>4</number>
</property>
<property name="leftMargin">
<number>8</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>8</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="lineAbove">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineBelow">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,145 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
*
* 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 "WhatsNew_0_8.h"
#include "ui_WhatsNewWidget_0_8.h"
#include "libtomahawk-widgets/PlaylistDelegate.h"
#include "ViewManager.h"
#include "SourceList.h"
#include "TomahawkSettings.h"
#include "widgets/RecentPlaylistsModel.h"
#include "widgets/RecentlyPlayedPlaylistsModel.h"
#include "MetaPlaylistInterface.h"
#include "audio/AudioEngine.h"
#include "playlist/AlbumModel.h"
#include "playlist/RecentlyPlayedModel.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "widgets/OverlayWidget.h"
#include "widgets/BasicHeader.h"
#include "utils/ImageRegistry.h"
#include "utils/AnimatedSpinner.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
#include "utils/DpiScaler.h"
#include <QPainter>
#include <QScrollArea>
#define HISTORY_PLAYLIST_ITEMS 10
#define HISTORY_TRACK_ITEMS 15
using namespace Tomahawk;
using namespace Tomahawk::Widgets;
WhatsNew_0_8::WhatsNew_0_8( QWidget* parent )
{
}
WhatsNew_0_8::~WhatsNew_0_8()
{
}
WhatsNewWidget_0_8::WhatsNewWidget_0_8( QWidget* parent )
: QWidget( parent )
, ui( new Ui::WhatsNewWidget_0_8 )
{
QWidget* widget = new QWidget;
ui->setupUi( widget );
ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
area->setPalette( pal );
area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame );
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
}
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
ui->widget->setPalette( pal );
ui->widget->setAutoFillBackground( true );
}
}
WhatsNewWidget_0_8::~WhatsNewWidget_0_8()
{
delete ui;
}
playlistinterface_ptr
WhatsNewWidget_0_8::playlistInterface() const
{
return playlistinterface_ptr();
}
bool
WhatsNewWidget_0_8::jumpToCurrentTrack()
{
return false;
}
bool
WhatsNewWidget_0_8::isBeingPlayed() const
{
return false;
}
void
WhatsNewWidget_0_8::changeEvent( QEvent* e )
{
QWidget::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
ui->retranslateUi( this );
break;
default:
break;
}
}
Q_EXPORT_PLUGIN2( ViewPagePlugin, WhatsNew_0_8 )

View File

@ -0,0 +1,99 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
*
* 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 WHATSNEW_0_8_H
#define WHATSNEW_0_8_H
#include "PlaylistInterface.h"
#include "Query.h"
#include "Source.h"
#include "ViewPagePlugin.h"
#include "ViewPageLazyLoader.h"
#include "utils/TomahawkUtilsGui.h"
#include <QWidget>
#include <QListWidgetItem>
#include <QStyledItemDelegate>
#include "../ViewPageDllMacro.h"
class AlbumModel;
class RecentlyPlayedModel;
class OverlayWidget;
class BasicHeader;
namespace Ui
{
class WhatsNewWidget_0_8;
}
namespace Tomahawk
{
namespace Widgets
{
class WhatsNewWidget_0_8 : public QWidget
{
Q_OBJECT
friend class WhatsNew_0_8;
public:
WhatsNewWidget_0_8( QWidget* parent = 0 );
virtual ~WhatsNewWidget_0_8();
virtual bool isBeingPlayed() const;
virtual playlistinterface_ptr playlistInterface() const;
virtual bool jumpToCurrentTrack();
protected:
void changeEvent( QEvent* e );
private:
Ui::WhatsNewWidget_0_8 *ui;
};
const QString WHATSNEW_0_8_VIEWPAGE_NAME = "whatsnew_0_8";
class TOMAHAWK_VIEWPAGE_EXPORT WhatsNew_0_8 : public Tomahawk::ViewPageLazyLoader< WhatsNewWidget_0_8 >
{
Q_OBJECT
Q_INTERFACES( Tomahawk::ViewPagePlugin )
Q_PLUGIN_METADATA( IID "org.tomahawk-player.Player.ViewPagePlugin" )
public:
WhatsNew_0_8( QWidget* parent = 0 );
virtual ~WhatsNew_0_8();
virtual const QString defaultName() { return WHATSNEW_0_8_VIEWPAGE_NAME; }
virtual QString title() const { return tr( "What's new in Tomahawk 0.8?" ); }
virtual QString description() const { return tr( "An overview of the changes and additions since 0.7." ); }
virtual const QString pixmapPath() const { return ( RESPATH "images/dashboard.svg" ); }
virtual int sortValue() { return 1; }
virtual bool showInfoBar() const { return true; }
};
} // Widgets
} // Tomahawk
#endif // WHATSNEW_0_8_H