Skip to content

Commit 05d0651

Browse files
committed
show license+description when directory is selected
1 parent df24c98 commit 05d0651

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,39 @@ void QgsCptCityColorRampV2Dialog::on_tabBar_currentChanged( int index )
252252

253253
void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
254254
{
255+
QString path, title, copyFile, descFile;
256+
257+
// get basic information, depending on if is color ramp or directory
258+
QgsCptCityDataItem *item =
259+
dynamic_cast< QgsCptCityDataItem* >( mModel->dataItem( mBrowserView->currentIndex() ) );
260+
if ( item && item->type() == QgsCptCityDataItem::Directory )
261+
{
262+
path = item->path();
263+
title = tr( "%1 directory details" ).arg( item->name() );
264+
copyFile = mCollection->copyingFileName( path );
265+
descFile = mCollection->descFileName( path );
266+
}
267+
else if ( item )
268+
{
269+
path = mRamp->schemeName() + mRamp->variantName();
270+
title = tr( "%1 gradient details" ).arg( path );
271+
copyFile = mRamp->copyingFileName();
272+
descFile = mRamp->descFileName();
273+
}
274+
else
275+
{
276+
return;
277+
}
278+
255279
// prepare dialog
256280
QgsDialog dlg( this, 0, QDialogButtonBox::Close );
257281
QVBoxLayout *layout = dlg.layout();
258-
QString title = tr( "gradient %1 details" ).arg( mRamp->schemeName() + mRamp->variantName() );
259282
dlg.setWindowTitle( title );
260283
QTextEdit *textEdit = new QTextEdit( &dlg );
261284
textEdit->setReadOnly( true );
262285
layout->addWidget( textEdit );
263286

264287
// add contents of DESC.xml and COPYING.xml
265-
QString copyFile = mRamp->copyingFileName();
266288
QString copyText;
267289
if ( ! copyFile.isNull() )
268290
{
@@ -273,7 +295,6 @@ void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
273295
file.close();
274296
}
275297
}
276-
QString descFile = mRamp->descFileName();
277298
QString descText;
278299
if ( ! descFile.isNull() )
279300
{
@@ -284,6 +305,7 @@ void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
284305
file.close();
285306
}
286307
}
308+
textEdit->insertPlainText( title + "\n\n" );
287309
textEdit->insertPlainText( "===================" );
288310
textEdit->insertPlainText( " copying " );
289311
textEdit->insertPlainText( "===================\n" );

0 commit comments

Comments
 (0)