parent
2e6a5bb1d6
commit
875cad3f72
@ -0,0 +1,122 @@
|
||||
// Ryzom Core Studio - Georges 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 "expr_link_dlg.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
ExprLinkDlg::ExprLinkDlg( 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() ) );
|
||||
}
|
||||
|
||||
ExprLinkDlg::~ExprLinkDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void ExprLinkDlg::load( const QList< SlotInfo > &a, const QList< SlotInfo > &b )
|
||||
{
|
||||
QListIterator< SlotInfo > itra( a );
|
||||
QListIterator< SlotInfo > itrb( b );
|
||||
|
||||
while( itra.hasNext() )
|
||||
{
|
||||
const SlotInfo &info = itra.next();
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setText( info.name );
|
||||
item->setData( Qt::UserRole, info.slot );
|
||||
|
||||
m_ui.list1->addItem( item );
|
||||
}
|
||||
|
||||
while( itrb.hasNext() )
|
||||
{
|
||||
const SlotInfo &info = itrb.next();
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setText( info.name );
|
||||
item->setData( Qt::UserRole, info.slot );
|
||||
|
||||
m_ui.list2->addItem( item );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int ExprLinkDlg::getSlotA() const
|
||||
{
|
||||
QListWidgetItem *item = m_ui.list1->currentItem();
|
||||
if( item == NULL )
|
||||
return -1;
|
||||
|
||||
int slot = item->data( Qt::UserRole ).toInt();
|
||||
return slot;
|
||||
}
|
||||
|
||||
int ExprLinkDlg::getSlotB() const
|
||||
{
|
||||
QListWidgetItem *item = m_ui.list2->currentItem();
|
||||
if( item == NULL )
|
||||
return -1;
|
||||
|
||||
int slot = item->data( Qt::UserRole ).toInt();
|
||||
return slot;
|
||||
}
|
||||
|
||||
void ExprLinkDlg::onOKClicked()
|
||||
{
|
||||
int slotA = getSlotA();
|
||||
int slotB = getSlotB();
|
||||
|
||||
if( ( slotA == -1 ) || ( slotB == -1 ) )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "No slots selected" ),
|
||||
tr( "You need to select a slot on both sides." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( slotA == 0 ) && ( slotB == 0 ) )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "Wrong slots selected" ),
|
||||
tr( "You can only select the 'Out' slot on one of the sides." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( slotA != 0 ) && ( slotB != 0 ) )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "Wrong slots selected" ),
|
||||
tr( "One of the slots selected must be the 'Out' slot!" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void ExprLinkDlg::onCancelClicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,49 @@
|
||||
// Ryzom Core Studio - Georges 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 EXPR_LINK_DLG
|
||||
#define EXPR_LINK_DLG
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include "ui_expr_link_dlg.h"
|
||||
#include "expr_slot_info.h"
|
||||
|
||||
class ExprLinkDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExprLinkDlg( QWidget *parent = NULL );
|
||||
~ExprLinkDlg();
|
||||
|
||||
void load( const QList< SlotInfo > &a, const QList< SlotInfo > &b );
|
||||
|
||||
int getSlotA() const;
|
||||
int getSlotB() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOKClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
private:
|
||||
Ui::ExprLinkDialog m_ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExprLinkDialog</class>
|
||||
<widget class="QDialog" name="ExprLinkDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>581</width>
|
||||
<height>388</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Linking nodes</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="list1"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>398</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -0,0 +1,32 @@
|
||||
// Ryzom Core Studio - Georges 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 EXPR_SLOT_INFO
|
||||
#define EXPR_SLOT_INFO
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SlotInfo
|
||||
{
|
||||
QString name;
|
||||
int slot;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue