Display merge file locations as relative paths.
This commit is contained in:
+11
-21
@@ -63,14 +63,7 @@ namespace glabels
|
||||
mUndoRedoModel = undoRedoModel;
|
||||
|
||||
// Initialize CWD
|
||||
if ( model->fileName().isEmpty() )
|
||||
{
|
||||
mCwd = ".";
|
||||
}
|
||||
else
|
||||
{
|
||||
mCwd = QFileInfo( model->fileName() ).absolutePath();
|
||||
}
|
||||
mCwd = mModel->dir();
|
||||
|
||||
onMergeChanged();
|
||||
connect( mModel, SIGNAL(mergeChanged()), this, SLOT(onMergeChanged()) );
|
||||
@@ -87,26 +80,22 @@ namespace glabels
|
||||
mOldFormatComboIndex = index;
|
||||
formatCombo->setCurrentIndex( index );
|
||||
|
||||
QString fn;
|
||||
|
||||
switch ( merge::Factory::idToType( mModel->merge()->id() ) )
|
||||
{
|
||||
case merge::Factory::NONE:
|
||||
case merge::Factory::FIXED:
|
||||
locationLabel->setEnabled( false );
|
||||
locationButton->setEnabled( false );
|
||||
locationButton->setText( "" );
|
||||
locationLineEdit->setText( "" );
|
||||
locationBrowseButton->setVisible( false );
|
||||
break;
|
||||
|
||||
case merge::Factory::FILE:
|
||||
locationLabel->setEnabled( true );
|
||||
locationButton->setEnabled( true );
|
||||
if ( mModel->merge()->source().isEmpty() )
|
||||
{
|
||||
locationButton->setText( "Select file..." );
|
||||
}
|
||||
else
|
||||
{
|
||||
locationButton->setText( mModel->merge()->source() );
|
||||
}
|
||||
fn = QDir(mModel->dir()).relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
locationBrowseButton->setVisible( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -135,7 +124,8 @@ namespace glabels
|
||||
///
|
||||
void MergeView::onMergeSourceChanged()
|
||||
{
|
||||
locationButton->setText( mModel->merge()->source() );
|
||||
QString fn = QDir(mModel->dir()).relativeFilePath( mModel->merge()->source() );
|
||||
locationLineEdit->setText( fn );
|
||||
|
||||
recordsTable->clear();
|
||||
recordsTable->setColumnCount( 0 );
|
||||
@@ -185,7 +175,7 @@ namespace glabels
|
||||
///
|
||||
/// Location button clicked handler
|
||||
///
|
||||
void MergeView::onLocationButtonClicked()
|
||||
void MergeView::onLocationBrowseButtonClicked()
|
||||
{
|
||||
QString fileName =
|
||||
QFileDialog::getOpenFileName( this,
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ namespace glabels
|
||||
void onMergeSelectionChanged();
|
||||
|
||||
void onFormatComboActivated();
|
||||
void onLocationButtonClicked();
|
||||
void onLocationBrowseButtonClicked();
|
||||
void onSelectAllButtonClicked();
|
||||
void onUnselectAllButtonClicked();
|
||||
void onCellChanged( int iRow, int iCol );
|
||||
|
||||
+44
-46
@@ -46,16 +46,9 @@
|
||||
<property name="title">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="locationButton">
|
||||
<property name="text">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -63,6 +56,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="formatCombo"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="locationLineEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="locationBrowseButton">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="locationLabel">
|
||||
<property name="text">
|
||||
@@ -70,24 +84,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="formatCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -151,8 +149,8 @@
|
||||
<slot>onSelectAllButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>63</x>
|
||||
<y>571</y>
|
||||
<x>97</x>
|
||||
<y>570</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>69</x>
|
||||
@@ -176,22 +174,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>locationButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MergeView</receiver>
|
||||
<slot>onLocationButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>174</x>
|
||||
<y>93</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>570</x>
|
||||
<y>75</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>formatCombo</sender>
|
||||
<signal>activated(int)</signal>
|
||||
@@ -199,8 +181,8 @@
|
||||
<slot>onFormatComboActivated()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>162</x>
|
||||
<y>48</y>
|
||||
<x>257</x>
|
||||
<y>109</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>563</x>
|
||||
@@ -208,11 +190,27 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>locationBrowseButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>MergeView</receiver>
|
||||
<slot>onLocationBrowseButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>296</x>
|
||||
<y>130</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>565</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onSelectAllButtonClicked()</slot>
|
||||
<slot>onUnselectAllButtonClicked()</slot>
|
||||
<slot>onLocationButtonClicked()</slot>
|
||||
<slot>onFormatComboActivated()</slot>
|
||||
<slot>onLocationBrowseButtonClicked()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user