From 34a20ba610fa241b9634b21a535b33612052ed3f Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 21 Aug 2009 18:36:18 +0200 Subject: [PATCH] Added new WelcomeScreen widget The new WelcomeScreen widget is intended to be shown after startup by default. It allows the user to choose how to start the session, i.e. shows a list of recently edited projects, a list of new stuff at the Sharing Platform as well as some help related information and links. --- data/themes/default/ListArrow.png | Bin 0 -> 484 bytes data/themes/default/style.css | 24 +- include/WelcomeScreen.h | 57 ++++ src/gui/WelcomeScreen.cpp | 140 +++++++++ src/gui/dialogs/WelcomeScreen.ui | 462 ++++++++++++++++++++++++++++++ 5 files changed, 682 insertions(+), 1 deletion(-) create mode 100644 data/themes/default/ListArrow.png create mode 100644 include/WelcomeScreen.h create mode 100644 src/gui/WelcomeScreen.cpp create mode 100644 src/gui/dialogs/WelcomeScreen.ui diff --git a/data/themes/default/ListArrow.png b/data/themes/default/ListArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..9ad96e5bfa580011bd74cd5cefe56853b40c9b78 GIT binary patch literal 484 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01^HG01^HHlaKtv00007bV*G`2iXV{ z4ILlxg{Dma000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0003$Nkl}eEC@3TnwNQvfnt^RWL1+)q1N0(2N>33aL_xS>ilssdYGD#t z82iE8vix`ZU^}`7op0yPncuy4hULo@>GUcU!>{J77955pW;7TuD#7D&$Q#}zUQilM zTqbjbF$n+=^oq>wwDV%AT0^c_xz+`V2A9L3b!MHJ;s)l=n=Kg005!-^0uG4E9u^HFX&_A aOa1`Mt97NO0Z?lI0000 + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program 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 2 of the License, or (at your option) any later version. + * + * This program 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 this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _WELCOME_SCREEN_H +#define _WELCOME_SCREEN_H + +#include + + +namespace Ui { class WelcomeScreen; } +class QListWidgetItem; + + +class WelcomeScreen : public QWidget +{ + Q_OBJECT +public: + WelcomeScreen( QWidget * _parent ); + ~WelcomeScreen(); + + +private slots: + void createNewProject(); + void importProject(); + void openTutorial(); + void instantMidiAction(); + void openOnlineResource( QListWidgetItem * _item ); + + +private: + Ui::WelcomeScreen * ui; + +} ; + +#endif + diff --git a/src/gui/WelcomeScreen.cpp b/src/gui/WelcomeScreen.cpp new file mode 100644 index 000000000..cc57ec51f --- /dev/null +++ b/src/gui/WelcomeScreen.cpp @@ -0,0 +1,140 @@ +/* + * WelcomeScreen.cpp - implementation of WelcomeScreen + * + * Copyright (c) 2009 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program 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 2 of the License, or (at your option) any later version. + * + * This program 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 this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include + +#include "WelcomeScreen.h" +#include "RecentResourceListModel.h" +#include "engine.h" +#include "embed.h" + +#include "ui_WelcomeScreen.h" + + + +WelcomeScreen::WelcomeScreen( QWidget * _parent ) : + QWidget( _parent ), + ui( new Ui::WelcomeScreen ) +{ + ui->setupUi( this ); + + // polish UI + foreach( QPushButton * btn, + ui->WelcomeFrame->findChildren() ) + { + btn->setText( " " + btn->text() + " " ); + } + + ui->iconLabel->setPixmap( embed::getIconPixmap( "icon" ) ); + ui->newProjectButton->setIcon( + embed::getIconPixmap( "project_new_from_template" ) ); + ui->importProjectButton->setIcon( + embed::getIconPixmap( "project_import" ) ); + ui->openTutorialButton->setIcon( + embed::getIconPixmap( "help" ) ); + ui->instantMidiActionButton->setIcon( + embed::getIconPixmap( "instrument_track" ) ); + + // connect signals of buttons + connect( ui->newProjectButton, SIGNAL( clicked() ), + this, SLOT( createNewProject() ) ); + connect( ui->importProjectButton, SIGNAL( clicked() ), + this, SLOT( importProject() ) ); + connect( ui->openTutorialButton, SIGNAL( clicked() ), + this, SLOT( openTutorial() ) ); + connect( ui->instantMidiActionButton, SIGNAL( clicked() ), + this, SLOT( instantMidiAction() ) ); + + // setup recent projects list view + RecentResourceListModel * recentProjectsModel = + new RecentResourceListModel( engine::workingDirResourceDB(), -1, this ); + recentProjectsModel->resourceListModel()-> + setTypeFilter( ResourceItem::TypeProject ); + ui->recentProjectsListView->setModel( recentProjectsModel ); + + // setup recent community resources list view + RecentResourceListModel * recentCommunityResourcesModel = + new RecentResourceListModel( engine::webResourceDB(), 100, this ); + ui->communityResourcesListView->setModel( recentCommunityResourcesModel ); + + // setup online resources list widget + for( int i = 0; i < ui->onlineResourcesListWidget->count(); ++i ) + { + ui->onlineResourcesListWidget->item( i )->setIcon( + embed::getIconPixmap( "ListArrow" ) ); + } + + connect( ui->onlineResourcesListWidget, + SIGNAL( itemClicked( QListWidgetItem * ) ), + this, SLOT( openOnlineResource( QListWidgetItem * ) ) ); +} + + + + +WelcomeScreen::~WelcomeScreen() +{ +} + + + + +void WelcomeScreen::createNewProject() +{ +} + + + + +void WelcomeScreen::importProject() +{ +} + + + + +void WelcomeScreen::openTutorial() +{ +} + + + + +void WelcomeScreen::instantMidiAction() +{ +} + + + + +void WelcomeScreen::openOnlineResource( QListWidgetItem * _item ) +{ + // the URL to be opened is encoded in status tip (no other + // possibility to store such information in Qt Designer) + QDesktopServices::openUrl( _item->statusTip() ); +} + + +#include "moc_WelcomeScreen.cxx" + diff --git a/src/gui/dialogs/WelcomeScreen.ui b/src/gui/dialogs/WelcomeScreen.ui new file mode 100644 index 000000000..ad366c872 --- /dev/null +++ b/src/gui/dialogs/WelcomeScreen.ui @@ -0,0 +1,462 @@ + + + WelcomeScreen + + + + 0 + 0 + 767 + 664 + + + + + + + + 4 + + + 24 + + + 8 + + + 24 + + + 10 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 24 + 75 + true + + + + Welcome to LMMS + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 10 + 16 + + + + + + + + 24 + + + 24 + + + + + New project + + + + 24 + 24 + + + + + + + + Import project + + + + 24 + 24 + + + + + + + + Open tutorial + + + + 24 + 24 + + + + + + + + Instant MIDI action + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 24 + + + + + + + + 4 + + + 10 + + + + + + 18 + + + + Recent projects + + + + + + + + 18 + + + + Recent community resources + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 20 + + + + + + + + + 18 + + + + Did you know...? + + + + + + + QFrame::NoFrame + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Linux Biolinum O'; font-size:12pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> + + + + + + + + 18 + + + + Online resources + + + + + + + QFrame::NoFrame + + + 4 + + + + Users forum + + + http://sourceforge.net/apps/phpbb/lmms/ + + + + + Online manual + + + http://lmms.sourceforge.net/wiki/NewManual + + + + + Wiki + + + http://lmms.sourceforge.net/wiki/ + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + + 16 + 16 + + + + QAbstractItemView::ScrollPerPixel + + + + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + + 16 + 16 + + + + QAbstractItemView::ScrollPerPixel + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 16 + 16 + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 16 + 16 + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 16 + 16 + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 16 + 16 + + + + + + + + +