Skip to content
Permalink
Browse files

rename QgsFilePickerWidget to QgsFileWidget

  • Loading branch information
3nids committed Jan 15, 2016
1 parent 36157d4 commit c063838f52a3ea19696bd09bfa1b2070e02ea3ec
@@ -73,7 +73,7 @@
%Include qgsfieldproxymodel.sip
%Include qgsfieldvalidator.sip
%Include qgsfiledropedit.sip
%Include qgsfilepickerwidget.sip
%Include qgsfilewidget.sip
%Include qgsfilterlineedit.sip
%Include qgsformannotationitem.sip
%Include qgsgenericprojectionselector.sip
@@ -7,16 +7,19 @@ class QgsExternalResourceWidget : QWidget

public:

enum DocumentViewerContent
enum DocumentViewerContent
{
NoContent,
Image,
Web
};

explicit QgsExternalResourceWidget( QWidget* parent /TransferThis/ );

~QgsExternalResourceWidget();
/**
* @brief QgsExternalResourceWidget creates a widget with a file widget and a document viewer
* Both part of the widget are optional.
* @see QgsFileWidget
*/
explicit QgsExternalResourceWidget( QWidget *parent = 0 );

/**
* @brief documentPath returns the path of the current document in the widget
@@ -25,30 +28,38 @@ class QgsExternalResourceWidget : QWidget
QVariant documentPath( QVariant::Type type = QVariant::String ) const;
void setDocumentPath( QVariant documentPath );

//! access the file picker widget to allow its configuration
QgsFilePickerWidget* filePickerwidget();
//! access the file widget to allow its configuration
QgsFileWidget* fileWidget();

//! returns if the file picker is visible in the widget
bool filePickerVisible() const;
//! set the visiblity of the file picker in the widget
void setFilePickerVisible( bool visible );
//! returns if the file widget is visible in the widget
bool fileWidgetVisible() const;
//! set the visiblity of the file widget in the layout
void setFileWidgetVisible( bool visible );

//! returns the type of content used in the document viewer
QgsExternalResourceWidget::DocumentViewerContent documentViewerContent() const;
//! setDocumentViewerContent defines the type of content to be shown. Widget will be adapated accordingly
void setDocumentViewerContent( QgsExternalResourceWidget::DocumentViewerContent content );

//! set the configuration of the document viewer
//! returns the height of the document viewer
int documentViewerHeight() const;
/**
* @brief setDocumentViewerWidth set the height of the document viewer.
* @param height the height. Use 0 for automatic best display.
*/
void setDocumentViewerHeight( int height );
//! returns the width of the document viewer
int documentViewerWidth() const ;
/**
* @brief setDocumentViewerWidth set the width of the document viewer.
* @param width the width. Use 0 for automatic best display.
*/
void setDocumentViewerWidth( int width );

//! defines if the widget is readonly
void setReadOnly( bool readOnly );

signals:
//! emitteed as soon as the current document changes
void valueChanged( QString );


};
@@ -1,8 +1,8 @@

class QgsFilePickerWidget : QWidget
class QgsFileWidget : QWidget
{
%TypeHeaderCode
#include <qgsfilepickerwidget.h>
#include <qgsfilewidget.h>
%End

public:
@@ -20,9 +20,9 @@ class QgsFilePickerWidget : QWidget
RelativeDefaultPath
};

explicit QgsFilePickerWidget( QWidget* parent /TransferThis/ );
explicit QgsFileWidget( QWidget* parent /TransferThis/ );

~QgsFilePickerWidget();
~QgsFileWidget();

//! Returns the current file path
QString filePath();
@@ -50,9 +50,9 @@ class QgsFilePickerWidget : QWidget
void setFilter( const QString &filter );

//! determines if the tool button is shown
bool filePickerButtonVisible() const;
bool fileWidgetButtonVisible() const;
//! determines if the tool button is shown
void setFilePickerButtonVisible( bool visible );
void setFileWidgetButtonVisible( bool visible );

//! determines if the file path will be shown as a link
bool useLink() const;
@@ -68,12 +68,12 @@ class QgsFilePickerWidget : QWidget
void setDefaultRoot( QString defaultRoot );

//! determines the storage mode (i.e. file or directory)
QgsFilePickerWidget::StorageMode storageMode() const;
void setStorageMode( QgsFilePickerWidget::StorageMode storageMode );
QgsFileWidget::StorageMode storageMode() const;
void setStorageMode( QgsFileWidget::StorageMode storageMode );

//! determines if the relative path is with respect to the project path or the default path
QgsFilePickerWidget::RelativeStorage relativeStorage() const;
void setRelativeStorage( QgsFilePickerWidget::RelativeStorage relativeStorage );
QgsFileWidget::RelativeStorage relativeStorage() const;
void setRelativeStorage( QgsFileWidget::RelativeStorage relativeStorage );

signals:
void fileChanged( QString );
@@ -34,7 +34,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsexternalresourcewidgetplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsfilepickerwidgetplugin.cpp
qgsfilewidgetplugin.cpp
qgsfilterlineeditplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsprojectionselectionwidgetplugin.cpp
@@ -58,7 +58,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsexternalresourcewidgetplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilepickerwidgetplugin.h
qgsfilewidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
@@ -88,7 +88,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsexternalresourcewidgetplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilepickerwidgetplugin.h
qgsfilewidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
@@ -1,5 +1,5 @@
/***************************************************************************
qgsfilepickerwidgetplugin.cpp
qgsfilewidgetplugin.cpp
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 Denis Rouzaud
@@ -14,52 +14,52 @@
***************************************************************************/

#include "qgiscustomwidgets.h"
#include "qgsfilepickerwidgetplugin.h"
#include "qgsfilepickerwidget.h"
#include "qgsfilewidgetplugin.h"
#include "qgsfilewidget.h"


QgsFilePickerWidgetPlugin::QgsFilePickerWidgetPlugin( QObject *parent )
QgsFileWidgetPlugin::QgsFileWidgetPlugin( QObject *parent )
: QObject( parent )
, mInitialized( false )
{
}

QString QgsFilePickerWidgetPlugin::name() const
QString QgsFileWidgetPlugin::name() const
{
return "QgsFilePickerWidget";
return "QgsFileWidget";
}

QString QgsFilePickerWidgetPlugin::group() const
QString QgsFileWidgetPlugin::group() const
{
return QgisCustomWidgets::groupName();
}

QString QgsFilePickerWidgetPlugin::includeFile() const
QString QgsFileWidgetPlugin::includeFile() const
{
return "qgsfilepickerwidget.h";
return "qgsfilewidget.h";
}

QIcon QgsFilePickerWidgetPlugin::icon() const
QIcon QgsFileWidgetPlugin::icon() const
{
return QIcon( ":/images/icons/qgis-icon-60x60.png" );
}

bool QgsFilePickerWidgetPlugin::isContainer() const
bool QgsFileWidgetPlugin::isContainer() const
{
return false;
}

QWidget *QgsFilePickerWidgetPlugin::createWidget( QWidget *parent )
QWidget *QgsFileWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsFilePickerWidget( parent );
return new QgsFileWidget( parent );
}

bool QgsFilePickerWidgetPlugin::isInitialized() const
bool QgsFileWidgetPlugin::isInitialized() const
{
return mInitialized;
}

void QgsFilePickerWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
void QgsFileWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
{
Q_UNUSED( core );
if ( mInitialized )
@@ -68,20 +68,20 @@ void QgsFilePickerWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
}


QString QgsFilePickerWidgetPlugin::toolTip() const
QString QgsFileWidgetPlugin::toolTip() const
{
return "";
}

QString QgsFilePickerWidgetPlugin::whatsThis() const
QString QgsFileWidgetPlugin::whatsThis() const
{
return "";
}

QString QgsFilePickerWidgetPlugin::domXml() const
QString QgsFileWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mQgsFilePickerWidget\">\n"
" <widget class=\"%1\" name=\"mQgsFileWidget\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
@@ -1,5 +1,5 @@
/***************************************************************************
qgsfilepickerwidgetplugin.h
qgsfilewidgetplugin.h
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 Denis Rouzaud
@@ -13,8 +13,8 @@
* *
***************************************************************************/

#ifndef QGSFILEPICKERWIDGETPLUGIN_H
#define QGSFILEPICKERWIDGETPLUGIN_H
#ifndef QGSFILEWIDGETPLUGIN_H
#define QGSFILEWIDGETPLUGIN_H


#include <QtGlobal>
@@ -27,13 +27,13 @@
#endif


class CUSTOMWIDGETS_EXPORT QgsFilePickerWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
class CUSTOMWIDGETS_EXPORT QgsFileWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES( QDesignerCustomWidgetInterface )

public:
explicit QgsFilePickerWidgetPlugin( QObject *parent = 0 );
explicit QgsFileWidgetPlugin( QObject *parent = 0 );

private:
bool mInitialized;
@@ -52,4 +52,4 @@ class CUSTOMWIDGETS_EXPORT QgsFilePickerWidgetPlugin : public QObject, public QD
QString whatsThis() const override;
QString domXml() const override;
};
#endif // QGSFILEPICKERWIDGETPLUGIN_H
#endif // QGSFILEWIDGETPLUGIN_H
@@ -198,7 +198,7 @@ SET(QGIS_GUI_SRCS
qgsfieldproxymodel.cpp
qgsfieldvalidator.cpp
qgsfiledropedit.cpp
qgsfilepickerwidget.cpp
qgsfilewidget.cpp
qgsfilterlineedit.cpp
qgsformannotationitem.cpp
qgsgenericprojectionselector.cpp
@@ -338,7 +338,7 @@ SET(QGIS_GUI_MOC_HDRS
qgsfieldproxymodel.h
qgsfieldvalidator.h
qgsfiledropedit.h
qgsfilepickerwidget.h
qgsfilewidget.h
qgsfilterlineedit.h
qgsformannotationitem.h
qgsgenericprojectionselector.h
@@ -43,13 +43,13 @@ QgsExternalResourceConfigDlg::QgsExternalResourceConfigDlg( QgsVectorLayer* vl,
connect( mRelativeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( enableRelative( bool ) ) );

// set ids for StorageTypeButtons
mStorageButtonGroup->setId( mStoreFilesButton, QgsFilePickerWidget::GetFile );
mStorageButtonGroup->setId( mStoreDirsButton, QgsFilePickerWidget::GetDirectory );
mStorageButtonGroup->setId( mStoreFilesButton, QgsFileWidget::GetFile );
mStorageButtonGroup->setId( mStoreDirsButton, QgsFileWidget::GetDirectory );
mStoreFilesButton->setChecked( true );

// set ids for RelativeButtons
mRelativeButtonGroup->setId( mRelativeProject, QgsFilePickerWidget::RelativeProject );
mRelativeButtonGroup->setId( mRelativeDefault, QgsFilePickerWidget::RelativeDefaultPath );
mRelativeButtonGroup->setId( mRelativeProject, QgsFileWidget::RelativeProject );
mRelativeButtonGroup->setId( mRelativeDefault, QgsFileWidget::RelativeDefaultPath );
mRelativeProject->setChecked( true );

mDocumentViewerContentComboBox->addItem( tr( "Image" ), QgsExternalResourceWidget::Image );
@@ -109,9 +109,9 @@ QgsEditorWidgetConfig QgsExternalResourceConfigDlg::config()
{
QgsEditorWidgetConfig cfg;

cfg.insert( "FilePicker", mFilePickerGroupBox->isChecked() );
cfg.insert( "FilePickerButton", mFilePickerButtonGroupBox->isChecked() );
cfg.insert( "FilePickerFilter", mFilePickerFilterLineEdit->text() );
cfg.insert( "FileWidget", mFileWidgetGroupBox->isChecked() );
cfg.insert( "FileWidgetButton", mFileWidgetButtonGroupBox->isChecked() );
cfg.insert( "FileWidgetFilter", mFileWidgetFilterLineEdit->text() );

if ( mUseLink->isChecked() )
{
@@ -135,7 +135,7 @@ QgsEditorWidgetConfig QgsExternalResourceConfigDlg::config()
}
else
{
cfg.insert( "RelativeStorage", ( int )QgsFilePickerWidget::Absolute );
cfg.insert( "RelativeStorage", ( int )QgsFileWidget::Absolute );
}

if ( mDocumentViewerGroupBox->isChecked() )
@@ -155,17 +155,17 @@ QgsEditorWidgetConfig QgsExternalResourceConfigDlg::config()

void QgsExternalResourceConfigDlg::setConfig( const QgsEditorWidgetConfig& config )
{
if ( config.contains( "FilePicker" ) )
if ( config.contains( "FileWidget" ) )
{
mFilePickerGroupBox->setChecked( config.value( "FilePicker" ).toBool() );
mFileWidgetGroupBox->setChecked( config.value( "FileWidget" ).toBool() );
}
if ( config.contains( "FilePicker" ) )
if ( config.contains( "FileWidget" ) )
{
mFilePickerButtonGroupBox->setChecked( config.value( "FilePickerButton" ).toBool() );
mFileWidgetButtonGroupBox->setChecked( config.value( "FileWidgetButton" ).toBool() );
}
if ( config.contains( "FilePickerFilter" ) )
if ( config.contains( "FileWidgetFilter" ) )
{
mFilePickerFilterLineEdit->setText( config.value( "Filter" ).toString() );
mFileWidgetFilterLineEdit->setText( config.value( "Filter" ).toString() );
}

if ( config.contains( "UseLink" ) )
@@ -184,7 +184,7 @@ void QgsExternalResourceConfigDlg::setConfig( const QgsEditorWidgetConfig& confi
if ( config.contains( "RelativeStorage" ) )
{
int relative = config.value( "RelativeStorage" ).toInt();
if (( QgsFilePickerWidget::RelativeStorage )relative == QgsFilePickerWidget::Absolute )
if (( QgsFileWidget::RelativeStorage )relative == QgsFileWidget::Absolute )
{
mRelativeGroupBox->setChecked( false );
}

0 comments on commit c063838

Please sign in to comment.
You can’t perform that action at this time.