mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-24 16:16:14 +00:00
Implemented saving.
This commit is contained in:
parent
7abf5b2aa1
commit
bc1b9600e2
2 changed files with 35 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue