Skip to content

Commit

Permalink
Standardize capitalization, use modern stable method to populate
Browse files Browse the repository at this point in the history
and set combobox values
  • Loading branch information
nyalldawson committed Jan 14, 2020
1 parent f64d9c1 commit 12fb06b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 67 deletions.
45 changes: 27 additions & 18 deletions src/app/layout/qgslayoutattributetablewidget.cpp
Expand Up @@ -77,18 +77,27 @@ QgsLayoutAttributeTableWidget::QgsLayoutAttributeTableWidget( QgsLayoutFrame *fr

blockAllSignals( true );

mResizeModeComboBox->addItem( tr( "Use existing frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to next page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat until finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );

mEmptyModeComboBox->addItem( tr( "Draw headers only" ), QgsLayoutTable::HeadersOnly );
mEmptyModeComboBox->addItem( tr( "Hide entire table" ), QgsLayoutTable::HideTable );
mEmptyModeComboBox->addItem( tr( "Show set message" ), QgsLayoutTable::ShowMessage );
mEmptyModeComboBox->addItem( tr( "Draw Headers Only" ), QgsLayoutTable::HeadersOnly );
mEmptyModeComboBox->addItem( tr( "Hide Entire Table" ), QgsLayoutTable::HideTable );
mEmptyModeComboBox->addItem( tr( "Show Set Message" ), QgsLayoutTable::ShowMessage );

mWrapBehaviorComboBox->addItem( tr( "Truncate text" ), QgsLayoutTable::TruncateText );
mWrapBehaviorComboBox->addItem( tr( "Wrap text" ), QgsLayoutTable::WrapText );
mWrapBehaviorComboBox->addItem( tr( "Truncate Text" ), QgsLayoutTable::TruncateText );
mWrapBehaviorComboBox->addItem( tr( "Wrap Text" ), QgsLayoutTable::WrapText );

mSourceComboBox->addItem( tr( "Layer features" ), QgsLayoutItemAttributeTable::LayerAttributes );
mHeaderModeComboBox->addItem( tr( "On First Frame" ), QgsLayoutTable::FirstFrame );
mHeaderModeComboBox->addItem( tr( "On All Frames" ), QgsLayoutTable::AllFrames );
mHeaderModeComboBox->addItem( tr( "No Header" ), QgsLayoutTable::NoHeaders );

mHeaderHAlignmentComboBox->addItem( tr( "Follow Column Alignment" ), QgsLayoutTable::FollowColumn );
mHeaderHAlignmentComboBox->addItem( tr( "Left" ), QgsLayoutTable::HeaderLeft );
mHeaderHAlignmentComboBox->addItem( tr( "Center" ), QgsLayoutTable::HeaderCenter );
mHeaderHAlignmentComboBox->addItem( tr( "Right" ), QgsLayoutTable::HeaderRight );

mSourceComboBox->addItem( tr( "Layer Features" ), QgsLayoutItemAttributeTable::LayerAttributes );
toggleAtlasSpecificControls( static_cast< bool >( coverageLayer() ) );

//update relations combo when relations modified in project
Expand Down Expand Up @@ -156,7 +165,7 @@ void QgsLayoutAttributeTableWidget::setReportTypeString( const QString &string )
const int atlasFeatureIndex = mSourceComboBox->findData( QgsLayoutItemAttributeTable::AtlasFeature );
if ( atlasFeatureIndex != -1 )
{
mSourceComboBox->setItemText( atlasFeatureIndex, tr( "Current %1 feature" ).arg( string ) );
mSourceComboBox->setItemText( atlasFeatureIndex, tr( "Current %1 Feature" ).arg( string ) );
}
}

Expand Down Expand Up @@ -479,8 +488,8 @@ void QgsLayoutAttributeTableWidget::updateGuiElements()
mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );

mHeaderHAlignmentComboBox->setCurrentIndex( static_cast<int>( mTable->headerHAlignment() ) );
mHeaderModeComboBox->setCurrentIndex( static_cast<int>( mTable->headerMode() ) );
mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );

mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
Expand Down Expand Up @@ -566,12 +575,12 @@ void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls( const bool atla
if ( mSourceComboBox->findData( QgsLayoutItemAttributeTable::AtlasFeature ) == -1 )
{
//add missing atlasfeature option to combobox
mSourceComboBox->addItem( tr( "Current atlas feature" ), QgsLayoutItemAttributeTable::AtlasFeature );
mSourceComboBox->addItem( tr( "Current Atlas Feature" ), QgsLayoutItemAttributeTable::AtlasFeature );
}
if ( mSourceComboBox->findData( QgsLayoutItemAttributeTable::RelationChildren ) == -1 )
{
//add missing relation children option to combobox
mSourceComboBox->addItem( tr( "Relation children" ), QgsLayoutItemAttributeTable::RelationChildren );
mSourceComboBox->addItem( tr( "Relation Children" ), QgsLayoutItemAttributeTable::RelationChildren );
}

//add relations for coverage layer
Expand Down Expand Up @@ -751,27 +760,27 @@ void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
}
}

void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( int index )
void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( int )
{
if ( !mTable )
{
return;
}

mTable->beginCommand( tr( "Change Table Alignment" ) );
mTable->setHeaderHAlignment( static_cast< QgsLayoutTable::HeaderHAlignment >( index ) );
mTable->setHeaderHAlignment( static_cast< QgsLayoutTable::HeaderHAlignment >( mHeaderHAlignmentComboBox->currentData().toInt() ) );
mTable->endCommand();
}

void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged( int index )
void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged( int )
{
if ( !mTable )
{
return;
}

mTable->beginCommand( tr( "Change Table Header Mode" ) );
mTable->setHeaderMode( ( QgsLayoutTable::HeaderMode )index );
mTable->setHeaderMode( static_cast< QgsLayoutTable::HeaderMode >( mHeaderModeComboBox->currentData().toInt() ) );
mTable->endCommand();
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/layout/qgslayouthtmlwidget.cpp
Expand Up @@ -59,10 +59,10 @@ QgsLayoutHtmlWidget::QgsLayoutHtmlWidget( QgsLayoutFrame *frame )
stylesheetEditorLayout->addWidget( mStylesheetEditor );

blockSignals( true );
mResizeModeComboBox->addItem( tr( "Use existing frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to next page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat on every page" ), QgsLayoutMultiFrame::RepeatOnEveryPage );
mResizeModeComboBox->addItem( tr( "Repeat until finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat on Every Page" ), QgsLayoutMultiFrame::RepeatOnEveryPage );
mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
blockSignals( false );
setGuiElementValues();

Expand Down
10 changes: 5 additions & 5 deletions src/app/layout/qgslayoutmanualtablewidget.cpp
Expand Up @@ -54,12 +54,12 @@ QgsLayoutManualTableWidget::QgsLayoutManualTableWidget( QgsLayoutFrame *frame )

blockAllSignals( true );

mResizeModeComboBox->addItem( tr( "Use existing frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to next page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat until finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );

mWrapBehaviorComboBox->addItem( tr( "Truncate text" ), QgsLayoutTable::TruncateText );
mWrapBehaviorComboBox->addItem( tr( "Wrap text" ), QgsLayoutTable::WrapText );
mWrapBehaviorComboBox->addItem( tr( "Truncate Text" ), QgsLayoutTable::TruncateText );
mWrapBehaviorComboBox->addItem( tr( "Wrap Text" ), QgsLayoutTable::WrapText );

mContentFontColorButton->setColorDialogTitle( tr( "Select Content Font Color" ) );
mContentFontColorButton->setAllowOpacity( true );
Expand Down
42 changes: 3 additions & 39 deletions src/ui/layout/qgslayoutattributetablewidgetbase.ui
Expand Up @@ -276,23 +276,7 @@
<widget class="QComboBox" name="mEmptyModeComboBox"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="mHeaderModeComboBox">
<item>
<property name="text">
<string>On first frame</string>
</property>
</item>
<item>
<property name="text">
<string>On all frames</string>
</property>
</item>
<item>
<property name="text">
<string>No header</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="mHeaderModeComboBox"/>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_11">
Expand Down Expand Up @@ -611,26 +595,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Follow column alignment</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Center</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
Expand All @@ -656,7 +620,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Heading font</string>
<string>Heading Font</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -728,7 +692,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Contents font</string>
<string>Contents Font</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/layout/qgslayoutmanualtablewidgetbase.ui
Expand Up @@ -365,7 +365,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Contents font</string>
<string>Contents Font</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 12fb06b

Please sign in to comment.