Changed: Fixed an error when cancelling a merge window, added double click support on merge source. Fixed window scaling on merge windows.

--HG--
branch : gsoc2011-translationovqt
This commit is contained in:
sfb 2011-10-22 14:23:54 -05:00
parent 86daa90ded
commit 76b8fbad67
5 changed files with 159 additions and 175 deletions

View file

@ -6,133 +6,112 @@
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>560</height>
<width>640</width>
<height>576</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>421</width>
<height>541</height>
</rect>
</property>
<property name="title">
<string>FTP Server informations</string>
</property>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>401</width>
<height>381</height>
</rect>
</property>
<property name="title">
<string>Content</string>
</property>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Please select the file</string>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>FTP Server informations</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Ftp server</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="url"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="cdToParrent">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ftp_selection.qrc">
<normaloff>:/translationManager/images/cdtoparent.png</normaloff>:/translationManager/images/cdtoparent.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QPushButton" name="connectButton">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Content</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Please select the file</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="fileList">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>378</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="doneButton">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QTreeWidget" name="fileList">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>381</width>
<height>311</height>
</rect>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>500</y>
<width>401</width>
<height>33</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="doneButton">
<property name="text">
<string>Done</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>411</width>
<height>81</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Ftp server</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="url"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="cdToParrent">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ftp_selection.qrc">
<normaloff>:/translationManager/images/cdtoparent.png</normaloff>:/translationManager/images/cdtoparent.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QPushButton" name="connectButton">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="ftp_selection.qrc"/>

View file

@ -14,7 +14,9 @@ CSourceDialog::CSourceDialog(QWidget *parent): QDialog(parent)
connect(_ui.ok_button, SIGNAL(clicked()), this, SLOT(OkButtonClicked()));
// Set signal and slot for "Cancel Button"
connect(_ui.cancel_button, SIGNAL(clicked()), this, SLOT(reject()));
_ui.listWidget->setSortingEnabled(false);
_ui.sourceSelectionListWidget->setSortingEnabled(false);
connect(_ui.sourceSelectionListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
this, SLOT(itemDoubleClicked(QListWidgetItem *)));
}
// Insert options in the source dialog. Options like: from FTP Server, from Local directory etc.
@ -24,14 +26,20 @@ void CSourceDialog::setSourceOptions(map<QListWidgetItem*,int> options)
for(it = options.begin(); it != options.end(); ++it)
{
_ui.listWidget->addItem((*it).first);
_ui.sourceSelectionListWidget->addItem((*it).first);
}
}
void CSourceDialog::OkButtonClicked()
{
selected_item = _ui.listWidget->currentItem();
reject();
selected_item = _ui.sourceSelectionListWidget->currentItem();
accept();
}
void CSourceDialog::itemDoubleClicked(QListWidgetItem *item)
{
selected_item = item;
accept();
}
}

View file

@ -22,6 +22,7 @@ private:
Ui::SourceSelectionDialog _ui;
private Q_SLOTS:
void OkButtonClicked();
void itemDoubleClicked(QListWidgetItem *item);
public:
CSourceDialog(QWidget *parent = 0);
~CSourceDialog(){}

View file

@ -12,8 +12,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>396</width>
<height>197</height>
<width>316</width>
<height>155</height>
</rect>
</property>
<property name="windowTitle">
@ -22,48 +22,38 @@
<property name="modal">
<bool>true</bool>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>381</width>
<height>181</height>
</rect>
</property>
<property name="title">
<string>Select source for merge operation</string>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>361</width>
<height>141</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="listWidget"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="ok_button">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="cancel_button">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Select source for merge operation</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="sourceSelectionListWidget"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="ok_button">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="cancel_button">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>

View file

@ -472,17 +472,23 @@ void CMainWindow::mergeSingleFile()
if(dialog->selected_item == local_item) // Local directory
{
file_name = QFileDialog::getOpenFileName(this);
} else if(dialog->selected_item == ftp_item) { // Ftp directory
}
else if(dialog->selected_item == ftp_item) // Ftp directory
{
CFtpSelection* ftp_dialog = new CFtpSelection(this);
ftp_dialog->show();
ftp_dialog->exec();
if(ftp_dialog->status == true)
{
if(ftp_dialog->exec() && ftp_dialog->status == true)
file_name = ftp_dialog->file->fileName();
}
} else {
delete ftp_dialog;
}
else
return;
}
// Make sure we retrieved a file name
if(file_name.isEmpty())
return;
editor_window->activateWindow();
CEditorWorksheet* current_window = qobject_cast<CEditorWorksheet*>(editor_window);