Added EditResourceLocationDialog
The EditResourceLocationDialog class provides a dialog for editing a certain ResourceLocation.
This commit is contained in:
69
include/EditResourceLocationDialog.h
Normal file
69
include/EditResourceLocationDialog.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* EditResourceLocationDialog.h - header file for EditResourceLocationDialog
|
||||
*
|
||||
* Copyright (c) 2010 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 _EDIT_RESOURCE_LOCATION_DIALOG_H
|
||||
#define _EDIT_RESOURCE_LOCATION_DIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
#include "ResourceLocation.h"
|
||||
|
||||
namespace Ui { class EditResourceLocationDialog; }
|
||||
|
||||
/*! \brief The EditResourceLocationDialog class provides a dialog for editing
|
||||
* a certain ResourceLocation.
|
||||
*/
|
||||
|
||||
class EditResourceLocationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*! \brief Constructs an EditResourceLocationDialog.
|
||||
* \param location A ResourceLocation object
|
||||
*/
|
||||
EditResourceLocationDialog(
|
||||
const ResourceLocation & location = ResourceLocation() );
|
||||
|
||||
/*! \brief Destroys the EditResourceLocationDialog. */
|
||||
virtual ~EditResourceLocationDialog();
|
||||
|
||||
/*! \brief Returns a ResourceLocation object based on user input. */
|
||||
const ResourceLocation & location() const
|
||||
{
|
||||
return m_location;
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void updateAndCheckInput();
|
||||
|
||||
|
||||
private:
|
||||
Ui::EditResourceLocationDialog * ui;
|
||||
ResourceLocation m_location;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
82
src/gui/Dialogs/EditResourceLocationDialog.cpp
Normal file
82
src/gui/Dialogs/EditResourceLocationDialog.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* EditResourceLocationDialog.cpp - implementation of EditResourceLocationDialog
|
||||
*
|
||||
* Copyright (c) 2010 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 <QtGui/QPushButton>
|
||||
|
||||
#include "EditResourceLocationDialog.h"
|
||||
#include "MainWindow.h"
|
||||
#include "engine.h"
|
||||
|
||||
#include "ui_EditResourceLocationDialog.h"
|
||||
|
||||
|
||||
|
||||
EditResourceLocationDialog::EditResourceLocationDialog(
|
||||
const ResourceLocation & location ) :
|
||||
QDialog( engine::mainWindow() ),
|
||||
ui( new Ui::EditResourceLocationDialog ),
|
||||
m_location( location )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
ui->nameEdit->setText( m_location.name() );
|
||||
ui->typeComboBox->setCurrentIndex(
|
||||
m_location.type() != ResourceLocation::Unknown ?
|
||||
m_location.type() : ResourceLocation::LocalDirectory );
|
||||
ui->addressEdit->setText( m_location.address() );
|
||||
|
||||
connect( ui->nameEdit, SIGNAL( textChanged( const QString & ) ),
|
||||
this, SLOT( updateAndCheckInput() ) );
|
||||
connect( ui->typeComboBox, SIGNAL( currentIndexChanged( int ) ),
|
||||
this, SLOT( updateAndCheckInput() ) );
|
||||
connect( ui->addressEdit, SIGNAL( textChanged( const QString & ) ),
|
||||
this, SLOT( updateAndCheckInput() ) );
|
||||
|
||||
updateAndCheckInput();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
EditResourceLocationDialog::~EditResourceLocationDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditResourceLocationDialog::updateAndCheckInput()
|
||||
{
|
||||
m_location.setName( ui->nameEdit->text() );
|
||||
m_location.setType( static_cast<ResourceLocation::Type>(
|
||||
ui->typeComboBox->currentIndex() ) );
|
||||
m_location.setAddress( ui->addressEdit->text() );
|
||||
|
||||
ui->buttonBox->
|
||||
button( QDialogButtonBox::Ok )->setEnabled( m_location.isValid() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "moc_EditResourceLocationDialog.cxx"
|
||||
|
||||
127
src/gui/Forms/EditResourceLocationDialog.ui
Normal file
127
src/gui/Forms/EditResourceLocationDialog.ui
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditResourceLocationDialog</class>
|
||||
<widget class="QDialog" name="EditResourceLocationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>138</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit resource location</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="nameEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="typeComboBox">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Local directory</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Web resource</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="addressEdit"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="browseDirectoryButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<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>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditResourceLocationDialog</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>EditResourceLocationDialog</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>
|
||||
Reference in New Issue
Block a user