Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata editor using QStackedWidget #19

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ef00816
first version of metadata wizard
Gustry Jun 15, 2017
9b13d46
use tabwidget
Gustry Jun 20, 2017
ec24425
links
Gustry Jun 21, 2017
1f57cad
add qgslayermetadata to the wizard
Gustry Jun 22, 2017
960b1f8
add metadata validator
Gustry Jul 17, 2017
4812535
add country list ISO
Gustry Jul 17, 2017
c58567b
add link type CSV, add keywords
Gustry Jul 18, 2017
28e21b7
add licenses
Gustry Jul 19, 2017
10ad5b5
add CRS
Gustry Jul 19, 2017
9428d9b
docstring
Gustry Jul 19, 2017
09e5314
reorder in cpp file, add contact UI
Gustry Jul 19, 2017
2bbcba0
disable UI for contacts
Gustry Jul 20, 2017
982f043
switch from QTableWidget to QTableView for links
Gustry Jul 20, 2017
954e4d7
review strings
Gustry Aug 3, 2017
b548fd5
add proper categories managment
Gustry Aug 9, 2017
6a49311
encoding and help text
Gustry Aug 9, 2017
76f559b
move metadata wizard to a widget in gui
Gustry Aug 9, 2017
7173214
set the metadata dialog for raster layer
Gustry Aug 9, 2017
539055f
add metadata widget to the vector layer properties
Gustry Aug 10, 2017
84deaee
add tooltip on languages
Gustry Aug 15, 2017
efaefb0
add tooltips on types
Gustry Aug 16, 2017
a6dabf7
add MIME CSV in the links tab
Gustry Aug 16, 2017
2b24c47
add fees and fix save metadata
Gustry Aug 16, 2017
f04e566
add rights
Gustry Aug 16, 2017
168de3f
add parent ID
Gustry Aug 17, 2017
45bfac1
add scrollbars for identification and access
Gustry Aug 17, 2017
b362e2e
add tooltips and UI review
Gustry Aug 17, 2017
8b30d7f
fix documentation,CSV and SIP
Gustry Aug 17, 2017
4460fc2
fix conflicts on the UI file
Gustry Sep 7, 2017
e4f70bd
add const in for loop
Gustry Sep 7, 2017
99cebd9
cleaning the code about the metadata editor
Gustry Sep 13, 2017
5eb85f1
add constraints in metadata editor
Gustry Sep 14, 2017
faa1421
rename false setters
Gustry Sep 14, 2017
6a41b02
add history in the metadata editor
Gustry Sep 14, 2017
ce5a189
fix strange behaviours in the layer properties dialog
Gustry Sep 14, 2017
cd73a42
fix conflict on UI files
Gustry Sep 20, 2017
60eafdd
fixing comments from the PR: QStringliteral, memory leaks...
Gustry Sep 21, 2017
b90564b
add ISO 639
Gustry Sep 21, 2017
6deaa9b
fix conflict on UI file
Gustry Sep 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions python/core/qgsapplication.sip
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ Returns the path to the translation directory.
:rtype: str
%End

static QString metadataPath();
%Docstring
Returns the path to the metadata directory.
.. versionadded:: 3.0
:rtype: str
%End

static QString qgisMasterDatabaseFilePath();
%Docstring
Returns the path to the master qgis.db file.
Expand Down
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
%Include qgsmessagebaritem.sip
%Include qgsmessagelogviewer.sip
%Include qgsmessageviewer.sip
%Include qgsmetadatawidget.sip
%Include qgsnewhttpconnection.sip
%Include qgsnewmemorylayerdialog.sip
%Include qgsnewnamedialog.sip
Expand Down
88 changes: 88 additions & 0 deletions python/gui/qgsmetadatawidget.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmetadatawidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsMetadataWidget : QWidget
{
%Docstring
A wizard to edit metadata on a map layer.

.. versionadded:: 3.0
%End

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

QgsMetadataWidget( QWidget *parent, QgsMapLayer *layer = 0 );
%Docstring
Constructor for the wizard.
%End
~QgsMetadataWidget();

void saveMetadata( QgsLayerMetadata &layerMetadata ) const;
%Docstring
Save all fields in a QgsLayerMetadata object.
%End

bool checkMetadata() const;
%Docstring
Check if values in the wizard are correct.
:rtype: bool
%End

void acceptMetadata();
%Docstring
Saves the metadata to the layer.
%End

static QMap<QString, QString> parseLanguages();
%Docstring
Returns a list of languages available by default in the wizard.
:rtype: QMap<str, QString>
%End

static QStringList parseLicenses();
%Docstring
Returns a list of licences available by default in the wizard.
:rtype: list of str
%End

static QStringList parseLinkTypes();
%Docstring
Returns a list of link types available by default in the wizard.
.. seealso:: https://github.com/OSGeo/Cat-Interop/blob/master/LinkPropertyLookupTable.csv
:rtype: list of str
%End

static QStringList parseMimeTypes();
%Docstring
Returns a list of MIME types available by default in the wizard.
.. seealso:: https://fr.wikipedia.org/wiki/Type_MIME
:rtype: list of str
%End

static QMap<QString, QString> parseTypes();
%Docstring
Returns a list of types available by default in the wizard.
:rtype: QMap<str, QString>
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmetadatawidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
68 changes: 68 additions & 0 deletions resources/metadata-ISO/LinkPropertyLookupTable.csv

Large diffs are not rendered by default.

250 changes: 250 additions & 0 deletions resources/metadata-ISO/country_code_ISO_3166.csv

Large diffs are not rendered by default.

185 changes: 185 additions & 0 deletions resources/metadata-ISO/language_codes_ISO_639.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
alpha2,English
aa,Afar
ab,Abkhazian
ae,Avestan
af,Afrikaans
ak,Akan
am,Amharic
an,Aragonese
ar,Arabic
as,Assamese
av,Avaric
ay,Aymara
az,Azerbaijani
ba,Bashkir
be,Belarusian
bg,Bulgarian
bh,Bihari languages
bi,Bislama
bm,Bambara
bn,Bengali
bo,Tibetan
br,Breton
bs,Bosnian
ca,Catalan; Valencian
ce,Chechen
ch,Chamorro
co,Corsican
cr,Cree
cs,Czech
cu,Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
cv,Chuvash
cy,Welsh
da,Danish
de,German
dv,Divehi; Dhivehi; Maldivian
dz,Dzongkha
ee,Ewe
el,"Greek, Modern (1453-)"
en,English
eo,Esperanto
es,Spanish; Castilian
et,Estonian
eu,Basque
fa,Persian
ff,Fulah
fi,Finnish
fj,Fijian
fo,Faroese
fr,French
fy,Western Frisian
ga,Irish
gd,Gaelic; Scottish Gaelic
gl,Galician
gn,Guarani
gu,Gujarati
gv,Manx
ha,Hausa
he,Hebrew
hi,Hindi
ho,Hiri Motu
hr,Croatian
ht,Haitian; Haitian Creole
hu,Hungarian
hy,Armenian
hz,Herero
ia,Interlingua (International Auxiliary Language Association)
id,Indonesian
ie,Interlingue; Occidental
ig,Igbo
ii,Sichuan Yi; Nuosu
ik,Inupiaq
io,Ido
is,Icelandic
it,Italian
iu,Inuktitut
ja,Japanese
jv,Javanese
ka,Georgian
kg,Kongo
ki,Kikuyu; Gikuyu
kj,Kuanyama; Kwanyama
kk,Kazakh
kl,Kalaallisut; Greenlandic
km,Central Khmer
kn,Kannada
ko,Korean
kr,Kanuri
ks,Kashmiri
ku,Kurdish
kv,Komi
kw,Cornish
ky,Kirghiz; Kyrgyz
la,Latin
lb,Luxembourgish; Letzeburgesch
lg,Ganda
li,Limburgan; Limburger; Limburgish
ln,Lingala
lo,Lao
lt,Lithuanian
lu,Luba-Katanga
lv,Latvian
mg,Malagasy
mh,Marshallese
mi,Maori
mk,Macedonian
ml,Malayalam
mn,Mongolian
mr,Marathi
ms,Malay
mt,Maltese
my,Burmese
na,Nauru
nb,"Bokmål, Norwegian; Norwegian Bokmål"
nd,"Ndebele, North; North Ndebele"
ne,Nepali
ng,Ndonga
nl,Dutch; Flemish
nn,"Norwegian Nynorsk; Nynorsk, Norwegian"
no,Norwegian
nr,"Ndebele, South; South Ndebele"
nv,Navajo; Navaho
ny,Chichewa; Chewa; Nyanja
oc,Occitan (post 1500); Provençal
oj,Ojibwa
om,Oromo
or,Oriya
os,Ossetian; Ossetic
pa,Panjabi; Punjabi
pi,Pali
pl,Polish
ps,Pushto; Pashto
pt,Portuguese
qu,Quechua
rm,Romansh
rn,Rundi
ro,Romanian; Moldavian; Moldovan
ru,Russian
rw,Kinyarwanda
sa,Sanskrit
sc,Sardinian
sd,Sindhi
se,Northern Sami
sg,Sango
si,Sinhala; Sinhalese
sk,Slovak
sl,Slovenian
sm,Samoan
sn,Shona
so,Somali
sq,Albanian
sr,Serbian
ss,Swati
st,"Sotho, Southern"
su,Sundanese
sv,Swedish
sw,Swahili
ta,Tamil
te,Telugu
tg,Tajik
th,Thai
ti,Tigrinya
tk,Turkmen
tl,Tagalog
tn,Tswana
to,Tonga (Tonga Islands)
tr,Turkish
ts,Tsonga
tt,Tatar
tw,Twi
ty,Tahitian
ug,Uighur; Uyghur
uk,Ukrainian
ur,Urdu
uz,Uzbek
ve,Venda
vi,Vietnamese
vo,Volapük
wa,Walloon
wo,Wolof
xh,Xhosa
yi,Yiddish
yo,Yoruba
za,Zhuang; Chuang
zh,Chinese
zu,Zulu
7 changes: 7 additions & 0 deletions resources/metadata-ISO/licenses.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name,code
Creative Commons CC Zero,CC0
Open Data Commons Public Domain Dedication and Licence,PDDL
Creative Commons Attribution 4.0,CC-BY-4.0
Open Data Commons Attribution License,ODC-BY
Creative Commons Attribution Share-Alike 4.0,CC-BY-SA-4.0
Open Data Commons Open Database License,ODBL
16 changes: 16 additions & 0 deletions resources/metadata-ISO/md_scope_codes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
attribute;information applies to the attribute class
attributeType;information applies to the characteristic of a feature
collectionHardware;information applies to the collection hardware class
collectionSession;information applies to the collection session
dataset;information applies to the dataset
series;information applies to the series
nonGeographicDataset;information applies to non-geographic data
dimensionGroup;information applies to a dimension group
feature;information applies to a feature
featureType;information applies to a feature type
propertyType;information applies to a property type
fieldSession;information applies to a field session
software;information applies to a computer program or routine
service;information applies to a capability which a service provider entity makes available to a service user entity through a set of interfaces that define a behavior, such as a use case
model;information applies to a copy or imitation of an existing or hypothetical object
tile;information applies to a tile, a spatial subset of geographic data
25 changes: 25 additions & 0 deletions resources/metadata-ISO/mime.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
application/octet-stream
application/pdf
application/xhtml+xml
application/json
application/xml
application/zip
image/gif
image/jpeg
image/png
image/tiff
image/svg+xml
text/csv
text/html
text/plain
text/xml
application/vnd.oasis.opendocument.text
application/vnd.oasis.opendocument.spreadsheet
application/vnd.oasis.opendocument.presentation
application/vnd.oasis.opendocument.graphics
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.ms-powerpoint
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/msword
application/vnd.openxmlformats-officedocument.wordprocessingml.document
11 changes: 11 additions & 0 deletions src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "qgsmaplayerstyleguiutils.h"
#include "qgsmaptoolemitpoint.h"
#include "qgsmaptopixel.h"
#include "qgsmetadatawidget.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgsmultibandcolorrendererwidget.h"
#include "qgspalettedrendererwidget.h"
Expand Down Expand Up @@ -231,6 +232,13 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
mOptsPage_Histogram->setEnabled( false );
}

QVBoxLayout *layout = new QVBoxLayout( metadataFrame );
layout->setMargin( 0 );
mMetadataWidget = new QgsMetadataWidget( this, mRasterLayer );
mMetadataWidget->layout()->setContentsMargins( -1, 0, -1, 0 );
layout->addWidget( mMetadataWidget );
metadataFrame->setLayout( layout );

QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().toWkt() );
QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().authid() + " - " + mRasterLayer->crs().description() );
mCrsSelector->setCrs( mRasterLayer->crs() );
Expand Down Expand Up @@ -829,6 +837,9 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setRenderer( rendererWidget->renderer() );
}

mMetadataWidget->acceptMetadata();
mMetadataFilled = false;

//transparency settings
QgsRasterRenderer *rasterRenderer = mRasterLayer->renderer();
if ( rasterRenderer )
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsrasterlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class QgsMapLayer;
class QgsMapCanvas;
class QgsRasterLayer;
class QgsMapToolEmitPoint;
class QgsMetadataWidget;
class QgsRasterRenderer;
class QgsRasterRendererWidget;
class QgsRasterHistogramWidget;
Expand Down Expand Up @@ -154,6 +155,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
//bool mRasterLayerIsInternal;

QgsRasterRendererWidget *mRendererWidget = nullptr;
QgsMetadataWidget *mMetadataWidget = nullptr;

bool rasterIsMultiBandColor();

Expand Down
Loading