From 88efab3b606fb502c5882b052b91e793295dc481 Mon Sep 17 00:00:00 2001 From: cemycc Date: Fri, 8 Jul 2011 18:31:59 +0300 Subject: [PATCH] Added: #1307 Ui deffs for merge source selection and ftp selection --- .../TranslationManagerPlugin.cbp | 32 ++++ .../TranslationManagerPlugin.layout | 4 + .../translation_manager/ftp_selection.cpp | 121 ++++++++++++++ .../translation_manager/ftp_selection.h | 46 ++++++ .../translation_manager/ftp_selection.ui | 135 ++++++++++++++++ .../nbproject/Package-Default.bash | 75 +++++++++ .../nbproject/configurations.xml | 147 ++++++++++++++++++ .../nbproject/private/configurations.xml | 41 +++++ .../nbproject/private/private.properties | 0 .../nbproject/private/private.xml | 17 ++ .../nbproject/project.properties | 0 .../translation_manager/nbproject/project.xml | 23 +++ .../translation_manager/source_selection.cpp | 37 +++++ .../translation_manager/source_selection.h | 37 +++++ .../translation_manager/source_selection.ui | 70 +++++++++ .../translation_manager_constants.h | 27 ++++ 16 files changed, 812 insertions(+) create mode 100644 code/TranslationManagerPlugin/TranslationManagerPlugin.cbp create mode 100644 code/TranslationManagerPlugin/TranslationManagerPlugin.layout create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/Package-Default.bash create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/configurations.xml create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/configurations.xml create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.properties create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.xml create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.properties create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.xml create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h diff --git a/code/TranslationManagerPlugin/TranslationManagerPlugin.cbp b/code/TranslationManagerPlugin/TranslationManagerPlugin.cbp new file mode 100644 index 000000000..f8c6d49c1 --- /dev/null +++ b/code/TranslationManagerPlugin/TranslationManagerPlugin.cbp @@ -0,0 +1,32 @@ + + + + + + diff --git a/code/TranslationManagerPlugin/TranslationManagerPlugin.layout b/code/TranslationManagerPlugin/TranslationManagerPlugin.layout new file mode 100644 index 000000000..23b67ddb1 --- /dev/null +++ b/code/TranslationManagerPlugin/TranslationManagerPlugin.layout @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp new file mode 100644 index 000000000..dbc1144a8 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp @@ -0,0 +1,121 @@ + +#include "ftp_selection.h" + +#include +#include +namespace Plugin +{ + CFtpSelection::CFtpSelection(QWidget *parent): QDialog(parent) + { + _ui.setupUi(this); + connect(_ui.connectButton, SIGNAL(clicked()), this, SLOT(ConnectButtonClicked())); + connect(_ui.doneButton, SIGNAL(clicked()), this, SLOT(DoneButtonClicked())); + connect(_ui.cancelButton, SIGNAL(clicked()), this, SLOT(CancelButtonClicked())); + + // file list + connect(_ui.fileList, SIGNAL(itemActivated(QTreeWidgetItem*,int)),this, SLOT(processItem(QTreeWidgetItem*,int))); + _ui.fileList->setEnabled(false); + _ui.fileList->setRootIsDecorated(false); + _ui.fileList->setHeaderLabels(QStringList() << tr("Name") << tr("Size") << tr("Owner") << tr("Group") << tr("Time")); + _ui.fileList->header()->setStretchLastSection(false); + } + + void CFtpSelection::ConnectButtonClicked() + { + conn = new QFtp(this); + connect(conn, SIGNAL(commandFinished(int,bool)), this, SLOT(FtpCommandFinished(int,bool))); + connect(conn, SIGNAL(listInfo(QUrlInfo)), this, SLOT(AddToList(QUrlInfo))); + + QUrl url(_ui.url->text()); + if (!url.isValid() || url.scheme().toLower() != QLatin1String("ftp")) { + conn->connectToHost(_ui.url->text(), 21); + conn->login(); + } else { + conn->connectToHost(url.host(), url.port(21)); + + if (!url.userName().isEmpty()) + conn->login(QUrl::fromPercentEncoding(url.userName().toLatin1()), url.password()); + else + conn->login(); + if (!url.path().isEmpty()) + conn->cd(url.path()); + } + } + + void CFtpSelection::FtpCommandFinished(int, bool error) + { + if (conn->currentCommand() == QFtp::ConnectToHost) + { + if (error) + { + QMessageBox::information(this, tr("FTP"), + tr("Unable to connect to the FTP server " + "at %1. Please check that the host " + "name is correct.") + .arg(_ui.url->text())); + return; + } + + return; + } + + if (conn->currentCommand() == QFtp::Login) + { + conn->list(); + } + + if (conn->currentCommand() == QFtp::List) + { + if (isDirectory.isEmpty()) { + _ui.fileList->addTopLevelItem(new QTreeWidgetItem(QStringList() << tr(""))); + _ui.fileList->setEnabled(false); + } + } + } + + void CFtpSelection::AddToList(const QUrlInfo &urlInfo) + { + QTreeWidgetItem *item = new QTreeWidgetItem; + item->setText(0, urlInfo.name()); + item->setText(1, QString::number(urlInfo.size())); + item->setText(2, urlInfo.owner()); + item->setText(3, urlInfo.group()); + item->setText(4, urlInfo.lastModified().toString("MMM dd yyyy")); + + QPixmap pixmap(urlInfo.isDir() ? ":/images/dir.png" : ":/images/file.png"); + item->setIcon(0, pixmap); + + isDirectory[urlInfo.name()] = urlInfo.isDir(); + _ui.fileList->addTopLevelItem(item); + if (!_ui.fileList->currentItem()) { + _ui.fileList->setCurrentItem(_ui.fileList->topLevelItem(0)); + _ui.fileList->setEnabled(true); + } + } + + void CFtpSelection::processItem(QTreeWidgetItem* item, int) + { + QString name = item->text(0); + if (isDirectory.value(name)) + { + _ui.fileList->clear(); + isDirectory.clear(); + currentPath += '/'; + currentPath += name; + conn->cd(name); + conn->list(); + //TODO: cursor + return; + } + } + + void CFtpSelection::DoneButtonClicked() + { + + } + + void CFtpSelection::CancelButtonClicked() + { + + } +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h new file mode 100644 index 000000000..195abfc85 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h @@ -0,0 +1,46 @@ +/* + * File: ftp_selection.h + * Author: cemycc + * + * Created on July 8, 2011, 4:03 PM + */ + +#ifndef FTP_SELECTION_H +#define FTP_SELECTION_H + +#include +#include +#include +#include +#include +#include + +#include "ui_ftp_selection.h" + +using namespace std; + +namespace Plugin { + + class CFtpSelection : public QDialog + { + Q_OBJECT + private: + Ui::FtpSelectionDialog _ui; + QFtp *conn; + QHash isDirectory; + QString currentPath; + private Q_SLOTS: + void processItem(QTreeWidgetItem*,int); + void CancelButtonClicked(); + void ConnectButtonClicked(); + void DoneButtonClicked(); + void FtpCommandFinished(int, bool error); + void AddToList(const QUrlInfo &urlInfo); + public: + CFtpSelection(QWidget* parent = 0); + ~CFtpSelection() {} + }; +} + +#endif /* FTP_SELECTION_H */ + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui new file mode 100644 index 000000000..c23a7137b --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui @@ -0,0 +1,135 @@ + + + FtpSelectionDialog + + + + 0 + 0 + 383 + 547 + + + + Dialog + + + + + 10 + 10 + 371 + 501 + + + + FTP Server informations + + + + + 0 + 130 + 371 + 411 + + + + Content + + + + + 0 + 20 + 141 + 21 + + + + Please select the file + + + + + + 0 + 40 + 361 + 311 + + + + + 1 + + + + + + + + 1 + 29 + 361 + 107 + + + + + + + Ftp server + + + + + + + + + + Connect + + + + + + + + + + + + + + + + + 10 + 500 + 361 + 33 + + + + + + + Done + + + + + + + Cancel + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/Package-Default.bash b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/Package-Default.bash new file mode 100644 index 000000000..d50edf611 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/Package-Default.bash @@ -0,0 +1,75 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_PLATFORM=GNU-Linux-x86 +CND_CONF=Default +CND_DISTDIR=dist +CND_BUILDDIR=build +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=../../../../../../../build/bin/object_viewer_qt +OUTPUT_BASENAME=object_viewer_qt +PACKAGE_TOP_DIR=translationmanager/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package +rm -rf ${NBTMPDIR} +mkdir -p ${NBTMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory "${NBTMPDIR}/translationmanager/bin" +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/translationmanager.tar +cd ${NBTMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/translationmanager.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${NBTMPDIR} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/configurations.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/configurations.xml new file mode 100644 index 000000000..66a3d7f05 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/configurations.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + ../../../../../../../build/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ui_translation_manager_settings_page.h + + + + + + + + + + + + + ../../../../../../include/nel/misc/app_context.h + ../../../../../../include/nel/misc/common.h + ../../../../../../include/nel/misc/debug.h + ../../../../../../include/nel/misc/displayer.h + ../../../../../../include/nel/misc/log.h + ../../../../../../include/nel/misc/mem_displayer.h + ../../../../../../include/nel/misc/mutex.h + ../../../../../../include/nel/misc/string_common.h + ../../../../../../include/nel/misc/time_nl.h + ../../../../../../include/nel/misc/types_nl.h + + + + + + + + ../../extension_system/iplugin.h + ../../extension_system/iplugin_manager.h + ../../extension_system/iplugin_spec.h + + + + ../core/core_constants.h + ../core/core_global.h + ../core/icontext.h + ../core/icore.h + ../core/icore_listener.h + ../core/imenu_manager.h + ../core/ioptions_page.h + + + + + editor_worksheet.cpp + editor_worksheet.h + extract_bot_names.cpp + extract_bot_names.h + extract_new_sheet_names.cpp + extract_new_sheet_names.h + source_selection.cpp + source_selection.h + translation_manager_constants.h + translation_manager_editor.h + translation_manager_main_window.cpp + translation_manager_main_window.h + translation_manager_plugin.cpp + translation_manager_plugin.h + translation_manager_settings_page.cpp + translation_manager_settings_page.h + + + ../../../../../../../build/Makefile + + + ^(nbproject)$ + + . + + ../../../../../../../build/Makefile + + + + LOCAL_SOURCES + default + + + + ../../../../../../../build + ${MAKE} -f Makefile ovqt_plugin_translation_manager + ${MAKE} -f Makefile clean + ../../../../../../../build/bin/object_viewer_qt + + + + + + ../../../../../../include + + + + + + + ../../../../../../../build/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager + ../../../../../../include + + + + + + + ../../../../../../../build/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager + ../../../../../../include + + + + + + + ../../../../../../../build/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/configurations.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/configurations.xml new file mode 100644 index 000000000..c4febd942 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/configurations.xml @@ -0,0 +1,41 @@ + + + ../../../../../../../build/Makefile + + + + localhost + 2 + + + + + + + + + + + + + + + + + gdb + + + + "${OUTPUT_PATH}" + + "${OUTPUT_PATH}" + + true + 0 + 0 + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.properties b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.properties new file mode 100644 index 000000000..e69de29bb diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.xml new file mode 100644 index 000000000..c6e5619d5 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/private/private.xml @@ -0,0 +1,17 @@ + + + + true + + + 0 + 0 + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.properties b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.properties new file mode 100644 index 000000000..e69de29bb diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.xml new file mode 100644 index 000000000..68607a434 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/nbproject/project.xml @@ -0,0 +1,23 @@ + + + org.netbeans.modules.cnd.makeproject + + + translation_manager + + cpp + h + UTF-8 + + + . + + + + Default + 0 + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp new file mode 100644 index 000000000..6bc048b0b --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp @@ -0,0 +1,37 @@ + +#include + +#include "source_selection.h" + +namespace Plugin +{ + + +CSourceDialog::CSourceDialog(QWidget *parent): QDialog(parent) +{ + _ui.setupUi(this); + // Set signal and slot for "OK Button" + + 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); +} + +void CSourceDialog::setSourceOptions(map options) +{ + map::iterator it; + + for(it = options.begin(); it != options.end(); ++it) + { + _ui.listWidget->addItem((*it).first); + } +} + +void CSourceDialog::OkButtonClicked() +{ + selected_item = _ui.listWidget->currentItem(); + reject(); +} + +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h new file mode 100644 index 000000000..074ad5b86 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h @@ -0,0 +1,37 @@ + + +#ifndef SOURCE_SELECTION_H +#define SOURCE_SELECTION_H + +#include +#include +#include +#include +#include "ui_source_selection.h" +#include + +using namespace std; + +namespace Plugin +{ + class CSourceDialog : public QDialog + { + Q_OBJECT + private: + Ui::SourceSelectionDialog _ui; + + private Q_SLOTS: + + void OkButtonClicked(); + public: + CSourceDialog(QWidget *parent = 0); + ~CSourceDialog(){} + void setSourceOptions(map options); + QListWidgetItem *selected_item; + + }; +} + + +#endif /* SOURCE_SELECTION_H */ + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui new file mode 100644 index 000000000..6e6f822fe --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui @@ -0,0 +1,70 @@ + + + SourceSelectionDialog + + + Qt::WindowModal + + + true + + + + 0 + 0 + 396 + 197 + + + + Dialog + + + true + + + + + 10 + 10 + 381 + 181 + + + + Select source for merge operation + + + + + 10 + 30 + 361 + 141 + + + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h new file mode 100644 index 000000000..b6bdc8315 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h @@ -0,0 +1,27 @@ +/* + * File: translation_manager_constants.h + * Author: cemycc + * + * Created on July 5, 2011, 9:15 PM + */ + +#ifndef TRANSLATION_MANAGER_CONSTANTS_H +#define TRANSLATION_MANAGER_CONSTANTS_H + +namespace Plugin +{ + namespace Constants + { + const char * const WK_BOTNAMES = "bot_names_wk.txt"; + const char * const WK_ITEM = "item_words_wk.txt"; + const char * const WK_CREATURE = "creature_words_wk.txt"; + const char * const WK_SBRICK = "sbrick_words_wk.txt"; + const char * const WK_SPHRASE = "sphrase_words_wk.txt"; + const char * const WK_PLACE = "place_words_wk.txt"; + const char * const WK_CONTINENT = "place_words_wk.txt"; + const char * const WK_STABLE = "place_words_wk.txt"; + } +} + +#endif /* TRANSLATION_MANAGER_CONSTANTS_H */ +