MODIFIED: #1471 Exiting OVQT will now work again properly.
This commit is contained in:
parent
0ce956b71a
commit
bbaefe88d5
8 changed files with 87 additions and 8 deletions
code/nel/tools/3d/object_viewer_qt/src/plugins
|
@ -176,11 +176,12 @@ void MainWindow::saveAll()
|
|||
{
|
||||
}
|
||||
|
||||
void MainWindow::close()
|
||||
void MainWindow::closeDocument()
|
||||
{
|
||||
m_contextManager->currentContext()->close();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::cut()
|
||||
{
|
||||
}
|
||||
|
@ -297,7 +298,7 @@ void MainWindow::createActions()
|
|||
m_closeAction = new QAction(tr("Close"), this);
|
||||
m_closeAction->setShortcut(QKeySequence::Close);
|
||||
menuManager()->registerAction(m_closeAction, Constants::CLOSE);
|
||||
connect(m_closeAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||
connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeDocument()));
|
||||
m_closeAction->setEnabled(false);
|
||||
|
||||
m_exitAction = new QAction(tr("E&xit"), this);
|
||||
|
|
|
@ -71,7 +71,7 @@ private Q_SLOTS:
|
|||
void save();
|
||||
void saveAs();
|
||||
void saveAll();
|
||||
void close();
|
||||
void closeDocument();
|
||||
void cut();
|
||||
void copy();
|
||||
void paste();
|
||||
|
|
|
@ -45,6 +45,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
|
|||
gui_editor_plugin.h
|
||||
gui_editor_window.h
|
||||
gui_editor_context.h
|
||||
gui_editor_core_listener.h
|
||||
widget_properties.h
|
||||
widget_hierarchy.h
|
||||
link_list.h
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "gui_editor_core_listener.h"
|
||||
#include "gui_editor_window.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
bool GUIEditorCoreListener::closeMainWindow() const
|
||||
{
|
||||
return mainWindow->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef GUI_EDITOR_CORE_LISTENER_H
|
||||
#define GUI_EDITOR_CORE_LISTENER_H
|
||||
|
||||
#include "../core/icore_listener.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class GUIEditorWindow;
|
||||
|
||||
class GUIEditorCoreListener : public Core::ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GUIEditorCoreListener( GUIEditorWindow *mainWindow, QObject *parent = NULL ){ this->mainWindow = mainWindow; }
|
||||
~GUIEditorCoreListener(){}
|
||||
bool closeMainWindow() const;
|
||||
|
||||
private:
|
||||
GUIEditorWindow *mainWindow;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#include "gui_editor_plugin.h"
|
||||
#include "gui_editor_window.h"
|
||||
#include "gui_editor_context.h"
|
||||
#include "gui_editor_core_listener.h"
|
||||
|
||||
#include "../core/icore.h"
|
||||
#include "../core/core_constants.h"
|
||||
|
@ -42,7 +43,12 @@ namespace GUIEditor
|
|||
{
|
||||
Q_UNUSED(errorString);
|
||||
m_plugMan = pluginManager;
|
||||
addAutoReleasedObject(new GUIEditorContext(this));
|
||||
GUIEditorContext *context = new GUIEditorContext( this );
|
||||
GUIEditorWindow *window = static_cast< GUIEditorWindow* >( context->widget() );
|
||||
|
||||
addAutoReleasedObject( context );
|
||||
addAutoReleasedObject( new GUIEditorCoreListener( window, this ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -249,17 +249,17 @@ namespace GUIEditor
|
|||
|
||||
}
|
||||
|
||||
void GUIEditorWindow::close()
|
||||
bool GUIEditorWindow::close()
|
||||
{
|
||||
if( currentProject.isEmpty() )
|
||||
return;
|
||||
return false;
|
||||
|
||||
QMessageBox::StandardButton reply = QMessageBox::question( this,
|
||||
tr( "Closing project" ),
|
||||
tr( "Are you sure you want to close this project?" ),
|
||||
QMessageBox::Yes | QMessageBox::No );
|
||||
if( reply != QMessageBox::Yes )
|
||||
return;
|
||||
return false;
|
||||
|
||||
projectFiles.clearAll();
|
||||
projectWindow->clear();
|
||||
|
@ -271,6 +271,8 @@ namespace GUIEditor
|
|||
currentProject = "";
|
||||
currentProjectFile = "";
|
||||
projectParser.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GUIEditorWindow::onProjectFilesChanged()
|
||||
|
|
|
@ -54,7 +54,7 @@ public Q_SLOTS:
|
|||
void newDocument();
|
||||
void save();
|
||||
void saveAs();
|
||||
void close();
|
||||
bool close();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onProjectFilesChanged();
|
||||
|
|
Loading…
Reference in a new issue