mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-10 09:19:01 +00:00
Work with translated files, instead of work files.
This commit is contained in:
parent
b0c916276d
commit
a51f76d036
3 changed files with 43 additions and 15 deletions
|
@ -54,6 +54,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||||
|
|
||||||
_ui.mdiArea->closeAllSubWindows();
|
_ui.mdiArea->closeAllSubWindows();
|
||||||
windowMapper = new QSignalMapper(this);
|
windowMapper = new QSignalMapper(this);
|
||||||
|
m_UXTMapper = new QSignalMapper(this);
|
||||||
connect(windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(setActiveSubWindow(QWidget *)));
|
connect(windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(setActiveSubWindow(QWidget *)));
|
||||||
|
|
||||||
initialize_settings["georges"] = false;
|
initialize_settings["georges"] = false;
|
||||||
|
@ -87,8 +88,20 @@ void CMainWindow::createMenus()
|
||||||
{
|
{
|
||||||
windowMenu = m->addMenu("Window");
|
windowMenu = m->addMenu("Window");
|
||||||
|
|
||||||
QAction *a = m->addAction( "Uxt" );
|
QMenu *mm = m->addMenu( "UI translation" );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( onUxtClicked() ) );
|
if( mm != NULL )
|
||||||
|
{
|
||||||
|
QStringListIterator itr( languages );
|
||||||
|
while( itr.hasNext() )
|
||||||
|
{
|
||||||
|
QString lang = itr.next();
|
||||||
|
QAction *a = mm->addAction( lang );
|
||||||
|
connect( a, SIGNAL( triggered() ), m_UXTMapper, SLOT( map() ) );
|
||||||
|
m_UXTMapper->setMapping( a, lang );
|
||||||
|
}
|
||||||
|
|
||||||
|
connect( m_UXTMapper, SIGNAL( mapped( QString ) ), this, SLOT( onUxtMapped( QString ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
menu = m;
|
menu = m;
|
||||||
}
|
}
|
||||||
|
@ -550,14 +563,14 @@ void CMainWindow::mergeSingleFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::onUxtClicked()
|
void CMainWindow::onUxtMapped( QString lang )
|
||||||
{
|
{
|
||||||
QString path = work_path + "/" + QString( Constants::WK_UXT );
|
QString path = translation_path + "/" + lang + ".uxt";
|
||||||
path.replace( "\\", "/" );
|
path.replace( "\\", "/" );
|
||||||
|
|
||||||
if( getEditorByWindowFilePath( path ) != NULL )
|
if( getEditorByWindowFilePath( path ) != NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UXTEditor *e = new UXTEditor();
|
UXTEditor *e = new UXTEditor();
|
||||||
e->open( path );
|
e->open( path );
|
||||||
e->setCurrentFile( path );
|
e->setCurrentFile( path );
|
||||||
|
|
|
@ -71,6 +71,7 @@ private:
|
||||||
QAction *saveAsAct;
|
QAction *saveAsAct;
|
||||||
QMenu *windowMenu;
|
QMenu *windowMenu;
|
||||||
QSignalMapper *windowMapper;
|
QSignalMapper *windowMapper;
|
||||||
|
QSignalMapper *m_UXTMapper;
|
||||||
// config
|
// config
|
||||||
QMap<string,bool> initialize_settings;
|
QMap<string,bool> initialize_settings;
|
||||||
QList<QString> filters;
|
QList<QString> filters;
|
||||||
|
@ -90,7 +91,7 @@ private Q_SLOTS:
|
||||||
void setActiveSubWindow(QWidget *window);
|
void setActiveSubWindow(QWidget *window);
|
||||||
void updateWindowsList();
|
void updateWindowsList();
|
||||||
void mergeSingleFile();
|
void mergeSingleFile();
|
||||||
void onUxtClicked();
|
void onUxtMapped( QString lang );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openWorkFile(QString file);
|
void openWorkFile(QString file);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "nel/misc/diff_tool.h"
|
#include "nel/misc/diff_tool.h"
|
||||||
|
#include "nel/misc/i18n.h"
|
||||||
|
|
||||||
namespace TranslationManager
|
namespace TranslationManager
|
||||||
{
|
{
|
||||||
|
@ -120,23 +121,36 @@ void UXTEditor::saveAs( QString filename )
|
||||||
|
|
||||||
QTextStream out( &f );
|
QTextStream out( &f );
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = d_ptr->infos.begin();
|
std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = d_ptr->infos.begin();
|
||||||
while( itr != d_ptr->infos.end() )
|
while( itr != d_ptr->infos.end() )
|
||||||
{
|
{
|
||||||
QString line = "";
|
QString hashLine = "// HASH_VALUE ";
|
||||||
|
hashLine += QString( NLMISC::CI18N::hashToString( itr->HashValue ).c_str() ).toUpper();
|
||||||
|
hashLine += "\r\n";
|
||||||
|
|
||||||
line += itr->Identifier.c_str();
|
QString idxLine = "// INDEX ";
|
||||||
line += "\t";
|
idxLine += QString::number( idx );
|
||||||
|
idxLine += "\r\n";
|
||||||
|
|
||||||
line += "[";
|
|
||||||
line += itr->Text.toUtf8().c_str();
|
QString trLine = "";
|
||||||
line += "]";
|
trLine += itr->Identifier.c_str();
|
||||||
|
trLine += "\t";
|
||||||
|
trLine += "[";
|
||||||
|
trLine += itr->Text.toUtf8().c_str();
|
||||||
|
trLine += "]";
|
||||||
|
trLine += "\r\n";
|
||||||
|
|
||||||
line += "\r\n";
|
QString newLine = "\r\n";
|
||||||
|
|
||||||
out << line;
|
out << hashLine;
|
||||||
|
out << idxLine;
|
||||||
|
out << trLine;
|
||||||
|
out << newLine;
|
||||||
|
|
||||||
++itr;
|
++itr;
|
||||||
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
|
Loading…
Reference in a new issue