From 6c26659030935c1f22daa5a8bb69f43ca94dd72b Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" <uwelk@xhochy.com> Date: Fri, 6 Jun 2014 14:29:07 +0100 Subject: [PATCH] Add skeleton What's New page --- src/viewpages/whatsnew_0_8/CMakeLists.txt | 10 ++ .../whatsnew_0_8/WhatsNewWidget_0_8.ui | 117 ++++++++++++++ src/viewpages/whatsnew_0_8/WhatsNew_0_8.cpp | 145 ++++++++++++++++++ src/viewpages/whatsnew_0_8/WhatsNew_0_8.h | 99 ++++++++++++ 4 files changed, 371 insertions(+) create mode 100644 src/viewpages/whatsnew_0_8/CMakeLists.txt create mode 100644 src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui create mode 100644 src/viewpages/whatsnew_0_8/WhatsNew_0_8.cpp create mode 100644 src/viewpages/whatsnew_0_8/WhatsNew_0_8.h diff --git a/src/viewpages/whatsnew_0_8/CMakeLists.txt b/src/viewpages/whatsnew_0_8/CMakeLists.txt new file mode 100644 index 000000000..dc3ae1ab5 --- /dev/null +++ b/src/viewpages/whatsnew_0_8/CMakeLists.txt @@ -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 +) diff --git a/src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui b/src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui new file mode 100644 index 000000000..74c3de421 --- /dev/null +++ b/src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui @@ -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> diff --git a/src/viewpages/whatsnew_0_8/WhatsNew_0_8.cpp b/src/viewpages/whatsnew_0_8/WhatsNew_0_8.cpp new file mode 100644 index 000000000..d2d081776 --- /dev/null +++ b/src/viewpages/whatsnew_0_8/WhatsNew_0_8.cpp @@ -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 ) diff --git a/src/viewpages/whatsnew_0_8/WhatsNew_0_8.h b/src/viewpages/whatsnew_0_8/WhatsNew_0_8.h new file mode 100644 index 000000000..3caf78b6b --- /dev/null +++ b/src/viewpages/whatsnew_0_8/WhatsNew_0_8.h @@ -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