Skip to content
Permalink
Browse files

show license+description when directory is selected

  • Loading branch information
etiennesky committed Aug 18, 2012
1 parent df24c98 commit 05d06516942be4bbb67cb6ef2852ef37f59add59
Showing with 25 additions and 3 deletions.
  1. +25 −3 src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
@@ -252,17 +252,39 @@ void QgsCptCityColorRampV2Dialog::on_tabBar_currentChanged( int index )

void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
{
QString path, title, copyFile, descFile;

// get basic information, depending on if is color ramp or directory
QgsCptCityDataItem *item =
dynamic_cast< QgsCptCityDataItem* >( mModel->dataItem( mBrowserView->currentIndex() ) );
if ( item && item->type() == QgsCptCityDataItem::Directory )
{
path = item->path();
title = tr( "%1 directory details" ).arg( item->name() );
copyFile = mCollection->copyingFileName( path );
descFile = mCollection->descFileName( path );
}
else if ( item )
{
path = mRamp->schemeName() + mRamp->variantName();
title = tr( "%1 gradient details" ).arg( path );
copyFile = mRamp->copyingFileName();
descFile = mRamp->descFileName();
}
else
{
return;
}

// prepare dialog
QgsDialog dlg( this, 0, QDialogButtonBox::Close );
QVBoxLayout *layout = dlg.layout();
QString title = tr( "gradient %1 details" ).arg( mRamp->schemeName() + mRamp->variantName() );
dlg.setWindowTitle( title );
QTextEdit *textEdit = new QTextEdit( &dlg );
textEdit->setReadOnly( true );
layout->addWidget( textEdit );

// add contents of DESC.xml and COPYING.xml
QString copyFile = mRamp->copyingFileName();
QString copyText;
if ( ! copyFile.isNull() )
{
@@ -273,7 +295,6 @@ void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
file.close();
}
}
QString descFile = mRamp->descFileName();
QString descText;
if ( ! descFile.isNull() )
{
@@ -284,6 +305,7 @@ void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed()
file.close();
}
}
textEdit->insertPlainText( title + "\n\n" );
textEdit->insertPlainText( "===================" );
textEdit->insertPlainText( " copying " );
textEdit->insertPlainText( "===================\n" );

0 comments on commit 05d0651

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