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> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>446</width> <width>640</width>
<height>560</height> <height>576</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<widget class="QGroupBox" name="groupBox"> <layout class="QGridLayout" name="gridLayout_3">
<property name="geometry"> <item row="0" column="0">
<rect> <widget class="QGroupBox" name="groupBox">
<x>10</x> <property name="title">
<y>10</y> <string>FTP Server informations</string>
<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>
</property> </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>
<widget class="QTreeWidget" name="fileList"> </item>
<property name="geometry"> </layout>
<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>
</widget> </widget>
<resources> <resources>
<include location="ftp_selection.qrc"/> <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())); connect(_ui.ok_button, SIGNAL(clicked()), this, SLOT(OkButtonClicked()));
// Set signal and slot for "Cancel Button" // Set signal and slot for "Cancel Button"
connect(_ui.cancel_button, SIGNAL(clicked()), this, SLOT(reject())); 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. // 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) for(it = options.begin(); it != options.end(); ++it)
{ {
_ui.listWidget->addItem((*it).first); _ui.sourceSelectionListWidget->addItem((*it).first);
} }
} }
void CSourceDialog::OkButtonClicked() void CSourceDialog::OkButtonClicked()
{ {
selected_item = _ui.listWidget->currentItem(); selected_item = _ui.sourceSelectionListWidget->currentItem();
reject(); accept();
}
void CSourceDialog::itemDoubleClicked(QListWidgetItem *item)
{
selected_item = item;
accept();
} }
} }

View file

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

View file

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

View file

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