mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 08:46:19 +00:00
Changed: #1307 Added some features and making little modifications
This commit is contained in:
parent
82e45b6d63
commit
fdbda07f0d
7 changed files with 681 additions and 613 deletions
|
@ -21,6 +21,8 @@
|
||||||
#include <QtCore/qfileinfo.h>
|
#include <QtCore/qfileinfo.h>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QCloseEvent>
|
#include <QtGui/QCloseEvent>
|
||||||
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QMenu>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "editor_worksheet.h"
|
#include "editor_worksheet.h"
|
||||||
|
@ -99,6 +101,7 @@ void CEditorWorksheet::open(QString filename)
|
||||||
// set editor signals
|
// set editor signals
|
||||||
connect(table_editor, SIGNAL(itemChanged(QTableWidgetItem*) ), this, SLOT(worksheetEditorChanged(QTableWidgetItem*)));
|
connect(table_editor, SIGNAL(itemChanged(QTableWidgetItem*) ), this, SLOT(worksheetEditorChanged(QTableWidgetItem*)));
|
||||||
connect(table_editor, SIGNAL(itemDoubleClicked(QTableWidgetItem*) ), this, SLOT(worksheetEditorCellEntered(QTableWidgetItem*)));
|
connect(table_editor, SIGNAL(itemDoubleClicked(QTableWidgetItem*) ), this, SLOT(worksheetEditorCellEntered(QTableWidgetItem*)));
|
||||||
|
connect (table_editor,SIGNAL(customContextMenuRequested(const QPoint &)), this,SLOT(contextMenuEvent(QContextMenuEvent*)));
|
||||||
} else {
|
} else {
|
||||||
QErrorMessage error;
|
QErrorMessage error;
|
||||||
error.showMessage("This file is not a worksheet file.");
|
error.showMessage("This file is not a worksheet file.");
|
||||||
|
@ -107,6 +110,23 @@ void CEditorWorksheet::open(QString filename)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CEditorWorksheet::contextMenuEvent(QContextMenuEvent *e)
|
||||||
|
{
|
||||||
|
QAction *insertRowAct = new QAction("Insert new row", this);
|
||||||
|
connect(insertRowAct, SIGNAL(triggered()), this, SLOT(insertRow()));
|
||||||
|
QAction *deleteRowAct = new QAction("Delete row", this);
|
||||||
|
connect(deleteRowAct, SIGNAL(triggered()), this, SLOT(deleteRow()));
|
||||||
|
|
||||||
|
QMenu *contextMenu = new QMenu(this);
|
||||||
|
contextMenu->addAction(insertRowAct);
|
||||||
|
contextMenu->addAction(deleteRowAct);
|
||||||
|
contextMenu->exec( e->globalPos() );
|
||||||
|
delete contextMenu;
|
||||||
|
contextMenu = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CEditorWorksheet::activateWindow()
|
void CEditorWorksheet::activateWindow()
|
||||||
{
|
{
|
||||||
showMaximized();
|
showMaximized();
|
||||||
|
@ -332,6 +352,7 @@ void CEditorWorksheet::extractBotNames(list<string> filters, string level_design
|
||||||
if(modified)
|
if(modified)
|
||||||
{
|
{
|
||||||
setWindowModified(true);
|
setWindowModified(true);
|
||||||
|
table_editor->scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ private Q_SLOTS:
|
||||||
void worksheetEditorChanged(QTableWidgetItem * item);
|
void worksheetEditorChanged(QTableWidgetItem * item);
|
||||||
void insertRow();
|
void insertRow();
|
||||||
void deleteRow();
|
void deleteRow();
|
||||||
|
void contextMenuEvent(QContextMenuEvent *e);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,6 +124,7 @@ public:
|
||||||
{
|
{
|
||||||
QTableWidgetItem* item = new QTableWidgetItem();
|
QTableWidgetItem* item = new QTableWidgetItem();
|
||||||
m_table->setItem(m_rowID, j, item);
|
m_table->setItem(m_rowID, j, item);
|
||||||
|
m_table->scrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
// Translation Manager Plugin - OVQT Plugin <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
// Copyright (C) 2011 Emanuel Costea <cemycc@gmail.com>
|
||||||
|
@ -123,16 +124,14 @@ void CMainWindow::createToolbar()
|
||||||
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
||||||
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
||||||
// Windows menu
|
// Windows menu
|
||||||
windowMenu = new QMenu(tr("&Windows..."), _ui.toolBar);
|
Core::ICore *core = Core::ICore::instance();
|
||||||
windowMenu->setIcon(QIcon(Core::Constants::ICON_PILL));
|
Core::IMenuManager *menuManager = core->menuManager();
|
||||||
|
windowMenu = menuManager->menuBar()->addMenu("Window");
|
||||||
updateWindowsList();
|
updateWindowsList();
|
||||||
_ui.toolBar->addAction(windowMenu->menuAction());
|
|
||||||
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
||||||
|
|
||||||
// Undo, Redo actions
|
// Undo, Redo actions
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
Core::ICore *core = Core::ICore::instance();
|
|
||||||
Core::IMenuManager *menuManager = core->menuManager();
|
|
||||||
QAction* undoAction = menuManager->action(Core::Constants::UNDO);
|
QAction* undoAction = menuManager->action(Core::Constants::UNDO);
|
||||||
if (undoAction != 0)
|
if (undoAction != 0)
|
||||||
_ui.toolBar->addAction(undoAction);
|
_ui.toolBar->addAction(undoAction);
|
||||||
|
@ -147,10 +146,15 @@ void CMainWindow::updateToolbar(QMdiSubWindow *window)
|
||||||
if(_ui.mdiArea->subWindowList().size() > 0)
|
if(_ui.mdiArea->subWindowList().size() > 0)
|
||||||
if(QString(window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
if(QString(window->widget()->metaObject()->className()) == "QTableWidget") // Sheet Editor
|
||||||
{
|
{
|
||||||
QAction *insertRowAct = windowMenu->addAction("Insert new row");
|
//setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
|
QAction *insertRowAct = new QAction("Insert new row", this);
|
||||||
connect(insertRowAct, SIGNAL(triggered()), window, SLOT(insertRow()));
|
connect(insertRowAct, SIGNAL(triggered()), window, SLOT(insertRow()));
|
||||||
QAction *deleteRowAct = windowMenu->addAction("Delete row");
|
//addAction(insertRowAct);
|
||||||
|
windowMenu->addAction(insertRowAct);
|
||||||
|
QAction *deleteRowAct = new QAction("Delete row", this);
|
||||||
connect(deleteRowAct, SIGNAL(triggered()), window, SLOT(deleteRow()));
|
connect(deleteRowAct, SIGNAL(triggered()), window, SLOT(deleteRow()));
|
||||||
|
//addAction(deleteRowAct);
|
||||||
|
windowMenu->addAction(deleteRowAct);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +171,7 @@ void CMainWindow::setActiveSubWindow(QWidget* window)
|
||||||
|
|
||||||
void CMainWindow::activeSubWindowChanged()
|
void CMainWindow::activeSubWindowChanged()
|
||||||
{
|
{
|
||||||
//TODO: nothing to be done here atm
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::updateWindowsList()
|
void CMainWindow::updateWindowsList()
|
||||||
|
@ -187,10 +191,11 @@ void CMainWindow::updateWindowsList()
|
||||||
} else {
|
} else {
|
||||||
action_text = tr("%1 %2").arg(i + 1).arg(window_file);
|
action_text = tr("%1 %2").arg(i + 1).arg(window_file);
|
||||||
}
|
}
|
||||||
QAction *action = windowMenu->addAction(action_text);
|
QAction *action = new QAction(action_text, this);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(subWindows.at(i) == current_window);
|
action->setChecked(subWindows.at(i) == current_window);
|
||||||
connect(action, SIGNAL(triggered()), windowMapper, SLOT(map()));
|
connect(action, SIGNAL(triggered()), windowMapper, SLOT(map()));
|
||||||
|
windowMenu->addAction(action);
|
||||||
windowMapper->setMapping(action, subWindows.at(i));
|
windowMapper->setMapping(action, subWindows.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,7 +594,35 @@ bool CMainWindow::isPhraseEditor(QString filename)
|
||||||
|
|
||||||
bool CCoreListener::closeMainWindow() const
|
bool CCoreListener::closeMainWindow() const
|
||||||
{
|
{
|
||||||
return true;
|
Q_FOREACH(QMdiSubWindow *subWindow, m_MainWindow->_ui.mdiArea->subWindowList())
|
||||||
|
{
|
||||||
|
CEditor *currentEditor = qobject_cast<CEditor*>(subWindow);
|
||||||
|
if(subWindow->isWindowModified())
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("The document has been modified ( %1 ).").arg(currentEditor->windowFilePath()));
|
||||||
|
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:
|
||||||
|
currentEditor->save();
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case QMessageBox::Discard:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace Plugin */
|
} /* namespace Plugin */
|
||||||
|
|
|
@ -62,8 +62,9 @@ public:
|
||||||
CMainWindow(QWidget *parent = 0);
|
CMainWindow(QWidget *parent = 0);
|
||||||
virtual ~CMainWindow() {}
|
virtual ~CMainWindow() {}
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
|
public:
|
||||||
|
Ui::CMainWindow _ui;
|
||||||
private:
|
private:
|
||||||
Ui::CMainWindow _ui;
|
|
||||||
// actions
|
// actions
|
||||||
QAction *openAct;
|
QAction *openAct;
|
||||||
QAction *saveAct;
|
QAction *saveAct;
|
||||||
|
@ -111,13 +112,20 @@ class CCoreListener : public Core::ICoreListener
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CCoreListener(QObject *parent = 0): ICoreListener(parent) {}
|
CCoreListener(CMainWindow* mainWindow, QObject *parent = 0): ICoreListener(parent)
|
||||||
virtual ~CCoreListener() {}
|
{
|
||||||
|
m_MainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~CCoreListener() {}
|
||||||
virtual bool closeMainWindow() const;
|
virtual bool closeMainWindow() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMainWindow *m_MainWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plugin
|
} // namespace Plugin
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,12 @@ bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *plugi
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
|
// create the mainwindow
|
||||||
|
CMainWindow *mainWindow = new CMainWindow();
|
||||||
|
|
||||||
addAutoReleasedObject(new CTranslationManagerSettingsPage(this));
|
addAutoReleasedObject(new CTranslationManagerSettingsPage(this));
|
||||||
addAutoReleasedObject(new CTranslationManagerContext(this));
|
addAutoReleasedObject(new CTranslationManagerContext(mainWindow, this));
|
||||||
addAutoReleasedObject(new CCoreListener(this));
|
addAutoReleasedObject(new CCoreListener(mainWindow, this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +77,8 @@ void TranslationManagerPlugin::extensionsInitialized()
|
||||||
helpMenu->insertAction(aboutQtAction, aboutTManPlugin);
|
helpMenu->insertAction(aboutQtAction, aboutTManPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
void TranslationManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
|
@ -82,9 +82,9 @@ class CTranslationManagerContext: public Core::IContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CTranslationManagerContext(QObject *parent = 0): IContext(parent)
|
CTranslationManagerContext(CMainWindow* mainWindow, QObject *parent = 0): IContext(parent)
|
||||||
{
|
{
|
||||||
m_MainWindow = new CMainWindow();
|
m_MainWindow = mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~CTranslationManagerContext() {}
|
virtual ~CTranslationManagerContext() {}
|
||||||
|
|
Loading…
Reference in a new issue