Skip to content

Commit

Permalink
[needs-docs] update metadata viewer and review UI for vector layer di…
Browse files Browse the repository at this point in the history
…alog (#4316)

Funded by WorldBank/GFDRR
  • Loading branch information
Gustry authored and timlinux committed Apr 12, 2017
1 parent 0e09fda commit c4ad950
Show file tree
Hide file tree
Showing 5 changed files with 832 additions and 949 deletions.
57 changes: 50 additions & 7 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -292,6 +292,12 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
)
);

QString myStyle = QgsApplication::reportStyleSheet();
teMetadataViewer->clear();
teMetadataViewer->document()->setDefaultStyleSheet( myStyle );
teMetadataViewer->setHtml( htmlMetadata() );
mMetadataFilled = true;

QgsSettings settings;
// if dialog hasn't been opened/closed yet, default to Styles tab, which is used most often
// this will be read by restoreOptionsBaseUi()
Expand Down Expand Up @@ -383,7 +389,6 @@ void QgsVectorLayerProperties::syncToLayer()
// populate the general information
mLayerOrigNameLineEdit->setText( mLayer->originalName() );
txtDisplayName->setText( mLayer->name() );
txtLayerSource->setText( mLayer->publicSource() );
pbnQueryBuilder->setWhatsThis( tr( "This button opens the query "
"builder and allows you to create a subset of features to display on "
"the map canvas rather than displaying all features in the layer" ) );
Expand Down Expand Up @@ -562,19 +567,58 @@ void QgsVectorLayerProperties::apply()
}

//layer title and abstract
if ( mLayer->shortName() != mLayerShortNameLineEdit->text() )
mMetadataFilled = false;
mLayer->setShortName( mLayerShortNameLineEdit->text() );

if ( mLayer->title() != mLayerTitleLineEdit->text() )
mMetadataFilled = false;
mLayer->setTitle( mLayerTitleLineEdit->text() );

if ( mLayer->abstract() != mLayerAbstractTextEdit->toPlainText() )
mMetadataFilled = false;
mLayer->setAbstract( mLayerAbstractTextEdit->toPlainText() );

if ( mLayer->keywordList() != mLayerKeywordListLineEdit->text() )
mMetadataFilled = false;
mLayer->setKeywordList( mLayerKeywordListLineEdit->text() );

if ( mLayer->dataUrl() != mLayerDataUrlLineEdit->text() )
mMetadataFilled = false;
mLayer->setDataUrl( mLayerDataUrlLineEdit->text() );

if ( mLayer->dataUrlFormat() != mLayerDataUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mLayer->setDataUrlFormat( mLayerDataUrlFormatComboBox->currentText() );

//layer attribution and metadataUrl
if ( mLayer->attribution() != mLayerAttributionLineEdit->text() )
mMetadataFilled = false;
mLayer->setAttribution( mLayerAttributionLineEdit->text() );

if ( mLayer->attributionUrl() != mLayerAttributionUrlLineEdit->text() )
mMetadataFilled = false;
mLayer->setAttributionUrl( mLayerAttributionUrlLineEdit->text() );

if ( mLayer->metadataUrl() != mLayerMetadataUrlLineEdit->text() )
mMetadataFilled = false;
mLayer->setMetadataUrl( mLayerMetadataUrlLineEdit->text() );

if ( mLayer->metadataUrlType() != mLayerMetadataUrlTypeComboBox->currentText() )
mMetadataFilled = false;
mLayer->setMetadataUrlType( mLayerMetadataUrlTypeComboBox->currentText() );

if ( mLayer->metadataUrlFormat() != mLayerMetadataUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mLayer->setMetadataUrlFormat( mLayerMetadataUrlFormatComboBox->currentText() );

// LegendURL
if ( mLayer->legendUrl() != mLayerLegendUrlLineEdit->text() )
mMetadataFilled = false;
mLayer->setLegendUrl( mLayerLegendUrlLineEdit->text() );

if ( mLayer->legendUrlFormat() != mLayerLegendUrlFormatComboBox->currentText() )
mMetadataFilled = false;
mLayer->setLegendUrlFormat( mLayerLegendUrlFormatComboBox->currentText() );

//layer simplify drawing configuration
Expand Down Expand Up @@ -701,7 +745,7 @@ void QgsVectorLayerProperties::on_pbnIndex_clicked()
}
}

QString QgsVectorLayerProperties::metadata()
QString QgsVectorLayerProperties::htmlMetadata()
{
return mLayer->htmlMetadata();
}
Expand All @@ -714,6 +758,7 @@ void QgsVectorLayerProperties::on_mLayerOrigNameLineEdit_textEdited( const QStri
void QgsVectorLayerProperties::on_mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs )
{
mLayer->setCrs( crs );
mMetadataFilled = false;
}

void QgsVectorLayerProperties::loadDefaultStyle_clicked()
Expand Down Expand Up @@ -1310,14 +1355,12 @@ void QgsVectorLayerProperties::on_pbnUpdateExtents_clicked()

void QgsVectorLayerProperties::mOptionsStackedWidget_CurrentChanged( int indx )
{
if ( indx != mOptStackedWidget->indexOf( mOptsPage_Metadata ) || mMetadataFilled )
if ( indx != mOptStackedWidget->indexOf( mOptsPage_Information ) || mMetadataFilled )
return;

//set the metadata contents (which can be expensive)
QString myStyle = QgsApplication::reportStyleSheet();
teMetadata->clear();
teMetadata->document()->setDefaultStyleSheet( myStyle );
teMetadata->setHtml( metadata() );
teMetadataViewer->clear();
teMetadataViewer->setHtml( htmlMetadata() );
mMetadataFilled = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.h
Expand Up @@ -81,7 +81,7 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
void syncToLayer();

//! Get metadata about the layer in nice formatted html
QString metadata();
QString htmlMetadata();

//! Slot to update layer display name as original is edited
void on_mLayerOrigNameLineEdit_textEdited( const QString &text );
Expand Down
53 changes: 40 additions & 13 deletions src/core/qgsapplication.cpp
Expand Up @@ -963,49 +963,49 @@ QString QgsApplication::reportStyleSheet()
" color: black;"
" border: 1px solid #6c6c6c;"
"}"
".overview{ font: 1.82em; font-weight: bold;}"
"body{ background: white;"
".overview{"
" font: 1.82em;"
" font-weight: bold;"
"}"
"body{"
" background: white;"
" color: black;"
" font-family: arial,sans-serif;"
" font-family: 'Lato', 'Ubuntu', 'Lucida Grande', 'Segoe UI', 'Arial', sans-serif;"
" width: 100%;"
"}"
"h1{ background-color: #F6F6F6;"
" color: #8FB171; "
" color: #589632; " // from http://qgis.org/en/site/getinvolved/styleguide.html
" font-size: x-large; "
" font-weight: normal;"
" font-family: luxi serif, georgia, times new roman, times, serif;"
" background: none;"
" padding: 0.75em 0 0;"
" margin: 0;"
" line-height: 3em;"
"}"
"h2{ background-color: #F6F6F6;"
" color: #8FB171; "
" color: #589632; " // from http://qgis.org/en/site/getinvolved/styleguide.html
" font-size: medium; "
" font-weight: normal;"
" font-family: luxi serif, georgia, times new roman, times, serif;"
" background: none;"
" padding: 0.75em 0 0;"
" margin: 0;"
" line-height: 1.1em;"
"}"
"h3{ background-color: #F6F6F6;"
" color: #729FCF;"
" font-family: luxi serif, georgia, times new roman, times, serif;"
" color: #93b023;" // from http://qgis.org/en/site/getinvolved/styleguide.html
" font-weight: bold;"
" font-size: large;"
" text-align: right;"
" border-bottom: 5px solid #DCEB5C;"
"}"
"h4{ background-color: #F6F6F6;"
" color: #729FCF;"
" font-family: luxi serif, georgia, times new roman, times, serif;"
" color: #93b023;" // from http://qgis.org/en/site/getinvolved/styleguide.html
" font-weight: bold;"
" font-size: medium;"
" text-align: right;"
"}"
"h5{ background-color: #F6F6F6;"
" color: #729FCF;"
" font-family: luxi serif, georgia, times new roman, times, serif;"
" color: #93b023;" // from http://qgis.org/en/site/getinvolved/styleguide.html
" font-weight: bold;"
" font-size: small;"
" text-align: right;"
Expand All @@ -1019,6 +1019,33 @@ QString QgsApplication::reportStyleSheet()
" margin: 1px;"
" padding: 0px 3px; "
" font-size: small;"
"}"
".section {"
" font-weight: bold;"
" padding-top:25px;"
"}"
".list-view .highlight {"
" text-align: right;"
" border: 0px;"
" width: 20%;"
" padding-right: 15px;"
" padding-left: 20px;"
" font-weight: bold;"
"}"
".tabular-view{ "
" border-collapse: collapse;"
" width: 95%;"
"}"
".tabular-view th, .tabular-view td { "
" border:10px solid black;"
"}"
".tabular-view .odd-row{"
" background-color: #f9f9f9;"
"}"
"hr {"
" border: 0;"
" height: 0;"
" border-top: 1px solid black;"
"}";
return myStyle;
}
Expand Down

0 comments on commit c4ad950

Please sign in to comment.