mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 00:18:43 +00:00
Fixed: #1307 Clean up code.
This commit is contained in:
parent
259c6f8ab2
commit
d0d7f37432
22 changed files with 1858 additions and 1869 deletions
|
@ -17,8 +17,7 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h
|
||||||
ftp_selection.h
|
ftp_selection.h
|
||||||
editor_worksheet.h
|
editor_worksheet.h
|
||||||
editor_phrase.h
|
editor_phrase.h
|
||||||
extract_new_sheet_names.h
|
)
|
||||||
extract_bot_names.h)
|
|
||||||
|
|
||||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui
|
SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui
|
||||||
translation_manager_main_window.ui
|
translation_manager_main_window.ui
|
||||||
|
@ -28,7 +27,6 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui
|
||||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_RCS ftp_selection.qrc)
|
SET(OVQT_PLUG_TRANSLATION_MANAGER_RCS ftp_selection.qrc)
|
||||||
|
|
||||||
SET(QT_USE_QTGUI TRUE)
|
SET(QT_USE_QTGUI TRUE)
|
||||||
SET(QT_USE_QTOPENGL TRUE)
|
|
||||||
SET(QT_USE_QTNETWORK TRUE)
|
SET(QT_USE_QTNETWORK TRUE)
|
||||||
|
|
||||||
QT4_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR})
|
QT4_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR})
|
||||||
|
@ -42,7 +40,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||||
|
|
||||||
ADD_LIBRARY(ovqt_plugin_translation_manager MODULE ${SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS})
|
ADD_LIBRARY(ovqt_plugin_translation_manager MODULE ${SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(ovqt_plugin_translation_manager ovqt_plugin_core nelmisc nel3d nelligo nelgeorges ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
|
TARGET_LINK_LIBRARIES(ovqt_plugin_translation_manager ovqt_plugin_core nelmisc nelligo nelgeorges ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ovqt_plugin_translation_manager "NeL, Tools, 3D: Object Viewer Qt Plugin: Translation Manager")
|
NL_DEFAULT_PROPS(ovqt_plugin_translation_manager "NeL, Tools, 3D: Object Viewer Qt Plugin: Translation Manager")
|
||||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_translation_manager)
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_translation_manager)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -15,32 +14,32 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "editor_phrase.h"
|
||||||
|
#include "translation_manager_constants.h"
|
||||||
|
|
||||||
// Nel includes
|
// Nel includes
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
#include "nel/misc/diff_tool.h"
|
#include "nel/misc/diff_tool.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QTextCodec>
|
||||||
|
#include <QtCore/QTextStream>
|
||||||
|
#include <QtGui/QTextCursor>
|
||||||
#include <QtGui/QErrorMessage>
|
#include <QtGui/QErrorMessage>
|
||||||
#include <QtCore/qfileinfo.h>
|
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QCloseEvent>
|
#include <QtGui/QCloseEvent>
|
||||||
#include <QtCore/QByteArray>
|
|
||||||
#include <QtCore/qtextcodec.h>
|
|
||||||
#include <QtGui/QTextCursor>
|
|
||||||
#include <QtCore/qtextstream.h>
|
|
||||||
#include <QtCore/qtextcodec.h>
|
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "editor_phrase.h"
|
|
||||||
#include "translation_manager_constants.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace TranslationManager {
|
namespace TranslationManager
|
||||||
|
{
|
||||||
|
|
||||||
void CEditorPhrase::open(QString filename)
|
void CEditorPhrase::open(QString filename)
|
||||||
{
|
{
|
||||||
vector<STRING_MANAGER::TPhrase> phrases;
|
std::vector<STRING_MANAGER::TPhrase> phrases;
|
||||||
if(readPhraseFile(filename.toStdString(), phrases, false))
|
if(readPhraseFile(filename.toStdString(), phrases, false))
|
||||||
{
|
{
|
||||||
text_edit = new CTextEdit(this);
|
text_edit = new CTextEdit(this);
|
||||||
|
@ -63,7 +62,9 @@ void CEditorPhrase::open(QString filename)
|
||||||
current_file = filename;
|
current_file = filename;
|
||||||
connect(text_edit->document(), SIGNAL(contentsChanged()), this, SLOT(docContentsChanged()));
|
connect(text_edit->document(), SIGNAL(contentsChanged()), this, SLOT(docContentsChanged()));
|
||||||
connect(text_edit->document(), SIGNAL(undoCommandAdded()), this, SLOT(newUndoCommandAdded()));
|
connect(text_edit->document(), SIGNAL(undoCommandAdded()), this, SLOT(newUndoCommandAdded()));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage("This file is not a phrase file.");
|
error.showMessage("This file is not a phrase file.");
|
||||||
error.exec();
|
error.exec();
|
||||||
|
@ -102,39 +103,32 @@ void CEditorPhrase::saveAs(QString filename)
|
||||||
setCurrentFile(current_file);
|
setCurrentFile(current_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CEditorPhrase::closeEvent(QCloseEvent *event)
|
void CEditorPhrase::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if(isWindowModified())
|
if(isWindowModified())
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("The document has been modified.");
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
msgBox.setInformativeText("Do you want to save your changes?");
|
msgBox.setText(tr("The document has been modified."));
|
||||||
|
msgBox.setInformativeText(tr("Do you want to save your changes?"));
|
||||||
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
msgBox.setDefaultButton(QMessageBox::Save);
|
msgBox.setDefaultButton(QMessageBox::Save);
|
||||||
|
|
||||||
int ret = msgBox.exec();
|
int ret = msgBox.exec();
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case QMessageBox::Save:
|
case QMessageBox::Save:
|
||||||
save();
|
save();
|
||||||
event->accept();
|
|
||||||
close();
|
|
||||||
break;
|
break;
|
||||||
case QMessageBox::Discard:
|
case QMessageBox::Discard:
|
||||||
event->accept();
|
|
||||||
close();
|
|
||||||
break;
|
break;
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
event->ignore();
|
event->ignore();
|
||||||
break;
|
return;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
event->accept();
|
event->accept();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,6 +18,9 @@
|
||||||
#ifndef EDITOR_PHRASE_H
|
#ifndef EDITOR_PHRASE_H
|
||||||
#define EDITOR_PHRASE_H
|
#define EDITOR_PHRASE_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "translation_manager_editor.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
@ -32,16 +35,16 @@
|
||||||
#include <QtGui/QErrorMessage>
|
#include <QtGui/QErrorMessage>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
// Project includes
|
namespace TranslationManager
|
||||||
#include "translation_manager_editor.h"
|
{
|
||||||
|
|
||||||
namespace TranslationManager {
|
|
||||||
|
|
||||||
class CTextEdit : public QTextEdit
|
class CTextEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTextEdit(QWidget *parent = 0) : QTextEdit(parent)
|
CTextEdit(QWidget *parent = 0) : QTextEdit(parent)
|
||||||
{
|
{
|
||||||
|
@ -57,8 +60,7 @@ public:
|
||||||
class CEditorPhrase : public CEditor
|
class CEditorPhrase : public CEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
CTextEdit *text_edit;
|
|
||||||
public:
|
public:
|
||||||
CEditorPhrase(QMdiArea *parent) : CEditor(parent) {}
|
CEditorPhrase(QMdiArea *parent) : CEditor(parent) {}
|
||||||
CEditorPhrase() : CEditor() {}
|
CEditorPhrase() : CEditor() {}
|
||||||
|
@ -67,10 +69,13 @@ public:
|
||||||
void saveAs(QString filename);
|
void saveAs(QString filename);
|
||||||
void activateWindow();
|
void activateWindow();
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void docContentsChanged();
|
void docContentsChanged();
|
||||||
void newUndoCommandAdded();
|
void newUndoCommandAdded();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CTextEdit *text_edit;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUndoPhraseNewCommand : public QUndoCommand
|
class CUndoPhraseNewCommand : public QUndoCommand
|
||||||
|
@ -92,6 +97,7 @@ public:
|
||||||
{
|
{
|
||||||
m_textEdit->redo();
|
m_textEdit->redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CTextEdit *m_textEdit;
|
CTextEdit *m_textEdit;
|
||||||
};
|
};
|
||||||
|
@ -109,7 +115,6 @@ public:
|
||||||
rule.format = translateStringFormat;
|
rule.format = translateStringFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
|
|
||||||
|
|
||||||
singleLineCommentFormat.setForeground(Qt::red);
|
singleLineCommentFormat.setForeground(Qt::red);
|
||||||
rule.pattern = QRegExp("//[^\n]*");
|
rule.pattern = QRegExp("//[^\n]*");
|
||||||
rule.format = singleLineCommentFormat;
|
rule.format = singleLineCommentFormat;
|
||||||
|
@ -134,10 +139,12 @@ public:
|
||||||
|
|
||||||
void highlightBlock(const QString &text)
|
void highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
Q_FOREACH(const HighlightingRule &rule, highlightingRules) {
|
Q_FOREACH(const HighlightingRule &rule, highlightingRules)
|
||||||
|
{
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0)
|
||||||
|
{
|
||||||
int length = expression.matchedLength();
|
int length = expression.matchedLength();
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
|
@ -149,13 +156,17 @@ public:
|
||||||
if (previousBlockState() != 1)
|
if (previousBlockState() != 1)
|
||||||
startIndex = commentStartExpression.indexIn(text);
|
startIndex = commentStartExpression.indexIn(text);
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
while (startIndex >= 0)
|
||||||
|
{
|
||||||
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
||||||
int commentLength;
|
int commentLength;
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1)
|
||||||
|
{
|
||||||
setCurrentBlockState(1);
|
setCurrentBlockState(1);
|
||||||
commentLength = text.length() - startIndex;
|
commentLength = text.length() - startIndex;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
commentLength = endIndex - startIndex
|
commentLength = endIndex - startIndex
|
||||||
+ commentEndExpression.matchedLength();
|
+ commentEndExpression.matchedLength();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "editor_worksheet.h"
|
||||||
|
#include "extract_bot_names.h"
|
||||||
|
#include "translation_manager_constants.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QErrorMessage>
|
#include <QtGui/QErrorMessage>
|
||||||
#include <QtGui/QTableWidgetItem>
|
#include <QtGui/QTableWidgetItem>
|
||||||
|
@ -24,15 +29,10 @@
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "editor_worksheet.h"
|
|
||||||
#include "extract_bot_names.h"
|
|
||||||
#include "translation_manager_constants.h"
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace TranslationManager {
|
namespace TranslationManager
|
||||||
|
{
|
||||||
|
|
||||||
void CEditorWorksheet::open(QString filename)
|
void CEditorWorksheet::open(QString filename)
|
||||||
{
|
{
|
||||||
|
@ -45,25 +45,31 @@ void CEditorWorksheet::open(QString filename)
|
||||||
{
|
{
|
||||||
table_editor->setColumnCount(wk_file.ColCount - 1);
|
table_editor->setColumnCount(wk_file.ColCount - 1);
|
||||||
hasHashValue = true;
|
hasHashValue = true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
table_editor->setColumnCount(wk_file.ColCount);
|
table_editor->setColumnCount(wk_file.ColCount);
|
||||||
}
|
}
|
||||||
table_editor->setRowCount(wk_file.size() - 1);
|
table_editor->setRowCount(wk_file.size() - 1);
|
||||||
|
|
||||||
// read columns name
|
// read columns name
|
||||||
for(unsigned int i = 0; i < wk_file.ColCount; i++)
|
for(uint i = 0; i < wk_file.ColCount; i++)
|
||||||
{
|
{
|
||||||
if(hasHashValue && i == 0)
|
if(hasHashValue && i == 0)
|
||||||
{
|
{
|
||||||
// we don't show the column with hash value
|
// we don't show the column with hash value
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QTableWidgetItem *col = new QTableWidgetItem();
|
QTableWidgetItem *col = new QTableWidgetItem();
|
||||||
ucstring col_name = wk_file.getData(0, i);
|
ucstring col_name = wk_file.getData(0, i);
|
||||||
col->setText(QString(col_name.toString().c_str()));
|
col->setText(QString(col_name.toString().c_str()));
|
||||||
if(hasHashValue)
|
if(hasHashValue)
|
||||||
{
|
{
|
||||||
table_editor->setHorizontalHeaderItem(i - 1, col);
|
table_editor->setHorizontalHeaderItem(i - 1, col);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
table_editor->setHorizontalHeaderItem(i, col);
|
table_editor->setHorizontalHeaderItem(i, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,14 +83,18 @@ void CEditorWorksheet::open(QString filename)
|
||||||
if(hasHashValue && j == 0)
|
if(hasHashValue && j == 0)
|
||||||
{
|
{
|
||||||
// we don't show the column with hash value
|
// we don't show the column with hash value
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QTableWidgetItem *row = new QTableWidgetItem();
|
QTableWidgetItem *row = new QTableWidgetItem();
|
||||||
ucstring row_value = wk_file.getData(i, j);
|
ucstring row_value = wk_file.getData(i, j);
|
||||||
row->setText(QString::fromUtf8(row_value.toUtf8().c_str()));
|
row->setText(QString::fromUtf8(row_value.toUtf8().c_str()));
|
||||||
if(hasHashValue)
|
if(hasHashValue)
|
||||||
{
|
{
|
||||||
table_editor->setItem(i - 1, j - 1, row);
|
table_editor->setItem(i - 1, j - 1, row);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
table_editor->setItem(i - 1, j, row);
|
table_editor->setItem(i - 1, j, row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,20 +110,21 @@ void CEditorWorksheet::open(QString filename)
|
||||||
connect(table_editor, SIGNAL(itemChanged(QTableWidgetItem *) ), this, SLOT(worksheetEditorChanged(QTableWidgetItem *)));
|
connect(table_editor, SIGNAL(itemChanged(QTableWidgetItem *) ), this, SLOT(worksheetEditorChanged(QTableWidgetItem *)));
|
||||||
connect(table_editor, SIGNAL(itemDoubleClicked(QTableWidgetItem *) ), this, SLOT(worksheetEditorCellEntered(QTableWidgetItem *)));
|
connect(table_editor, SIGNAL(itemDoubleClicked(QTableWidgetItem *) ), this, SLOT(worksheetEditorCellEntered(QTableWidgetItem *)));
|
||||||
connect(table_editor,SIGNAL(customContextMenuRequested(const QPoint &)), this,SLOT(contextMenuEvent(QContextMenuEvent *)));
|
connect(table_editor,SIGNAL(customContextMenuRequested(const QPoint &)), this,SLOT(contextMenuEvent(QContextMenuEvent *)));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage("This file is not a worksheet file.");
|
error.showMessage(tr("This file is not a worksheet file."));
|
||||||
error.exec();
|
error.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CEditorWorksheet::contextMenuEvent(QContextMenuEvent *e)
|
void CEditorWorksheet::contextMenuEvent(QContextMenuEvent *e)
|
||||||
{
|
{
|
||||||
QAction *insertRowAct = new QAction("Insert new row", this);
|
QAction *insertRowAct = new QAction(tr("Insert new row"), this);
|
||||||
connect(insertRowAct, SIGNAL(triggered()), this, SLOT(insertRow()));
|
connect(insertRowAct, SIGNAL(triggered()), this, SLOT(insertRow()));
|
||||||
QAction *deleteRowAct = new QAction("Delete row", this);
|
QAction *deleteRowAct = new QAction(tr("Delete row"), this);
|
||||||
connect(deleteRowAct, SIGNAL(triggered()), this, SLOT(deleteRow()));
|
connect(deleteRowAct, SIGNAL(triggered()), this, SLOT(deleteRow()));
|
||||||
|
|
||||||
QMenu *contextMenu = new QMenu(this);
|
QMenu *contextMenu = new QMenu(this);
|
||||||
|
@ -189,16 +200,17 @@ void CEditorWorksheet::deleteRow()
|
||||||
{
|
{
|
||||||
int selected_row = table_editor->currentRow();
|
int selected_row = table_editor->currentRow();
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
msgBox.setText(tr("The row will be deleted."));
|
msgBox.setText(tr("The row will be deleted."));
|
||||||
msgBox.setInformativeText(tr("Do you want to delete the selected row ?"));
|
msgBox.setInformativeText(tr("Do you want to delete the selected row ?"));
|
||||||
msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
|
msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
|
||||||
msgBox.setDefaultButton(QMessageBox::No);
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
|
|
||||||
int ret = msgBox.exec();
|
int ret = msgBox.exec();
|
||||||
if(ret == QMessageBox::Yes)
|
if(ret == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
current_stack->push(new CUndoWorksheetDeleteCommand(table_editor, selected_row));
|
current_stack->push(new CUndoWorksheetDeleteCommand(table_editor, selected_row));
|
||||||
}
|
}
|
||||||
|
|
||||||
table_editor->clearFocus();
|
table_editor->clearFocus();
|
||||||
table_editor->clearSelection();
|
table_editor->clearSelection();
|
||||||
return;
|
return;
|
||||||
|
@ -286,7 +298,7 @@ void CEditorWorksheet::extractWords(QString filename, QString columnId, IWordLis
|
||||||
|
|
||||||
// **** Load the excel sheet
|
// **** Load the excel sheet
|
||||||
// load
|
// load
|
||||||
TWorksheet workSheet;
|
STRING_MANAGER::TWorksheet workSheet;
|
||||||
if(!loadExcelSheet(filename.toStdString(), workSheet, true))
|
if(!loadExcelSheet(filename.toStdString(), workSheet, true))
|
||||||
{
|
{
|
||||||
nlwarning("Error reading '%s'. Aborted", filename.toStdString().c_str());
|
nlwarning("Error reading '%s'. Aborted", filename.toStdString().c_str());
|
||||||
|
@ -308,7 +320,7 @@ void CEditorWorksheet::extractWords(QString filename, QString columnId, IWordLis
|
||||||
}
|
}
|
||||||
|
|
||||||
// **** List all words with the builder given
|
// **** List all words with the builder given
|
||||||
std::vector<string> allWords;
|
std::vector<std::string> allWords;
|
||||||
if(!wordListBuilder.buildWordList(allWords, filename.toStdString()))
|
if(!wordListBuilder.buildWordList(allWords, filename.toStdString()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -326,7 +338,9 @@ void CEditorWorksheet::extractWords(QString filename, QString columnId, IWordLis
|
||||||
{
|
{
|
||||||
knPos = keyColIndex - 1;
|
knPos = keyColIndex - 1;
|
||||||
nPos = nameColIndex - 1;
|
nPos = nameColIndex - 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
knPos = keyColIndex;
|
knPos = keyColIndex;
|
||||||
nPos = nameColIndex;
|
nPos = nameColIndex;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +374,6 @@ void CEditorWorksheet::insertTableRecords(QList<QString> records, QList<CTableWi
|
||||||
new_items.push_back(rec_s);
|
new_items.push_back(rec_s);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEditorWorksheet::compareWorksheetFile(QString filename)
|
bool CEditorWorksheet::compareWorksheetFile(QString filename)
|
||||||
|
@ -388,10 +401,11 @@ bool CEditorWorksheet::compareWorksheetFile(QString filename)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +431,7 @@ void CEditorWorksheet::mergeWorksheetFile(QString filename)
|
||||||
{
|
{
|
||||||
const int lastRow = table_editor->rowCount();
|
const int lastRow = table_editor->rowCount();
|
||||||
table_editor->setRowCount(lastRow + 1);
|
table_editor->setRowCount(lastRow + 1);
|
||||||
for(unsigned int j = 0; j < table_editor->columnCount(); j++)
|
for(int j = 0; j < table_editor->columnCount(); j++)
|
||||||
{
|
{
|
||||||
ucstring rowValue = wk_file.getData(i, j + colIndex); // get the value
|
ucstring rowValue = wk_file.getData(i, j + colIndex); // get the value
|
||||||
QTableWidgetItem *row = new QTableWidgetItem();
|
QTableWidgetItem *row = new QTableWidgetItem();
|
||||||
|
@ -426,7 +440,9 @@ void CEditorWorksheet::mergeWorksheetFile(QString filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(tr("This file is not a worksheet file."));
|
error.showMessage(tr("This file is not a worksheet file."));
|
||||||
error.exec();
|
error.exec();
|
||||||
|
@ -438,6 +454,7 @@ void CEditorWorksheet::closeEvent(QCloseEvent *event)
|
||||||
if(isWindowModified())
|
if(isWindowModified())
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
msgBox.setText(tr("The document has been modified."));
|
msgBox.setText(tr("The document has been modified."));
|
||||||
msgBox.setInformativeText(tr("Do you want to save your changes?"));
|
msgBox.setInformativeText(tr("Do you want to save your changes?"));
|
||||||
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
|
@ -447,24 +464,17 @@ void CEditorWorksheet::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
case QMessageBox::Save:
|
case QMessageBox::Save:
|
||||||
save();
|
save();
|
||||||
event->accept();
|
|
||||||
close();
|
|
||||||
break;
|
break;
|
||||||
case QMessageBox::Discard:
|
case QMessageBox::Discard:
|
||||||
event->accept();
|
|
||||||
close();
|
|
||||||
break;
|
break;
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
event->ignore();
|
event->ignore();
|
||||||
break;
|
return;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
event->accept();
|
event->accept();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CEditorWorksheet::isBotNamesTable()
|
bool CEditorWorksheet::isBotNamesTable()
|
||||||
|
@ -476,7 +486,6 @@ bool CEditorWorksheet::isBotNamesTable()
|
||||||
{
|
{
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,13 +495,21 @@ bool CEditorWorksheet::isSheetTable(QString type)
|
||||||
if(type.toAscii() == Constants::WK_ITEM)
|
if(type.toAscii() == Constants::WK_ITEM)
|
||||||
{
|
{
|
||||||
column_name = "item ID";
|
column_name = "item ID";
|
||||||
} else if(type.toAscii() == Constants::WK_CREATURE) {
|
}
|
||||||
|
else if(type.toAscii() == Constants::WK_CREATURE)
|
||||||
|
{
|
||||||
column_name = "creature ID";
|
column_name = "creature ID";
|
||||||
} else if(type.toAscii() == Constants::WK_SBRICK) {
|
}
|
||||||
|
else if(type.toAscii() == Constants::WK_SBRICK)
|
||||||
|
{
|
||||||
column_name = "sbrick ID";
|
column_name = "sbrick ID";
|
||||||
} else if(type.toAscii() == Constants::WK_SPHRASE) {
|
}
|
||||||
|
else if(type.toAscii() == Constants::WK_SPHRASE)
|
||||||
|
{
|
||||||
column_name = "sphrase ID";
|
column_name = "sphrase ID";
|
||||||
} else if(type.toAscii() == Constants::WK_PLACE) {
|
}
|
||||||
|
else if(type.toAscii() == Constants::WK_PLACE)
|
||||||
|
{
|
||||||
column_name = "placeId";
|
column_name = "placeId";
|
||||||
}
|
}
|
||||||
bool status = true;
|
bool status = true;
|
||||||
|
@ -501,7 +518,6 @@ bool CEditorWorksheet::isSheetTable(QString type)
|
||||||
{
|
{
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
#ifndef EDITOR_WORKSHEET_H
|
#ifndef EDITOR_WORKSHEET_H
|
||||||
#define EDITOR_WORKSHEET_H
|
#define EDITOR_WORKSHEET_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "translation_manager_editor.h"
|
||||||
|
#include "extract_new_sheet_names.h"
|
||||||
|
|
||||||
// Nel includes
|
// Nel includes
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/misc/sheet_id.h"
|
#include "nel/misc/sheet_id.h"
|
||||||
|
@ -34,11 +38,9 @@
|
||||||
#include <QtGui/QUndoCommand>
|
#include <QtGui/QUndoCommand>
|
||||||
#include <QtGui/QUndoStack>
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "translation_manager_editor.h"
|
|
||||||
#include "extract_new_sheet_names.h"
|
|
||||||
|
|
||||||
namespace TranslationManager {
|
namespace TranslationManager
|
||||||
|
{
|
||||||
|
|
||||||
struct CTableWidgetItemStore
|
struct CTableWidgetItemStore
|
||||||
{
|
{
|
||||||
|
@ -47,6 +49,7 @@ public:
|
||||||
m_item(item),
|
m_item(item),
|
||||||
m_row(row),
|
m_row(row),
|
||||||
m_column(column) { }
|
m_column(column) { }
|
||||||
|
|
||||||
QTableWidgetItem *m_item;
|
QTableWidgetItem *m_item;
|
||||||
int m_row;
|
int m_row;
|
||||||
int m_column;
|
int m_column;
|
||||||
|
@ -55,8 +58,7 @@ public:
|
||||||
class CEditorWorksheet : public CEditor
|
class CEditorWorksheet : public CEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
|
||||||
QString temp_content;
|
|
||||||
public:
|
public:
|
||||||
CEditorWorksheet(QMdiArea *parent) : CEditor(parent) {}
|
CEditorWorksheet(QMdiArea *parent) : CEditor(parent) {}
|
||||||
CEditorWorksheet() : CEditor() {}
|
CEditorWorksheet() : CEditor() {}
|
||||||
|
@ -67,12 +69,13 @@ public:
|
||||||
void activateWindow();
|
void activateWindow();
|
||||||
void mergeWorksheetFile(QString filename);
|
void mergeWorksheetFile(QString filename);
|
||||||
bool compareWorksheetFile(QString filename);
|
bool compareWorksheetFile(QString filename);
|
||||||
void extractBotNames(list<string> filters, string level_design_path, NLLIGO::CLigoConfig ligoConfig);
|
void extractBotNames(std::list<std::string> filters, std::string level_design_path, NLLIGO::CLigoConfig ligoConfig);
|
||||||
void extractWords(QString filename, QString columnId, IWordListBuilder &wordListBuilder);
|
void extractWords(QString filename, QString columnId, IWordListBuilder &wordListBuilder);
|
||||||
void insertTableRecords(QList<QString> records, QList<CTableWidgetItemStore> new_items);
|
void insertTableRecords(QList<QString> records, QList<CTableWidgetItemStore> new_items);
|
||||||
bool isBotNamesTable();
|
bool isBotNamesTable();
|
||||||
bool isSheetTable(QString type);
|
bool isSheetTable(QString type);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void worksheetEditorCellEntered(QTableWidgetItem *item);
|
void worksheetEditorCellEntered(QTableWidgetItem *item);
|
||||||
void worksheetEditorChanged(QTableWidgetItem *item);
|
void worksheetEditorChanged(QTableWidgetItem *item);
|
||||||
|
@ -80,6 +83,8 @@ private Q_SLOTS:
|
||||||
void deleteRow();
|
void deleteRow();
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
void contextMenuEvent(QContextMenuEvent *e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString temp_content;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUndoWorksheetCommand : public QUndoCommand
|
class CUndoWorksheetCommand : public QUndoCommand
|
||||||
|
@ -133,10 +138,10 @@ public:
|
||||||
{
|
{
|
||||||
m_table->removeRow(m_rowID);
|
m_table->removeRow(m_rowID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTableWidget *m_table;
|
QTableWidget *m_table;
|
||||||
int m_rowID;
|
int m_rowID;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUndoWorksheetExtraction : public QUndoCommand
|
class CUndoWorksheetExtraction : public QUndoCommand
|
||||||
|
@ -153,7 +158,6 @@ public:
|
||||||
{
|
{
|
||||||
m_table->setItem(is.m_row, is.m_column, is.m_item);
|
m_table->setItem(is.m_row, is.m_column, is.m_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo()
|
void undo()
|
||||||
|
@ -163,7 +167,6 @@ public:
|
||||||
m_table->setItem(is.m_row, is.m_column, is.m_item);
|
m_table->setItem(is.m_row, is.m_column, is.m_item);
|
||||||
m_table->takeItem(is.m_row, is.m_column);
|
m_table->takeItem(is.m_row, is.m_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -17,18 +17,14 @@
|
||||||
|
|
||||||
#include "extract_bot_names.h"
|
#include "extract_bot_names.h"
|
||||||
|
|
||||||
|
|
||||||
static bool RemoveOlds = false;
|
static bool RemoveOlds = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
TCreatureInfo *ExtractBotNames::getCreature(const std::string &sheetName)
|
TCreatureInfo *ExtractBotNames::getCreature(const std::string &sheetName)
|
||||||
{
|
{
|
||||||
CSheetId id(sheetName+".creature");
|
NLMISC::CSheetId id(sheetName+".creature");
|
||||||
|
|
||||||
if (Creatures.find(id) != Creatures.end())
|
if (Creatures.find(id) != Creatures.end())
|
||||||
return &(Creatures.find(id)->second);
|
return &(Creatures.find(id)->second);
|
||||||
|
@ -36,18 +32,17 @@ TCreatureInfo *ExtractBotNames::getCreature(const std::string &sheetName)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ExtractBotNames::cleanupName(const std::string &name)
|
std::string ExtractBotNames::cleanupName(const std::string &name)
|
||||||
{
|
{
|
||||||
string ret;
|
std::string ret;
|
||||||
|
|
||||||
for (uint i=0; i<name.size(); ++i)
|
for (size_t i = 0; i < name.size(); ++i)
|
||||||
{
|
{
|
||||||
if (name[i] != ' ')
|
if (name[i] != ' ')
|
||||||
ret += name[i];
|
ret += name[i];
|
||||||
else
|
else
|
||||||
ret += '_';
|
ret += '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +50,13 @@ ucstring ExtractBotNames::cleanupUcName(const ucstring &name)
|
||||||
{
|
{
|
||||||
ucstring ret;
|
ucstring ret;
|
||||||
|
|
||||||
for (uint i=0; i<name.size(); ++i)
|
for (size_t i = 0; i < name.size(); ++i)
|
||||||
{
|
{
|
||||||
if (name[i] != ' ')
|
if (name[i] != ' ')
|
||||||
ret += name[i];
|
ret += name[i];
|
||||||
else
|
else
|
||||||
ret += '_';
|
ret += '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,16 +82,12 @@ ucstring ExtractBotNames::makeGroupName(const ucstring & translationName)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::set<std::string> ExtractBotNames::getGenericNames()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set<string> ExtractBotNames::getGenericNames()
|
|
||||||
{
|
{
|
||||||
return GenericNames;
|
return GenericNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
map<string, TEntryInfo> ExtractBotNames::getSimpleNames()
|
std::map<std::string, TEntryInfo> ExtractBotNames::getSimpleNames()
|
||||||
{
|
{
|
||||||
return SimpleNames;
|
return SimpleNames;
|
||||||
}
|
}
|
||||||
|
@ -112,20 +102,22 @@ void ExtractBotNames::cleanGenericNames()
|
||||||
GenericNames.clear();
|
GenericNames.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
string ExtractBotNames::removeAndStoreFunction(const std::string &fullName)
|
std::string ExtractBotNames::removeAndStoreFunction(const std::string &fullName)
|
||||||
|
{
|
||||||
|
std::string::size_type pos = fullName.find("$");
|
||||||
|
if (pos == std::string::npos)
|
||||||
{
|
{
|
||||||
string::size_type pos = fullName.find("$");
|
|
||||||
if (pos == string::npos)
|
|
||||||
return fullName;
|
return fullName;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// extract and store the function name
|
// extract and store the function name
|
||||||
string ret;
|
std::string ret;
|
||||||
|
|
||||||
ret = fullName.substr(0, pos);
|
ret = fullName.substr(0, pos);
|
||||||
string::size_type pos2 = fullName.find("$", pos+1);
|
std::string::size_type pos2 = fullName.find("$", pos+1);
|
||||||
|
|
||||||
string fct = fullName.substr(pos+1, pos2-(pos+1));
|
std::string fct = fullName.substr(pos + 1, pos2 - (pos + 1));
|
||||||
|
|
||||||
ret += fullName.substr(pos2 + 1);
|
ret += fullName.substr(pos2 + 1);
|
||||||
|
|
||||||
|
@ -134,12 +126,10 @@ string ExtractBotNames::removeAndStoreFunction(const std::string &fullName)
|
||||||
nldebug("Adding function '%s'", fct.c_str());
|
nldebug("Adding function '%s'", fct.c_str());
|
||||||
Functions.insert(fct);
|
Functions.insert(fct);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtractBotNames::addGenericName(const std::string &name, const std::string &sheetName)
|
void ExtractBotNames::addGenericName(const std::string &name, const std::string &sheetName)
|
||||||
{
|
{
|
||||||
TCreatureInfo *c = getCreature(sheetName);
|
TCreatureInfo *c = getCreature(sheetName);
|
||||||
|
@ -185,75 +175,72 @@ void ExtractBotNames::addSimpleName(const std::string &name, const std::string &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractBotNames::setRequiredSettings(list<string> filters, string level_design_path)
|
void ExtractBotNames::setRequiredSettings(std::list<std::string> filters, std::string level_design_path)
|
||||||
{
|
{
|
||||||
for (std::list<string>::iterator it = filters.begin(); it != filters.end(); ++it)
|
for (std::list<std::string>::iterator it = filters.begin(); it != filters.end(); ++it)
|
||||||
{
|
{
|
||||||
Filters.push_back(*it);
|
Filters.push_back(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// init the sheets
|
// init the sheets
|
||||||
CSheetId::init(false);
|
NLMISC::CSheetId::init(false);
|
||||||
const string PACKED_SHEETS_NAME = "bin/translation_tools_creature.packed_sheets";
|
const std::string PACKED_SHEETS_NAME = "bin/translation_tools_creature.packed_sheets";
|
||||||
loadForm("creature", PACKED_SHEETS_NAME, Creatures, false, false);
|
loadForm("creature", PACKED_SHEETS_NAME, Creatures, false, false);
|
||||||
|
|
||||||
if (Creatures.empty())
|
if (Creatures.empty())
|
||||||
{
|
{
|
||||||
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
|
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtractBotNames::extractBotNamesFromPrimitives(CLigoConfig ligoConfig)
|
void ExtractBotNames::extractBotNamesFromPrimitives(NLLIGO::CLigoConfig ligoConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// ok, ready for the real work,
|
// ok, ready for the real work,
|
||||||
// first, read the primitives files and parse the primitives
|
// first, read the primitives files and parse the primitives
|
||||||
vector<string> files;
|
std::vector<std::string> files;
|
||||||
CPath::getFileList("primitive", files);
|
NLMISC::CPath::getFileList("primitive", files);
|
||||||
|
|
||||||
|
|
||||||
for (uint i=0; i<files.size(); ++i)
|
for (uint i=0; i<files.size(); ++i)
|
||||||
{
|
{
|
||||||
string pathName = files[i];
|
std::string pathName = files[i];
|
||||||
pathName = CPath::lookup(pathName);
|
pathName = NLMISC::CPath::lookup(pathName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// dnk-88: what is it?
|
||||||
// check filters
|
// check filters
|
||||||
uint j = 0;
|
uint j = 0;
|
||||||
for (j=0; j<Filters.size(); ++j)
|
for (size_t j = 0; j < Filters.size(); ++j)
|
||||||
{
|
{
|
||||||
if (pathName.find(Filters[j]) != string::npos)
|
if (pathName.find(Filters[j]) != std::string::npos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j != Filters.size())
|
if (j != Filters.size())
|
||||||
// skip this file
|
// skip this file
|
||||||
continue;
|
continue;
|
||||||
|
*/
|
||||||
|
nlinfo("Loading file '%s'...", NLMISC::CFile::getFilename(pathName).c_str());
|
||||||
|
|
||||||
nlinfo("Loading file '%s'...", CFile::getFilename(pathName).c_str());
|
NLLIGO::CPrimitives primDoc;
|
||||||
|
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc;
|
||||||
CPrimitives primDoc;
|
|
||||||
CPrimitiveContext::instance().CurrentPrimitive = &primDoc;
|
|
||||||
loadXmlPrimitiveFile(primDoc, pathName, ligoConfig);
|
loadXmlPrimitiveFile(primDoc, pathName, ligoConfig);
|
||||||
|
|
||||||
// now parse the file
|
// now parse the file
|
||||||
|
|
||||||
// look for group template
|
// look for group template
|
||||||
{
|
{
|
||||||
TPrimitiveClassPredicate pred("group_template_npc");
|
NLLIGO::TPrimitiveClassPredicate pred("group_template_npc");
|
||||||
TPrimitiveSet result;
|
NLLIGO::TPrimitiveSet result;
|
||||||
|
|
||||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
NLLIGO::CPrimitiveSet<NLLIGO::TPrimitiveClassPredicate> ps;
|
||||||
ps.buildSet(primDoc.RootNode, pred, result);
|
ps.buildSet(primDoc.RootNode, pred, result);
|
||||||
|
|
||||||
for (uint i = 0; i < result.size(); ++i)
|
for (uint i = 0; i < result.size(); ++i)
|
||||||
{
|
{
|
||||||
string name;
|
std::string name;
|
||||||
string countStr;
|
std::string countStr;
|
||||||
string sheetStr;
|
std::string sheetStr;
|
||||||
result[i]->getPropertyByName("name", name);
|
result[i]->getPropertyByName("name", name);
|
||||||
result[i]->getPropertyByName("count", countStr);
|
result[i]->getPropertyByName("count", countStr);
|
||||||
result[i]->getPropertyByName("bot_sheet_look", sheetStr);
|
result[i]->getPropertyByName("bot_sheet_look", sheetStr);
|
||||||
|
@ -276,16 +263,16 @@ void ExtractBotNames::extractBotNamesFromPrimitives(CLigoConfig ligoConfig)
|
||||||
}
|
}
|
||||||
// look for bot template
|
// look for bot template
|
||||||
{
|
{
|
||||||
TPrimitiveClassPredicate pred("bot_template_npc");
|
NLLIGO::TPrimitiveClassPredicate pred("bot_template_npc");
|
||||||
TPrimitiveSet result;
|
NLLIGO::TPrimitiveSet result;
|
||||||
|
|
||||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
NLLIGO::CPrimitiveSet<NLLIGO::TPrimitiveClassPredicate> ps;
|
||||||
ps.buildSet(primDoc.RootNode, pred, result);
|
ps.buildSet(primDoc.RootNode, pred, result);
|
||||||
|
|
||||||
for (uint i=0; i<result.size(); ++i)
|
for (size_t i = 0; i < result.size(); ++i)
|
||||||
{
|
{
|
||||||
string name;
|
std::string name;
|
||||||
string sheetStr;
|
std::string sheetStr;
|
||||||
result[i]->getPropertyByName("name", name);
|
result[i]->getPropertyByName("name", name);
|
||||||
result[i]->getPropertyByName("sheet_look", sheetStr);
|
result[i]->getPropertyByName("sheet_look", sheetStr);
|
||||||
|
|
||||||
|
@ -307,17 +294,17 @@ void ExtractBotNames::extractBotNamesFromPrimitives(CLigoConfig ligoConfig)
|
||||||
}
|
}
|
||||||
// look for npc_group
|
// look for npc_group
|
||||||
{
|
{
|
||||||
TPrimitiveClassPredicate pred("npc_group");
|
NLLIGO::TPrimitiveClassPredicate pred("npc_group");
|
||||||
TPrimitiveSet result;
|
NLLIGO::TPrimitiveSet result;
|
||||||
|
|
||||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
NLLIGO::CPrimitiveSet<NLLIGO::TPrimitiveClassPredicate> ps;
|
||||||
ps.buildSet(primDoc.RootNode, pred, result);
|
ps.buildSet(primDoc.RootNode, pred, result);
|
||||||
|
|
||||||
for (uint i=0; i<result.size(); ++i)
|
for (size_t i = 0; i < result.size(); ++i)
|
||||||
{
|
{
|
||||||
string name;
|
std::string name;
|
||||||
string countStr;
|
std::string countStr;
|
||||||
string sheetStr;
|
std::string sheetStr;
|
||||||
result[i]->getPropertyByName("name", name);
|
result[i]->getPropertyByName("name", name);
|
||||||
result[i]->getPropertyByName("count", countStr);
|
result[i]->getPropertyByName("count", countStr);
|
||||||
result[i]->getPropertyByName("bot_sheet_client", sheetStr);
|
result[i]->getPropertyByName("bot_sheet_client", sheetStr);
|
||||||
|
@ -344,16 +331,16 @@ void ExtractBotNames::extractBotNamesFromPrimitives(CLigoConfig ligoConfig)
|
||||||
}
|
}
|
||||||
// look for bot
|
// look for bot
|
||||||
{
|
{
|
||||||
TPrimitiveClassPredicate pred("npc_bot");
|
NLLIGO::TPrimitiveClassPredicate pred("npc_bot");
|
||||||
TPrimitiveSet result;
|
NLLIGO::TPrimitiveSet result;
|
||||||
|
|
||||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
NLLIGO::CPrimitiveSet<NLLIGO::TPrimitiveClassPredicate> ps;
|
||||||
ps.buildSet(primDoc.RootNode, pred, result);
|
ps.buildSet(primDoc.RootNode, pred, result);
|
||||||
|
|
||||||
for (uint i=0; i<result.size(); ++i)
|
for (size_t i = 0; i < result.size(); ++i)
|
||||||
{
|
{
|
||||||
string name;
|
std::string name;
|
||||||
string sheetStr;
|
std::string sheetStr;
|
||||||
result[i]->getPropertyByName("name", name);
|
result[i]->getPropertyByName("name", name);
|
||||||
result[i]->getPropertyByName("sheet_client", sheetStr);
|
result[i]->getPropertyByName("sheet_client", sheetStr);
|
||||||
|
|
||||||
|
|
|
@ -30,21 +30,15 @@
|
||||||
#include "nel/ligo/primitive.h"
|
#include "nel/ligo/primitive.h"
|
||||||
#include "nel/ligo/primitive_utils.h"
|
#include "nel/ligo/primitive_utils.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLLIGO;
|
|
||||||
using namespace STRING_MANAGER;
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TCreatureInfo
|
struct TCreatureInfo
|
||||||
{
|
{
|
||||||
CSheetId SheetId;
|
NLMISC::CSheetId SheetId;
|
||||||
bool ForceSheetName;
|
bool ForceSheetName;
|
||||||
bool DisplayName;
|
bool DisplayName;
|
||||||
|
|
||||||
|
|
||||||
void readGeorges(const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
void readGeorges(const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
||||||
{
|
{
|
||||||
const NLGEORGES::UFormElm &item=form->getRootNode();
|
const NLGEORGES::UFormElm &item=form->getRootNode();
|
||||||
|
@ -61,7 +55,6 @@ struct TCreatureInfo
|
||||||
f.serial(DisplayName);
|
f.serial(DisplayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint getVersion ()
|
static uint getVersion ()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -70,42 +63,37 @@ struct TCreatureInfo
|
||||||
void removed()
|
void removed()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TEntryInfo
|
struct TEntryInfo
|
||||||
{
|
{
|
||||||
string SheetName;
|
std::string SheetName;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExtractBotNames
|
struct ExtractBotNames
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
vector<string> Filters;
|
std::vector<std::string> Filters;
|
||||||
std::map<CSheetId, TCreatureInfo> Creatures;
|
std::map<NLMISC::CSheetId, TCreatureInfo> Creatures;
|
||||||
set<string> GenericNames;
|
std::set<std::string> GenericNames;
|
||||||
map<string, TEntryInfo> SimpleNames;
|
std::map<std::string, TEntryInfo> SimpleNames;
|
||||||
set<string> Functions;
|
std::set<std::string> Functions;
|
||||||
private:
|
private:
|
||||||
TCreatureInfo *getCreature(const std::string &sheetName);
|
TCreatureInfo *getCreature(const std::string &sheetName);
|
||||||
ucstring makeGroupName(const ucstring &translationName);
|
ucstring makeGroupName(const ucstring &translationName);
|
||||||
string removeAndStoreFunction(const std::string &fullName);
|
std::string removeAndStoreFunction(const std::string &fullName);
|
||||||
void addGenericName(const std::string &name, const std::string &sheetName);
|
void addGenericName(const std::string &name, const std::string &sheetName);
|
||||||
void addSimpleName(const std::string &name, const std::string &sheetName);
|
void addSimpleName(const std::string &name, const std::string &sheetName);
|
||||||
public:
|
public:
|
||||||
void extractBotNamesFromPrimitives(CLigoConfig ligoConfig);
|
void extractBotNamesFromPrimitives(NLLIGO::CLigoConfig ligoConfig);
|
||||||
void setRequiredSettings(list<string> filters, string level_design_path);
|
void setRequiredSettings(std::list<std::string> filters, std::string level_design_path);
|
||||||
set<string> getGenericNames();
|
std::set<std::string> getGenericNames();
|
||||||
map<string, TEntryInfo> getSimpleNames();
|
std::map<std::string, TEntryInfo> getSimpleNames();
|
||||||
string cleanupName(const std::string &name);
|
std::string cleanupName(const std::string &name);
|
||||||
ucstring cleanupUcName(const ucstring &name);
|
ucstring cleanupUcName(const ucstring &name);
|
||||||
void cleanSimpleNames();
|
void cleanSimpleNames();
|
||||||
void cleanGenericNames();
|
void cleanGenericNames();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* EXTRACT_BOT_NAMES_H */
|
#endif /* EXTRACT_BOT_NAMES_H */
|
||||||
|
|
||||||
|
|
|
@ -16,128 +16,125 @@
|
||||||
|
|
||||||
#include "extract_new_sheet_names.h"
|
#include "extract_new_sheet_names.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLLIGO;
|
|
||||||
using namespace STRING_MANAGER;
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
/*
|
/*
|
||||||
* Specialisation of IWordListBuilder to list sheets in a directory
|
* Specialisation of IWordListBuilder to list sheets in a directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool CSheetWordListBuilder::buildWordList(std::vector<std::string> &allWords, std::string workSheetFileName)
|
||||||
bool CSheetWordListBuilder::buildWordList(std::vector<string> &allWords, string workSheetFileName)
|
|
||||||
{
|
{
|
||||||
SheetExt= toLower(SheetExt);
|
SheetExt = NLMISC::toLower(SheetExt);
|
||||||
// verify the directory is correct
|
// verify the directory is correct
|
||||||
if(!CFile::isDirectory(SheetPath))
|
if(!NLMISC::CFile::isDirectory(SheetPath))
|
||||||
{
|
{
|
||||||
nlwarning("Error: Directory '%s' not found. '%s' Aborted", SheetPath.c_str(), workSheetFileName.c_str());
|
nlwarning("Error: Directory '%s' not found. '%s' Aborted", SheetPath.c_str(), workSheetFileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// list all files.
|
// list all files.
|
||||||
std::vector<string> allFiles;
|
std::vector<std::string> allFiles;
|
||||||
allFiles.reserve(100000);
|
allFiles.reserve(100000);
|
||||||
CPath::getPathContent(SheetPath, true, false, true, allFiles, NULL);
|
NLMISC::CPath::getPathContent(SheetPath, true, false, true, allFiles, NULL);
|
||||||
|
|
||||||
// Keep only the extension we want, and remove "_" (parent)
|
// Keep only the extension we want, and remove "_" (parent)
|
||||||
allWords.clear();
|
allWords.clear();
|
||||||
allWords.reserve(allFiles.size());
|
allWords.reserve(allFiles.size());
|
||||||
for(uint i=0;i<allFiles.size();i++)
|
for(size_t i = 0; i < allFiles.size(); i++)
|
||||||
{
|
{
|
||||||
string fileNameWithoutExt= CFile::getFilenameWithoutExtension(allFiles[i]);
|
std::string fileNameWithoutExt = NLMISC::CFile::getFilenameWithoutExtension(allFiles[i]);
|
||||||
string extension= toLower(CFile::getExtension(allFiles[i]));
|
std::string extension = NLMISC::toLower(NLMISC::CFile::getExtension(allFiles[i]));
|
||||||
|
|
||||||
// bad extension?
|
// bad extension?
|
||||||
if(extension!=SheetExt)
|
if(extension!=SheetExt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// parent?
|
// parent?
|
||||||
if(fileNameWithoutExt.empty() || fileNameWithoutExt[0] == '_')
|
if(fileNameWithoutExt.empty() || fileNameWithoutExt[0] == '_')
|
||||||
continue;
|
continue;
|
||||||
// ok, add
|
|
||||||
allWords.push_back(toLower(fileNameWithoutExt));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// ok, add
|
||||||
|
allWords.push_back(NLMISC::toLower(fileNameWithoutExt));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
/*
|
/*
|
||||||
* Specialisation of IWordListBuilder to list new region/place name from .primitive
|
* Specialisation of IWordListBuilder to list new region/place name from .primitive
|
||||||
*/
|
*/
|
||||||
bool CRegionPrimWordListBuilder::buildWordList(std::vector<string> &allWords, string workSheetFileName)
|
bool CRegionPrimWordListBuilder::buildWordList(std::vector<std::string> &allWords, std::string workSheetFileName)
|
||||||
{
|
{
|
||||||
// verify the directory is correct
|
// verify the directory is correct
|
||||||
if(!CFile::isDirectory(PrimPath))
|
if(!NLMISC::CFile::isDirectory(PrimPath))
|
||||||
{
|
{
|
||||||
nlwarning("Error: Directory '%s' not found. '%s' Aborted", PrimPath.c_str(), workSheetFileName.c_str());
|
nlwarning("Error: Directory '%s' not found. '%s' Aborted", PrimPath.c_str(), workSheetFileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// list all files.
|
// list all files.
|
||||||
std::vector<string> allFiles;
|
std::vector<std::string> allFiles;
|
||||||
allFiles.reserve(100000);
|
allFiles.reserve(100000);
|
||||||
CPath::getPathContent(PrimPath, true, false, true, allFiles, NULL);
|
NLMISC::CPath::getPathContent(PrimPath, true, false, true, allFiles, NULL);
|
||||||
|
|
||||||
// parse all primitive that match the filter
|
// parse all primitive that match the filter
|
||||||
allWords.clear();
|
allWords.clear();
|
||||||
allWords.reserve(100000);
|
allWords.reserve(100000);
|
||||||
// to avoid duplicate
|
// to avoid duplicate
|
||||||
set<string> allWordSet;
|
std::set<std::string> allWordSet;
|
||||||
for(uint i=0;i<allFiles.size();i++)
|
for(size_t i = 0; i < allFiles.size(); i++)
|
||||||
{
|
{
|
||||||
string fileName= CFile::getFilename(allFiles[i]);
|
std::string fileName = NLMISC::CFile::getFilename(allFiles[i]);
|
||||||
// filter don't match?
|
// filter don't match?
|
||||||
bool oneMatch= false;
|
bool oneMatch= false;
|
||||||
for(uint filter=0;filter<PrimFilter.size();filter++)
|
for(size_t filter = 0; filter < PrimFilter.size(); filter++)
|
||||||
{
|
{
|
||||||
if(testWildCard(fileName, PrimFilter[filter]))
|
if(NLMISC::testWildCard(fileName, PrimFilter[filter]))
|
||||||
oneMatch= true;
|
oneMatch= true;
|
||||||
}
|
}
|
||||||
if(!oneMatch)
|
if(!oneMatch)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ok, read the file
|
// ok, read the file
|
||||||
CPrimitives PrimDoc;
|
NLLIGO::CPrimitives PrimDoc;
|
||||||
CPrimitiveContext::instance().CurrentPrimitive = &PrimDoc;
|
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &PrimDoc;
|
||||||
if (!loadXmlPrimitiveFile(PrimDoc, allFiles[i], LigoConfig))
|
if (!NLLIGO::loadXmlPrimitiveFile(PrimDoc, allFiles[i], LigoConfig))
|
||||||
{
|
{
|
||||||
nlwarning("Error: cannot open file '%s'. '%s' Aborted", allFiles[i].c_str(), workSheetFileName.c_str());
|
nlwarning("Error: cannot open file '%s'. '%s' Aborted", allFiles[i].c_str(), workSheetFileName.c_str());
|
||||||
CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
||||||
|
|
||||||
// For all primitives of interest
|
// For all primitives of interest
|
||||||
const char *listClass[] = {"continent", "region", "place", "stable",
|
const char *listClass[] = {"continent", "region", "place", "stable",
|
||||||
"teleport_destination", "room_template"};
|
"teleport_destination", "room_template"
|
||||||
|
};
|
||||||
|
|
||||||
const char *listProp[] = {"name", "name", "name", "name",
|
const char *listProp[] = {"name", "name", "name", "name",
|
||||||
"place_name", "place_name"};
|
"place_name", "place_name"
|
||||||
|
};
|
||||||
|
|
||||||
const uint numListClass= sizeof(listClass)/sizeof(listClass[0]);
|
const uint numListClass= sizeof(listClass)/sizeof(listClass[0]);
|
||||||
const uint numListProp= sizeof(listProp)/sizeof(listProp[0]);
|
const uint numListProp= sizeof(listProp)/sizeof(listProp[0]);
|
||||||
nlctassert(numListProp == numListClass);
|
nlctassert(numListProp == numListClass);
|
||||||
for(uint cid = 0; cid < numListClass; cid++)
|
for(uint cid = 0; cid < numListClass; cid++)
|
||||||
{
|
{
|
||||||
// parse the whole hierarchy
|
// parse the whole hierarchy
|
||||||
TPrimitiveClassPredicate predCont(listClass[cid]);
|
NLLIGO::TPrimitiveClassPredicate predCont(listClass[cid]);
|
||||||
CPrimitiveSet<TPrimitiveClassPredicate> setPlace;
|
NLLIGO::CPrimitiveSet<NLLIGO::TPrimitiveClassPredicate> setPlace;
|
||||||
TPrimitiveSet placeRes;
|
NLLIGO::TPrimitiveSet placeRes;
|
||||||
setPlace.buildSet(PrimDoc.RootNode, predCont, placeRes);
|
setPlace.buildSet(PrimDoc.RootNode, predCont, placeRes);
|
||||||
|
|
||||||
// for all found
|
// for all found
|
||||||
for (uint placeId= 0; placeId < placeRes.size(); ++placeId)
|
for (size_t placeId = 0; placeId < placeRes.size(); ++placeId)
|
||||||
{
|
{
|
||||||
string primName;
|
std::string primName;
|
||||||
if(placeRes[placeId]->getPropertyByName(listProp[cid], primName) && !primName.empty())
|
if(placeRes[placeId]->getPropertyByName(listProp[cid], primName) && !primName.empty())
|
||||||
{
|
{
|
||||||
primName= toLower(primName);
|
primName = NLMISC::toLower(primName);
|
||||||
// avoid duplicate
|
// avoid duplicate
|
||||||
if(allWordSet.insert(primName).second)
|
if(allWordSet.insert(primName).second)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +144,6 @@ bool CRegionPrimWordListBuilder::buildWordList(std::vector<string> &allWords, st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,43 +30,34 @@
|
||||||
#include "nel/ligo/primitive.h"
|
#include "nel/ligo/primitive.h"
|
||||||
#include "nel/ligo/primitive_utils.h"
|
#include "nel/ligo/primitive_utils.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace NLMISC;
|
|
||||||
using namespace NLLIGO;
|
|
||||||
using namespace STRING_MANAGER;
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
/*
|
/*
|
||||||
* Interface to build the whole list of words (key id) for a specific worksheet
|
* Interface to build the whole list of words (key id) for a specific worksheet
|
||||||
*/
|
*/
|
||||||
struct IWordListBuilder
|
struct IWordListBuilder
|
||||||
{
|
{
|
||||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName) =0;
|
virtual bool buildWordList(std::vector<std::string> &allWords, std::string workSheetFileName) =0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CSheetWordListBuilder : public IWordListBuilder
|
struct CSheetWordListBuilder : public IWordListBuilder
|
||||||
{
|
{
|
||||||
string SheetExt;
|
std::string SheetExt;
|
||||||
string SheetPath;
|
std::string SheetPath;
|
||||||
|
|
||||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName);
|
virtual bool buildWordList(std::vector<std::string> &allWords, std::string workSheetFileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CRegionPrimWordListBuilder : public IWordListBuilder
|
struct CRegionPrimWordListBuilder : public IWordListBuilder
|
||||||
{
|
{
|
||||||
string PrimPath;
|
std::string PrimPath;
|
||||||
vector<string> PrimFilter;
|
std::vector<std::string> PrimFilter;
|
||||||
NLLIGO::CLigoConfig LigoConfig;
|
NLLIGO::CLigoConfig LigoConfig;
|
||||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName);
|
virtual bool buildWordList(std::vector<std::string> &allWords, std::string workSheetFileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* EXTRACT_NEW_SHEET_NAMES_H */
|
#endif /* EXTRACT_NEW_SHEET_NAMES_H */
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,24 @@
|
||||||
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "ftp_selection.h"
|
#include "ftp_selection.h"
|
||||||
|
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtNetwork/QFtp>
|
#include <QtNetwork/QFtp>
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
CFtpSelection::CFtpSelection(QWidget *parent): QDialog(parent)
|
CFtpSelection::CFtpSelection(QWidget *parent): QDialog(parent)
|
||||||
|
@ -33,14 +49,17 @@ namespace TranslationManager
|
||||||
conn = new QFtp(this);
|
conn = new QFtp(this);
|
||||||
connect(conn, SIGNAL(commandFinished(int,bool)), this, SLOT(FtpCommandFinished(int,bool)));
|
connect(conn, SIGNAL(commandFinished(int,bool)), this, SLOT(FtpCommandFinished(int,bool)));
|
||||||
connect(conn, SIGNAL(listInfo(QUrlInfo)), this, SLOT(AddToList(QUrlInfo)));
|
connect(conn, SIGNAL(listInfo(QUrlInfo)), this, SLOT(AddToList(QUrlInfo)));
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
QUrl url(_ui.url->text());
|
QUrl url(_ui.url->text());
|
||||||
if (!url.isValid() || url.scheme().toLower() != QLatin1String("ftp")) {
|
if (!url.isValid() || url.scheme().toLower() != QLatin1String("ftp"))
|
||||||
|
{
|
||||||
conn->connectToHost(_ui.url->text(), 21);
|
conn->connectToHost(_ui.url->text(), 21);
|
||||||
conn->login();
|
conn->login();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
conn->connectToHost(url.host(), url.port(21));
|
conn->connectToHost(url.host(), url.port(21));
|
||||||
|
|
||||||
if (!url.userName().isEmpty())
|
if (!url.userName().isEmpty())
|
||||||
|
@ -55,9 +74,8 @@ namespace TranslationManager
|
||||||
// Get the user action.
|
// Get the user action.
|
||||||
void CFtpSelection::FtpCommandFinished(int, bool error)
|
void CFtpSelection::FtpCommandFinished(int, bool error)
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
#endif
|
|
||||||
if (conn->currentCommand() == QFtp::ConnectToHost)
|
if (conn->currentCommand() == QFtp::ConnectToHost)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -85,7 +103,9 @@ namespace TranslationManager
|
||||||
status = false;
|
status = false;
|
||||||
file->close();
|
file->close();
|
||||||
file->remove();
|
file->remove();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
file->close();
|
file->close();
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +114,8 @@ namespace TranslationManager
|
||||||
|
|
||||||
if (conn->currentCommand() == QFtp::List)
|
if (conn->currentCommand() == QFtp::List)
|
||||||
{
|
{
|
||||||
if (isDirectory.isEmpty()) {
|
if (isDirectory.isEmpty())
|
||||||
|
{
|
||||||
_ui.fileList->addTopLevelItem(new QTreeWidgetItem(QStringList() << tr("<empty>")));
|
_ui.fileList->addTopLevelItem(new QTreeWidgetItem(QStringList() << tr("<empty>")));
|
||||||
_ui.fileList->setEnabled(false);
|
_ui.fileList->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +136,8 @@ namespace TranslationManager
|
||||||
|
|
||||||
isDirectory[urlInfo.name()] = urlInfo.isDir();
|
isDirectory[urlInfo.name()] = urlInfo.isDir();
|
||||||
_ui.fileList->addTopLevelItem(item);
|
_ui.fileList->addTopLevelItem(item);
|
||||||
if (!_ui.fileList->currentItem()) {
|
if (!_ui.fileList->currentItem())
|
||||||
|
{
|
||||||
_ui.fileList->setCurrentItem(_ui.fileList->topLevelItem(0));
|
_ui.fileList->setCurrentItem(_ui.fileList->topLevelItem(0));
|
||||||
_ui.fileList->setEnabled(true);
|
_ui.fileList->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -132,9 +154,8 @@ namespace TranslationManager
|
||||||
currentPath += name;
|
currentPath += name;
|
||||||
conn->cd(name);
|
conn->cd(name);
|
||||||
conn->list();
|
conn->list();
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ui.doneButton->setEnabled(true);
|
_ui.doneButton->setEnabled(true);
|
||||||
|
@ -143,16 +164,18 @@ namespace TranslationManager
|
||||||
// Exit from a directory
|
// Exit from a directory
|
||||||
void CFtpSelection::cdToParent()
|
void CFtpSelection::cdToParent()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
_ui.fileList->clear();
|
_ui.fileList->clear();
|
||||||
isDirectory.clear();
|
isDirectory.clear();
|
||||||
currentPath = currentPath.left(currentPath.lastIndexOf('/'));
|
currentPath = currentPath.left(currentPath.lastIndexOf('/'));
|
||||||
if (currentPath.isEmpty()) {
|
if (currentPath.isEmpty())
|
||||||
|
{
|
||||||
_ui.cdToParrent->setEnabled(false);
|
_ui.cdToParrent->setEnabled(false);
|
||||||
conn->cd("/");
|
conn->cd("/");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
conn->cd(currentPath);
|
conn->cd(currentPath);
|
||||||
}
|
}
|
||||||
conn->list();
|
conn->list();
|
||||||
|
@ -163,7 +186,8 @@ namespace TranslationManager
|
||||||
{
|
{
|
||||||
QString fileName = _ui.fileList->currentItem()->text(0);
|
QString fileName = _ui.fileList->currentItem()->text(0);
|
||||||
|
|
||||||
if (QFile::exists(fileName)) {
|
if (QFile::exists(fileName))
|
||||||
|
{
|
||||||
QMessageBox::information(this, tr("FTP"),
|
QMessageBox::information(this, tr("FTP"),
|
||||||
tr("There already exists a file called %1 in "
|
tr("There already exists a file called %1 in "
|
||||||
"the current directory.")
|
"the current directory.")
|
||||||
|
@ -172,10 +196,11 @@ namespace TranslationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
file = new QFile(fileName);
|
file = new QFile(fileName);
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
if (!file->open(QIODevice::WriteOnly)) {
|
if (!file->open(QIODevice::WriteOnly))
|
||||||
|
{
|
||||||
QMessageBox::information(this, tr("FTP"),
|
QMessageBox::information(this, tr("FTP"),
|
||||||
tr("Unable to save the file %1: %2.")
|
tr("Unable to save the file %1: %2.")
|
||||||
.arg(fileName).arg(file->errorString()));
|
.arg(fileName).arg(file->errorString()));
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#ifndef FTP_SELECTION_H
|
#ifndef FTP_SELECTION_H
|
||||||
#define FTP_SELECTION_H
|
#define FTP_SELECTION_H
|
||||||
|
|
||||||
|
#include "ui_ftp_selection.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
|
@ -16,20 +18,19 @@
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#include "ui_ftp_selection.h"
|
namespace TranslationManager
|
||||||
|
{
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace TranslationManager {
|
|
||||||
|
|
||||||
class CFtpSelection : public QDialog
|
class CFtpSelection : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
|
||||||
Ui::FtpSelectionDialog _ui;
|
public:
|
||||||
QFtp *conn;
|
CFtpSelection(QWidget *parent = 0);
|
||||||
QHash<QString, bool> isDirectory;
|
~CFtpSelection() {}
|
||||||
QString currentPath;
|
bool status;
|
||||||
|
QFile *file;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void cdToParent();
|
void cdToParent();
|
||||||
void processItem(QTreeWidgetItem *,int);
|
void processItem(QTreeWidgetItem *,int);
|
||||||
|
@ -37,13 +38,13 @@ namespace TranslationManager {
|
||||||
void DoneButtonClicked();
|
void DoneButtonClicked();
|
||||||
void FtpCommandFinished(int, bool error);
|
void FtpCommandFinished(int, bool error);
|
||||||
void AddToList(const QUrlInfo &urlInfo);
|
void AddToList(const QUrlInfo &urlInfo);
|
||||||
public:
|
|
||||||
bool status;
|
private:
|
||||||
QFile *file;
|
Ui::FtpSelectionDialog _ui;
|
||||||
CFtpSelection(QWidget* parent = 0);
|
QFtp *conn;
|
||||||
~CFtpSelection() {}
|
QHash<QString, bool> isDirectory;
|
||||||
|
QString currentPath;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FTP_SELECTION_H */
|
#endif /* FTP_SELECTION_H */
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,43 @@
|
||||||
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
#include <QtGui/qlistwidget.h>
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "source_selection.h"
|
#include "source_selection.h"
|
||||||
|
|
||||||
|
#include <QtGui/QListWidget>
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
CSourceDialog::CSourceDialog(QWidget *parent): QDialog(parent)
|
CSourceDialog::CSourceDialog(QWidget *parent): QDialog(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
// Set signal and slot for "OK Button"
|
|
||||||
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"
|
|
||||||
connect(_ui.cancel_button, SIGNAL(clicked()), this, SLOT(reject()));
|
connect(_ui.cancel_button, SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
|
|
||||||
_ui.sourceSelectionListWidget->setSortingEnabled(false);
|
_ui.sourceSelectionListWidget->setSortingEnabled(false);
|
||||||
connect(_ui.sourceSelectionListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
|
connect(_ui.sourceSelectionListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
|
||||||
this, SLOT(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.
|
||||||
void CSourceDialog::setSourceOptions(map<QListWidgetItem*,int> options)
|
void CSourceDialog::setSourceOptions(std::map<QListWidgetItem *, int> &options)
|
||||||
{
|
{
|
||||||
map<QListWidgetItem*,int>::iterator it;
|
std::map<QListWidgetItem *,int>::iterator it;
|
||||||
|
|
||||||
for(it = options.begin(); it != options.end(); ++it)
|
for(it = options.begin(); it != options.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef SOURCE_SELECTION_H
|
#ifndef SOURCE_SELECTION_H
|
||||||
#define SOURCE_SELECTION_H
|
#define SOURCE_SELECTION_H
|
||||||
|
|
||||||
|
#include "ui_source_selection.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QListWidgetItem>
|
#include <QtGui/QListWidgetItem>
|
||||||
#include "ui_source_selection.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
using namespace std;
|
#include <map>
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
@ -18,16 +32,19 @@ namespace TranslationManager
|
||||||
class CSourceDialog : public QDialog
|
class CSourceDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
|
||||||
Ui::SourceSelectionDialog _ui;
|
|
||||||
private Q_SLOTS:
|
|
||||||
void OkButtonClicked();
|
|
||||||
void itemDoubleClicked(QListWidgetItem *item);
|
|
||||||
public:
|
public:
|
||||||
CSourceDialog(QWidget *parent = 0);
|
CSourceDialog(QWidget *parent = 0);
|
||||||
~CSourceDialog() {}
|
~CSourceDialog() {}
|
||||||
void setSourceOptions(map<QListWidgetItem*, int> options);
|
void setSourceOptions(std::map<QListWidgetItem *, int> &options);
|
||||||
QListWidgetItem *selected_item;
|
QListWidgetItem *selected_item;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void OkButtonClicked();
|
||||||
|
void itemDoubleClicked(QListWidgetItem *item);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::SourceSelectionDialog _ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
/*
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
* File: translation_manager_constants.h
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
* Author: cemycc
|
//
|
||||||
*
|
// This program is free software: you can redistribute it and/or modify
|
||||||
* Created on July 5, 2011, 9:15 PM
|
// it under the terms of the GNU Affero General Public License as
|
||||||
*/
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef TRANSLATION_MANAGER_CONSTANTS_H
|
#ifndef TRANSLATION_MANAGER_CONSTANTS_H
|
||||||
#define TRANSLATION_MANAGER_CONSTANTS_H
|
#define TRANSLATION_MANAGER_CONSTANTS_H
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -25,14 +24,13 @@
|
||||||
#include <QtGui/QUndoStack>
|
#include <QtGui/QUndoStack>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
namespace TranslationManager {
|
namespace TranslationManager
|
||||||
|
{
|
||||||
|
|
||||||
class CEditor : public QMdiSubWindow {
|
class CEditor : public QMdiSubWindow
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
|
||||||
QUndoStack* current_stack;
|
|
||||||
QString current_file;
|
|
||||||
int editor_type;
|
|
||||||
public:
|
public:
|
||||||
CEditor(QMdiArea *parent) : QMdiSubWindow(parent) {}
|
CEditor(QMdiArea *parent) : QMdiSubWindow(parent) {}
|
||||||
CEditor() : QMdiSubWindow() {}
|
CEditor() : QMdiSubWindow() {}
|
||||||
|
@ -40,7 +38,7 @@ public:
|
||||||
virtual void save() =0;
|
virtual void save() =0;
|
||||||
virtual void saveAs(QString filename) =0;
|
virtual void saveAs(QString filename) =0;
|
||||||
virtual void activateWindow() =0;
|
virtual void activateWindow() =0;
|
||||||
public:
|
|
||||||
int eType()
|
int eType()
|
||||||
{
|
{
|
||||||
return editor_type;
|
return editor_type;
|
||||||
|
@ -62,10 +60,12 @@ public:
|
||||||
setWindowFilePath(current_file);
|
setWindowFilePath(current_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QUndoStack *current_stack;
|
||||||
|
QString current_file;
|
||||||
|
int editor_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* TRANSLATION_MANAGER_EDITOR_H */
|
#endif /* TRANSLATION_MANAGER_EDITOR_H */
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
|
@ -16,32 +15,31 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Project system includes
|
// Plugin includes
|
||||||
|
#include "translation_manager_main_window.h"
|
||||||
|
#include "translation_manager_constants.h"
|
||||||
|
#include "ftp_selection.h"
|
||||||
|
|
||||||
|
// Core includes
|
||||||
#include "../core/icore.h"
|
#include "../core/icore.h"
|
||||||
#include "../core/core_constants.h"
|
#include "../core/core_constants.h"
|
||||||
#include "../core/menu_manager.h"
|
#include "../core/menu_manager.h"
|
||||||
#include "../../extension_system/iplugin_spec.h"
|
#include "../../extension_system/iplugin_spec.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QWidget>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtCore/QEvent>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QErrorMessage>
|
|
||||||
#include <QtCore/QSignalMapper>
|
#include <QtCore/QSignalMapper>
|
||||||
|
#include <QtCore/QResource>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QErrorMessage>
|
||||||
#include <QtGui/QTableWidget>
|
#include <QtGui/QTableWidget>
|
||||||
#include <QtGui/QTableWidgetItem>
|
#include <QtGui/QTableWidgetItem>
|
||||||
#include <QtGui/QMdiSubWindow>
|
#include <QtGui/QMdiSubWindow>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtCore/QResource>
|
|
||||||
#include <QtGui/QMenuBar>
|
#include <QtGui/QMenuBar>
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QEvent>
|
|
||||||
#include <QtGui/QCloseEvent>
|
#include <QtGui/QCloseEvent>
|
||||||
// Plugin includes
|
|
||||||
#include "translation_manager_main_window.h"
|
|
||||||
#include "translation_manager_constants.h"
|
|
||||||
#include "ftp_selection.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
@ -83,45 +81,51 @@ void CMainWindow::createToolbar()
|
||||||
QMenu *wordsExtractionMenu = new QMenu("&Words extraction...");
|
QMenu *wordsExtractionMenu = new QMenu("&Words extraction...");
|
||||||
wordsExtractionMenu->setIcon(QIcon(Core::Constants::ICON_SETTINGS));
|
wordsExtractionMenu->setIcon(QIcon(Core::Constants::ICON_SETTINGS));
|
||||||
_ui.toolBar->addAction(wordsExtractionMenu->menuAction());
|
_ui.toolBar->addAction(wordsExtractionMenu->menuAction());
|
||||||
|
|
||||||
// extract bot names
|
// extract bot names
|
||||||
QAction *extractBotNamesAct = wordsExtractionMenu->addAction("&Extract bot names...");
|
QAction *extractBotNamesAct = wordsExtractionMenu->addAction("&Extract bot names...");
|
||||||
extractBotNamesAct->setStatusTip(tr("Extract bot names from primitives."));
|
extractBotNamesAct->setStatusTip(tr("Extract bot names from primitives."));
|
||||||
connect(extractBotNamesAct, SIGNAL(triggered()), this, SLOT(extractBotNames()));
|
connect(extractBotNamesAct, SIGNAL(triggered()), this, SLOT(extractBotNames()));
|
||||||
|
|
||||||
// Words extraction
|
// Words extraction
|
||||||
// -----------------------------
|
|
||||||
// signal mapper for extraction words
|
|
||||||
QSignalMapper *wordsExtractionMapper = new QSignalMapper(this);
|
QSignalMapper *wordsExtractionMapper = new QSignalMapper(this);
|
||||||
connect(wordsExtractionMapper, SIGNAL(mapped(QString)), this, SLOT(extractWords(QString)));
|
connect(wordsExtractionMapper, SIGNAL(mapped(QString)), this, SLOT(extractWords(QString)));
|
||||||
// extract item words
|
// extract item words
|
||||||
|
|
||||||
QAction *extractItemWordsAct = wordsExtractionMenu->addAction("&Extract item words...");
|
QAction *extractItemWordsAct = wordsExtractionMenu->addAction("&Extract item words...");
|
||||||
extractItemWordsAct->setStatusTip(tr("Extract item words"));
|
extractItemWordsAct->setStatusTip(tr("Extract item words"));
|
||||||
connect(extractItemWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
connect(extractItemWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||||
wordsExtractionMapper->setMapping(extractItemWordsAct, QString(Constants::WK_ITEM));
|
wordsExtractionMapper->setMapping(extractItemWordsAct, QString(Constants::WK_ITEM));
|
||||||
|
|
||||||
// extract creature words
|
// extract creature words
|
||||||
QAction *extractCreatureWordsAct = wordsExtractionMenu->addAction("&Extract creature words...");
|
QAction *extractCreatureWordsAct = wordsExtractionMenu->addAction(tr("&Extract creature words..."));
|
||||||
extractCreatureWordsAct->setStatusTip(tr("Extract creature words"));
|
extractCreatureWordsAct->setStatusTip(tr("Extract creature words"));
|
||||||
connect(extractCreatureWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
connect(extractCreatureWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||||
wordsExtractionMapper->setMapping(extractCreatureWordsAct, QString(Constants::WK_CREATURE));
|
wordsExtractionMapper->setMapping(extractCreatureWordsAct, QString(Constants::WK_CREATURE));
|
||||||
|
|
||||||
// extract sbrick words
|
// extract sbrick words
|
||||||
QAction *extractSbrickWordsAct = wordsExtractionMenu->addAction("&Extract sbrick words...");
|
QAction *extractSbrickWordsAct = wordsExtractionMenu->addAction("&Extract sbrick words...");
|
||||||
extractSbrickWordsAct->setStatusTip(tr("Extract sbrick words"));
|
extractSbrickWordsAct->setStatusTip(tr("Extract sbrick words"));
|
||||||
connect(extractSbrickWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
connect(extractSbrickWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||||
wordsExtractionMapper->setMapping(extractSbrickWordsAct, QString(Constants::WK_SBRICK));
|
wordsExtractionMapper->setMapping(extractSbrickWordsAct, QString(Constants::WK_SBRICK));
|
||||||
|
|
||||||
// extract sphrase words
|
// extract sphrase words
|
||||||
QAction *extractSphraseWordsAct = wordsExtractionMenu->addAction("&Extract sphrase words...");
|
QAction *extractSphraseWordsAct = wordsExtractionMenu->addAction("&Extract sphrase words...");
|
||||||
extractSphraseWordsAct->setStatusTip(tr("Extract sphrase words"));
|
extractSphraseWordsAct->setStatusTip(tr("Extract sphrase words"));
|
||||||
connect(extractSphraseWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
connect(extractSphraseWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||||
wordsExtractionMapper->setMapping(extractSphraseWordsAct, QString(Constants::WK_SPHRASE));
|
wordsExtractionMapper->setMapping(extractSphraseWordsAct, QString(Constants::WK_SPHRASE));
|
||||||
|
|
||||||
// extract place and region names
|
// extract place and region names
|
||||||
QAction *extractPlaceNamesAct = wordsExtractionMenu->addAction("&Extract place names...");
|
QAction *extractPlaceNamesAct = wordsExtractionMenu->addAction("&Extract place names...");
|
||||||
extractPlaceNamesAct->setStatusTip(tr("Extract place names from primitives"));
|
extractPlaceNamesAct->setStatusTip(tr("Extract place names from primitives"));
|
||||||
connect(extractPlaceNamesAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
connect(extractPlaceNamesAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||||
wordsExtractionMapper->setMapping(extractPlaceNamesAct, QString(Constants::WK_PLACE));
|
wordsExtractionMapper->setMapping(extractPlaceNamesAct, QString(Constants::WK_PLACE));
|
||||||
|
|
||||||
// Merge options
|
// Merge options
|
||||||
// -----------------------------
|
|
||||||
QAction *mergeSingleFileAct = wordsExtractionMenu->addAction("&Merge worksheet file...");
|
QAction *mergeSingleFileAct = wordsExtractionMenu->addAction("&Merge worksheet file...");
|
||||||
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
||||||
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
||||||
|
|
||||||
// Windows menu
|
// Windows menu
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::MenuManager *menuManager = core->menuManager();
|
Core::MenuManager *menuManager = core->menuManager();
|
||||||
|
@ -130,7 +134,6 @@ void CMainWindow::createToolbar()
|
||||||
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
||||||
|
|
||||||
// Undo, Redo actions
|
// Undo, Redo actions
|
||||||
// -----------------------------
|
|
||||||
QAction *undoAction = menuManager->action(Core::Constants::UNDO);
|
QAction *undoAction = menuManager->action(Core::Constants::UNDO);
|
||||||
if (undoAction != 0)
|
if (undoAction != 0)
|
||||||
_ui.toolBar->addAction(undoAction);
|
_ui.toolBar->addAction(undoAction);
|
||||||
|
@ -152,7 +155,6 @@ void CMainWindow::updateToolbar(QMdiSubWindow *window)
|
||||||
QAction *deleteRowAct = new QAction(tr("Delete row"), this);
|
QAction *deleteRowAct = new QAction(tr("Delete row"), this);
|
||||||
connect(deleteRowAct, SIGNAL(triggered()), window, SLOT(deleteRow()));
|
connect(deleteRowAct, SIGNAL(triggered()), window, SLOT(deleteRow()));
|
||||||
windowMenu->addAction(deleteRowAct);
|
windowMenu->addAction(deleteRowAct);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,11 +162,11 @@ void CMainWindow::updateToolbar(QMdiSubWindow *window)
|
||||||
void CMainWindow::setActiveSubWindow(QWidget *window)
|
void CMainWindow::setActiveSubWindow(QWidget *window)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
QMdiSubWindow *cwindow = qobject_cast<QMdiSubWindow *>(window);
|
QMdiSubWindow *mdiWindow = qobject_cast<QMdiSubWindow *>(window);
|
||||||
_ui.mdiArea->setActiveSubWindow(cwindow);
|
if (mdiWindow != 0)
|
||||||
|
_ui.mdiArea->setActiveSubWindow(mdiWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions for updating the windows list
|
// Functions for updating the windows list
|
||||||
|
@ -182,9 +184,12 @@ void CMainWindow::updateWindowsList()
|
||||||
{
|
{
|
||||||
QString window_file = QFileInfo(subWindows.at(i)->windowFilePath()).fileName();
|
QString window_file = QFileInfo(subWindows.at(i)->windowFilePath()).fileName();
|
||||||
QString action_text;
|
QString action_text;
|
||||||
if (i < 9) {
|
if (i < 9)
|
||||||
|
{
|
||||||
action_text = QString("&%1 %2").arg(i + 1).arg(window_file);
|
action_text = QString("&%1 %2").arg(i + 1).arg(window_file);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
action_text = QString("%1 %2").arg(i + 1).arg(window_file);
|
action_text = QString("%1 %2").arg(i + 1).arg(window_file);
|
||||||
}
|
}
|
||||||
QAction *action = new QAction(action_text, this);
|
QAction *action = new QAction(action_text, this);
|
||||||
|
@ -194,7 +199,9 @@ void CMainWindow::updateWindowsList()
|
||||||
windowMenu->addAction(action);
|
windowMenu->addAction(action);
|
||||||
windowMapper->setMapping(action, subWindows.at(i));
|
windowMapper->setMapping(action, subWindows.at(i));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
windowMenu->clear();
|
windowMenu->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,9 +225,8 @@ void CMainWindow::open()
|
||||||
editor->activateWindow();
|
editor->activateWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
// sheet editor
|
// sheet editor
|
||||||
if(isWorksheetEditor(file_name))
|
if(isWorksheetEditor(file_name))
|
||||||
{
|
{
|
||||||
|
@ -237,11 +243,8 @@ void CMainWindow::open()
|
||||||
new_window->open(file_name);
|
new_window->open(file_name);
|
||||||
new_window->activateWindow();
|
new_window->activateWindow();
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open a work file. You can set the directory for work file in the settings dialog
|
// Open a work file. You can set the directory for work file in the settings dialog
|
||||||
|
@ -256,31 +259,26 @@ void CMainWindow::openWorkFile(QString file)
|
||||||
new_window->open(file_path->filePath());
|
new_window->open(file_path->filePath());
|
||||||
new_window->activateWindow();
|
new_window->activateWindow();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(QString("The %1 file don't exists.").arg(file_path->fileName()));
|
error.showMessage(tr("The %1 file don't exists.").arg(file_path->fileName()));
|
||||||
error.exec();
|
error.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save signal
|
|
||||||
void CMainWindow::save()
|
void CMainWindow::save()
|
||||||
{
|
{
|
||||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||||
{
|
{
|
||||||
CEditor *current_window = qobject_cast<CEditor *>(_ui.mdiArea->currentSubWindow());
|
CEditor *current_window = qobject_cast<CEditor *>(_ui.mdiArea->currentSubWindow());
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
current_window->save();
|
current_window->save();
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save as signal
|
|
||||||
void CMainWindow::saveAs()
|
void CMainWindow::saveAs()
|
||||||
{
|
{
|
||||||
QString file_name;
|
QString file_name;
|
||||||
|
@ -288,17 +286,12 @@ void CMainWindow::saveAs()
|
||||||
{
|
{
|
||||||
file_name = QFileDialog::getSaveFileName(this);
|
file_name = QFileDialog::getSaveFileName(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_name.isEmpty())
|
if (!file_name.isEmpty())
|
||||||
{
|
{
|
||||||
CEditor *current_window = qobject_cast<CEditor *>(_ui.mdiArea->currentSubWindow());
|
CEditor *current_window = qobject_cast<CEditor *>(_ui.mdiArea->currentSubWindow());
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
current_window->saveAs(file_name);
|
current_window->saveAs(file_name);
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +300,8 @@ void CMainWindow::initializeSettings(bool georges = false)
|
||||||
{
|
{
|
||||||
if(georges == true && initialize_settings["georges"] == false)
|
if(georges == true && initialize_settings["georges"] == false)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath(level_design_path.toStdString() + "/DFN", true, false);
|
NLMISC::CPath::addSearchPath(level_design_path.toStdString() + "/DFN", true, false);
|
||||||
CPath::addSearchPath(level_design_path.toStdString() + "/Game_elem/Creature", true, false);
|
NLMISC::CPath::addSearchPath(level_design_path.toStdString() + "/Game_elem/Creature", true, false);
|
||||||
initialize_settings["georges"] = true;
|
initialize_settings["georges"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +322,6 @@ void CMainWindow::initializeSettings(bool georges = false)
|
||||||
nlerror("Can't found path to world_editor_classes.xml");
|
nlerror("Can't found path to world_editor_classes.xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extracting words
|
// Extracting words
|
||||||
|
@ -342,14 +334,17 @@ void CMainWindow::extractWords(QString typeq)
|
||||||
{
|
{
|
||||||
editor_window->activateWindow();
|
editor_window->activateWindow();
|
||||||
QString file_path = editor_window->windowFilePath();
|
QString file_path = editor_window->windowFilePath();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
openWorkFile(typeq);
|
openWorkFile(typeq);
|
||||||
editor_window = getEditorByWorksheetType(typeq);
|
editor_window = getEditorByWorksheetType(typeq);
|
||||||
if(editor_window != NULL)
|
if(editor_window != NULL)
|
||||||
{
|
{
|
||||||
editor_window->activateWindow();
|
editor_window->activateWindow();
|
||||||
QString file_path = editor_window->windowFilePath();
|
QString file_path = editor_window->windowFilePath();
|
||||||
} else return;
|
}
|
||||||
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString column_name;
|
QString column_name;
|
||||||
|
@ -358,48 +353,54 @@ void CMainWindow::extractWords(QString typeq)
|
||||||
// Primitives extraction
|
// Primitives extraction
|
||||||
CRegionPrimWordListBuilder builderP;
|
CRegionPrimWordListBuilder builderP;
|
||||||
bool isSheet = false;
|
bool isSheet = false;
|
||||||
if(typeq.toAscii() == Constants::WK_ITEM) {
|
if(typeq.toAscii() == Constants::WK_ITEM)
|
||||||
|
{
|
||||||
column_name = "item ID";
|
column_name = "item ID";
|
||||||
builderS.SheetExt = "sitem";
|
builderS.SheetExt = "sitem";
|
||||||
builderS.SheetPath = level_design_path.append("/game_element/sitem").toStdString();
|
builderS.SheetPath = level_design_path.append("/game_element/sitem").toStdString();
|
||||||
isSheet = true;
|
isSheet = true;
|
||||||
} else if(typeq.toAscii() == Constants::WK_CREATURE) {
|
}
|
||||||
|
else if(typeq.toAscii() == Constants::WK_CREATURE)
|
||||||
|
{
|
||||||
column_name = "creature ID";
|
column_name = "creature ID";
|
||||||
builderS.SheetExt = "creature";
|
builderS.SheetExt = "creature";
|
||||||
builderS.SheetPath = level_design_path.append("/Game_elem/Creature/fauna").toStdString();
|
builderS.SheetPath = level_design_path.append("/Game_elem/Creature/fauna").toStdString();
|
||||||
isSheet = true;
|
isSheet = true;
|
||||||
} else if(typeq.toAscii() == Constants::WK_SBRICK) {
|
}
|
||||||
|
else if(typeq.toAscii() == Constants::WK_SBRICK)
|
||||||
|
{
|
||||||
column_name = "sbrick ID";
|
column_name = "sbrick ID";
|
||||||
builderS.SheetExt = "sbrick";
|
builderS.SheetExt = "sbrick";
|
||||||
builderS.SheetPath = level_design_path.append("/game_element/sbrick").toStdString();
|
builderS.SheetPath = level_design_path.append("/game_element/sbrick").toStdString();
|
||||||
isSheet = true;
|
isSheet = true;
|
||||||
} else if(typeq.toAscii() == Constants::WK_SPHRASE) {
|
}
|
||||||
|
else if(typeq.toAscii() == Constants::WK_SPHRASE)
|
||||||
|
{
|
||||||
column_name = "sphrase ID";
|
column_name = "sphrase ID";
|
||||||
builderS.SheetExt = "sphrase";
|
builderS.SheetExt = "sphrase";
|
||||||
builderS.SheetPath = level_design_path.append("/game_element/sphrase").toStdString();
|
builderS.SheetPath = level_design_path.append("/game_element/sphrase").toStdString();
|
||||||
isSheet = true;
|
isSheet = true;
|
||||||
} else if(typeq.toAscii() == Constants::WK_PLACE) {
|
}
|
||||||
|
else if(typeq.toAscii() == Constants::WK_PLACE)
|
||||||
|
{
|
||||||
column_name = "placeId";
|
column_name = "placeId";
|
||||||
builderP.PrimPath = primitives_path.toStdString();
|
builderP.PrimPath = primitives_path.toStdString();
|
||||||
builderP.PrimFilter.push_back("region_*.primitive");
|
builderP.PrimFilter.push_back("region_*.primitive");
|
||||||
builderP.PrimFilter.push_back("indoors_*.primitive");
|
builderP.PrimFilter.push_back("indoors_*.primitive");
|
||||||
isSheet = false;
|
isSheet = false;
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
if(isSheet)
|
if(isSheet)
|
||||||
{
|
{
|
||||||
editor_window->extractWords(editor_window->windowFilePath(), column_name, builderS);
|
editor_window->extractWords(editor_window->windowFilePath(), column_name, builderS);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
initializeSettings(false);
|
initializeSettings(false);
|
||||||
editor_window->extractWords(editor_window->windowFilePath(), column_name, builderP);
|
editor_window->extractWords(editor_window->windowFilePath(), column_name, builderP);
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract bot names from primitives
|
// Extract bot names from primitives
|
||||||
|
@ -412,23 +413,23 @@ void CMainWindow::extractBotNames()
|
||||||
{
|
{
|
||||||
editor_window->activateWindow();
|
editor_window->activateWindow();
|
||||||
QString file_path = editor_window->windowFilePath();
|
QString file_path = editor_window->windowFilePath();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
openWorkFile(Constants::WK_BOTNAMES);
|
openWorkFile(Constants::WK_BOTNAMES);
|
||||||
editor_window = getEditorByWorksheetType(NULL);
|
editor_window = getEditorByWorksheetType(NULL);
|
||||||
if(editor_window != NULL)
|
if(editor_window != NULL)
|
||||||
{
|
{
|
||||||
editor_window->activateWindow();
|
editor_window->activateWindow();
|
||||||
QString file_path = editor_window->windowFilePath();
|
QString file_path = editor_window->windowFilePath();
|
||||||
} else return;
|
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
else return;
|
||||||
|
}
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
|
||||||
initializeSettings(true);
|
initializeSettings(true);
|
||||||
editor_window->extractBotNames(convertQStringList(filters), level_design_path.toStdString(), ligoConfig);
|
editor_window->extractBotNames(convertQStringList(filters), level_design_path.toStdString(), ligoConfig);
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +445,7 @@ void CMainWindow::mergeSingleFile()
|
||||||
if (_ui.mdiArea->subWindowList().size() == 0)
|
if (_ui.mdiArea->subWindowList().size() == 0)
|
||||||
{
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(QString("Open a work file in editor for merge operation."));
|
error.showMessage(tr("Open a work file in editor for merge operation."));
|
||||||
error.exec();
|
error.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +453,7 @@ void CMainWindow::mergeSingleFile()
|
||||||
if(editor_window->eType() != Constants::ED_SHEET) // Sheet Editor
|
if(editor_window->eType() != Constants::ED_SHEET) // Sheet Editor
|
||||||
{
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(QString("Please open or activate the window with a sheet file."));
|
error.showMessage(tr("Please open or activate the window with a sheet file."));
|
||||||
error.exec();
|
error.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -497,20 +498,24 @@ void CMainWindow::mergeSingleFile()
|
||||||
if(current_window->compareWorksheetFile(file_name))
|
if(current_window->compareWorksheetFile(file_name))
|
||||||
{
|
{
|
||||||
current_window->mergeWorksheetFile(file_name);
|
current_window->mergeWorksheetFile(file_name);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(tr("The file: %1 has different columns from the current file in editor.").arg(file_name));
|
error.showMessage(tr("The file: %1 has different columns from the current file in editor.").arg(file_name));
|
||||||
error.exec();
|
error.exec();
|
||||||
}
|
}
|
||||||
if(dialog->selected_item == ftp_item)
|
if(dialog->selected_item == ftp_item)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
// TODO: uninit ftp_dialog?????
|
||||||
if(!ftp_dialog->file->remove())
|
if(!ftp_dialog->file->remove())
|
||||||
{
|
{
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage(tr("Please remove the file from ftp server manually. The file is located on the same directory with OVQT application."));
|
error.showMessage(tr("Please remove the file from ftp server manually. The file is located on the same directory with OVQT application."));
|
||||||
error.exec();
|
error.exec();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,9 +549,7 @@ bool CMainWindow::verifySettings()
|
||||||
error_settings.exec();
|
error_settings.exec();
|
||||||
count_errors = true;
|
count_errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !count_errors;
|
return !count_errors;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCoreListener::closeMainWindow() const
|
bool CCoreListener::closeMainWindow() const
|
||||||
|
@ -558,8 +561,9 @@ bool CCoreListener::closeMainWindow() const
|
||||||
if(subWindow->isWindowModified())
|
if(subWindow->isWindowModified())
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
msgBox.setText(tr("The document has been modified ( %1 ).").arg(currentEditor->windowFilePath()));
|
msgBox.setText(tr("The document has been modified ( %1 ).").arg(currentEditor->windowFilePath()));
|
||||||
msgBox.setInformativeText("Do you want to save your changes?");
|
msgBox.setInformativeText(tr("Do you want to save your changes?"));
|
||||||
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
msgBox.setDefaultButton(QMessageBox::Save);
|
msgBox.setDefaultButton(QMessageBox::Save);
|
||||||
int ret = msgBox.exec();
|
int ret = msgBox.exec();
|
||||||
|
@ -598,12 +602,15 @@ CEditorWorksheet *CMainWindow::getEditorByWorksheetType(const QString &type)
|
||||||
if(currentEditor->eType() == Constants::ED_SHEET)
|
if(currentEditor->eType() == Constants::ED_SHEET)
|
||||||
{
|
{
|
||||||
CEditorWorksheet *editor = qobject_cast<CEditorWorksheet *>(currentEditor);
|
CEditorWorksheet *editor = qobject_cast<CEditorWorksheet *>(currentEditor);
|
||||||
if(type != NULL) {
|
if(type != NULL)
|
||||||
|
{
|
||||||
if(editor->isSheetTable(type))
|
if(editor->isSheetTable(type))
|
||||||
{
|
{
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if(editor->isBotNamesTable())
|
if(editor->isBotNamesTable())
|
||||||
{
|
{
|
||||||
return editor;
|
return editor;
|
||||||
|
@ -614,8 +621,7 @@ CEditorWorksheet *CMainWindow::getEditorByWorksheetType(const QString &type)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<std::string> CMainWindow::convertQStringList(QStringList listq)
|
||||||
list<string> CMainWindow::convertQStringList(QStringList listq)
|
|
||||||
{
|
{
|
||||||
std::list<std::string> stdlist;
|
std::list<std::string> stdlist;
|
||||||
|
|
||||||
|
@ -623,7 +629,6 @@ list<string> CMainWindow::convertQStringList(QStringList listq)
|
||||||
{
|
{
|
||||||
stdlist.push_back(text.toStdString());
|
stdlist.push_back(text.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return stdlist;
|
return stdlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,19 +640,13 @@ bool CMainWindow::isWorksheetEditor(QString filename)
|
||||||
if(wk_file.ColCount > 1)
|
if(wk_file.ColCount > 1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMainWindow::isPhraseEditor(QString filename)
|
bool CMainWindow::isPhraseEditor(QString filename)
|
||||||
{
|
{
|
||||||
vector<STRING_MANAGER::TPhrase> phrases;
|
vector<STRING_MANAGER::TPhrase> phrases;
|
||||||
if(readPhraseFile(filename.toStdString(), phrases, false))
|
return readPhraseFile(filename.toStdString(), phrases, false);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace TranslationManager */
|
} /* namespace TranslationManager */
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -15,20 +14,19 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAIN_WINDOW_H
|
#ifndef MAIN_WINDOW_H
|
||||||
#define MAIN_WINDOW_H
|
#define MAIN_WINDOW_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_translation_manager_main_window.h"
|
||||||
|
#include "translation_manager_editor.h"
|
||||||
|
#include "source_selection.h"
|
||||||
|
#include "editor_worksheet.h"
|
||||||
|
#include "editor_phrase.h"
|
||||||
|
|
||||||
// Project system includes
|
// Project system includes
|
||||||
#include "../core/icore_listener.h"
|
#include "../core/icore_listener.h"
|
||||||
|
|
||||||
// Nel includes
|
|
||||||
#include "nel/misc/types_nl.h"
|
|
||||||
#include "nel/misc/sheet_id.h"
|
|
||||||
#include "nel/misc/path.h"
|
|
||||||
#include "nel/misc/diff_tool.h"
|
|
||||||
#include "nel/ligo/ligo_config.h"
|
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtGui/QUndoStack>
|
#include <QtGui/QUndoStack>
|
||||||
|
@ -39,16 +37,15 @@
|
||||||
#include <QtCore/QSignalMapper>
|
#include <QtCore/QSignalMapper>
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
|
|
||||||
// Plugin includes
|
// STL includes
|
||||||
#include "translation_manager_editor.h"
|
|
||||||
#include "source_selection.h"
|
|
||||||
#include "ui_translation_manager_main_window.h"
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "editor_worksheet.h"
|
|
||||||
#include "editor_phrase.h"
|
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
|
// Nel includes
|
||||||
|
#include "nel/misc/types_nl.h"
|
||||||
|
#include "nel/misc/sheet_id.h"
|
||||||
|
#include "nel/misc/path.h"
|
||||||
|
#include "nel/misc/diff_tool.h"
|
||||||
|
#include "nel/ligo/ligo_config.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -58,12 +55,15 @@ namespace TranslationManager
|
||||||
class CMainWindow : public QMainWindow
|
class CMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMainWindow(QWidget *parent = 0);
|
CMainWindow(QWidget *parent = 0);
|
||||||
virtual ~CMainWindow() {}
|
virtual ~CMainWindow() {}
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ui::CMainWindow _ui;
|
Ui::CMainWindow _ui;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// actions
|
// actions
|
||||||
QAction *openAct;
|
QAction *openAct;
|
||||||
|
@ -80,6 +80,7 @@ private:
|
||||||
QString translation_path;
|
QString translation_path;
|
||||||
QString work_path;
|
QString work_path;
|
||||||
NLLIGO::CLigoConfig ligoConfig;
|
NLLIGO::CLigoConfig ligoConfig;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void extractBotNames();
|
void extractBotNames();
|
||||||
void extractWords(QString typeq);
|
void extractWords(QString typeq);
|
||||||
|
@ -89,6 +90,7 @@ private Q_SLOTS:
|
||||||
void setActiveSubWindow(QWidget *window);
|
void setActiveSubWindow(QWidget *window);
|
||||||
void updateWindowsList();
|
void updateWindowsList();
|
||||||
void mergeSingleFile();
|
void mergeSingleFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openWorkFile(QString file);
|
void openWorkFile(QString file);
|
||||||
void updateToolbar(QMdiSubWindow *window);
|
void updateToolbar(QMdiSubWindow *window);
|
||||||
|
@ -97,20 +99,18 @@ private:
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createToolbar();
|
void createToolbar();
|
||||||
void initializeSettings(bool georges);
|
void initializeSettings(bool georges);
|
||||||
list<string> convertQStringList(QStringList listq);
|
std::list<std::string> convertQStringList(QStringList listq);
|
||||||
CEditor *getEditorByWindowFilePath(const QString &fileName);
|
CEditor *getEditorByWindowFilePath(const QString &fileName);
|
||||||
// Worksheet specific functions
|
// Worksheet specific functions
|
||||||
CEditorWorksheet *getEditorByWorksheetType(const QString &type);
|
CEditorWorksheet *getEditorByWorksheetType(const QString &type);
|
||||||
bool isWorksheetEditor(QString filename);
|
bool isWorksheetEditor(QString filename);
|
||||||
bool isPhraseEditor(QString filename);
|
bool isPhraseEditor(QString filename);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCoreListener : public Core::ICoreListener
|
class CCoreListener : public Core::ICoreListener
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCoreListener(CMainWindow *mainWindow, QObject *parent = 0): ICoreListener(parent)
|
CCoreListener(CMainWindow *mainWindow, QObject *parent = 0): ICoreListener(parent)
|
||||||
{
|
{
|
||||||
|
@ -124,10 +124,6 @@ public:
|
||||||
CMainWindow *m_MainWindow;
|
CMainWindow *m_MainWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace TranslationManager
|
} // namespace TranslationManager
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // SIMPLE_VIEWER_H
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
#include "translation_manager_plugin.h"
|
#include "translation_manager_plugin.h"
|
||||||
#include "translation_manager_settings_page.h"
|
#include "translation_manager_settings_page.h"
|
||||||
#include "translation_manager_main_window.h"
|
#include "translation_manager_main_window.h"
|
||||||
// Project system includes
|
|
||||||
|
// Core includes
|
||||||
#include "../core/icore.h"
|
#include "../core/icore.h"
|
||||||
#include "../core/core_constants.h"
|
#include "../core/core_constants.h"
|
||||||
#include "../core/menu_manager.h"
|
#include "../core/menu_manager.h"
|
||||||
|
@ -65,11 +66,8 @@ bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *plugi
|
||||||
|
|
||||||
void TranslationManagerPlugin::extensionsInitialized()
|
void TranslationManagerPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
@ -86,23 +84,6 @@ void TranslationManagerPlugin::addAutoReleasedObject(QObject *obj)
|
||||||
_autoReleaseObjects.prepend(obj);
|
_autoReleaseObjects.prepend(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* TranslationManagerPlugin::objectByName(const QString &name) const
|
|
||||||
{
|
|
||||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
|
||||||
if (qobj->objectName() == name)
|
|
||||||
return qobj;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionSystem::IPluginSpec *TranslationManagerPlugin::pluginByName(const QString &name) const
|
|
||||||
{
|
|
||||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
|
||||||
if (spec->name() == name)
|
|
||||||
return spec;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(TranslationManager::TranslationManagerPlugin)
|
Q_EXPORT_PLUGIN(TranslationManager::TranslationManagerPlugin)
|
|
@ -58,12 +58,8 @@ public:
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
|
||||||
void addAutoReleasedObject(QObject *obj);
|
void addAutoReleasedObject(QObject *obj);
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
|
||||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
|
@ -75,6 +71,7 @@ private:
|
||||||
class CTranslationManagerContext: public Core::IContext
|
class CTranslationManagerContext: public Core::IContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTranslationManagerContext(CMainWindow *mainWindow, QObject *parent = 0): IContext(parent)
|
CTranslationManagerContext(CMainWindow *mainWindow, QObject *parent = 0): IContext(parent)
|
||||||
{
|
{
|
||||||
|
@ -109,9 +106,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainWindow *m_MainWindow;
|
CMainWindow *m_MainWindow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plugin
|
}
|
||||||
|
|
||||||
#endif // TRANSLATION_MANAGER_PLUGIN_H
|
#endif // TRANSLATION_MANAGER_PLUGIN_H
|
|
@ -1,5 +1,4 @@
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,17 +16,15 @@
|
||||||
|
|
||||||
#include "translation_manager_settings_page.h"
|
#include "translation_manager_settings_page.h"
|
||||||
|
|
||||||
|
// Core includes
|
||||||
|
#include "../core/icore.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtGui/QListWidgetItem>
|
#include <QtGui/QListWidgetItem>
|
||||||
|
|
||||||
// NeL includes
|
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "../core/icore.h"
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -203,5 +200,4 @@ void CTranslationManagerSettingsPage::writeSettings()
|
||||||
settings->sync();
|
settings->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace Plugin */
|
|
|
@ -24,13 +24,9 @@
|
||||||
|
|
||||||
#include "ui_translation_manager_settings_page.h"
|
#include "ui_translation_manager_settings_page.h"
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
@class CTranslationManagerSettingsPage
|
|
||||||
*/
|
|
||||||
class CTranslationManagerSettingsPage : public Core::IOptionsPage
|
class CTranslationManagerSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -61,6 +57,6 @@ private:
|
||||||
void readSettings();
|
void readSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plugin
|
}
|
||||||
|
|
||||||
#endif // TRANSLATION_MANAGER_SETTINGS_H
|
#endif // TRANSLATION_MANAGER_SETTINGS_H
|
|
@ -6,34 +6,21 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>533</width>
|
<width>589</width>
|
||||||
<height>478</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>531</width>
|
|
||||||
<height>421</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Translation Manager Plugin</string>
|
<string>Translation Manager Plugin</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<property name="geometry">
|
<item row="0" column="0">
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>521</width>
|
|
||||||
<height>232</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
|
@ -118,45 +105,8 @@
|
||||||
<widget class="QListWidget" name="lang_list"/>
|
<widget class="QListWidget" name="lang_list"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>340</y>
|
|
||||||
<width>521</width>
|
|
||||||
<height>60</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Translation directory</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLineEdit" name="translation_edit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QToolButton" name="translation_add">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>270</y>
|
|
||||||
<width>521</width>
|
|
||||||
<height>60</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
|
@ -176,8 +126,32 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Translation directory</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLineEdit" name="translation_edit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QToolButton" name="translation_add">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../core/core.qrc"/>
|
<include location="../core/core.qrc"/>
|
||||||
|
|
Loading…
Reference in a new issue