mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 01:18:46 +00:00
Changed: #1307 Added the base files for phrase editor and new method to save the editor type
This commit is contained in:
parent
f5984da292
commit
8cf9d368af
7 changed files with 150 additions and 18 deletions
|
@ -16,6 +16,7 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h
|
||||||
source_selection.h
|
source_selection.h
|
||||||
ftp_selection.h
|
ftp_selection.h
|
||||||
editor_worksheet.h
|
editor_worksheet.h
|
||||||
|
editor_phrase.h
|
||||||
extract_new_sheet_names.h
|
extract_new_sheet_names.h
|
||||||
extract_bot_names.h)
|
extract_bot_names.h)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
// 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>
|
||||||
|
//
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QErrorMessage>
|
||||||
|
#include <QtCore/qfileinfo.h>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QCloseEvent>
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
// 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>
|
||||||
|
//
|
||||||
|
// 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 EDITOR_PHRASE_H
|
||||||
|
#define EDITOR_PHRASE_H
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtGui/QMdiArea>
|
||||||
|
#include <QtGui/QMdiSubWindow>
|
||||||
|
#include <QtGui/QUndoCommand>
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
|
// 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 */
|
|
@ -93,6 +93,7 @@ void CEditorWorksheet::open(QString filename)
|
||||||
setCurrentFile(filename);
|
setCurrentFile(filename);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWidget(table_editor);
|
setWidget(table_editor);
|
||||||
|
editor_type = Constants::ED_SHEET;
|
||||||
table_editor->resizeColumnsToContents();
|
table_editor->resizeColumnsToContents();
|
||||||
table_editor->resizeRowsToContents();
|
table_editor->resizeRowsToContents();
|
||||||
// set editor signals
|
// set editor signals
|
||||||
|
|
|
@ -12,6 +12,9 @@ namespace Plugin
|
||||||
{
|
{
|
||||||
namespace Constants
|
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_BOTNAMES = "bot_names_wk.txt";
|
||||||
const char * const WK_ITEM = "item_words_wk.txt";
|
const char * const WK_ITEM = "item_words_wk.txt";
|
||||||
const char * const WK_CREATURE = "creature_words_wk.txt";
|
const char * const WK_CREATURE = "creature_words_wk.txt";
|
||||||
|
|
|
@ -40,6 +40,10 @@ public:
|
||||||
virtual void saveAs(QString filename) =0;
|
virtual void saveAs(QString filename) =0;
|
||||||
virtual void activateWindow() =0;
|
virtual void activateWindow() =0;
|
||||||
public:
|
public:
|
||||||
|
int eType()
|
||||||
|
{
|
||||||
|
return editor_type;
|
||||||
|
}
|
||||||
QString subWindowFilePath()
|
QString subWindowFilePath()
|
||||||
{
|
{
|
||||||
return current_file;
|
return current_file;
|
||||||
|
|
|
@ -206,6 +206,10 @@ void CMainWindow::open()
|
||||||
editor->activateWindow();
|
editor->activateWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
#endif
|
||||||
|
// sheet editor
|
||||||
if(isWorksheetEditor(file_name))
|
if(isWorksheetEditor(file_name))
|
||||||
{
|
{
|
||||||
CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea);
|
CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea);
|
||||||
|
@ -213,6 +217,9 @@ 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();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -241,11 +248,13 @@ 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
|
||||||
if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
{
|
#endif
|
||||||
current_window->save();
|
current_window->save();
|
||||||
}
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,11 +269,13 @@ void CMainWindow::saveAs()
|
||||||
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());
|
||||||
if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
#ifndef QT_NO_CURSOR
|
||||||
{
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
#endif
|
||||||
current_window->saveAs(file_name);
|
current_window->saveAs(file_name);
|
||||||
}
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +352,9 @@ void CMainWindow::extractWords(QString typeq)
|
||||||
builderP.PrimFilter.push_back("indoors_*.primitive");
|
builderP.PrimFilter.push_back("indoors_*.primitive");
|
||||||
isSheet = false;
|
isSheet = false;
|
||||||
}
|
}
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
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);
|
||||||
|
@ -349,6 +362,9 @@ void CMainWindow::extractWords(QString typeq)
|
||||||
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();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -371,8 +387,14 @@ void CMainWindow::extractBotNames()
|
||||||
QString file_path = editor_window->windowFilePath();
|
QString file_path = editor_window->windowFilePath();
|
||||||
} else return;
|
} else return;
|
||||||
}
|
}
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
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();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +414,7 @@ void CMainWindow::mergeSingleFile()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(QString(editor_window->widget()->metaObject()->className()) != "QTableWidget") // 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(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())
|
Q_FOREACH(QMdiSubWindow *subWindow, _ui.mdiArea->subWindowList())
|
||||||
{
|
{
|
||||||
CEditor *currentEditor = qobject_cast<CEditor*>(subWindow);
|
CEditor *currentEditor = qobject_cast<CEditor*>(subWindow);
|
||||||
if(QString(currentEditor->widget()->metaObject()->className()) == "QTableWidget")
|
if(currentEditor->eType() == Constants::ED_SHEET)
|
||||||
{
|
{
|
||||||
CEditorWorksheet *editor = qobject_cast<CEditorWorksheet *>(currentEditor);
|
CEditorWorksheet *editor = qobject_cast<CEditorWorksheet *>(currentEditor);
|
||||||
if(type != NULL) {
|
if(type != NULL) {
|
||||||
|
|
Loading…
Reference in a new issue