|
|
@ -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 */
|
|
|
|