mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-28 11:20:53 +00:00
merge from default
This commit is contained in:
commit
40b50b0c7d
20 changed files with 2904 additions and 7 deletions
|
@ -1,9 +1,10 @@
|
|||
ADD_SUBDIRECTORY(core)
|
||||
ADD_SUBDIRECTORY(example)
|
||||
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
||||
ADD_SUBDIRECTORY(landscape_editor)
|
||||
ADD_SUBDIRECTORY(landscape_editor)
|
||||
ADD_SUBDIRECTORY(log)
|
||||
ADD_SUBDIRECTORY(disp_sheet_id)
|
||||
ADD_SUBDIRECTORY(object_viewer)
|
||||
ADD_SUBDIRECTORY(zone_painter)
|
||||
ADD_SUBDIRECTORY(georges_editor)
|
||||
ADD_SUBDIRECTORY(translation_manager)
|
||||
|
|
|
@ -91,6 +91,7 @@ const char * const DATA_PATH_SECTION = "DataPath";
|
|||
const char * const SEARCH_PATHS = "SearchPaths";
|
||||
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
|
||||
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
|
||||
const char * const PRIMITIVES_PATH = "/home/cemycc/Ryzom/work/ryzom/code/ryzom/common/data_leveldesign/primitives";
|
||||
const char * const ASSETS_PATH = "AssetsPath";
|
||||
const char * const REMAP_EXTENSIONS = "RemapExtensions";
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace NL3D
|
||||
{
|
||||
class CPSAttribMakerBase;
|
||||
class CPSAttribMakerBase;
|
||||
}
|
||||
|
||||
namespace NLQT
|
||||
|
@ -50,11 +50,12 @@ public:
|
|||
void remove(NL3D::CPSAttribMakerBase *am);
|
||||
// rename a scheme, given a pointer on it
|
||||
void rename(NL3D::CPSAttribMakerBase *am, const std::string &newName);
|
||||
protected:
|
||||
protected:
|
||||
// typedef std::pair<std::string, NL3D::CPSAttribMakerBase *> TSchemeInfo;
|
||||
typedef std::multimap<std::string, TSchemeInfo> TSchemeMap;
|
||||
TSchemeMap _SchemeMap;
|
||||
TSchemeMap _SchemeMap;
|
||||
};
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${LIBXML2_INCLUDE_DIR}
|
||||
${QT_INCLUDES})
|
||||
|
||||
FILE(GLOB SRC *.cpp *.h)
|
||||
|
||||
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||
|
||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h
|
||||
translation_manager_main_window.h
|
||||
translation_manager_settings_page.h
|
||||
translation_manager_editor.h
|
||||
source_selection.h
|
||||
ftp_selection.h
|
||||
editor_worksheet.h
|
||||
extract_new_sheet_names.h
|
||||
extract_bot_names.h)
|
||||
|
||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui
|
||||
translation_manager_main_window.ui
|
||||
source_selection.ui
|
||||
ftp_selection.ui)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
SET(QT_USE_QTOPENGL TRUE)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
|
||||
QT4_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR})
|
||||
QT4_WRAP_UI(OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS ${OVQT_PLUG_TRANSLATION_MANAGER_UIS})
|
||||
|
||||
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UIS})
|
||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS})
|
||||
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC})
|
||||
SOURCE_GROUP("Translation Manager Plugin" FILES ${SRC})
|
||||
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})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_translation_manager ovqt_plugin_core nelmisc nel3d 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_ADD_RUNTIME_FLAGS(ovqt_plugin_translation_manager)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_translation_manager)
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||
|
||||
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
|
@ -1,3 +1,5 @@
|
|||
OVQT Translation Manager plugin
|
||||
--------------------------------
|
||||
Translation Manager Plugin
|
||||
--------------------------
|
||||
GSoC 2011 Project
|
||||
http://dev.ryzom.com/wiki/ryzom/OVQTTranslationPluginGSoc2011
|
||||
|
||||
|
|
|
@ -0,0 +1,537 @@
|
|||
// 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/>.
|
||||
|
||||
#include "editor_worksheet.h"
|
||||
#include <set>
|
||||
// Qt includes
|
||||
#include <QtGui/QErrorMessage>
|
||||
#include <QtGui/QTableWidgetItem>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QCloseEvent>
|
||||
|
||||
#include "extract_bot_names.h"
|
||||
#include "translation_manager_constants.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Plugin {
|
||||
|
||||
|
||||
|
||||
void CEditorWorksheet::open(QString filename)
|
||||
{
|
||||
STRING_MANAGER::TWorksheet wk_file;
|
||||
if(loadExcelSheet(filename.toStdString(), wk_file, true) == true)
|
||||
{
|
||||
bool hasHashValue = false;
|
||||
table_editor = new QTableWidget();
|
||||
if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
table_editor->setColumnCount(wk_file.ColCount - 1);
|
||||
hasHashValue = true;
|
||||
} else {
|
||||
table_editor->setColumnCount(wk_file.ColCount);
|
||||
}
|
||||
table_editor->setRowCount(wk_file.size() - 1);
|
||||
|
||||
// read columns name
|
||||
for(unsigned int i = 0; i < wk_file.ColCount; i++)
|
||||
{
|
||||
if(hasHashValue && i == 0)
|
||||
{
|
||||
// we don't show the column with hash value
|
||||
} else {
|
||||
QTableWidgetItem *col = new QTableWidgetItem();
|
||||
ucstring col_name = wk_file.getData(0, i);
|
||||
col->setText(tr(col_name.toString().c_str()));
|
||||
if(hasHashValue)
|
||||
{
|
||||
table_editor->setHorizontalHeaderItem(i - 1, col);
|
||||
} else {
|
||||
table_editor->setHorizontalHeaderItem(i, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// read rows
|
||||
for(unsigned int i = 1; i < wk_file.size(); i++)
|
||||
{
|
||||
for(unsigned int j = 0; j < wk_file.ColCount; j++)
|
||||
{
|
||||
if(hasHashValue && j == 0)
|
||||
{
|
||||
// we don't show the column with hash value
|
||||
} else {
|
||||
QTableWidgetItem *row = new QTableWidgetItem();
|
||||
ucstring row_value = wk_file.getData(i, j);
|
||||
row->setText(tr(row_value.toString().c_str()));
|
||||
if(hasHashValue)
|
||||
{
|
||||
table_editor->setItem(i - 1, j - 1, row);
|
||||
} else {
|
||||
table_editor->setItem(i - 1, j, row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setCurrentFile(filename);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setWidget(table_editor);
|
||||
table_editor->resizeColumnsToContents();
|
||||
table_editor->resizeRowsToContents();
|
||||
// set editor signals
|
||||
connect(table_editor, SIGNAL(cellChanged(int,int) ), this, SLOT(worksheetEditorChanged(int,int)));
|
||||
} else {
|
||||
QErrorMessage error;
|
||||
error.showMessage("This file is not a worksheet file.");
|
||||
error.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CEditorWorksheet::activateWindow()
|
||||
{
|
||||
showMaximized();
|
||||
}
|
||||
|
||||
void CEditorWorksheet::save()
|
||||
{
|
||||
STRING_MANAGER::TWorksheet wk_file;
|
||||
loadExcelSheet(current_file.toStdString(), wk_file, true);
|
||||
uint rowIdx;
|
||||
uint colIdx = 0;
|
||||
bool hasHashValue = false;
|
||||
if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
hasHashValue = true;
|
||||
colIdx = 1;
|
||||
}
|
||||
for(int i = 0; i < table_editor->rowCount(); i++)
|
||||
{
|
||||
// maybe extra rows ?
|
||||
if((unsigned)table_editor->rowCount() > (wk_file.size() - 1))
|
||||
{
|
||||
rowIdx = wk_file.size();
|
||||
wk_file.resize(rowIdx + table_editor->rowCount() - wk_file.size() + 1);
|
||||
}
|
||||
for(int j = 0; j < table_editor->columnCount(); j++)
|
||||
{
|
||||
ucstring tvalue;
|
||||
ucstring colname;
|
||||
uint rowIdf;
|
||||
QString tvalueQt = table_editor->item(i, j)->text();
|
||||
tvalue = ucstring(tvalueQt.toStdString());
|
||||
colname = wk_file.getData(0, j + colIdx);
|
||||
|
||||
rowIdf = uint(i + 1);
|
||||
if(wk_file.findRow(j + colIdx, colname, rowIdf)) // search for the row
|
||||
{
|
||||
if(wk_file.getData(i + 1, j + colIdx) != tvalue) // verify the current value
|
||||
{
|
||||
wk_file.setData(i + 1, j + colIdx, tvalue); // change the value
|
||||
}
|
||||
} else {
|
||||
wk_file.setData(i + 1, j + colIdx, tvalue); // insert the value
|
||||
}
|
||||
}
|
||||
}
|
||||
if(hasHashValue)
|
||||
{
|
||||
// rewrite the hash codes
|
||||
makeHashCode(wk_file, true);
|
||||
}
|
||||
// write to file
|
||||
ucstring s = prepareExcelSheet(wk_file);
|
||||
NLMISC::CI18N::writeTextFile(current_file.toStdString(), s, false);
|
||||
setCurrentFile(current_file);
|
||||
}
|
||||
|
||||
void CEditorWorksheet::saveAs(QString filename)
|
||||
{
|
||||
STRING_MANAGER::TWorksheet new_file, wk_file;
|
||||
loadExcelSheet(current_file.toStdString(), wk_file, true);
|
||||
// set columns
|
||||
new_file.resize(new_file.size() + 1);
|
||||
for(unsigned int i = 0; i < wk_file.ColCount; i++)
|
||||
{
|
||||
ucstring col_name = wk_file.getData(0, i);
|
||||
new_file.insertColumn(new_file.ColCount);
|
||||
new_file.setData(0, new_file.ColCount - 1, col_name);
|
||||
}
|
||||
// read all the rows from table
|
||||
uint rowIdx;
|
||||
uint colIdx = 0;
|
||||
bool hasHashValue = false;
|
||||
if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
hasHashValue = true;
|
||||
colIdx = 1;
|
||||
}
|
||||
for(int i = 0; i < table_editor->rowCount(); i++)
|
||||
{
|
||||
rowIdx = new_file.size();
|
||||
new_file.resize(new_file.size() + 1);
|
||||
for(int j = 0; j < table_editor->columnCount(); j++)
|
||||
{
|
||||
QTableWidgetItem* item = table_editor->item(i, j);
|
||||
new_file.setData(rowIdx, j + colIdx, ucstring(item->text().toStdString()));
|
||||
}
|
||||
}
|
||||
if(hasHashValue)
|
||||
{
|
||||
// rewrite the hash codes
|
||||
makeHashCode(wk_file, true);
|
||||
}
|
||||
ucstring s = prepareExcelSheet(new_file);
|
||||
NLMISC::CI18N::writeTextFile(filename.toStdString(), s, false);
|
||||
setCurrentFile(filename);
|
||||
}
|
||||
|
||||
void CEditorWorksheet::insertRow()
|
||||
{
|
||||
int last_row = table_editor->rowCount();
|
||||
table_editor->setRowCount(last_row + 1);
|
||||
for(int j = 0; j < table_editor->columnCount(); j++)
|
||||
{
|
||||
QTableWidgetItem* item = new QTableWidgetItem();
|
||||
table_editor->setItem(last_row, j, item);
|
||||
}
|
||||
}
|
||||
|
||||
void CEditorWorksheet::deleteRow()
|
||||
{
|
||||
int selected_row = table_editor->currentRow();
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The row will be deleted.");
|
||||
msgBox.setInformativeText("Do you want to delete the selected row ?");
|
||||
msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if(ret == QMessageBox::Yes)
|
||||
{
|
||||
table_editor->removeRow(selected_row);
|
||||
}
|
||||
|
||||
table_editor->clearFocus();
|
||||
table_editor->clearSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
void CEditorWorksheet::worksheetEditorChanged(int row, int column)
|
||||
{
|
||||
if(!isWindowModified())
|
||||
setWindowModified(true);
|
||||
}
|
||||
|
||||
void CEditorWorksheet::extractBotNames(list<string> filters, string level_design_path, NLLIGO::CLigoConfig ligoConfig)
|
||||
{
|
||||
bool modified = false;
|
||||
ExtractBotNames ebn;
|
||||
ebn.setRequiredSettings(filters, level_design_path);
|
||||
ebn.extractBotNamesFromPrimitives(ligoConfig);
|
||||
// get SimpleNames
|
||||
{
|
||||
map<string, TEntryInfo> SimpleNames = ebn.getSimpleNames();
|
||||
map<string, TEntryInfo>::iterator it(SimpleNames.begin()), last(SimpleNames.end());
|
||||
|
||||
for (; it != last; ++it)
|
||||
{
|
||||
QList<QTableWidgetItem*> search_results = table_editor->findItems(tr(it->first.c_str()), Qt::MatchExactly);
|
||||
if(search_results.size() == 0)
|
||||
{
|
||||
const int currentRow = table_editor->rowCount();
|
||||
table_editor->setRowCount(currentRow + 1);
|
||||
QTableWidgetItem *bot_name_row = new QTableWidgetItem();
|
||||
bot_name_row->setText(tr(it->first.c_str()));
|
||||
bot_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, 0, bot_name_row);
|
||||
QTableWidgetItem *translation_name_row = new QTableWidgetItem();
|
||||
translation_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
translation_name_row->setText(tr(it->first.c_str()));
|
||||
table_editor ->setItem(currentRow , 1, translation_name_row);
|
||||
QTableWidgetItem *sheet_name_row = new QTableWidgetItem();
|
||||
sheet_name_row->setText(tr(it->second.SheetName.c_str()));
|
||||
sheet_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, 2, sheet_name_row);
|
||||
if(!modified) modified = true;
|
||||
}
|
||||
}
|
||||
ebn.cleanSimpleNames();
|
||||
}
|
||||
// get GenericNames
|
||||
{
|
||||
set<string> GenericNames = ebn.getGenericNames();
|
||||
set<string>::iterator it(GenericNames.begin()), last(GenericNames.end());
|
||||
for (; it != last; ++it)
|
||||
{
|
||||
string gnName = "gn_" + ebn.cleanupName(*it);
|
||||
QList<QTableWidgetItem*> search_results = table_editor->findItems(tr((*it).c_str()), Qt::MatchExactly);
|
||||
if(search_results.size() == 0)
|
||||
{
|
||||
const int currentRow = table_editor->rowCount();
|
||||
table_editor->setRowCount(currentRow + 1);
|
||||
QTableWidgetItem *bot_name_row = new QTableWidgetItem();
|
||||
bot_name_row->setText(tr((*it).c_str()));
|
||||
bot_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, 0, bot_name_row);
|
||||
QTableWidgetItem *translation_name_row = new QTableWidgetItem();
|
||||
translation_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
translation_name_row->setText(tr(gnName.c_str()));
|
||||
table_editor ->setItem(currentRow , 1, translation_name_row);
|
||||
QTableWidgetItem *sheet_name_row = new QTableWidgetItem();
|
||||
sheet_name_row->setText(" ");
|
||||
sheet_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, 2, sheet_name_row);
|
||||
if(!modified) modified = true;
|
||||
}
|
||||
}
|
||||
ebn.cleanGenericNames();
|
||||
}
|
||||
if(modified)
|
||||
{
|
||||
setWindowModified(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CEditorWorksheet::extractWords(QString filename, QString columnId, IWordListBuilder& wordListBuilder)
|
||||
{
|
||||
uint i;
|
||||
|
||||
// **** Load the excel sheet
|
||||
// load
|
||||
TWorksheet workSheet;
|
||||
if(!loadExcelSheet(filename.toStdString(), workSheet, true))
|
||||
{
|
||||
nlwarning("Error reading '%s'. Aborted", filename.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
// get the key column index
|
||||
uint keyColIndex = 0;
|
||||
if(!workSheet.findCol(columnId.toStdString(), keyColIndex))
|
||||
{
|
||||
nlwarning("Error: Don't find the column '%s'. '%s' Aborted", columnId.toStdString().c_str(), filename.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
// get the name column index
|
||||
uint nameColIndex;
|
||||
if(!workSheet.findCol(ucstring("name"), nameColIndex))
|
||||
{
|
||||
nlwarning("Error: Don't find the column 'name'. '%s' Aborted", filename.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// **** List all words with the builder given
|
||||
std::vector<string> allWords;
|
||||
if(!wordListBuilder.buildWordList(allWords, filename.toStdString()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool modified = false;
|
||||
for(i = 0; i < allWords.size(); i++)
|
||||
{
|
||||
string keyName = allWords[i];
|
||||
QList<QTableWidgetItem*> search_results = table_editor->findItems(tr(keyName.c_str()), Qt::MatchExactly);
|
||||
if(search_results.size() == 0)
|
||||
{
|
||||
|
||||
int knPos = 0, nPos = 0;
|
||||
if(workSheet.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
knPos = keyColIndex - 1;
|
||||
nPos = nameColIndex - 1;
|
||||
} else {
|
||||
knPos = keyColIndex;
|
||||
nPos = nameColIndex;
|
||||
}
|
||||
const int currentRow = table_editor->rowCount();
|
||||
table_editor->setRowCount(currentRow + 1);
|
||||
// keyName row
|
||||
QTableWidgetItem *key_name_row = new QTableWidgetItem();
|
||||
key_name_row->setText(tr(keyName.c_str()));
|
||||
key_name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, knPos, key_name_row);
|
||||
// nameColumn key
|
||||
QTableWidgetItem *name_row = new QTableWidgetItem();
|
||||
name_row->setText(QString("<GEN>") + tr(keyName.c_str()));
|
||||
name_row->setBackgroundColor(QColor("#F75D59"));
|
||||
table_editor ->setItem(currentRow, nPos, name_row);
|
||||
if(!modified) modified = true;
|
||||
}
|
||||
}
|
||||
if(modified)
|
||||
{
|
||||
setWindowModified(true);
|
||||
table_editor->scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
bool CEditorWorksheet::compareWorksheetFile(QString filename)
|
||||
{
|
||||
STRING_MANAGER::TWorksheet wk_file;
|
||||
int colIndex = 0;
|
||||
if(loadExcelSheet(filename.toStdString(), wk_file, true) == true)
|
||||
{
|
||||
if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
colIndex = 1;
|
||||
}
|
||||
if(wk_file.ColCount - colIndex != table_editor->columnCount())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for(int i = 0; i < table_editor->columnCount(); i++)
|
||||
{
|
||||
QString item = table_editor->horizontalHeaderItem(i)->text();
|
||||
ucstring itemC = wk_file.getData(0, i+ colIndex);
|
||||
if(item.toStdString() != itemC.toString())
|
||||
{
|
||||
nlwarning(item.toStdString().c_str());
|
||||
nlwarning(itemC.toString().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEditorWorksheet::mergeWorksheetFile(QString filename)
|
||||
{
|
||||
STRING_MANAGER::TWorksheet wk_file;
|
||||
if(loadExcelSheet(filename.toStdString(), wk_file, true) == true)
|
||||
{
|
||||
bool hasHashValue = false;
|
||||
int colIndex = 0;
|
||||
if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE"))
|
||||
{
|
||||
hasHashValue = true;
|
||||
colIndex = 1;
|
||||
}
|
||||
// read rows
|
||||
for(unsigned int i = 1; i < wk_file.size(); i++)
|
||||
{
|
||||
// search with the first column
|
||||
ucstring rowId = wk_file.getData(i,colIndex);
|
||||
QList<QTableWidgetItem*> search_results = table_editor->findItems(tr(rowId.toString().c_str()), Qt::MatchExactly);
|
||||
if(search_results.size() == 0)
|
||||
{
|
||||
const int lastRow = table_editor->rowCount();
|
||||
table_editor->setRowCount(lastRow + 1);
|
||||
for(unsigned int j = 0; j < table_editor->columnCount(); j++)
|
||||
{
|
||||
ucstring rowValue = wk_file.getData(i, j + colIndex); // get the value
|
||||
QTableWidgetItem *row = new QTableWidgetItem();
|
||||
row->setText(QString(rowValue.toString().c_str())); // set the value in table item
|
||||
table_editor->setItem(lastRow, j, row);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QErrorMessage error;
|
||||
error.showMessage("This file is not a worksheet file.");
|
||||
error.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void CEditorWorksheet::setCurrentFile(QString filename)
|
||||
{
|
||||
QFileInfo *file = new QFileInfo(filename);
|
||||
current_file = file->canonicalFilePath();
|
||||
setWindowModified(false);
|
||||
setWindowTitle(file->fileName() + "[*]");
|
||||
setWindowFilePath(current_file);
|
||||
}
|
||||
|
||||
void CEditorWorksheet::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if(isWindowModified())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The document has been modified.");
|
||||
msgBox.setInformativeText("Do you want to save your changes?");
|
||||
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Save);
|
||||
int ret = msgBox.exec();
|
||||
switch (ret)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
save();
|
||||
event->accept();
|
||||
close();
|
||||
break;
|
||||
case QMessageBox::Discard:
|
||||
event->accept();
|
||||
close();
|
||||
break;
|
||||
case QMessageBox::Cancel:
|
||||
event->ignore();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
event->accept();
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
bool CEditorWorksheet::isBotNamesTable()
|
||||
{
|
||||
bool status = true;
|
||||
if(table_editor->horizontalHeaderItem(0)->text() != "bot name"
|
||||
|| table_editor->horizontalHeaderItem(1)->text() != "translated name"
|
||||
|| table_editor->horizontalHeaderItem(2)->text() != "sheet_name")
|
||||
{
|
||||
status = false;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
bool CEditorWorksheet::isSheetTable(QString type)
|
||||
{
|
||||
QString column_name;
|
||||
if(type.toAscii() == Constants::WK_ITEM)
|
||||
{
|
||||
column_name = "item ID";
|
||||
} else if(type.toAscii() == Constants::WK_CREATURE) {
|
||||
column_name = "creature ID";
|
||||
} else if(type.toAscii() == Constants::WK_SBRICK) {
|
||||
column_name = "sbrick ID";
|
||||
} else if(type.toAscii() == Constants::WK_SPHRASE) {
|
||||
column_name = "sphrase ID";
|
||||
} else if(type.toAscii() == Constants::WK_PLACE) {
|
||||
column_name = "placeId";
|
||||
}
|
||||
bool status = true;
|
||||
if(table_editor->horizontalHeaderItem(0)->text() != column_name
|
||||
|| table_editor->horizontalHeaderItem(1)->text() != "name")
|
||||
{
|
||||
status = false;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
// 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_WORKSHEET_H
|
||||
#define EDITOR_WORKSHEET_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
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QTableWidget>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
|
||||
#include "translation_manager_editor.h"
|
||||
#include "extract_new_sheet_names.h"
|
||||
|
||||
namespace Plugin {
|
||||
|
||||
class CEditorWorksheet : public CEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QTableWidget* table_editor;
|
||||
public:
|
||||
CEditorWorksheet(QMdiArea* parent) : CEditor(parent) {}
|
||||
CEditorWorksheet() : CEditor() {}
|
||||
void open(QString filename);
|
||||
void save();
|
||||
void saveAs(QString filename);
|
||||
void activateWindow();
|
||||
void mergeWorksheetFile(QString filename);
|
||||
bool compareWorksheetFile(QString filename);
|
||||
void extractBotNames(list<string> filters, string level_design_path, NLLIGO::CLigoConfig ligoConfig);
|
||||
void extractWords(QString filename, QString columnId, IWordListBuilder &wordListBuilder);
|
||||
bool isBotNamesTable();
|
||||
bool isSheetTable(QString type);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
private Q_SLOTS:
|
||||
void worksheetEditorChanged(int,int);
|
||||
void insertRow();
|
||||
void deleteRow();
|
||||
private:
|
||||
void setCurrentFile(QString filename);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
#endif /* EDITOR_WORKSHEET_H */
|
||||
|
|
@ -0,0 +1,379 @@
|
|||
// 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/>.
|
||||
|
||||
#include "extract_bot_names.h"
|
||||
|
||||
|
||||
static bool RemoveOlds = false;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
TCreatureInfo *ExtractBotNames::getCreature(const std::string &sheetName)
|
||||
{
|
||||
CSheetId id(sheetName+".creature");
|
||||
|
||||
if (Creatures.find(id) != Creatures.end())
|
||||
return &(Creatures.find(id)->second);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string ExtractBotNames::cleanupName(const std::string &name)
|
||||
{
|
||||
string ret;
|
||||
|
||||
for (uint i=0; i<name.size(); ++i)
|
||||
{
|
||||
if (name[i] != ' ')
|
||||
ret += name[i];
|
||||
else
|
||||
ret += '_';
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ucstring ExtractBotNames::cleanupUcName(const ucstring &name)
|
||||
{
|
||||
ucstring ret;
|
||||
|
||||
for (uint i=0; i<name.size(); ++i)
|
||||
{
|
||||
if (name[i] != ' ')
|
||||
ret += name[i];
|
||||
else
|
||||
ret += '_';
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Removes first and last '$'
|
||||
*/
|
||||
ucstring ExtractBotNames::makeGroupName(const ucstring & translationName)
|
||||
{
|
||||
ucstring ret = translationName;
|
||||
if (ret.size() >= 2)
|
||||
{
|
||||
if ( *ret.begin() == ucchar('$'))
|
||||
{
|
||||
ret=ret.substr(1);
|
||||
}
|
||||
if ( *ret.rbegin() == ucchar('$'))
|
||||
{
|
||||
ret = ret.substr(0, ret.size()-1);
|
||||
}
|
||||
}
|
||||
ret = cleanupUcName(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set<string> ExtractBotNames::getGenericNames()
|
||||
{
|
||||
return GenericNames;
|
||||
}
|
||||
|
||||
map<string, TEntryInfo> ExtractBotNames::getSimpleNames()
|
||||
{
|
||||
return SimpleNames;
|
||||
}
|
||||
|
||||
void ExtractBotNames::cleanSimpleNames()
|
||||
{
|
||||
SimpleNames.clear();
|
||||
}
|
||||
|
||||
void ExtractBotNames::cleanGenericNames()
|
||||
{
|
||||
GenericNames.clear();
|
||||
}
|
||||
|
||||
string ExtractBotNames::removeAndStoreFunction(const std::string &fullName)
|
||||
{
|
||||
string::size_type pos = fullName.find("$");
|
||||
if (pos == string::npos)
|
||||
return fullName;
|
||||
else
|
||||
{
|
||||
// extract and store the function name
|
||||
string ret;
|
||||
|
||||
ret = fullName.substr(0, pos);
|
||||
string::size_type pos2 = fullName.find("$", pos+1);
|
||||
|
||||
string fct = fullName.substr(pos+1, pos2-(pos+1));
|
||||
|
||||
ret += fullName.substr(pos2+1);
|
||||
|
||||
if (Functions.find(fct) == Functions.end())
|
||||
{
|
||||
nldebug("Adding function '%s'", fct.c_str());
|
||||
Functions.insert(fct);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtractBotNames::addGenericName(const std::string &name, const std::string &sheetName)
|
||||
{
|
||||
TCreatureInfo *c = getCreature(sheetName);
|
||||
if (!c || c->ForceSheetName || !c->DisplayName)
|
||||
return;
|
||||
|
||||
if (SimpleNames.find(name) != SimpleNames.end())
|
||||
{
|
||||
nldebug("Name '%s' is now a generic name", name.c_str());
|
||||
GenericNames.insert(name);
|
||||
SimpleNames.erase(name);
|
||||
|
||||
}
|
||||
else if (GenericNames.find(name) == GenericNames.end())
|
||||
{
|
||||
nldebug("Adding generic name '%s'", name.c_str());
|
||||
GenericNames.insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtractBotNames::addSimpleName(const std::string &name, const std::string &sheetName)
|
||||
{
|
||||
TCreatureInfo *c = getCreature(sheetName);
|
||||
if (!c || c->ForceSheetName || !c->DisplayName)
|
||||
return;
|
||||
|
||||
if (SimpleNames.find(name) != SimpleNames.end())
|
||||
{
|
||||
addGenericName(name, sheetName);
|
||||
}
|
||||
else if (GenericNames.find(name) != GenericNames.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
nldebug("Adding simple name '%s'", name.c_str());
|
||||
|
||||
TEntryInfo ei;
|
||||
ei.SheetName = sheetName;
|
||||
|
||||
SimpleNames.insert(make_pair(name, ei));
|
||||
}
|
||||
}
|
||||
|
||||
void ExtractBotNames::setRequiredSettings(list<string> filters, string level_design_path)
|
||||
{
|
||||
for (std::list<string>::iterator it = filters.begin(); it != filters.end(); ++it)
|
||||
{
|
||||
Filters.push_back(*it);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// init the sheets
|
||||
CSheetId::init(false);
|
||||
const string PACKED_SHEETS_NAME = "bin/translation_tools_creature.packed_sheets";
|
||||
loadForm("creature", PACKED_SHEETS_NAME, Creatures, false, false);
|
||||
|
||||
if (Creatures.empty())
|
||||
{
|
||||
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ExtractBotNames::extractBotNamesFromPrimitives(CLigoConfig ligoConfig)
|
||||
{
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// ok, ready for the real work,
|
||||
// first, read the primitives files and parse the primitives
|
||||
vector<string> files;
|
||||
CPath::getFileList("primitive", files);
|
||||
|
||||
|
||||
for (uint i=0; i<files.size(); ++i)
|
||||
{
|
||||
string pathName = files[i];
|
||||
pathName = CPath::lookup(pathName);
|
||||
|
||||
|
||||
|
||||
// check filters
|
||||
uint j=0;
|
||||
for (j=0; j<Filters.size(); ++j)
|
||||
{
|
||||
if (pathName.find(Filters[j]) != string::npos)
|
||||
break;
|
||||
}
|
||||
if (j != Filters.size())
|
||||
// skip this file
|
||||
continue;
|
||||
|
||||
nlinfo("Loading file '%s'...", CFile::getFilename(pathName).c_str());
|
||||
|
||||
CPrimitives primDoc;
|
||||
CPrimitiveContext::instance().CurrentPrimitive = &primDoc;
|
||||
loadXmlPrimitiveFile(primDoc, pathName, ligoConfig);
|
||||
|
||||
// now parse the file
|
||||
|
||||
// look for group template
|
||||
{
|
||||
TPrimitiveClassPredicate pred("group_template_npc");
|
||||
TPrimitiveSet result;
|
||||
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
||||
ps.buildSet(primDoc.RootNode, pred, result);
|
||||
|
||||
for (uint i=0; i<result.size(); ++i)
|
||||
{
|
||||
string name;
|
||||
string countStr;
|
||||
string sheetStr;
|
||||
result[i]->getPropertyByName("name", name);
|
||||
result[i]->getPropertyByName("count", countStr);
|
||||
result[i]->getPropertyByName("bot_sheet_look", sheetStr);
|
||||
|
||||
uint32 count;
|
||||
NLMISC::fromString(countStr, count);
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
if (sheetStr.empty())
|
||||
{
|
||||
nlwarning("In '%s', empty sheet !", buildPrimPath(result[i]).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
addGenericName(removeAndStoreFunction(name), sheetStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// look for bot template
|
||||
{
|
||||
TPrimitiveClassPredicate pred("bot_template_npc");
|
||||
TPrimitiveSet result;
|
||||
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
||||
ps.buildSet(primDoc.RootNode, pred, result);
|
||||
|
||||
for (uint i=0; i<result.size(); ++i)
|
||||
{
|
||||
string name;
|
||||
string sheetStr;
|
||||
result[i]->getPropertyByName("name", name);
|
||||
result[i]->getPropertyByName("sheet_look", sheetStr);
|
||||
|
||||
if (sheetStr.empty())
|
||||
{
|
||||
// take the sheet in the parent
|
||||
result[i]->getParent()->getPropertyByName("bot_sheet_look", sheetStr);
|
||||
}
|
||||
|
||||
if (sheetStr.empty())
|
||||
{
|
||||
nlwarning("In '%s', empty sheet !", buildPrimPath(result[i]).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
addGenericName(removeAndStoreFunction(name), sheetStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
// look for npc_group
|
||||
{
|
||||
TPrimitiveClassPredicate pred("npc_group");
|
||||
TPrimitiveSet result;
|
||||
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
||||
ps.buildSet(primDoc.RootNode, pred, result);
|
||||
|
||||
for (uint i=0; i<result.size(); ++i)
|
||||
{
|
||||
string name;
|
||||
string countStr;
|
||||
string sheetStr;
|
||||
result[i]->getPropertyByName("name", name);
|
||||
result[i]->getPropertyByName("count", countStr);
|
||||
result[i]->getPropertyByName("bot_sheet_client", sheetStr);
|
||||
|
||||
uint32 count;
|
||||
NLMISC::fromString(countStr, count);
|
||||
|
||||
if (count > 0 && sheetStr.empty())
|
||||
{
|
||||
nlwarning("In '%s', empty sheet !", buildPrimPath(result[i]).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
addSimpleName(removeAndStoreFunction(name), sheetStr);
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
addGenericName(removeAndStoreFunction(name), sheetStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// look for bot
|
||||
{
|
||||
TPrimitiveClassPredicate pred("npc_bot");
|
||||
TPrimitiveSet result;
|
||||
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> ps;
|
||||
ps.buildSet(primDoc.RootNode, pred, result);
|
||||
|
||||
for (uint i=0; i<result.size(); ++i)
|
||||
{
|
||||
string name;
|
||||
string sheetStr;
|
||||
result[i]->getPropertyByName("name", name);
|
||||
result[i]->getPropertyByName("sheet_client", sheetStr);
|
||||
|
||||
if (sheetStr.empty())
|
||||
{
|
||||
// take the sheet in the parent
|
||||
result[i]->getParent()->getPropertyByName("bot_sheet_client", sheetStr);
|
||||
}
|
||||
|
||||
if (sheetStr.empty())
|
||||
{
|
||||
nlwarning("In '%s', empty sheet !", buildPrimPath(result[i]).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
addSimpleName(removeAndStoreFunction(name), sheetStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
// 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 EXTRACT_BOT_NAMES_H
|
||||
#define EXTRACT_BOT_NAMES_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/config_file.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/diff_tool.h"
|
||||
#include "nel/georges/u_form.h"
|
||||
#include "nel/georges/u_form_elm.h"
|
||||
#include "nel/georges/load_form.h"
|
||||
#include "nel/ligo/ligo_config.h"
|
||||
#include "nel/ligo/primitive.h"
|
||||
#include "nel/ligo/primitive_utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
using namespace NLLIGO;
|
||||
using namespace STRING_MANAGER;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
struct TCreatureInfo
|
||||
{
|
||||
CSheetId SheetId;
|
||||
bool ForceSheetName;
|
||||
bool DisplayName;
|
||||
|
||||
|
||||
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
||||
{
|
||||
const NLGEORGES::UFormElm &item=form->getRootNode();
|
||||
|
||||
SheetId=sheetId;
|
||||
item.getValueByName(ForceSheetName, "3d data.ForceDisplayCreatureName");
|
||||
item.getValueByName(DisplayName, "3d data.DisplayName");
|
||||
}
|
||||
|
||||
void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(SheetId);
|
||||
f.serial(ForceSheetName);
|
||||
f.serial(DisplayName);
|
||||
}
|
||||
|
||||
|
||||
static uint getVersion ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void removed()
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct TEntryInfo
|
||||
{
|
||||
string SheetName;
|
||||
};
|
||||
|
||||
struct ExtractBotNames
|
||||
{
|
||||
private:
|
||||
vector<string> Filters;
|
||||
std::map<CSheetId, TCreatureInfo> Creatures;
|
||||
set<string> GenericNames;
|
||||
map<string, TEntryInfo> SimpleNames;
|
||||
set<string> Functions;
|
||||
private:
|
||||
TCreatureInfo *getCreature(const std::string &sheetName);
|
||||
ucstring makeGroupName(const ucstring & translationName);
|
||||
string removeAndStoreFunction(const std::string &fullName);
|
||||
void addGenericName(const std::string &name, const std::string &sheetName);
|
||||
void addSimpleName(const std::string &name, const std::string &sheetName);
|
||||
public:
|
||||
void extractBotNamesFromPrimitives(CLigoConfig ligoConfig);
|
||||
void setRequiredSettings(list<string> filters, string level_design_path);
|
||||
set<string> getGenericNames();
|
||||
map<string, TEntryInfo> getSimpleNames();
|
||||
string cleanupName(const std::string &name);
|
||||
ucstring cleanupUcName(const ucstring &name);
|
||||
void cleanSimpleNames();
|
||||
void cleanGenericNames();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* EXTRACT_BOT_NAMES_H */
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// 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 "extract_new_sheet_names.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
using namespace NLLIGO;
|
||||
using namespace STRING_MANAGER;
|
||||
|
||||
namespace Plugin {
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
/*
|
||||
* Specialisation of IWordListBuilder to list sheets in a directory
|
||||
*/
|
||||
|
||||
|
||||
bool CSheetWordListBuilder::buildWordList(std::vector<string> &allWords, string workSheetFileName)
|
||||
{
|
||||
SheetExt= toLower(SheetExt);
|
||||
nlinfo("aaaa");
|
||||
// verify the directory is correct
|
||||
if(!CFile::isDirectory(SheetPath))
|
||||
{
|
||||
nlwarning("Error: Directory '%s' not found. '%s' Aborted", SheetPath.c_str(), workSheetFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// list all files.
|
||||
std::vector<string> allFiles;
|
||||
allFiles.reserve(100000);
|
||||
CPath::getPathContent(SheetPath, true, false, true, allFiles, NULL);
|
||||
|
||||
// Keep only the extension we want, and remove "_" (parent)
|
||||
allWords.clear();
|
||||
allWords.reserve(allFiles.size());
|
||||
for(uint i=0;i<allFiles.size();i++)
|
||||
{
|
||||
string fileNameWithoutExt= CFile::getFilenameWithoutExtension(allFiles[i]);
|
||||
string extension= toLower(CFile::getExtension(allFiles[i]));
|
||||
// bad extension?
|
||||
if(extension!=SheetExt)
|
||||
continue;
|
||||
// parent?
|
||||
if(fileNameWithoutExt.empty()||fileNameWithoutExt[0]=='_')
|
||||
continue;
|
||||
// ok, add
|
||||
allWords.push_back(toLower(fileNameWithoutExt));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
/*
|
||||
* Specialisation of IWordListBuilder to list new region/place name from .primitive
|
||||
*/
|
||||
bool CRegionPrimWordListBuilder::buildWordList(std::vector<string> &allWords, string workSheetFileName)
|
||||
{
|
||||
// verify the directory is correct
|
||||
if(!CFile::isDirectory(PrimPath))
|
||||
{
|
||||
nlwarning("Error: Directory '%s' not found. '%s' Aborted", PrimPath.c_str(), workSheetFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// list all files.
|
||||
std::vector<string> allFiles;
|
||||
allFiles.reserve(100000);
|
||||
CPath::getPathContent(PrimPath, true, false, true, allFiles, NULL);
|
||||
|
||||
// parse all primitive that match the filter
|
||||
allWords.clear();
|
||||
allWords.reserve(100000);
|
||||
// to avoid duplicate
|
||||
set<string> allWordSet;
|
||||
for(uint i=0;i<allFiles.size();i++)
|
||||
{
|
||||
string fileName= CFile::getFilename(allFiles[i]);
|
||||
// filter don't match?
|
||||
bool oneMatch= false;
|
||||
for(uint filter=0;filter<PrimFilter.size();filter++)
|
||||
{
|
||||
if(testWildCard(fileName, PrimFilter[filter]))
|
||||
oneMatch= true;
|
||||
}
|
||||
if(!oneMatch)
|
||||
continue;
|
||||
|
||||
// ok, read the file
|
||||
CPrimitives PrimDoc;
|
||||
CPrimitiveContext::instance().CurrentPrimitive = &PrimDoc;
|
||||
if (!loadXmlPrimitiveFile(PrimDoc, allFiles[i], LigoConfig))
|
||||
{
|
||||
nlwarning("Error: cannot open file '%s'. '%s' Aborted", allFiles[i].c_str(), workSheetFileName.c_str());
|
||||
CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
||||
return false;
|
||||
}
|
||||
CPrimitiveContext::instance().CurrentPrimitive = NULL;
|
||||
|
||||
// For all primitives of interest
|
||||
const char *listClass[]= {"continent", "region", "place", "stable",
|
||||
"teleport_destination", "room_template"};
|
||||
const char *listProp[]= {"name", "name", "name", "name",
|
||||
"place_name", "place_name"};
|
||||
const uint numListClass= sizeof(listClass)/sizeof(listClass[0]);
|
||||
const uint numListProp= sizeof(listProp)/sizeof(listProp[0]);
|
||||
nlctassert(numListProp==numListClass);
|
||||
for(uint cid=0;cid<numListClass;cid++)
|
||||
{
|
||||
// parse the whole hierarchy
|
||||
TPrimitiveClassPredicate predCont(listClass[cid]);
|
||||
CPrimitiveSet<TPrimitiveClassPredicate> setPlace;
|
||||
TPrimitiveSet placeRes;
|
||||
setPlace.buildSet(PrimDoc.RootNode, predCont, placeRes);
|
||||
// for all found
|
||||
for (uint placeId= 0; placeId < placeRes.size(); ++placeId)
|
||||
{
|
||||
string primName;
|
||||
if(placeRes[placeId]->getPropertyByName(listProp[cid], primName) && !primName.empty())
|
||||
{
|
||||
primName= toLower(primName);
|
||||
// avoid duplicate
|
||||
if(allWordSet.insert(primName).second)
|
||||
{
|
||||
allWords.push_back(primName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// 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 EXTRACT_NEW_SHEET_NAMES_H
|
||||
#define EXTRACT_NEW_SHEET_NAMES_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/config_file.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/diff_tool.h"
|
||||
#include "nel/misc/algo.h"
|
||||
#include "nel/georges/u_form.h"
|
||||
#include "nel/georges/u_form_elm.h"
|
||||
#include "nel/georges/load_form.h"
|
||||
#include "nel/ligo/ligo_config.h"
|
||||
#include "nel/ligo/primitive.h"
|
||||
#include "nel/ligo/primitive_utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
using namespace NLLIGO;
|
||||
using namespace STRING_MANAGER;
|
||||
|
||||
namespace Plugin {
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
/*
|
||||
* Interface to build the whole list of words (key id) for a specific worksheet
|
||||
*/
|
||||
struct IWordListBuilder
|
||||
{
|
||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName) =0;
|
||||
|
||||
};
|
||||
|
||||
struct CSheetWordListBuilder : public IWordListBuilder
|
||||
{
|
||||
string SheetExt;
|
||||
string SheetPath;
|
||||
|
||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName);
|
||||
};
|
||||
|
||||
struct CRegionPrimWordListBuilder : public IWordListBuilder
|
||||
{
|
||||
string PrimPath;
|
||||
vector<string> PrimFilter;
|
||||
NLLIGO::CLigoConfig LigoConfig;
|
||||
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* EXTRACT_NEW_SHEET_NAMES_H */
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
// 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 TRANSLATION_MANAGER_EDITOR_H
|
||||
#define TRANSLATION_MANAGER_EDITOR_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
|
||||
namespace Plugin {
|
||||
|
||||
class CEditor : public QMdiSubWindow {
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QString current_file;
|
||||
int editor_type;
|
||||
public:
|
||||
CEditor(QMdiArea* parent) : QMdiSubWindow(parent) {}
|
||||
CEditor() : QMdiSubWindow() {}
|
||||
virtual void open(QString filename) =0;
|
||||
virtual void save() =0;
|
||||
virtual void saveAs(QString filename) =0;
|
||||
virtual void activateWindow() =0;
|
||||
public:
|
||||
QString subWindowFilePath()
|
||||
{
|
||||
return current_file;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* TRANSLATION_MANAGER_EDITOR_H */
|
||||
|
|
@ -0,0 +1,582 @@
|
|||
// 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/>.
|
||||
|
||||
#include "translation_manager_main_window.h"
|
||||
#include "translation_manager_constants.h"
|
||||
#include "editor_worksheet.h"
|
||||
#include "ftp_selection.h"
|
||||
|
||||
// Project system includes
|
||||
#include "../core/icore.h"
|
||||
#include "../core/core_constants.h"
|
||||
#include "../core/imenu_manager.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
// Qt includes
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QErrorMessage>
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QTableWidget>
|
||||
#include <QtGui/QTableWidgetItem>
|
||||
#include <QtGui/QListWidget>
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtCore/QSize>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtCore/QResource>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QCloseEvent>
|
||||
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
_ui.mdiArea->closeAllSubWindows();
|
||||
connect(_ui.mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)),this, SLOT(activeSubWindowChanged()));
|
||||
windowMapper = new QSignalMapper(this);
|
||||
connect(windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(setActiveSubWindow(QWidget*)));
|
||||
|
||||
initialize_settings["georges"] = false;
|
||||
initialize_settings["ligo"] = false;
|
||||
readSettings();
|
||||
createToolbar();
|
||||
m_undoStack = new QUndoStack(this);
|
||||
}
|
||||
|
||||
void CMainWindow::createToolbar()
|
||||
{
|
||||
// File menu
|
||||
openAct = new QAction(QIcon(Core::Constants::ICON_OPEN), "&Open...", this);
|
||||
_ui.toolBar->addAction(openAct);
|
||||
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
|
||||
saveAct = new QAction(QIcon(Core::Constants::ICON_SAVE), "&Save...", this);
|
||||
_ui.toolBar->addAction(saveAct);
|
||||
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
saveAsAct = new QAction(QIcon(Core::Constants::ICON_SAVE_AS), "&Save as...", this);
|
||||
_ui.toolBar->addAction(saveAsAct);
|
||||
connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||
|
||||
// Tools menu
|
||||
QMenu *wordsExtractionMenu = new QMenu("&Words extraction...");
|
||||
wordsExtractionMenu->setIcon(QIcon(Core::Constants::ICON_SETTINGS));
|
||||
_ui.toolBar->addAction(wordsExtractionMenu->menuAction());
|
||||
// extract bot names
|
||||
QAction *extractBotNamesAct = wordsExtractionMenu->addAction("&Extract bot names...");
|
||||
extractBotNamesAct->setStatusTip(tr("Extract bot names from primitives."));
|
||||
connect(extractBotNamesAct, SIGNAL(triggered()), this, SLOT(extractBotNames()));
|
||||
// Words extraction
|
||||
// -----------------------------
|
||||
// signal mapper for extraction words
|
||||
QSignalMapper *wordsExtractionMapper = new QSignalMapper(this);
|
||||
connect(wordsExtractionMapper, SIGNAL(mapped(QString)), this, SLOT(extractWords(QString)));
|
||||
// extract item words
|
||||
QAction *extractItemWordsAct = wordsExtractionMenu->addAction("&Extract item words...");
|
||||
extractItemWordsAct->setStatusTip(tr("Extract item words"));
|
||||
connect(extractItemWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||
wordsExtractionMapper->setMapping(extractItemWordsAct, tr(Constants::WK_ITEM));
|
||||
// extract creature words
|
||||
QAction *extractCreatureWordsAct = wordsExtractionMenu->addAction("&Extract creature words...");
|
||||
extractCreatureWordsAct->setStatusTip(tr("Extract creature words"));
|
||||
connect(extractCreatureWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||
wordsExtractionMapper->setMapping(extractCreatureWordsAct, tr(Constants::WK_CREATURE));
|
||||
// extract sbrick words
|
||||
QAction *extractSbrickWordsAct = wordsExtractionMenu->addAction("&Extract sbrick words...");
|
||||
extractSbrickWordsAct->setStatusTip(tr("Extract sbrick words"));
|
||||
connect(extractSbrickWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||
wordsExtractionMapper->setMapping(extractSbrickWordsAct, tr(Constants::WK_SBRICK));
|
||||
// extract sphrase words
|
||||
QAction *extractSphraseWordsAct = wordsExtractionMenu->addAction("&Extract sphrase words...");
|
||||
extractSphraseWordsAct->setStatusTip(tr("Extract sphrase words"));
|
||||
connect(extractSphraseWordsAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||
wordsExtractionMapper->setMapping(extractSphraseWordsAct, tr(Constants::WK_SPHRASE));
|
||||
// extract place and region names
|
||||
QAction *extractPlaceNamesAct = wordsExtractionMenu->addAction("&Extract place names...");
|
||||
extractPlaceNamesAct->setStatusTip(tr("Extract place names from primitives"));
|
||||
connect(extractPlaceNamesAct, SIGNAL(triggered()), wordsExtractionMapper, SLOT(map()));
|
||||
wordsExtractionMapper->setMapping(extractPlaceNamesAct, tr(Constants::WK_PLACE));
|
||||
// Merge options
|
||||
// -----------------------------
|
||||
QAction *mergeSingleFileAct = wordsExtractionMenu->addAction("&Merge worksheet file...");
|
||||
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
||||
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
||||
// Windows menu
|
||||
windowMenu = new QMenu(tr("&Windows..."), _ui.toolBar);
|
||||
windowMenu->setIcon(QIcon(Core::Constants::ICON_PILL));
|
||||
updateWindowsList();
|
||||
_ui.toolBar->addAction(windowMenu->menuAction());
|
||||
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
||||
}
|
||||
|
||||
void CMainWindow::updateToolbar(QMdiSubWindow *window)
|
||||
{
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
if(QString(window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
QAction *insertRowAct = windowMenu->addAction("Insert new row");
|
||||
connect(insertRowAct, SIGNAL(triggered()), window, SLOT(insertRow()));
|
||||
QAction *deleteRowAct = windowMenu->addAction("Delete row");
|
||||
connect(deleteRowAct, SIGNAL(triggered()), window, SLOT(deleteRow()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::setActiveSubWindow(QWidget* window)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QMdiSubWindow *cwindow = qobject_cast<QMdiSubWindow *>(window);
|
||||
_ui.mdiArea->setActiveSubWindow(cwindow);
|
||||
}
|
||||
|
||||
void CMainWindow::activeSubWindowChanged()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CMainWindow::updateWindowsList()
|
||||
{
|
||||
windowMenu->clear();
|
||||
QMdiSubWindow *current_window = _ui.mdiArea->activeSubWindow();
|
||||
QList<QMdiSubWindow*> subWindows = _ui.mdiArea->subWindowList();
|
||||
|
||||
updateToolbar(current_window);
|
||||
|
||||
for(int i = 0; i < subWindows.size(); ++i)
|
||||
{
|
||||
QString window_file = QFileInfo(subWindows.at(i)->windowFilePath()).fileName();
|
||||
QString action_text;
|
||||
if (i < 9) {
|
||||
action_text = tr("&%1 %2").arg(i + 1).arg(window_file);
|
||||
} else {
|
||||
action_text = tr("%1 %2").arg(i + 1).arg(window_file);
|
||||
}
|
||||
QAction *action = windowMenu->addAction(action_text);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(subWindows.at(i) == current_window);
|
||||
connect(action, SIGNAL(triggered()), windowMapper, SLOT(map()));
|
||||
windowMapper->setMapping(action, subWindows.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::open()
|
||||
{
|
||||
QString file_name = QFileDialog::getOpenFileName(this);
|
||||
if(!file_name.isEmpty())
|
||||
{
|
||||
list<CEditor*> subWindows = convertSubWindowList(_ui.mdiArea->subWindowList());
|
||||
list<CEditor*>::iterator it = subWindows.begin();
|
||||
CEditor* current_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
for(; it != subWindows.end(); ++it)
|
||||
{
|
||||
QString sw_file = (*it)->subWindowFilePath();
|
||||
if(file_name == sw_file)
|
||||
{
|
||||
if((*it) != current_window)
|
||||
{
|
||||
(*it)->activateWindow();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(isWorksheetEditor(file_name))
|
||||
{
|
||||
CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea);
|
||||
new_window->open(file_name);
|
||||
new_window->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMainWindow::openWorkFile(QString file)
|
||||
{
|
||||
QFileInfo* file_path = new QFileInfo(QString("%1/%2").arg(QString(work_path.c_str())).arg(file));
|
||||
if(file_path->exists())
|
||||
{
|
||||
if(isWorksheetEditor(file_path->filePath()))
|
||||
{
|
||||
CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea);
|
||||
new_window->open(file_path->filePath());
|
||||
new_window->activateWindow();
|
||||
}
|
||||
} else {
|
||||
QErrorMessage error;
|
||||
error.showMessage(QString("The %1 file don't exists.").arg(file_path->fileName()));
|
||||
error.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMainWindow::save()
|
||||
{
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
CEditor* current_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
|
||||
if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
current_window->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::saveAs()
|
||||
{
|
||||
QString file_name;
|
||||
if (_ui.mdiArea->isActiveWindow())
|
||||
{
|
||||
file_name = QFileDialog::getSaveFileName(this);
|
||||
}
|
||||
|
||||
if (!file_name.isEmpty())
|
||||
{
|
||||
CEditor* current_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
if(QString(current_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
current_window->saveAs(file_name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::initializeSettings(bool georges = false)
|
||||
{
|
||||
if(georges == true && initialize_settings["georges"] == false)
|
||||
{
|
||||
CPath::addSearchPath(level_design_path + "/DFN", true, false);
|
||||
CPath::addSearchPath(level_design_path + "/Game_elem/Creature", true, false);
|
||||
initialize_settings["georges"] = true;
|
||||
}
|
||||
|
||||
if(initialize_settings["ligo"] == false)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// init ligo config
|
||||
string ligoPath = CPath::lookup("world_editor_classes.xml", true, true);
|
||||
ligoConfig.readPrimitiveClass(ligoPath.c_str(), false);
|
||||
NLLIGO::Register();
|
||||
NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &ligoConfig;
|
||||
initialize_settings["ligo"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::extractWords(QString typeq)
|
||||
{
|
||||
if(verifySettings() == true)
|
||||
{
|
||||
CEditorWorksheet* current_window;
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
CEditor* editor_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
if(QString(editor_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(editor_window);
|
||||
QString file_path = current_window->subWindowFilePath();
|
||||
if(!current_window->isSheetTable(typeq))
|
||||
{
|
||||
list<CEditor*> subWindows = convertSubWindowList(_ui.mdiArea->subWindowList());
|
||||
list<CEditor*>::iterator it = subWindows.begin();
|
||||
bool finded = false;
|
||||
|
||||
for(; it != subWindows.end(); ++it)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>((*it));
|
||||
file_path = current_window->subWindowFilePath();
|
||||
if(current_window->isSheetTable(typeq))
|
||||
{
|
||||
finded = true;
|
||||
current_window->activateWindow();
|
||||
}
|
||||
}
|
||||
if(!finded)
|
||||
{
|
||||
openWorkFile(typeq);
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(_ui.mdiArea->currentSubWindow());
|
||||
QString file_path = current_window->windowFilePath();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
openWorkFile(typeq);
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(_ui.mdiArea->currentSubWindow());
|
||||
QString file_path = current_window->windowFilePath();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
QString column_name;
|
||||
// Sheet extraction
|
||||
CSheetWordListBuilder builderS;
|
||||
// Primitives extraction
|
||||
CRegionPrimWordListBuilder builderP;
|
||||
bool isSheet = false;
|
||||
if(typeq.toAscii() == Constants::WK_ITEM) {
|
||||
column_name = "item ID";
|
||||
builderS.SheetExt = "sitem";
|
||||
builderS.SheetPath = level_design_path + "/game_element/sitem";
|
||||
isSheet = true;
|
||||
} else if(typeq.toAscii() == Constants::WK_CREATURE) {
|
||||
column_name = "creature ID";
|
||||
builderS.SheetExt = "creature";
|
||||
builderS.SheetPath = level_design_path + "/Game_elem/Creature/fauna";
|
||||
isSheet = true;
|
||||
} else if(typeq.toAscii() == Constants::WK_SBRICK) {
|
||||
column_name = "sbrick ID";
|
||||
builderS.SheetExt = "sbrick";
|
||||
builderS.SheetPath = level_design_path + "/game_element/sbrick";
|
||||
isSheet = true;
|
||||
} else if(typeq.toAscii() == Constants::WK_SPHRASE) {
|
||||
column_name = "sphrase ID";
|
||||
builderS.SheetExt = "sphrase";
|
||||
builderS.SheetPath = level_design_path + "/game_element/sphrase";
|
||||
isSheet = true;
|
||||
} else if(typeq.toAscii() == Constants::WK_PLACE) {
|
||||
column_name = "placeId";
|
||||
builderP.PrimPath = primitives_path;
|
||||
builderP.PrimFilter.push_back("region_*.primitive");
|
||||
builderP.PrimFilter.push_back("indoors_*.primitive");
|
||||
isSheet = false;
|
||||
}
|
||||
|
||||
if(isSheet)
|
||||
{
|
||||
current_window->extractWords(current_window->windowFilePath(), column_name, builderS);
|
||||
} else {
|
||||
initializeSettings(false);
|
||||
current_window->extractWords(current_window->windowFilePath(), column_name, builderP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMainWindow::extractBotNames()
|
||||
{
|
||||
if(verifySettings() == true)
|
||||
{
|
||||
CEditorWorksheet* current_window;
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
CEditor* editor_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
if(QString(editor_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(editor_window);
|
||||
QString file_path = current_window->subWindowFilePath();
|
||||
if(!current_window->isBotNamesTable())
|
||||
{
|
||||
list<CEditor*> subWindows = convertSubWindowList(_ui.mdiArea->subWindowList());
|
||||
list<CEditor*>::iterator it = subWindows.begin();
|
||||
bool finded = false;
|
||||
|
||||
for(; it != subWindows.end(); ++it)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>((*it));
|
||||
file_path = current_window->subWindowFilePath();
|
||||
if(current_window->isBotNamesTable())
|
||||
{
|
||||
finded = true;
|
||||
current_window->activateWindow();
|
||||
}
|
||||
}
|
||||
if(!finded)
|
||||
{
|
||||
openWorkFile(tr(Constants::WK_BOTNAMES));
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(_ui.mdiArea->currentSubWindow());
|
||||
QString file_path = current_window->windowFilePath();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
openWorkFile(tr(Constants::WK_BOTNAMES));
|
||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
current_window = qobject_cast<CEditorWorksheet*>(_ui.mdiArea->currentSubWindow());
|
||||
QString file_path = current_window->windowFilePath();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
initializeSettings(true);
|
||||
current_window->extractBotNames(filters, level_design_path, ligoConfig);
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::mergeSingleFile()
|
||||
{
|
||||
CEditor* editor_window = qobject_cast<CEditor*>(_ui.mdiArea->currentSubWindow());
|
||||
CSourceDialog *dialog = new CSourceDialog(this);
|
||||
map<QListWidgetItem*, int> methods;
|
||||
// create items
|
||||
QListWidgetItem* local_item = new QListWidgetItem();
|
||||
local_item->setText("Local directory");
|
||||
methods[local_item] = 0;
|
||||
QListWidgetItem* ftp_item = new QListWidgetItem();
|
||||
ftp_item->setText("From a FTP server");
|
||||
methods[ftp_item] = 1;
|
||||
|
||||
dialog->setSourceOptions(methods);
|
||||
dialog->show();
|
||||
dialog->exec();
|
||||
if(dialog->selected_item == local_item) // Local directory
|
||||
{
|
||||
QString file_name;
|
||||
if (_ui.mdiArea->subWindowList().size() > 0)
|
||||
{
|
||||
file_name = QFileDialog::getOpenFileName(this);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if(QString(editor_window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||
{
|
||||
editor_window->activateWindow();
|
||||
CEditorWorksheet* current_window = qobject_cast<CEditorWorksheet*>(editor_window);
|
||||
if(current_window->windowFilePath() == file_name)
|
||||
return;
|
||||
if(current_window->compareWorksheetFile(file_name))
|
||||
{
|
||||
current_window->mergeWorksheetFile(file_name);
|
||||
} else {
|
||||
QErrorMessage error;
|
||||
error.showMessage(QString("The file: %1 has different columns from the current file in editor.").arg(file_name));
|
||||
error.exec();
|
||||
}
|
||||
}
|
||||
} else if(dialog->selected_item == ftp_item) { // Ftp directory
|
||||
CFtpSelection* ftp_dialog = new CFtpSelection(this);
|
||||
ftp_dialog->show();
|
||||
ftp_dialog->exec();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CMainWindow::readSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup("translationmanager");
|
||||
filters = convertQStringList(settings->value("filters").toStringList()); /* filters */
|
||||
languages = convertQStringList(settings->value("trlanguages").toStringList()); /* languages */
|
||||
translation_path = settings->value("translation").toString().toStdString();
|
||||
work_path = settings->value("work").toString().toStdString();
|
||||
settings->endGroup();
|
||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||
level_design_path = settings->value(Core::Constants::LEVELDESIGN_PATH).toString().toStdString();
|
||||
primitives_path = QString(Core::Constants::PRIMITIVES_PATH).toStdString();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void CMainWindow::debug(QString text)
|
||||
{
|
||||
QErrorMessage error_settings;
|
||||
error_settings.showMessage(text);
|
||||
error_settings.exec();
|
||||
}
|
||||
|
||||
bool CMainWindow::verifySettings()
|
||||
{
|
||||
bool count_errors = false;
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup("translationmanager");
|
||||
|
||||
if(settings->value("filters").toList().count() == 0)
|
||||
{
|
||||
QErrorMessage error_settings;
|
||||
error_settings.showMessage("Please write all the paths on the settings dialog.");
|
||||
error_settings.exec();
|
||||
count_errors = true;
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
|
||||
return !count_errors;
|
||||
|
||||
}
|
||||
|
||||
list<string> CMainWindow::convertQStringList(QStringList listq)
|
||||
{
|
||||
std::list<std::string> stdlist;
|
||||
|
||||
Q_FOREACH(QString text, listq)
|
||||
{
|
||||
stdlist.push_back(text.toStdString());
|
||||
}
|
||||
|
||||
return stdlist;
|
||||
}
|
||||
|
||||
list<CEditor*> CMainWindow::convertSubWindowList(QList<QMdiSubWindow*> listq)
|
||||
{
|
||||
list<CEditor*> subwindows;
|
||||
QList<QMdiSubWindow*>::iterator it = listq.begin();
|
||||
|
||||
for(; it != listq.end(); ++it)
|
||||
{
|
||||
CEditor* current_window = qobject_cast<CEditor*>((*it));
|
||||
subwindows.push_back(current_window);
|
||||
}
|
||||
|
||||
return subwindows;
|
||||
}
|
||||
|
||||
bool CMainWindow::isWorksheetEditor(QString filename)
|
||||
{
|
||||
STRING_MANAGER::TWorksheet wk_file;
|
||||
if(loadExcelSheet(filename.toStdString(), wk_file, true) == true)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CCoreListener::closeMainWindow() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} /* namespace Plugin */
|
||||
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
// 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 MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
// Project includes
|
||||
#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
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QUndoStack>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QTableWidget>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
|
||||
#include "translation_manager_editor.h"
|
||||
#include "source_selection.h"
|
||||
#include "ui_translation_manager_main_window.h"
|
||||
#include <set>
|
||||
|
||||
class QWidget;
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMainWindow(QWidget *parent = 0);
|
||||
virtual ~CMainWindow() {}
|
||||
QUndoStack *m_undoStack;
|
||||
private:
|
||||
|
||||
Ui::CMainWindow _ui;
|
||||
// actions
|
||||
QAction *openAct;
|
||||
QAction *saveAct;
|
||||
QAction *saveAsAct;
|
||||
QMenu *windowMenu;
|
||||
QSignalMapper *windowMapper;
|
||||
// config
|
||||
map<string,bool> initialize_settings;
|
||||
list<string> filters;
|
||||
list<string> languages;
|
||||
string level_design_path;
|
||||
string primitives_path;
|
||||
string translation_path;
|
||||
string work_path;
|
||||
NLLIGO::CLigoConfig ligoConfig;
|
||||
private Q_SLOTS:
|
||||
void extractBotNames();
|
||||
void extractWords(QString typeq);
|
||||
void open();
|
||||
void save();
|
||||
void saveAs();
|
||||
void activeSubWindowChanged();
|
||||
void setActiveSubWindow(QWidget *window);
|
||||
void updateWindowsList();
|
||||
void mergeSingleFile();
|
||||
void debug(QString text); // TODO
|
||||
private:
|
||||
void openWorkFile(QString file);
|
||||
void updateToolbar(QMdiSubWindow *window);
|
||||
bool verifySettings();
|
||||
void readSettings();
|
||||
void createMenus();
|
||||
void createToolbar();
|
||||
void initializeSettings(bool georges);
|
||||
list<string> convertQStringList(QStringList listq);
|
||||
list<CEditor*> convertSubWindowList(QList<QMdiSubWindow*> listq);
|
||||
bool isWorksheetEditor(QString filename);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class CCoreListener : public Core::ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CCoreListener(QObject *parent = 0): ICoreListener(parent) {}
|
||||
virtual ~CCoreListener() {}
|
||||
|
||||
virtual bool closeMainWindow() const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
|
||||
|
||||
#endif // SIMPLE_VIEWER_H
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMainWindow</class>
|
||||
<widget class="QMainWindow" name="CMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>883</width>
|
||||
<height>576</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QMdiArea" name="mdiArea"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,140 @@
|
|||
// 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/>.
|
||||
|
||||
// Project includes
|
||||
#include "translation_manager_plugin.h"
|
||||
#include "translation_manager_settings_page.h"
|
||||
#include "translation_manager_main_window.h"
|
||||
// Project system includes
|
||||
#include "../core/icore.h"
|
||||
#include "../core/core_constants.h"
|
||||
#include "../core/imenu_manager.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QErrorMessage>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
TranslationManagerPlugin::~TranslationManagerPlugin()
|
||||
{
|
||||
Q_FOREACH(QObject *obj, _autoReleaseObjects)
|
||||
{
|
||||
_plugMan->removeObject(obj);
|
||||
}
|
||||
qDeleteAll(_autoReleaseObjects);
|
||||
_autoReleaseObjects.clear();
|
||||
}
|
||||
|
||||
bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
|
||||
addAutoReleasedObject(new CTranslationManagerSettingsPage(this));
|
||||
addAutoReleasedObject(new CTranslationManagerContext(this));
|
||||
addAutoReleasedObject(new CCoreListener(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::extensionsInitialized()
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
Core::IMenuManager *menuManager = core->menuManager();
|
||||
//menuManager = _plugMan->getObject<Core::IMenuManager>();
|
||||
// Menu Actions for plugin
|
||||
QAction *aboutTManPlugin = new QAction("Translation Manager", this);
|
||||
// Locations
|
||||
QMenu *helpMenu = menuManager->menu(Core::Constants::M_HELP);
|
||||
QAction *aboutQtAction = menuManager->action(Core::Constants::ABOUT_QT);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->insertAction(aboutQtAction, aboutTManPlugin);
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// Ensure that a context doesn't exist yet.
|
||||
// This only applies to platforms without PIC, e.g. Windows.
|
||||
nlassert(!NLMISC::INelContext::isContextInitialised());
|
||||
#endif // NL_OS_WINDOWS
|
||||
_LibContext = new NLMISC::CLibraryContext(*nelContext);
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::name() const
|
||||
{
|
||||
return "Translation Manager";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::version() const
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::vendor() const
|
||||
{
|
||||
return "cemycc";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::description() const
|
||||
{
|
||||
return "OVQT plugin for translation files.";
|
||||
}
|
||||
|
||||
QStringList TranslationManagerPlugin::dependencies() const
|
||||
{
|
||||
QStringList list;
|
||||
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||
//list.append("ObjectViewer");
|
||||
return list;
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::addAutoReleasedObject(QObject *obj)
|
||||
{
|
||||
_plugMan->addObject(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(Plugin::TranslationManagerPlugin)
|
|
@ -0,0 +1,123 @@
|
|||
// 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 TRANSLATION_MANAGER_PLUGIN_H
|
||||
#define TRANSLATION_MANAGER_PLUGIN_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "../core/icontext.h"
|
||||
#include "translation_manager_main_window.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/app_context.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
class CLibraryContext;
|
||||
}
|
||||
|
||||
namespace ExtensionSystem
|
||||
{
|
||||
class IPluginSpec;
|
||||
}
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class CTranslationManagerContext;
|
||||
|
||||
class TranslationManagerPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||
public:
|
||||
virtual ~TranslationManagerPlugin();
|
||||
|
||||
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
|
||||
void extensionsInitialized();
|
||||
|
||||
void setNelContext(NLMISC::INelContext *nelContext);
|
||||
|
||||
QString name() const;
|
||||
QString version() const;
|
||||
QString vendor() const;
|
||||
QString description() const;
|
||||
QStringList dependencies() const;
|
||||
|
||||
void addAutoReleasedObject(QObject *obj);
|
||||
|
||||
QObject *objectByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
|
||||
private:
|
||||
ExtensionSystem::IPluginManager *_plugMan;
|
||||
QList<QObject *> _autoReleaseObjects;
|
||||
};
|
||||
|
||||
class CTranslationManagerContext: public Core::IContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTranslationManagerContext(QObject *parent = 0): IContext(parent)
|
||||
{
|
||||
m_MainWindow = new CMainWindow();
|
||||
}
|
||||
|
||||
virtual ~CTranslationManagerContext() {}
|
||||
|
||||
virtual QString id() const
|
||||
{
|
||||
return QLatin1String("TranslationManagerContext");
|
||||
}
|
||||
virtual QString trName() const
|
||||
{
|
||||
return tr("Translation Manager");
|
||||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
virtual QWidget *widget()
|
||||
{
|
||||
return m_MainWindow;
|
||||
}
|
||||
virtual QUndoStack *undoStack()
|
||||
{
|
||||
return m_MainWindow->m_undoStack;
|
||||
}
|
||||
virtual void open()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMainWindow *m_MainWindow;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // TRANSLATION_MANAGER_PLUGIN_H
|
|
@ -0,0 +1,207 @@
|
|||
// 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/>.
|
||||
|
||||
#include "translation_manager_settings_page.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QListWidgetItem>
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Project includes
|
||||
#include "../core/icore.h"
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
QString lastDir = ".";
|
||||
|
||||
CTranslationManagerSettingsPage::CTranslationManagerSettingsPage(QObject *parent)
|
||||
: IOptionsPage(parent),
|
||||
_currentPage(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::id() const
|
||||
{
|
||||
return QLatin1String("TranslationManagerPage");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::trName() const
|
||||
{
|
||||
return tr("Translation Manager page");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::category() const
|
||||
{
|
||||
return QLatin1String("General");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::trCategory() const
|
||||
{
|
||||
return tr("General");
|
||||
}
|
||||
|
||||
QIcon CTranslationManagerSettingsPage::categoryIcon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
QWidget *CTranslationManagerSettingsPage::createPage(QWidget *parent)
|
||||
{
|
||||
_currentPage = new QWidget(parent);
|
||||
_ui.setupUi(_currentPage);
|
||||
readSettings();
|
||||
connect(_ui.filter_add, SIGNAL(clicked()), this, SLOT(filterAdd()));
|
||||
connect(_ui.filter_del, SIGNAL(clicked()), this, SLOT(filterDel()));
|
||||
connect(_ui.lang_add, SIGNAL(clicked()), this, SLOT(languageAdd()));
|
||||
connect(_ui.lang_del, SIGNAL(clicked()), this, SLOT(languageDel()));
|
||||
connect(_ui.translation_add, SIGNAL(clicked()), this, SLOT(translationAdd()));
|
||||
connect(_ui.work_add, SIGNAL(clicked()), this, SLOT(workAdd()));
|
||||
|
||||
return _currentPage;
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::filterAdd()
|
||||
{
|
||||
QString newValue = _ui.filter_edit->text();
|
||||
if (!newValue.isEmpty())
|
||||
{
|
||||
QListWidgetItem *newItem = new QListWidgetItem;
|
||||
newItem->setText(newValue);
|
||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
_ui.filter_list->addItem(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::filterDel()
|
||||
{
|
||||
QListWidgetItem *removeItem = _ui.filter_list->takeItem(_ui.filter_list->currentRow());
|
||||
if (!removeItem)
|
||||
delete removeItem;
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::languageAdd()
|
||||
{
|
||||
QString newValue = _ui.lang_edit->text();
|
||||
if (!newValue.isEmpty())
|
||||
{
|
||||
QListWidgetItem *newItem = new QListWidgetItem;
|
||||
newItem->setText(newValue);
|
||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
_ui.lang_list->addItem(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::languageDel()
|
||||
{
|
||||
QListWidgetItem *removeItem = _ui.lang_list->takeItem(_ui.lang_list->currentRow());
|
||||
if (!removeItem)
|
||||
delete removeItem;
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::translationAdd()
|
||||
{
|
||||
QString newPath = QFileDialog::getExistingDirectory(_currentPage, "");
|
||||
if (!newPath.isEmpty())
|
||||
{
|
||||
_ui.translation_edit->setText(newPath);
|
||||
}
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::workAdd()
|
||||
{
|
||||
QString newPath = QFileDialog::getExistingDirectory(_currentPage, "");
|
||||
if (!newPath.isEmpty())
|
||||
{
|
||||
_ui.work_edit->setText(newPath);
|
||||
}
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::apply()
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::readSettings()
|
||||
{
|
||||
QStringList filters, languages;
|
||||
QString ligo, translation, work;
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup("translationmanager");
|
||||
|
||||
filters = settings->value("filters").toStringList(); /* filters */
|
||||
languages = settings->value("trlanguages").toStringList(); /* languages */
|
||||
ligo = settings->value("ligo").toString();
|
||||
translation = settings->value("translation").toString();
|
||||
work = settings->value("work").toString();
|
||||
|
||||
settings->endGroup();
|
||||
// filter
|
||||
Q_FOREACH(QString filter, filters)
|
||||
{
|
||||
QListWidgetItem *newItem = new QListWidgetItem;
|
||||
newItem->setText(filter);
|
||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
_ui.filter_list->addItem(newItem);
|
||||
}
|
||||
// languages
|
||||
Q_FOREACH(QString lang, languages)
|
||||
{
|
||||
QListWidgetItem *newItem = new QListWidgetItem;
|
||||
newItem->setText(lang);
|
||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
_ui.lang_list->addItem(newItem);
|
||||
}
|
||||
// translation
|
||||
_ui.translation_edit->setText(translation);
|
||||
// work
|
||||
_ui.work_edit->setText(work);
|
||||
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::writeSettings()
|
||||
{
|
||||
QStringList filters, languages;
|
||||
QString ligo, translation, work;
|
||||
// filters
|
||||
for (int i = 0; i < _ui.filter_list->count(); ++i)
|
||||
filters << _ui.filter_list->item(i)->text();
|
||||
// languages
|
||||
for (int i = 0; i < _ui.lang_list->count(); ++i)
|
||||
languages << _ui.lang_list->item(i)->text();
|
||||
// translations path
|
||||
translation = _ui.translation_edit->text();
|
||||
// work path
|
||||
work = _ui.work_edit->text();
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup("translationmanager");
|
||||
settings->setValue("filters", filters);
|
||||
settings->setValue("trlanguages", languages);
|
||||
settings->setValue("translation", translation);
|
||||
settings->setValue("work", work);
|
||||
settings->endGroup();
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
|
||||
} /* namespace Plugin */
|
|
@ -0,0 +1,66 @@
|
|||
// 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 TRANSLATION_MANAGER_SETTINGS_PAGE_H
|
||||
#define TRANSLATION_MANAGER_SETTINGS_PAGE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "../core/ioptions_page.h"
|
||||
|
||||
#include "ui_translation_manager_settings_page.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
/**
|
||||
@class CTranslationManagerSettingsPage
|
||||
*/
|
||||
class CTranslationManagerSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTranslationManagerSettingsPage(QObject *parent = 0);
|
||||
virtual ~CTranslationManagerSettingsPage() {}
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString trName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QIcon categoryIcon() const;
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
|
||||
virtual void apply();
|
||||
virtual void finish() {}
|
||||
private Q_SLOTS:
|
||||
void filterAdd();
|
||||
void filterDel();
|
||||
void languageAdd();
|
||||
void languageDel();
|
||||
void translationAdd();
|
||||
void workAdd();
|
||||
private:
|
||||
QWidget *_currentPage;
|
||||
Ui::CTranslationManagerSettingsPage _ui;
|
||||
void writeSettings();
|
||||
void readSettings();
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // TRANSLATION_MANAGER_SETTINGS_H
|
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CTranslationManagerSettingsPage</class>
|
||||
<widget class="QWidget" name="CTranslationManagerSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>533</width>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<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">
|
||||
<string>Translation Manager Plugin</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>30</y>
|
||||
<width>521</width>
|
||||
<height>232</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="filter_edit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="filter_add">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/core.qrc">
|
||||
<normaloff>:/core/icons/ic_nel_add_item.png</normaloff>:/core/icons/ic_nel_add_item.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="filter_del">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/core.qrc">
|
||||
<normaloff>:/core/icons/ic_nel_delete_item.png</normaloff>:/core/icons/ic_nel_delete_item.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Languages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLineEdit" name="lang_edit"/>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="lang_add">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/core.qrc">
|
||||
<normaloff>:/core/icons/ic_nel_add_item.png</normaloff>:/core/icons/ic_nel_add_item.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QToolButton" name="lang_del">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../core/core.qrc">
|
||||
<normaloff>:/core/icons/ic_nel_delete_item.png</normaloff>:/core/icons/ic_nel_delete_item.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="QListWidget" name="filter_list"/>
|
||||
</item>
|
||||
<item row="1" column="4" colspan="4">
|
||||
<widget class="QListWidget" name="lang_list"/>
|
||||
</item>
|
||||
</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 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">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Work directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="work_edit"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="work_add">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../core/core.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue