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