QuickLoadDialog: initial version

This commit introduces initial version of the QuickLoadDialog.
It's a simple dialog with a filter line-edit as well as a ListView
showing all (filtered) ResourceItem's. Once integrated properly it'll
allow to quickly load a specific resource into current context, e.g. a
sample into AudioFileProcessor or a MIDI file into SongEditor.
This commit is contained in:
Tobias Doerffel
2009-08-18 00:23:55 +02:00
parent cc987b2e6a
commit 562688e845
3 changed files with 229 additions and 0 deletions

48
include/QuickLoadDialog.h Normal file
View File

@@ -0,0 +1,48 @@
/*
* QuickLoadDialog.h - header file for QuickLoadDialog
*
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 _QUICK_LOAD_DIALOG_H
#define _QUICK_LOAD_DIALOG_H
#include <QtGui/QDialog>
namespace Ui { class QuickLoadDialog; }
class ResourceListModel;
class QuickLoadDialog : public QDialog
{
public:
QuickLoadDialog( QWidget * _parent );
~QuickLoadDialog();
private:
Ui::QuickLoadDialog * ui;
ResourceListModel * m_listModel;
} ;
#endif

View File

@@ -0,0 +1,61 @@
/*
* QuickLoadDialog.cpp - implementation of QuickLoadDialog
*
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 "QuickLoadDialog.h"
#include "ResourceListModel.h"
#include "UnifiedResourceProvider.h"
#include "engine.h"
#include "ui_QuickLoadDialog.h"
QuickLoadDialog::QuickLoadDialog( QWidget * _parent ) :
QDialog( _parent ),
ui( new Ui::QuickLoadDialog ),
m_listModel( new ResourceListModel(
engine::resourceProvider()->database(), this ) )
{
ui->setupUi( this );
// setup list view to display our model
ui->resourceListView->setModel( m_listModel );
ui->resourceListView->selectionModel()->select(
m_listModel->index( 0, 0 ),
QItemSelectionModel::SelectCurrent );
// connect filter edit with model
connect( ui->filterEdit, SIGNAL( textChanged( const QString & ) ),
m_listModel, SLOT( setFilter( const QString & ) ) );
}
QuickLoadDialog::~QuickLoadDialog()
{
delete m_listModel;
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QuickLoadDialog</class>
<widget class="QDialog" name="QuickLoadDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>546</height>
</rect>
</property>
<property name="windowTitle">
<string>Load resource</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Resource type:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLineEdit" name="filterEdit"/>
</item>
<item>
<widget class="QListView" name="resourceListView">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>filterEdit</tabstop>
<tabstop>resourceListView</tabstop>
<tabstop>comboBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QuickLoadDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QuickLoadDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>