mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
UXT Editor widget
This commit is contained in:
parent
bc50ca150b
commit
85f1e37155
6 changed files with 148 additions and 1 deletions
|
@ -17,6 +17,7 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h
|
|||
ftp_selection.h
|
||||
editor_worksheet.h
|
||||
editor_phrase.h
|
||||
uxt_editor.h
|
||||
)
|
||||
|
||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui
|
||||
|
|
|
@ -21,8 +21,9 @@ namespace TranslationManager
|
|||
{
|
||||
namespace Constants
|
||||
{
|
||||
const int ED_SHEET = 1;
|
||||
const int ED_SHEET = 1;
|
||||
const int ED_PHRASE = 2;
|
||||
const int ED_UXT = 3;
|
||||
|
||||
const char *const WK_BOTNAMES = "bot_names_wk.txt";
|
||||
const char *const WK_ITEM = "item_words_wk.txt";
|
||||
|
@ -32,6 +33,7 @@ const char *const WK_SPHRASE = "sphrase_words_wk.txt";
|
|||
const char *const WK_PLACE = "place_words_wk.txt";
|
||||
const char *const WK_CONTINENT = "place_words_wk.txt";
|
||||
const char *const WK_STABLE = "place_words_wk.txt";
|
||||
const char *const WK_UXT = "wk.uxt";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QCloseEvent>
|
||||
|
||||
#include "uxt_editor.h"
|
||||
|
||||
namespace TranslationManager
|
||||
{
|
||||
|
||||
|
@ -84,6 +86,10 @@ void CMainWindow::createMenus()
|
|||
if( m != NULL )
|
||||
{
|
||||
windowMenu = m->addMenu("Window");
|
||||
|
||||
QAction *a = m->addAction( "Uxt" );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( onUxtClicked() ) );
|
||||
|
||||
menu = m;
|
||||
}
|
||||
|
||||
|
@ -544,6 +550,14 @@ void CMainWindow::mergeSingleFile()
|
|||
}
|
||||
}
|
||||
|
||||
void CMainWindow::onUxtClicked()
|
||||
{
|
||||
UXTEditor *e = new UXTEditor();
|
||||
e->open( work_path + "/" + QString( Constants::WK_UXT ) );
|
||||
_ui.mdiArea->addSubWindow( e );
|
||||
e->activateWindow();
|
||||
}
|
||||
|
||||
// Read the settings from QSettings
|
||||
void CMainWindow::readSettings()
|
||||
{
|
||||
|
|
|
@ -90,6 +90,7 @@ private Q_SLOTS:
|
|||
void setActiveSubWindow(QWidget *window);
|
||||
void updateWindowsList();
|
||||
void mergeSingleFile();
|
||||
void onUxtClicked();
|
||||
|
||||
private:
|
||||
void openWorkFile(QString file);
|
||||
|
|
96
code/studio/src/plugins/translation_manager/uxt_editor.cpp
Normal file
96
code/studio/src/plugins/translation_manager/uxt_editor.cpp
Normal file
|
@ -0,0 +1,96 @@
|
|||
#include "translation_manager_constants.h"
|
||||
#include "uxt_editor.h"
|
||||
|
||||
#include <QTableWidget>
|
||||
#include <QFormLayout>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "nel/misc/diff_tool.h"
|
||||
|
||||
namespace TranslationManager
|
||||
{
|
||||
|
||||
class UXTEditorPvt
|
||||
{
|
||||
public:
|
||||
|
||||
UXTEditorPvt()
|
||||
{
|
||||
t = new QTableWidget();
|
||||
}
|
||||
|
||||
QTableWidget *t;
|
||||
};
|
||||
|
||||
|
||||
UXTEditor::UXTEditor( QMdiArea *parent ) :
|
||||
CEditor( parent )
|
||||
{
|
||||
editor_type = Constants::ED_UXT;
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
|
||||
d_ptr = new UXTEditorPvt();
|
||||
}
|
||||
|
||||
UXTEditor::~UXTEditor()
|
||||
{
|
||||
delete d_ptr;
|
||||
d_ptr = NULL;
|
||||
}
|
||||
|
||||
void UXTEditor::open( QString filename )
|
||||
{
|
||||
std::vector< STRING_MANAGER::TStringInfo > infos;
|
||||
STRING_MANAGER::loadStringFile( filename.toUtf8().constData(), infos, true );
|
||||
|
||||
if( infos.size() == 0 )
|
||||
return;
|
||||
|
||||
d_ptr->t->clear();
|
||||
d_ptr->t->setColumnCount( 2 );
|
||||
d_ptr->t->setRowCount( infos.size() );
|
||||
|
||||
int i = 0;
|
||||
|
||||
std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = infos.begin();
|
||||
while( itr != infos.end() )
|
||||
{
|
||||
const STRING_MANAGER::TStringInfo &info = *itr;
|
||||
|
||||
QTableWidgetItem *name = new QTableWidgetItem( info.Identifier.c_str() );
|
||||
QTableWidgetItem *text1 = new QTableWidgetItem( info.Text.toUtf8().c_str() );
|
||||
|
||||
d_ptr->t->setItem( i, 0, name );
|
||||
d_ptr->t->setItem( i, 1, text1 );
|
||||
|
||||
++itr;
|
||||
i++;
|
||||
}
|
||||
|
||||
d_ptr->t->resizeColumnsToContents();
|
||||
|
||||
setWidget( d_ptr->t );
|
||||
setCurrentFile( filename );
|
||||
}
|
||||
|
||||
void UXTEditor::save()
|
||||
{
|
||||
}
|
||||
|
||||
void UXTEditor::saveAs( QString filename )
|
||||
{
|
||||
}
|
||||
|
||||
void UXTEditor::activateWindow()
|
||||
{
|
||||
showMaximized();
|
||||
}
|
||||
|
||||
|
||||
void UXTEditor::closeEvent( QCloseEvent *e )
|
||||
{
|
||||
e->accept();
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
33
code/studio/src/plugins/translation_manager/uxt_editor.h
Normal file
33
code/studio/src/plugins/translation_manager/uxt_editor.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef UXT_EDITOR_H
|
||||
#define UXT_EDITOR_H
|
||||
|
||||
#include "translation_manager_editor.h"
|
||||
|
||||
namespace TranslationManager
|
||||
{
|
||||
|
||||
class UXTEditorPvt;
|
||||
|
||||
class UXTEditor : public CEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UXTEditor( QMdiArea *parent = NULL );
|
||||
~UXTEditor();
|
||||
|
||||
void open( QString filename );
|
||||
void save();
|
||||
void saveAs( QString filename );
|
||||
void activateWindow();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *e );
|
||||
|
||||
private:
|
||||
UXTEditorPvt *d_ptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in a new issue