Implemented saving.

This commit is contained in:
dfighter1985 2014-07-18 00:50:40 +02:00
parent 512aa4c867
commit de87aca09d
2 changed files with 35 additions and 1 deletions

View file

@ -553,7 +553,9 @@ void CMainWindow::mergeSingleFile()
void CMainWindow::onUxtClicked()
{
UXTEditor *e = new UXTEditor();
e->open( work_path + "/" + QString( Constants::WK_UXT ) );
QString path = work_path + "/" + QString( Constants::WK_UXT );
e->open( path );
e->setCurrentFile( path );
_ui.mdiArea->addSubWindow( e );
e->activateWindow();
}

View file

@ -6,6 +6,9 @@
#include <QCloseEvent>
#include <QMessageBox>
#include <QFile>
#include <QTextStream>
#include "nel/misc/diff_tool.h"
namespace TranslationManager
@ -89,10 +92,39 @@ void UXTEditor::open( QString filename )
void UXTEditor::save()
{
saveAs( current_file );
}
void UXTEditor::saveAs( QString filename )
{
QFile f( filename );
if( !f.open( QIODevice::WriteOnly ) )
return;
QTextStream out( &f );
std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = d_ptr->infos.begin();
while( itr != d_ptr->infos.end() )
{
QString line = "";
line += itr->Identifier.c_str();
line += "\t";
line += "[";
line += itr->Text.toUtf8().c_str();
line += "]";
line += "\r\n";
out << line;
++itr;
}
f.close();
d_ptr->changed = false;
}
void UXTEditor::activateWindow()