Added dialog for the new GUI action.

--HG--
branch : dfighter-tools
hg/compatibility
dfighter1985 10 years ago
parent 5217b38f58
commit 03c041310e

@ -36,6 +36,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
texture_property_manager.h texture_property_manager.h
expression_editor.h expression_editor.h
expr_link_dlg.h expr_link_dlg.h
new_gui_dlg.h
) )
SET(OVQT_PLUGIN_GUI_EDITOR_UIS SET(OVQT_PLUGIN_GUI_EDITOR_UIS
@ -55,6 +56,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS
texture_chooser.ui texture_chooser.ui
expression_editor.ui expression_editor.ui
expr_link_dlg.ui expr_link_dlg.ui
new_gui_dlg.ui
) )
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)

@ -44,6 +44,7 @@
#include "editor_selection_watcher.h" #include "editor_selection_watcher.h"
#include "editor_message_processor.h" #include "editor_message_processor.h"
#include "add_widget_widget.h" #include "add_widget_widget.h"
#include "new_gui_dlg.h"
namespace GUIEditor namespace GUIEditor
{ {
@ -199,6 +200,13 @@ namespace GUIEditor
void GUIEditorWindow::newDocument() void GUIEditorWindow::newDocument()
{ {
NewGUIDlg d;
int result = d.exec();
if( result == QDialog::Rejected )
return;
close();
} }
void GUIEditorWindow::save() void GUIEditorWindow::save()
@ -358,14 +366,14 @@ namespace GUIEditor
void GUIEditorWindow::createMenus() void GUIEditorWindow::createMenus()
{ {
Core::MenuManager *mm = Core::ICore::instance()->menuManager(); Core::MenuManager *mm = Core::ICore::instance()->menuManager();
//QAction *newAction = mm->action( Core::Constants::NEW ); QAction *newAction = mm->action( Core::Constants::NEW );
QAction *saveAction = mm->action( Core::Constants::SAVE ); QAction *saveAction = mm->action( Core::Constants::SAVE );
QAction *saveAsAction = mm->action( Core::Constants::SAVE_AS ); QAction *saveAsAction = mm->action( Core::Constants::SAVE_AS );
QAction *closeAction = mm->action( Core::Constants::CLOSE ); QAction *closeAction = mm->action( Core::Constants::CLOSE );
QAction *delAction = mm->action( Core::Constants::DEL ); QAction *delAction = mm->action( Core::Constants::DEL );
//if( newAction != NULL ) if( newAction != NULL )
// newAction->setEnabled( true ); newAction->setEnabled( true );
if( saveAction != NULL ) if( saveAction != NULL )
saveAction->setEnabled( true ); saveAction->setEnabled( true );
if( saveAsAction != NULL ) if( saveAsAction != NULL )

@ -0,0 +1,72 @@
// Ryzom Core Studio - GUI Editor Plugin
//
// Copyright (C) 2014 Laszlo Kis-Adam
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
//
// 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 "new_gui_dlg.h"
#include <QMessageBox>
NewGUIDlg::NewGUIDlg( QWidget *parent ) :
QDialog( parent )
{
m_ui.setupUi( this );
connect( m_ui.okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );
connect( m_ui.cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
}
NewGUIDlg::~NewGUIDlg()
{
}
QString NewGUIDlg::getProjectName() const
{
return m_ui.projectEdit->text();
}
QString NewGUIDlg::getWindowName() const
{
return m_ui.windowEdit->text();
}
void NewGUIDlg::onOKClicked()
{
if( m_ui.projectEdit->text().isEmpty() )
{
QMessageBox::information( this,
tr( "New project" ),
tr( "You must specify a project name!" ) );
return;
}
if( m_ui.windowEdit->text().isEmpty() )
{
QMessageBox::information( this,
tr( "New project" ),
tr( "You must specify a window name!" ) );
return;
}
accept();
}
void NewGUIDlg::onCancelClicked()
{
reject();
}

@ -0,0 +1,44 @@
// Ryzom Core Studio - GUI Editor Plugin
//
// Copyright (C) 2014 Laszlo Kis-Adam
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
//
// 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 NEW_GUI_DLG_H
#define NEW_GUI_DLG_H
#include "ui_new_gui_dlg.h"
class NewGUIDlg : public QDialog
{
Q_OBJECT
public:
NewGUIDlg( QWidget *parent = NULL );
~NewGUIDlg();
QString getProjectName() const;
QString getWindowName() const;
private Q_SLOTS:
void onOKClicked();
void onCancelClicked();
private:
Ui::NewGUIDialog m_ui;
};
#endif

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewGUIDialog</class>
<widget class="QDialog" name="NewGUIDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>292</width>
<height>95</height>
</rect>
</property>
<property name="windowTitle">
<string>New GUI</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Project name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="projectEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Window name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="windowEdit"/>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>107</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="okButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading…
Cancel
Save