diff --git a/src/dlgRoomExits.cpp b/src/dlgRoomExits.cpp index d813974..07d1adc 100644 --- a/src/dlgRoomExits.cpp +++ b/src/dlgRoomExits.cpp @@ -27,15 +27,15 @@ dlgRoomExits::dlgRoomExits( Host * pH, QWidget * pW ) , QDialog( pW ) { setupUi(this); - connect( saveButton, SIGNAL(pressed()), this, SLOT(save())); - connect( addSpecialExit,SIGNAL(pressed()), this, SLOT(slot_addSpecialExit())); + connect( saveButton, SIGNAL(clicked()), this, SLOT(save())); + connect( addSpecialExit,SIGNAL(clicked()), this, SLOT(slot_addSpecialExit())); connect( specialExits,SIGNAL(itemClicked ( QTreeWidgetItem *, int)), this, SLOT(slot_editItem(QTreeWidgetItem*,int))); } void dlgRoomExits::slot_editItem(QTreeWidgetItem * pI, int column ) { if( column == 0 || !pI ) return; - if( mpEditItem != 0 ) + if( mpEditItem != 0 && mEditColumn != 0 && (mEditColumn < specialExits->columnCount()) ) { specialExits->closePersistentEditor( mpEditItem, mEditColumn ); mpEditItem = 0; @@ -52,7 +52,6 @@ void dlgRoomExits::slot_addSpecialExit() pI->setText(1, ""); pI->setText(2, ""); specialExits->addTopLevelItem(pI); - } void dlgRoomExits::save() diff --git a/src/exitstreewidget.cpp b/src/exitstreewidget.cpp new file mode 100644 index 0000000..a5ddb45 --- /dev/null +++ b/src/exitstreewidget.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2012 by Vadim Peretokin * + * vadim.peretokin@mudlet.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include "ExitsTreeWidget.h" +#include +#include "Host.h" +#include "HostManager.h" +#include "TDebug.h" + +ExitsTreeWidget::ExitsTreeWidget( QWidget * pW ) : QTreeWidget( pW ) +{ + setSelectionMode(QAbstractItemView::ExtendedSelection); + setUniformRowHeights(true); +} + +void ExitsTreeWidget::keyPressEvent ( QKeyEvent * event ) +{ + if (event->key() == Qt::Key_Delete) + { + QList selection = selectedItems(); + foreach(QTreeWidgetItem *item, selection) + { + takeTopLevelItem(indexOfTopLevelItem(item)); + } + } +} diff --git a/src/exitstreewidget.h b/src/exitstreewidget.h new file mode 100644 index 0000000..e031bee --- /dev/null +++ b/src/exitstreewidget.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2012 by Vadim Peretokin * + * vadim.peretokin@mudlet.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef EXITSTREEWIDGET_H +#define EXITSTREEWIDGET_H + +#include +#include + +class Host; + +class ExitsTreeWidget : public QTreeWidget +{ +Q_OBJECT + +public: + ExitsTreeWidget( QWidget * pW ); + void keyPressEvent ( QKeyEvent * event ); +private: + +signals: + +public slots: + +}; + +#endif // EXITSTREEWIDGET_H diff --git a/src/src.pro b/src/src.pro index ab8d379..c4ae042 100755 --- a/src/src.pro +++ b/src/src.pro @@ -114,7 +114,8 @@ SOURCES += TConsole.cpp \ irc/src/ircutil.cpp \ dlgIRC.cpp \ T2DMap.cpp \ - dlgRoomExits.cpp + dlgRoomExits.cpp \ + ExitsTreeWidget.cpp HEADERS += mudlet.h \ @@ -189,7 +190,8 @@ HEADERS += mudlet.h \ irc/include/ircutil.h \ dlgIRC.h \ T2DMap.h \ - dlgRoomExits.h + dlgRoomExits.h \ + ExitsTreeWidget.h FORMS += ui/connection_profiles.ui \ ui/main_window.ui \ diff --git a/src/ui/room_exits.ui b/src/ui/room_exits.ui index 31cdda8..1950f69 100644 --- a/src/ui/room_exits.ui +++ b/src/ui/room_exits.ui @@ -6,612 +6,400 @@ 0 0 - 550 - 524 + 747 + 486 Dialog - - - - 50 - 50 - 81 - 20 - - - - - - - 190 - 50 - 81 - 20 - - - - - - - 320 - 50 - 81 - 20 - - - - - - - 50 - 180 - 81 - 20 - - - - - - - 320 - 180 - 81 - 20 - - - - - - - 190 - 180 - 81 - 20 - - - - - - - 320 - 110 - 81 - 20 - - - - - - - 50 - 110 - 81 - 20 - - - - - - - 460 - 50 - 81 - 20 - - - - - - - 460 - 110 - 81 - 20 - - - - - - - 460 - 230 - 81 - 20 - - - - - - - 460 - 180 - 81 - 20 - - - - - - - 80 - 20 - 21 - 16 - - - - NW - - - - - - 80 - 90 - 21 - 16 - - - - W - - - - - - 220 - 20 - 21 - 16 - - - - N - - - - - - 350 - 20 - 21 - 16 - - - - NE - - - - - - 350 - 90 - 21 - 16 - - - - E - - - - - - 80 - 160 - 21 - 16 - - - - SW - - - - - - 230 - 160 - 21 - 16 - - - - S - - - - - - 350 - 160 - 21 - 16 - - - - SE - - - - - - 490 - 30 - 21 - 16 - - - - UP - - - - - - 480 - 90 - 46 - 13 - - - - DOWN - - - - - - 490 - 140 - 21 - 16 - - - - IN - - - - - - 490 - 210 - 21 - 16 - - - - OUT - - - - - - 10 - 270 - 531 - 201 - - - - false - - - false - - - 3 - - - 80 - - - true - - - - Lock - - - - - Exit room ID - - - - - Command or script (Lua scripts need to be prefixed with "script:" - - - - - - - 10 - 50 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 10 - 110 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 10 - 180 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 150 - 50 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 150 - 180 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 280 - 50 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 280 - 110 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 280 - 180 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 420 - 50 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 420 - 110 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 420 - 180 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 420 - 230 - 31 - 23 - - - - Qt::NoFocus - - - lock - - - true - - - - - - 360 - 480 - 75 - 23 - - - - OK - - - - - - 450 - 480 - 75 - 23 - - - - Cancel - - - - - - 60 - 480 - 121 - 23 - - - - add special exit - - + + + + + General exits + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the northwest here + + + NW exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the north here + + + N exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the northeast here + + + NE exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the up here + + + Up exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the west here + + + + + + W exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the east here + + + E exit... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the down here + + + Down exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the southwest here + + + SW exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the south here + + + S exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the southeast here + + + SE exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the in here + + + In exit... + + + + + + + Qt::NoFocus + + + lock + + + true + + + + + + + Set the number of the room that's to the out here + + + Out exit... + + + + + + + + + + Special exits + + + + + + false + + + false + + + 3 + + + true + + + + Locked? + + + + + Exit room ID + + + + + Command or script (Lua scripts need to be prefixed with "script:") + + + + + + + + + + + add special exit + + + + + + + OK + + + + + + + Cancel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ExitsTreeWidget + QTreeWidget +
exitstreewidget.h
+
+
- nw - n - ne - w - e - sw - s - se - up - down - in - out addSpecialExit - specialExits saveButton pushButton_14 @@ -624,12 +412,12 @@ setDisabled(bool) - 20 - 64 + 36 + 48 - 68 - 61 + 135 + 45 @@ -640,12 +428,12 @@ setDisabled(bool) - 164 - 68 + 216 + 52 - 225 - 64 + 328 + 48 @@ -656,12 +444,12 @@ setDisabled(bool) - 298 - 63 + 395 + 47 - 346 - 63 + 494 + 47 @@ -672,12 +460,12 @@ setDisabled(bool) - 432 - 62 + 571 + 46 - 488 - 63 + 678 + 47 @@ -688,12 +476,12 @@ setDisabled(bool) - 27 - 116 + 43 + 73 - 71 - 119 + 138 + 76 @@ -704,12 +492,12 @@ setDisabled(bool) - 290 - 117 + 387 + 74 - 342 - 121 + 490 + 78 @@ -720,12 +508,12 @@ setDisabled(bool) - 431 - 114 + 570 + 71 - 473 - 114 + 663 + 71 @@ -736,12 +524,12 @@ setDisabled(bool) - 23 - 194 + 39 + 114 - 78 - 194 + 145 + 114 @@ -752,12 +540,12 @@ setDisabled(bool) - 159 - 188 + 211 + 108 - 203 - 191 + 306 + 111 @@ -768,12 +556,12 @@ setDisabled(bool) - 302 - 188 + 399 + 108 - 346 - 188 + 494 + 108 @@ -784,12 +572,12 @@ setDisabled(bool) - 436 - 170 + 575 + 100 - 476 - 170 + 666 + 100 @@ -800,12 +588,12 @@ setDisabled(bool) - 432 - 215 + 571 + 133 - 489 - 221 + 679 + 133 @@ -816,12 +604,12 @@ reject() - 476 - 486 + 679 + 456 298 - 497 + 485