Skip to content
Permalink
Browse files

Start on GUI work

  • Loading branch information
nyalldawson committed Jan 7, 2020
1 parent 90184a5 commit 591e1a28e02a74250c6a2a4e53d168f3130de537
Showing with 331 additions and 0 deletions.
  1. +1 −0 doc/CMakeLists.txt
  2. +1 −0 python/CMakeLists.txt
  3. +2 −0 python/core/auto_generated/numericformats/qgsbasicnumericformat.sip.in
  4. +2 −0 python/core/auto_generated/numericformats/qgsbearingnumericformat.sip.in
  5. +2 −0 python/core/auto_generated/numericformats/qgscurrencynumericformat.sip.in
  6. +2 −0 python/core/auto_generated/numericformats/qgsfallbacknumericformat.sip.in
  7. +5 −0 python/core/auto_generated/numericformats/qgsnumericformat.sip.in
  8. +5 −0 python/core/auto_generated/numericformats/qgsnumericformatregistry.sip.in
  9. +2 −0 python/core/auto_generated/numericformats/qgspercentagenumericformat.sip.in
  10. +2 −0 python/core/auto_generated/numericformats/qgsscientificnumericformat.sip.in
  11. +46 −0 python/gui/auto_generated/numericformats/qgsnumericformatselectorwidget.sip.in
  12. +1 −0 python/gui/gui_auto.sip
  13. +5 −0 src/core/numericformats/qgsbasicnumericformat.cpp
  14. +1 −0 src/core/numericformats/qgsbasicnumericformat.h
  15. +5 −0 src/core/numericformats/qgsbearingnumericformat.cpp
  16. +1 −0 src/core/numericformats/qgsbearingnumericformat.h
  17. +5 −0 src/core/numericformats/qgscurrencynumericformat.cpp
  18. +1 −0 src/core/numericformats/qgscurrencynumericformat.h
  19. +5 −0 src/core/numericformats/qgsfallbacknumericformat.cpp
  20. +1 −0 src/core/numericformats/qgsfallbacknumericformat.h
  21. +5 −0 src/core/numericformats/qgsnumericformat.h
  22. +9 −0 src/core/numericformats/qgsnumericformatregistry.cpp
  23. +5 −0 src/core/numericformats/qgsnumericformatregistry.h
  24. +5 −0 src/core/numericformats/qgspercentagenumericformat.cpp
  25. +1 −0 src/core/numericformats/qgspercentagenumericformat.h
  26. +5 −0 src/core/numericformats/qgsscientificnumericformat.cpp
  27. +1 −0 src/core/numericformats/qgsscientificnumericformat.h
  28. +6 −0 src/gui/CMakeLists.txt
  29. +64 −0 src/gui/numericformats/qgsnumericformatselectorwidget.cpp
  30. +58 −0 src/gui/numericformats/qgsnumericformatselectorwidget.h
  31. +2 −0 src/ui/CMakeLists.txt
  32. +75 −0 src/ui/numericformats/qgsnumericformatselectorbase.ui
@@ -110,6 +110,7 @@ IF(WITH_APIDOC)
${CMAKE_SOURCE_DIR}/src/gui/layertree
${CMAKE_SOURCE_DIR}/src/gui/layout
${CMAKE_SOURCE_DIR}/src/gui/locator
${CMAKE_SOURCE_DIR}/src/gui/numericformats
${CMAKE_SOURCE_DIR}/src/gui/ogr
${CMAKE_SOURCE_DIR}/src/gui/processing
${CMAKE_SOURCE_DIR}/src/gui/raster
@@ -148,6 +148,7 @@ IF (WITH_GUI)
${CMAKE_SOURCE_DIR}/src/gui/layertree
${CMAKE_SOURCE_DIR}/src/gui/layout
${CMAKE_SOURCE_DIR}/src/gui/locator
${CMAKE_SOURCE_DIR}/src/gui/numericformats
${CMAKE_SOURCE_DIR}/src/gui/processing

${CMAKE_BINARY_DIR}/src/gui
@@ -27,6 +27,8 @@ Default constructor

virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -34,6 +34,8 @@ Default constructor

virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -27,6 +27,8 @@ Default constructor

virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -26,6 +26,8 @@ Default constructor
%End
virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -115,6 +115,11 @@ Default constructor
Returns a unique id for this numeric format.

This id is used to identify this numeric format in the registry with :py:func:`QgsNumericFormatRegistry.format()`
%End

virtual QString visibleName() const = 0;
%Docstring
Returns the translated, user-visible name for this format.
%End

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const = 0;
@@ -80,6 +80,11 @@ Returns a basic numeric formatter which can be used
to represent any number in an default manner.

The caller takes ownership of the returned object.
%End

QString visibleName( const QString &id ) const;
%Docstring
Returns the translated, user-visible name for the format with matching ``id``.
%End

};
@@ -33,6 +33,8 @@ Default constructor

virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -27,6 +27,8 @@ Default constructor

virtual QString id() const;

virtual QString visibleName() const;

virtual QString formatDouble( double value, const QgsNumericFormatContext &context ) const;

virtual QgsNumericFormat *clone() const /Factory/;
@@ -0,0 +1,46 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/numericformats/qgsnumericformatselectorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsNumericFormatSelectorWidget : QgsPanelWidget
{

%TypeHeaderCode
#include "qgsnumericformatselectorwidget.h"
%End
public:

QgsNumericFormatSelectorWidget( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsNumericFormatSelectorWidget with the specified ``parent`` widget.
%End

void setFormat( const QgsNumericFormat *format );
%Docstring
Sets the format to show in the widget.
%End

QgsNumericFormat *format() const /TransferBack/;
%Docstring
Returns a new format object representing the settings currently configured in the widget.

The caller takes ownership of the returned object.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/numericformats/qgsnumericformatselectorwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -294,6 +294,7 @@
%Include auto_generated/layout/qgslayoutviewtooltemporarymousepan.sip
%Include auto_generated/layout/qgslayoutviewtoolzoom.sip
%Include auto_generated/locator/qgslocatorwidget.sip
%Include auto_generated/numericformats/qgsnumericformatselectorwidget.sip
%Include auto_generated/processing/qgsprocessingalgorithmconfigurationwidget.sip
%Include auto_generated/processing/qgsprocessingalgorithmdialogbase.sip
%Include auto_generated/processing/qgsprocessinggui.sip
@@ -46,6 +46,11 @@ QString QgsBasicNumericFormat::id() const
return QStringLiteral( "basic" );
}

QString QgsBasicNumericFormat::visibleName() const
{
return QObject::tr( "Number" );
}

QString QgsBasicNumericFormat::formatDouble( double value, const QgsNumericFormatContext &context ) const
{
std::ostringstream os;
@@ -38,6 +38,7 @@ class CORE_EXPORT QgsBasicNumericFormat : public QgsNumericFormat
QgsBasicNumericFormat();

QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -27,6 +27,11 @@ QString QgsBearingNumericFormat::id() const
return QStringLiteral( "bearing" );
}

QString QgsBearingNumericFormat::visibleName() const
{
return QObject::tr( "Bearing" );
}

QString QgsBearingNumericFormat::formatDouble( double value, const QgsNumericFormatContext &context ) const
{
switch ( mDirectionFormat )
@@ -46,6 +46,7 @@ class CORE_EXPORT QgsBearingNumericFormat : public QgsBasicNumericFormat
QgsBearingNumericFormat();

QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -28,6 +28,11 @@ QString QgsCurrencyNumericFormat::id() const
return QStringLiteral( "currency" );
}

QString QgsCurrencyNumericFormat::visibleName() const
{
return QObject::tr( "Currency" );
}

QString QgsCurrencyNumericFormat::formatDouble( double value, const QgsNumericFormatContext &context ) const
{
QString res = QgsBasicNumericFormat::formatDouble( value, context );
@@ -35,6 +35,7 @@ class CORE_EXPORT QgsCurrencyNumericFormat : public QgsBasicNumericFormat
QgsCurrencyNumericFormat();

QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -22,6 +22,11 @@ QString QgsFallbackNumericFormat::id() const
return QStringLiteral( "default" );
}

QString QgsFallbackNumericFormat::visibleName() const
{
return QObject::tr( "General" );
}

QString QgsFallbackNumericFormat::formatDouble( double value, const QgsNumericFormatContext & ) const
{
return QString::number( value );
@@ -34,6 +34,7 @@ class CORE_EXPORT QgsFallbackNumericFormat : public QgsNumericFormat
*/
QgsFallbackNumericFormat() = default;
QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -147,6 +147,11 @@ class CORE_EXPORT QgsNumericFormat
*/
virtual QString id() const = 0;

/**
* Returns the translated, user-visible name for this format.
*/
virtual QString visibleName() const = 0;

/**
* Returns a formatted string representation of a numeric double value.
*/
@@ -25,6 +25,7 @@

QgsNumericFormatRegistry::QgsNumericFormatRegistry()
{
addFormat( new QgsFallbackNumericFormat() );
addFormat( new QgsBasicNumericFormat() );
addFormat( new QgsBearingNumericFormat() );
addFormat( new QgsCurrencyNumericFormat() );
@@ -89,3 +90,11 @@ QgsNumericFormat *QgsNumericFormatRegistry::fallbackFormat() const
{
return new QgsFallbackNumericFormat();
}

QString QgsNumericFormatRegistry::visibleName( const QString &id ) const
{
if ( mFormats.contains( id ) )
return mFormats.value( id )->visibleName();

return QString();
}
@@ -97,6 +97,11 @@ class CORE_EXPORT QgsNumericFormatRegistry
*/
QgsNumericFormat *fallbackFormat() const SIP_FACTORY;

/**
* Returns the translated, user-visible name for the format with matching \a id.
*/
QString visibleName( const QString &id ) const;

private:
QHash<QString, QgsNumericFormat *> mFormats;
};
@@ -27,6 +27,11 @@ QString QgsPercentageNumericFormat::id() const
return QStringLiteral( "percentage" );
}

QString QgsPercentageNumericFormat::visibleName() const
{
return QObject::tr( "Perctange" );
}

QString QgsPercentageNumericFormat::formatDouble( double value, const QgsNumericFormatContext &context ) const
{
switch ( mInputValues )
@@ -42,6 +42,7 @@ class CORE_EXPORT QgsPercentageNumericFormat : public QgsBasicNumericFormat
QgsPercentageNumericFormat();

QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -28,6 +28,11 @@ QString QgsScientificNumericFormat::id() const
return QStringLiteral( "scientific" );
}

QString QgsScientificNumericFormat::visibleName() const
{
return QObject::tr( "Scientific" );
}

QString QgsScientificNumericFormat::formatDouble( double value, const QgsNumericFormatContext &context ) const
{
return QgsBasicNumericFormat::formatDouble( value, context );
@@ -35,6 +35,7 @@ class CORE_EXPORT QgsScientificNumericFormat : public QgsBasicNumericFormat
QgsScientificNumericFormat();

QString id() const override;
QString visibleName() const override;
QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
QgsNumericFormat *clone() const override SIP_FACTORY;
QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
@@ -202,6 +202,8 @@ SET(QGIS_GUI_SRCS

locator/qgslocatorwidget.cpp

numericformats/qgsnumericformatselectorwidget.cpp

ogr/qgsogrhelperfunctions.cpp
ogr/qgsnewogrconnection.cpp
ogr/qgsvectorlayersaveasdialog.cpp
@@ -791,6 +793,8 @@ SET(QGIS_GUI_HDRS

locator/qgslocatorwidget.h

numericformats/qgsnumericformatselectorwidget.h

ogr/qgsnewogrconnection.h
ogr/qgsogrhelperfunctions.h
ogr/qgsvectorlayersaveasdialog.h
@@ -964,6 +968,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/labeling
${CMAKE_SOURCE_DIR}/src/gui/layertree
${CMAKE_SOURCE_DIR}/src/gui/layout
${CMAKE_SOURCE_DIR}/src/gui/numericformats
${CMAKE_SOURCE_DIR}/src/gui/ogr
${CMAKE_SOURCE_DIR}/src/gui/processing
${CMAKE_SOURCE_DIR}/src/gui/providers/gdal
@@ -980,6 +985,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core/layout
${CMAKE_SOURCE_DIR}/src/core/locator
${CMAKE_SOURCE_DIR}/src/core/metadata
${CMAKE_SOURCE_DIR}/src/core/numericformats
${CMAKE_SOURCE_DIR}/src/core/processing
${CMAKE_SOURCE_DIR}/src/core/mesh
${CMAKE_SOURCE_DIR}/src/core/pal

0 comments on commit 591e1a2

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