diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt index 7e7da7e99..0f520c9d8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt @@ -16,6 +16,7 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h source_selection.h ftp_selection.h editor_worksheet.h + editor_phrase.h extract_new_sheet_names.h extract_bot_names.h) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp.txt new file mode 100644 index 000000000..83d360d8a --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp.txt @@ -0,0 +1,53 @@ +// Translation Manager Plugin - OVQT Plugin +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Emanuel Costea +// +// 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 . + +// Qt includes +#include +#include +#include +#include + +// Project includes +#include "editor_phrase.h" +#include "translation_manager_constants.h" + +using namespace std; + +namespace Plugin { + +void CEditorPhrase::open(QString filename) +{ + +} + +void CEditorPhrase::activateWindow() +{ + +} + +void CEditorPhrase::save() +{ + +} + +void CEditorPhrase::saveAs(QString filename) +{ + +} + + +} \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.h.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.h.txt new file mode 100644 index 000000000..539314eaf --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.h.txt @@ -0,0 +1,48 @@ +// Translation Manager Plugin - OVQT Plugin +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Emanuel Costea +// +// 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 . + +#ifndef EDITOR_PHRASE_H +#define EDITOR_PHRASE_H + +// Qt includes +#include +#include +#include +#include +#include +#include + +// Project includes +#include "translation_manager_editor.h" + +namespace Plugin { + +class CEditorPhrase : public CEditor +{ + Q_OBJECT +public: + CEditorPhrase(QMdiArea* parent) : CEditor(parent) {} + CEditorPhrase() : CEditor() {} + void open(QString filename); + void save(); + void saveAs(QString filename); + void activateWindow(); +}; + +} + +#endif /* EDITOR_PHRASE_H */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp index 5323ded1a..2c7261805 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp @@ -93,6 +93,7 @@ void CEditorWorksheet::open(QString filename) setCurrentFile(filename); setAttribute(Qt::WA_DeleteOnClose); setWidget(table_editor); + editor_type = Constants::ED_SHEET; table_editor->resizeColumnsToContents(); table_editor->resizeRowsToContents(); // set editor signals diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h index b6bdc8315..3cb66181b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h @@ -12,6 +12,9 @@ namespace Plugin { namespace Constants { + const int ED_SHEET = 1; + const int ED_PHRASE = 2; + const char * const WK_BOTNAMES = "bot_names_wk.txt"; const char * const WK_ITEM = "item_words_wk.txt"; const char * const WK_CREATURE = "creature_words_wk.txt"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h index ff947b1d1..767dd90de 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h @@ -31,7 +31,7 @@ Q_OBJECT protected: QUndoStack* current_stack; QString current_file; - int editor_type; + int editor_type; public: CEditor(QMdiArea* parent) : QMdiSubWindow(parent) {} CEditor() : QMdiSubWindow() {} @@ -40,6 +40,10 @@ public: virtual void saveAs(QString filename) =0; virtual void activateWindow() =0; public: + int eType() + { + return editor_type; + } QString subWindowFilePath() { return current_file; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp index 52e423156..e6fa9508a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp @@ -206,6 +206,10 @@ void CMainWindow::open() editor->activateWindow(); return; } + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif + // sheet editor if(isWorksheetEditor(file_name)) { CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea); @@ -213,6 +217,9 @@ void CMainWindow::open() new_window->open(file_name); new_window->activateWindow(); } + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif } } @@ -241,11 +248,13 @@ void CMainWindow::save() if(_ui.mdiArea->subWindowList().size() > 0) { CEditor* current_window = qobject_cast(_ui.mdiArea->currentSubWindow()); - - if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor - { - current_window->save(); - } + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif + current_window->save(); + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif } } @@ -258,13 +267,15 @@ void CMainWindow::saveAs() } if (!file_name.isEmpty()) - { - CEditor* current_window = qobject_cast(_ui.mdiArea->currentSubWindow()); - if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor - { - current_window->saveAs(file_name); - } - + { + CEditor* current_window = qobject_cast(_ui.mdiArea->currentSubWindow()); + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif + current_window->saveAs(file_name); + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif } } @@ -341,14 +352,19 @@ void CMainWindow::extractWords(QString typeq) builderP.PrimFilter.push_back("indoors_*.primitive"); isSheet = false; } - + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif if(isSheet) { editor_window->extractWords(editor_window->windowFilePath(), column_name, builderS); } else { initializeSettings(false); editor_window->extractWords(editor_window->windowFilePath(), column_name, builderP); - } + } + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif } } @@ -371,8 +387,14 @@ void CMainWindow::extractBotNames() QString file_path = editor_window->windowFilePath(); } else return; } + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif 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(); + #endif } } @@ -392,7 +414,7 @@ void CMainWindow::mergeSingleFile() return; } - if(QString(editor_window->widget()->metaObject()->className()) != "QTableWidget") // Sheet Editor + if(editor_window->eType() != Constants::ED_SHEET) // Sheet Editor { QErrorMessage error; error.showMessage(QString("Please open or activate the window with a sheet file.")); @@ -500,7 +522,7 @@ CEditorWorksheet *CMainWindow::getEditorByWorksheetType(const QString &type) Q_FOREACH(QMdiSubWindow *subWindow, _ui.mdiArea->subWindowList()) { CEditor *currentEditor = qobject_cast(subWindow); - if(QString(currentEditor->widget()->metaObject()->className()) == "QTableWidget") + if(currentEditor->eType() == Constants::ED_SHEET) { CEditorWorksheet *editor = qobject_cast(currentEditor); if(type != NULL) {