diff options
Diffstat (limited to 'src/modules/actioneditor')
| -rw-r--r-- | src/modules/actioneditor/actioneditor.cpp | 1894 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/modules/actioneditor/actioneditor.vcproj | 0 | ||||
| -rw-r--r-- | src/modules/actioneditor/actioneditor_QT4_vc05.vcproj | 522 |
3 files changed, 1208 insertions, 1208 deletions
diff --git a/src/modules/actioneditor/actioneditor.cpp b/src/modules/actioneditor/actioneditor.cpp index a18768472..3a14c1096 100644 --- a/src/modules/actioneditor/actioneditor.cpp +++ b/src/modules/actioneditor/actioneditor.cpp @@ -1,947 +1,947 @@ -//=============================================================================
-//
-// File : aliaseditor.cpp
-// Creation date : Tue 29 Dec 2004 02:45:59 2002 GMT by Szymon Stefanek
-//
-// This file is part of the KVirc irc client distribution
-// Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net)
-//
-// This program is FREE software. You can redistribute it and/or
-// modify it under the linkss of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your opinion) 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 "actioneditor.h"
-
-#include "kvi_iconmanager.h"
-#include "kvi_options.h"
-#include "kvi_locale.h"
-#include "kvi_imagedialog.h"
-#include "kvi_config.h"
-#include "kvi_filedialog.h"
-#include "kvi_fileutils.h"
-#include "kvi_scripteditor.h"
-#include "kvi_debug.h"
-#include "kvi_app.h"
-#include "kvi_qstring.h"
-#include "kvi_kvs_aliasmanager.h"
-#include "kvi_filedialog.h"
-#include "kvi_actionmanager.h"
-#include "kvi_action.h"
-#include "kvi_kvs_useraction.h"
-#include "kvi_customtoolbarmanager.h"
-#include "kvi_tal_vbox.h"
-#include <kvi_tal_groupbox.h>
-#include "kvi_tal_itemdelegates.h"
-
-#include <QList>
-#include <QSplitter>
-#include <QLayout>
-#include <QToolTip>
-#include <QPushButton>
-#include <QDir>
-#include <QMessageBox>
-#include <QLineEdit>
-#include <QComboBox>
-#include <QPainter>
-#include <QTabWidget>
-#include <QLabel>
-
-
-extern KviActionEditorWindow * g_pActionEditorWindow;
-
-static QString g_szLastEditedAction;
-
-#define LVI_ICON_SIZE 32
-#define LVI_BORDER 4
-#define LVI_SPACING 8
-#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER)
-
-KviActionEditorTreeWidgetItem::KviActionEditorTreeWidgetItem(KviTalTreeWidget * v,KviActionData * a)
-: KviTalTreeWidgetItem(v)
-{
- m_pActionData = a;
- m_pTreeWidget = v;
- //setFlags(Qt::ItemIsUserSelectable);
- QString t = "<b>" + m_pActionData->m_szName + "</b>";
- t += "<br><font color=\"#808080\" size=\"-1\">" + m_pActionData->m_szVisibleName + "</font>";
- m_szKey = m_pActionData->m_szName.toUpper();
- setText(0,t);
- QPixmap * p = g_pIconManager->getBigIcon(m_pActionData->m_szBigIcon);
- if(p)setIcon(0,*p);
-}
-
-KviActionEditorTreeWidgetItem::~KviActionEditorTreeWidgetItem()
-{
- delete m_pActionData;
-}
-
-
-QString KviActionEditorTreeWidgetItem::key(int,bool) const
-{
- return m_szKey;
-}
-
-KviSingleActionEditor::KviSingleActionEditor(QWidget * par,KviActionEditor * ed)
-: QWidget(par)
-{
- m_pActionEditor = ed;
- m_pActionData = 0;
-
- QGridLayout * g = new QGridLayout(this);
-
- QLabel * l = new QLabel(__tr2qs("Name:"),this);
- g->addWidget(l,0,0);
- m_pNameEdit = new QLineEdit(this);
- g->addWidget(m_pNameEdit,0,1);
- m_pNameEdit->setToolTip(__tr2qs("Internal unique name for the action"));
-
- l = new QLabel(__tr2qs("Label:"),this);
- g->addWidget(l,1,0);
- m_pVisibleNameEdit = new QLineEdit(this);
- g->addWidget(m_pVisibleNameEdit,1,1);
- m_pVisibleNameEdit->setToolTip(__tr2qs("Visible name for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here"));
-
-
- QTabWidget * tw = new QTabWidget(this);
- g->addWidget(tw,2,0,1,2);
-// g->addMultiCellWidget(tw,2,2,0,1);
-
- // code tab
- QWidget * tab = new QWidget(tw);
- QGridLayout * gl = new QGridLayout(tab);
-
- m_pScriptEditor = KviScriptEditor::createInstance(tab);
- gl->addWidget(m_pScriptEditor,0,0);
- m_pScriptEditor->setToolTip(__tr2qs("Action code"));
-
- tw->addTab(tab,__tr2qs("Code"));
-
- // properties tab
- tab = new QWidget(tw);
- gl = new QGridLayout(tab);
-
- l = new QLabel(__tr2qs("Category:"),tab);
- gl->addWidget(l,0,0);
- m_pCategoryCombo = new QComboBox(tab);
- gl->addWidget(m_pCategoryCombo,0,1,1,3);
- //gl->addMultiCellWidget(m_pCategoryCombo,0,0,1,3);
- m_pCategoryCombo->setToolTip(__tr2qs("Choose the category that best fits for this action"));
-
- l = new QLabel(__tr2qs("Description:"),tab);
- gl->addWidget(l,1,0);
- m_pDescriptionEdit = new QLineEdit(tab);
- gl->addWidget(m_pDescriptionEdit,1,1,1,3);
-// gl->addMultiCellWidget(m_pDescriptionEdit,1,1,1,3);
- m_pDescriptionEdit->setToolTip(__tr2qs("Visible short description for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here"));
-
- l = new QLabel(__tr2qs("Small Icon:"),tab);
- gl->addWidget(l,2,0);
- m_pSmallIconEdit = new QLineEdit(tab);
- gl->addWidget(m_pSmallIconEdit,2,1);
- m_pSmallIconButton = new QToolButton(tab);
- m_pSmallIconButton->setMinimumSize(QSize(20,20));
- connect(m_pSmallIconButton,SIGNAL(clicked()),this,SLOT(chooseSmallIcon()));
- gl->addWidget(m_pSmallIconButton,2,2);
- QString s= __tr2qs("The small icon associated to this action.<br>" \
- "It will appear at least in the popup menus when this action is inserted.<br>" \
- "It should be 16x16 pixels.");
- m_pSmallIconEdit->setToolTip(s);
- m_pSmallIconButton->setToolTip(s);
-
- l = new QLabel(__tr2qs("Big Icon:"),tab);
- gl->addWidget(l,3,0);
- m_pBigIconEdit = new QLineEdit(tab);
- gl->addWidget(m_pBigIconEdit,3,1);
- m_pBigIconButton = new QToolButton(tab);
- m_pBigIconButton->setMinimumSize(QSize(48,48));
- m_pBigIconButton->setIconSize(QSize(32,32));
- connect(m_pBigIconButton,SIGNAL(clicked()),this,SLOT(chooseBigIcon()));
- gl->addWidget(m_pBigIconButton,3,2,2,2);
-// gl->addMultiCellWidget(m_pBigIconButton,3,4,2,3);
- s = __tr2qs("The big icon associated to this action.<br>" \
- "It will appear at least in the toolbar buttons when this action is inserted.<br>" \
- "It should be 32x32 pixels.");
- m_pBigIconEdit->setToolTip(s);
- m_pBigIconButton->setToolTip(s);
-
- l = new QLabel(__tr2qs("Key Sequence:"),tab);
- gl->addWidget(l,4,0,2,1);
-// gl->addMultiCellWidget(l,4,5,0,0);
- m_pKeySequenceEdit = new QLineEdit(tab);
- gl->addWidget(m_pKeySequenceEdit,4,1,2,1);
-// gl->addMultiCellWidget(m_pKeySequenceEdit,4,5,1,1);
- m_pKeySequenceEdit->setToolTip(__tr2qs("Optional keyboard sequence that will activate this action.<br>" \
- "The sequence should be expressed as a string of up to four key codes separated by commas " \
- "eventually combined with the modifiers \"Ctrl\",\"Shift\",\"Alt\" and \"Meta\".<br>" \
- "Examples of such sequences are \"Ctrl+X\", \"Ctrl+Alt+Z\", \"Ctrl+X,Ctrl+C\" ..."));
-
- l = new QLabel(tab);
- gl->addWidget(l,6,0,1,4);
-// gl->addMultiCellWidget(l,6,6,0,3);
-
- gl->setColumnStretch(1,1);
- gl->setRowStretch(6,1);
-
-
- tw->addTab(tab,__tr2qs("Properties"));
-
-
-
- // flags tab
- tab = new QWidget(tw);
- gl = new QGridLayout(tab);
-
-
- m_pNeedsContextCheck = new QCheckBox(__tr2qs("Needs IRC Context"),tab);
- connect(m_pNeedsContextCheck,SIGNAL(toggled(bool)),this,SLOT(needsContextCheckToggled(bool)));
- m_pNeedsContextCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window belongs to an irc context"));
- gl->addWidget(m_pNeedsContextCheck,0,0,1,4);
-// gl->addMultiCellWidget(m_pNeedsContextCheck,0,0,0,3);
-
-
- l = new QLabel(tab);
- l->setMinimumWidth(40);
- gl->addWidget(l,1,0);
-
- m_pNeedsConnectionCheck = new QCheckBox(__tr2qs("Needs IRC Connection"),tab);
- connect(m_pNeedsConnectionCheck,SIGNAL(toggled(bool)),this,SLOT(needsConnectionCheckToggled(bool)));
- m_pNeedsConnectionCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window has an active IRC connection"));
- gl->addWidget(m_pNeedsConnectionCheck,1,1,1,3);
-// gl->addMultiCellWidget(m_pNeedsConnectionCheck,1,1,1,3);
-
-
- l = new QLabel(tab);
- l->setMinimumWidth(40);
- gl->addWidget(l,2,1);
-
- m_pEnableAtLoginCheck = new QCheckBox(__tr2qs("Enable at Login"),tab);
- m_pEnableAtLoginCheck->setToolTip(__tr2qs("Check this option if this action should be enabled also during " \
- "the login operations (so when the logical IRC connection hasn't been estabilished yet)"));
- gl->addWidget(m_pEnableAtLoginCheck,2,2,1,2);
-// gl->addMultiCellWidget(m_pEnableAtLoginCheck,2,2,2,3);
-
- m_pSpecificWindowsCheck = new QCheckBox(__tr2qs("Enable Only in Specified Windows"),tab);
- connect(m_pSpecificWindowsCheck,SIGNAL(toggled(bool)),this,SLOT(specificWindowsCheckToggled(bool)));
- m_pSpecificWindowsCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window is of a specified type"));
- gl->addWidget(m_pSpecificWindowsCheck,3,0,1,4);
-// gl->addMultiCellWidget(m_pSpecificWindowsCheck,3,3,0,3);
-
-
- m_pWindowConsoleCheck = new QCheckBox(__tr2qs("Enable in Console Windows"),tab);
- m_pWindowConsoleCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window is a console"));
- connect(m_pWindowConsoleCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
- gl->addWidget(m_pWindowConsoleCheck,4,1,1,3);
-// gl->addMultiCellWidget(m_pWindowConsoleCheck,4,4,1,3);
-
- m_pConsoleOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab);
- m_pConsoleOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \
- "selected users in the active window"));
- gl->addWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,2,1,2);
-// gl->addMultiCellWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,5,2,3);
-
- m_pWindowChannelCheck = new QCheckBox(__tr2qs("Enable in Channel Windows"),tab);
- m_pWindowChannelCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window is a channel"));
- connect(m_pWindowChannelCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
- gl->addWidget(m_pWindowChannelCheck,6,1,1,3);
-// gl->addMultiCellWidget(m_pWindowChannelCheck,6,6,1,3);
-
- m_pChannelOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab);
- m_pChannelOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \
- "selected users in the active window"));
- gl->addWidget(m_pChannelOnlyIfUsersSelectedCheck,7,2,1,2);
-// gl->addMultiCellWidget(m_pChannelOnlyIfUsersSelectedCheck,7,7,2,3);
-
- m_pWindowQueryCheck = new QCheckBox(__tr2qs("Enable in Query Windows"),tab);
- m_pWindowQueryCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window is a query"));
- connect(m_pWindowQueryCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool)));
- gl->addWidget(m_pWindowQueryCheck,8,1,1,3);
-// gl->addMultiCellWidget(m_pWindowQueryCheck,8,8,1,3);
-
- m_pQueryOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab);
- m_pQueryOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \
- "selected users in the active window"));
- gl->addWidget(m_pQueryOnlyIfUsersSelectedCheck,9,2,1,2);
-// gl->addMultiCellWidget(m_pQueryOnlyIfUsersSelectedCheck,9,9,2,3);
-
- m_pWindowDccChatCheck = new QCheckBox(__tr2qs("Enable in DCC Chat Windows"),tab);
- m_pWindowDccChatCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \
- "the active window is a dcc chat"));
- gl->addWidget(m_pWindowDccChatCheck,10,1,1,2);
-// gl->addMultiCellWidget(m_pWindowDccChatCheck,10,10,1,3);
-
- l = new QLabel(tab);
- gl->addWidget(l,11,0,1,4);
-// gl->addMultiCellWidget(l,11,11,0,3);
- gl->setColumnStretch(3,1);
- gl->setRowStretch(11,1);
-
- tw->addTab(tab,__tr2qs("Flags"));
- tw->setCurrentIndex(0);
-
- g->setRowStretch(2,1);
- g->setColumnStretch(1,1);
-
- KviPointerHashTableIterator<QString,KviActionCategory> it(*(KviActionManager::instance()->categories()));
- while(KviActionCategory * ac = it.current())
- {
- m_pCategoryCombo->addItem(ac->visibleName() + " (" + ac->name() + ")");
- ++it;
- }
-}
-
-KviSingleActionEditor::~KviSingleActionEditor()
-{
-}
-
-void KviSingleActionEditor::channelQueryOrConsoleWindowCheckToggled(bool)
-{
- m_pChannelOnlyIfUsersSelectedCheck->setEnabled(m_pWindowChannelCheck->isChecked());
- m_pChannelOnlyIfUsersSelectedCheck->setChecked(false);
- m_pQueryOnlyIfUsersSelectedCheck->setEnabled(m_pWindowQueryCheck->isChecked());
- m_pQueryOnlyIfUsersSelectedCheck->setChecked(false);
- m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(m_pWindowConsoleCheck->isChecked());
- m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false);
-}
-
-void KviSingleActionEditor::needsContextCheckToggled(bool)
-{
- m_pEnableAtLoginCheck->setChecked(false);
- m_pEnableAtLoginCheck->setEnabled(false);
- m_pNeedsConnectionCheck->setChecked(false);
- m_pNeedsConnectionCheck->setEnabled(m_pNeedsContextCheck->isChecked());
-}
-
-void KviSingleActionEditor::needsConnectionCheckToggled(bool)
-{
- m_pEnableAtLoginCheck->setChecked(false);
- m_pEnableAtLoginCheck->setEnabled(m_pNeedsConnectionCheck->isChecked());
-}
-
-void KviSingleActionEditor::specificWindowsCheckToggled(bool)
-{
- m_pWindowConsoleCheck->setChecked(false);
- m_pWindowChannelCheck->setChecked(false);
- m_pWindowQueryCheck->setChecked(false);
- m_pWindowDccChatCheck->setChecked(false);
- m_pQueryOnlyIfUsersSelectedCheck->setChecked(false);
- m_pChannelOnlyIfUsersSelectedCheck->setChecked(false);
- m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false);
- m_pQueryOnlyIfUsersSelectedCheck->setEnabled(false);
- m_pChannelOnlyIfUsersSelectedCheck->setEnabled(false);
- m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(false);
- bool b = m_pSpecificWindowsCheck->isChecked();
- m_pWindowConsoleCheck->setEnabled(b);
- m_pWindowChannelCheck->setEnabled(b);
- m_pWindowQueryCheck->setEnabled(b);
- m_pWindowDccChatCheck->setEnabled(b);
-}
-
-void KviSingleActionEditor::chooseSmallIcon()
-{
- if(!m_pActionData)return;
- KviImageDialog * d = new KviImageDialog(this);
- int ret = d->exec();
- QString s = d->selectedImage();
- delete d;
- if(ret != QDialog::Accepted)return;
- QPixmap * p = g_pIconManager->getImage(s.toUtf8().data());
- if(!p)return;
- m_pSmallIconEdit->setText(s);
- m_pSmallIconButton->setIcon(QIcon(*p));
-}
-
-void KviSingleActionEditor::chooseBigIcon()
-{
- if(!m_pActionData)return;
- KviImageDialog * d = new KviImageDialog(this,QString::null,KID_TYPE_ALL,KID_TYPE_FULL_PATH);
- int ret = d->exec();
- QString s = d->selectedImage();
- delete d;
- if(ret != QDialog::Accepted)return;
- QPixmap * p = g_pIconManager->getBigIcon(s);
- if(!p)return;
- m_pBigIconEdit->setText(s);
- m_pBigIconButton->setIcon(QIcon(*p));
-}
-
-void KviSingleActionEditor::setActionData(KviActionData * d)
-{
- m_pActionData = d;
-
- if(d)
- {
- unsigned int uOldFlags = d->m_uFlags;
- d->m_uFlags = KviAction::validateFlags(d->m_uFlags);
- if(d->m_uFlags != uOldFlags)
- debug("invalid action flags in KviSingleActionEditor::setActionData(): %d fixed to %d",uOldFlags,d->m_uFlags);
-
- m_pNameEdit->setText(d->m_szName);
- m_pNameEdit->setEnabled(true);
- m_pVisibleNameEdit->setText(d->m_szVisibleName);
- m_pVisibleNameEdit->setEnabled(true);
- m_pCategoryCombo->setEnabled(true);
- int i;
- for(i=0;i<m_pCategoryCombo->count();i++)
- {
- QString t = m_pCategoryCombo->itemText(i);
- int idx = t.lastIndexOf('(');
- QString r = t.right(t.length() - (idx + 1));
- QString r2 = r.left(r.length() - 1);
- r2.trimmed();
- if(r2 == d->m_szCategory)
- {
- m_pCategoryCombo->setCurrentIndex(i);
- break;
- }
- }
- if(i == m_pCategoryCombo->count())
- {
- m_pCategoryCombo->setCurrentIndex(0);
- }
- m_pScriptEditor->setText(d->m_szScriptCode);
- m_pScriptEditor->setEnabled(true);
- m_pKeySequenceEdit->setText(d->m_szKeySequence);
- m_pKeySequenceEdit->setEnabled(true);
- m_pDescriptionEdit->setText(d->m_szDescription);
- m_pDescriptionEdit->setEnabled(true);
- m_pSmallIconEdit->setEnabled(true);
- m_pBigIconEdit->setEnabled(true);
- QPixmap * p = g_pIconManager->getImage(d->m_szSmallIcon);
- if(p)
- {
- m_pSmallIconEdit->setText(d->m_szSmallIcon);
- m_pSmallIconButton->setIcon(QIcon(*p));
- } else {
- m_pSmallIconEdit->setText("");
- m_pSmallIconButton->setIcon(QIcon());
- }
- p = g_pIconManager->getImage(d->m_szBigIcon);
- if(p)
- {
- m_pBigIconEdit->setText(d->m_szBigIcon);
- m_pBigIconButton->setIcon(QIcon(*p));
- } else {
- m_pBigIconEdit->setText("");
- m_pBigIconButton->setIcon(QIcon());
- }
- m_pSmallIconButton->setEnabled(true);
- m_pBigIconButton->setEnabled(true);
- m_pNeedsContextCheck->setEnabled(true);
- bool b = (d->m_uFlags & KviAction::NeedsContext) || (d->m_uFlags & KviAction::NeedsConnection);
- m_pNeedsContextCheck->setChecked(b);
-
- m_pNeedsConnectionCheck->setEnabled(b);
- b = (d->m_uFlags & KviAction::NeedsContext) && (d->m_uFlags & KviAction::NeedsConnection);
- m_pNeedsConnectionCheck->setChecked(b);
-
- m_pEnableAtLoginCheck->setEnabled(b);
- m_pEnableAtLoginCheck->setChecked(b && (d->m_uFlags & KviAction::EnableAtLogin));
-
- m_pSpecificWindowsCheck->setEnabled(true);
- b = d->m_uFlags & KviAction::InternalWindowMask;
- m_pSpecificWindowsCheck->setChecked(b);
-
- m_pWindowConsoleCheck->setEnabled(b);
- m_pWindowChannelCheck->setEnabled(b);
- m_pWindowQueryCheck->setEnabled(b);
- m_pWindowDccChatCheck->setEnabled(b);
- b = d->m_uFlags & KviAction::WindowConsole;
- m_pWindowConsoleCheck->setChecked(b);
- m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(b);
- m_pConsoleOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected));
- b = d->m_uFlags & KviAction::WindowChannel;
- m_pWindowChannelCheck->setChecked(b);
- m_pChannelOnlyIfUsersSelectedCheck->setEnabled(b);
- m_pChannelOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected));
- b = d->m_uFlags & KviAction::WindowQuery;
- m_pWindowQueryCheck->setChecked(b);
- m_pQueryOnlyIfUsersSelectedCheck->setEnabled(b);
- m_pQueryOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected));
- m_pWindowDccChatCheck->setChecked(d->m_uFlags & KviAction::WindowDccChat);
- } else {
- m_pNameEdit->setText("");
- m_pNameEdit->setEnabled(false);
- m_pVisibleNameEdit->setText("");
- m_pVisibleNameEdit->setEnabled(false);
- m_pCategoryCombo->setEnabled(false);
- m_pScriptEditor->setText("");
- m_pScriptEditor->setEnabled(false);
- m_pKeySequenceEdit->setText("");
- m_pKeySequenceEdit->setEnabled(false);
- m_pDescriptionEdit->setText("");
- m_pDescriptionEdit->setEnabled(false);
- m_pSmallIconEdit->setText("");
- m_pSmallIconEdit->setEnabled(false);
- m_pBigIconEdit->setText("");
- m_pBigIconEdit->setEnabled(false);
- m_pSmallIconButton->setIcon(QIcon());
- m_pSmallIconButton->setEnabled(false);
- m_pBigIconButton->setIcon(QPixmap());
- m_pBigIconButton->setEnabled(false);
- m_pNeedsContextCheck->setChecked(false);
- m_pNeedsContextCheck->setEnabled(false);
- m_pNeedsConnectionCheck->setChecked(false);
- m_pNeedsConnectionCheck->setEnabled(false);
- m_pEnableAtLoginCheck->setChecked(false);
- m_pEnableAtLoginCheck->setEnabled(false);
- m_pWindowConsoleCheck->setChecked(false);
- m_pWindowConsoleCheck->setEnabled(false);
- m_pWindowChannelCheck->setChecked(false);
- m_pWindowChannelCheck->setEnabled(false);
- m_pWindowQueryCheck->setChecked(false);
- m_pWindowQueryCheck->setEnabled(false);
- m_pWindowDccChatCheck->setChecked(false);
- m_pWindowDccChatCheck->setEnabled(false);
- m_pSpecificWindowsCheck->setChecked(false);
- m_pSpecificWindowsCheck->setEnabled(false);
- m_pQueryOnlyIfUsersSelectedCheck->setChecked(false);
- m_pChannelOnlyIfUsersSelectedCheck->setChecked(false);
- m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false);
- m_pQueryOnlyIfUsersSelectedCheck->setEnabled(false);
- m_pChannelOnlyIfUsersSelectedCheck->setEnabled(false);
- m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(false);
- }
-}
-
-void KviSingleActionEditor::commit()
-{
- if(!m_pActionData)return;
-
- QString tmp = m_pNameEdit->text();
- if(tmp != m_pActionData->m_szName)
- {
- int idx = 1;
- while(KviActionManager::instance()->coreActionExists(tmp) || m_pActionEditor->actionExists(tmp))
- {
- QString tmp2;
- tmp2.setNum(idx);
- tmp = m_pNameEdit->text();
- tmp.append(tmp2);
- idx++;
- }
- }
-
- m_pActionData->m_szName = tmp;
- m_pScriptEditor->getText(m_pActionData->m_szScriptCode);
- m_pActionData->m_szVisibleName = m_pVisibleNameEdit->text();
- m_pActionData->m_szDescription = m_pDescriptionEdit->text();
- m_pActionData->m_szBigIcon = m_pBigIconEdit->text();
- m_pActionData->m_szSmallIcon = m_pSmallIconEdit->text();
- m_pActionData->m_szKeySequence = m_pKeySequenceEdit->text();
- QString szCat = m_pCategoryCombo->currentText();
- int idx = szCat.lastIndexOf(')');
- if(idx != -1)m_pActionData->m_szCategory = szCat.left(idx);
- else m_pActionData->m_szCategory = szCat;
- idx = m_pActionData->m_szCategory.lastIndexOf('(');
- if(idx != -1)m_pActionData->m_szCategory.remove(0,idx+1);
- m_pActionData->m_uFlags = 0;
- if(m_pNeedsContextCheck->isChecked())
- {
- m_pActionData->m_uFlags |= KviAction::NeedsContext;
- if(m_pNeedsConnectionCheck->isChecked())
- {
- m_pActionData->m_uFlags |= KviAction::NeedsConnection;
- if(m_pEnableAtLoginCheck->isChecked())m_pActionData->m_uFlags |= KviAction::EnableAtLogin;
- }
-
- }
- if(m_pSpecificWindowsCheck->isChecked())
- {
- if(m_pWindowConsoleCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowConsole;
- if(m_pWindowChannelCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowChannel;
- if(m_pWindowQueryCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowQuery;
- if(m_pWindowDccChatCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowDccChat;
- if(m_pActionData->m_uFlags & KviAction::InternalWindowMask)
- {
- if(m_pConsoleOnlyIfUsersSelectedCheck->isChecked() ||
- m_pChannelOnlyIfUsersSelectedCheck->isChecked() ||
- m_pQueryOnlyIfUsersSelectedCheck->isChecked())
- {
- m_pActionData->m_uFlags |= KviAction::WindowOnlyIfUsersSelected;
- }
- }
- }
-
- unsigned int uOldFlags = m_pActionData->m_uFlags;
- m_pActionData->m_uFlags = KviAction::validateFlags(m_pActionData->m_uFlags);
- if(m_pActionData->m_uFlags != uOldFlags)
- debug("invalid action flags in KviSingleActionEditor::commit(): %d fixed to %d",uOldFlags,m_pActionData->m_uFlags);
-}
-
-
-KviActionEditorTreeView::KviActionEditorTreeView(QWidget * pParent)
-: KviTalTreeWidget(pParent)
-{
- setColumnCount (1);
- setHeaderLabel(__tr2qs("Action"));
- setSelectionMode(QAbstractItemView::ExtendedSelection);
- setSortingEnabled(true);
- int iWidth = viewport()->width();
- if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
- setRootIsDecorated(false);
- setColumnWidth(0,iWidth);
-
-}
-
-KviActionEditorTreeView::~KviActionEditorTreeView()
-{
-}
-
-void KviActionEditorTreeView::resizeEvent(QResizeEvent * e)
-{
- KviTalTreeWidget::resizeEvent(e);
- int iWidth = viewport()->width();
- if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
- setColumnWidth(0,iWidth);
-}
-
-
-KviActionEditor::KviActionEditor(QWidget * par)
-: QWidget(par)
-{
-
- QGridLayout * l = new QGridLayout(this);
- m_pSplitter = new QSplitter(Qt::Horizontal,this);
- m_pSplitter->setOpaqueResize(false);
- l->addWidget(m_pSplitter,0,0);
-
-
- KviTalVBox * box = new KviTalVBox(m_pSplitter);
- m_pTreeWidget = new KviActionEditorTreeView(box);
- KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(m_pTreeWidget);
- m_pTreeWidget->setItemDelegate(itemDelegate);
- //m_pTreeWidget->setShowSortIndicator(true);
- m_pTreeWidget->setFocusPolicy(Qt::StrongFocus);
- connect(m_pTreeWidget,SIGNAL(currentItemChanged(KviTalTreeWidgetItem *,KviTalTreeWidgetItem *)),this,SLOT(currentItemChanged(KviTalTreeWidgetItem *,KviTalTreeWidgetItem *)));
-
- m_pNewActionButton = new QPushButton(__tr2qs("New Action"),box);
- connect(m_pNewActionButton,SIGNAL(clicked()),this,SLOT(newAction()));
-
- m_pDeleteActionsButton = new QPushButton(__tr2qs("Delete Actions"),box);
- connect(m_pDeleteActionsButton,SIGNAL(clicked()),this,SLOT(deleteActions()));
-
- m_pExportActionsButton = new QPushButton(__tr2qs("Export Actions..."),box);
- connect(m_pExportActionsButton,SIGNAL(clicked()),this,SLOT(exportActions()));
-
- box->setSpacing(1);
-
- m_pSingleActionEditor = new KviSingleActionEditor(m_pSplitter,this);
-
- KviActionEditorTreeWidgetItem * last = 0;
- KviActionEditorTreeWidgetItem * first = 0;
-
- KviPointerHashTableIterator<QString,KviAction> it(*(KviActionManager::instance()->actions()));
- while(KviAction * a = it.current())
- {
- if(a->isKviUserActionNeverOverrideThis())
- {
- KviActionData * ad = new KviActionData(a->name(),
- ((KviKvsUserAction *)a)->scriptCode(),
- ((KviKvsUserAction *)a)->visibleNameCode(),
- ((KviKvsUserAction *)a)->descriptionCode(),
- a->category() ? a->category()->name() : KviActionManager::categoryGeneric()->name(),
- a->bigIconString(),
- ((KviKvsUserAction *)a)->smallIconString(),
- a->flags(),
- a->keySequence(),
- 0);
- KviActionEditorTreeWidgetItem * lvi = new KviActionEditorTreeWidgetItem(m_pTreeWidget,ad);
- ad->m_pItem = lvi;
- if(ad->m_szName == g_szLastEditedAction)
- last = lvi;
- if(!first)
- first = lvi;
- }
- ++it;
- }
-
- if(!last)last = first; // try to sleect the first one then
-
- if(last)
- {
- m_pTreeWidget->setCurrentItem(last);
- currentItemChanged(last,last);
- } else {
- currentItemChanged(0,0);
- }
-
-}
-
-KviActionEditor::~KviActionEditor()
-{
-}
-
-void KviActionEditor::exportActions()
-{
- QString szName = QDir::homePath();
- if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR;
- szName += "myactions.kvs";
-
- QString szFile;
-
- if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,QString::null,true,true,true))return;
-
- QString szCode;
-
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- if(m_pTreeWidget->topLevelItem(i)->isSelected())
- {
- KviActionData * a = ((KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->actionData();
-
- KviKvsUserAction::exportToKvs(szCode,
- a->m_szName,
- a->m_szScriptCode,
- a->m_szVisibleName,
- a->m_szDescription,
- a->m_szCategory,
- a->m_szBigIcon,
- a->m_szSmallIcon,
- a->m_uFlags,
- a->m_szKeySequence);
- }
- }
-
- if(!KviFileUtils::writeFile(szFile,szCode))
- {
- QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the actions file."),__tr2qs("OK"));
- }
-}
-
-void KviActionEditor::deleteActions()
-{
- KviPointerList<KviActionEditorTreeWidgetItem> l;
- l.setAutoDelete(false);
-
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- if(m_pTreeWidget->topLevelItem(i)->isSelected())
- l.append((KviActionEditorTreeWidgetItem * )m_pTreeWidget->topLevelItem(i));
- }
-
- if(l.isEmpty())return;
-
- //if(QMessageBox::question(this,__tr2qsf("Confirm Deletion"),__tr2qsf("Do you really want to delete the selected actions ?"),__tr2qsf("Yes"),__tr2qsf("No")) != 0)
- // return;
-
- for(KviActionEditorTreeWidgetItem * i = l.first();i;i = l.next())
- {
- if(m_pSingleActionEditor->actionData() == i->actionData())
- m_pSingleActionEditor->setActionData(0);
- delete i;
- }
-}
-
-
-QString KviActionEditor::nameForAutomaticAction(const QString &szTemplate)
-{
- QString ret;
- QString szT = szTemplate;
- szT.replace(" ","");
- szT.replace(".","_");
-
- int i = 1;
- do {
- KviQString::sprintf(ret,"%Q%d",&szT,i);
- i++;
- } while(actionExists(ret));
-
- return ret;
-}
-
-void KviActionEditor::newAction()
-{
- QString szName = nameForAutomaticAction(__tr2qs("My Action"));
- QString szVis = __tr2qs("My Action");
- QString szDes = __tr2qs("Put here a short description of your action");
-
- szVis.prepend("$tr(\"");
- szVis.append("\")");
- szDes.prepend("$tr(\"");
- szDes.append("\")");
-
- KviActionData * ad = new KviActionData(szName,
- QString::null,
- szVis,
- szDes,
- KviActionManager::categoryGeneric()->name(),
- QString::null,
- QString::null,
- 0,
- QString::null,
- 0);
-
- KviActionEditorTreeWidgetItem * lvi = new KviActionEditorTreeWidgetItem(m_pTreeWidget,ad);
- ad->m_pItem = lvi;
- m_pTreeWidget->setCurrentItem(lvi);
- currentItemChanged(lvi,lvi);
-}
-
-bool KviActionEditor::actionExists(const QString &szName)
-{
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- if(((KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->actionData()->m_szName == szName)return true;
- }
- return false;
-}
-
-
-void KviActionEditor::currentItemChanged(KviTalTreeWidgetItem * i,KviTalTreeWidgetItem *prev)
-{
- if(m_pSingleActionEditor->actionData())
- m_pSingleActionEditor->commit();
-
- m_pTreeWidget->update();
-
- KviActionEditorTreeWidgetItem * it = (KviActionEditorTreeWidgetItem *)i;
- if(!it)
- {
- m_pSingleActionEditor->setActionData(0);
- m_pDeleteActionsButton->setEnabled(false);
- m_pExportActionsButton->setEnabled(false);
- return;
- }
- m_pDeleteActionsButton->setEnabled(true);
- m_pExportActionsButton->setEnabled(true);
-
- //if(!it->isSelected())m_pTreeWidget->setSelected(it,true);
-
- m_pSingleActionEditor->setActionData(it->actionData());
- g_szLastEditedAction = it->actionData()->m_szName;
-}
-
-void KviActionEditor::commit()
-{
- m_pSingleActionEditor->commit();
-
- // the hard part: update the actions without destroying them...
-
- KviActionManager::instance()->killAllKvsUserActions();
-
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- KviActionEditorTreeWidgetItem * it = (KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i);
- KviKvsUserAction * a = KviKvsUserAction::createInstance( // msvc workaround
- KviActionManager::instance(),
- it->actionData()->m_szName,
- it->actionData()->m_szScriptCode,
- it->actionData()->m_szVisibleName,
- it->actionData()->m_szDescription,
- it->actionData()->m_szCategory,
- it->actionData()->m_szBigIcon,
- it->actionData()->m_szSmallIcon,
- it->actionData()->m_uFlags,
- it->actionData()->m_szKeySequence);
-
- KviActionManager::instance()->registerAction(a);
- }
-
- KviCustomToolBarManager::instance()->updateVisibleToolBars();
-}
-
-
-KviActionEditorWindow::KviActionEditorWindow(KviFrame * lpFrm)
-: KviWindow(KVI_WINDOW_TYPE_SCRIPTEDITOR,lpFrm,"actioneditor",0)
-{
- g_pActionEditorWindow = this;
- setFixedCaption(__tr2qs("Action Editor"));
-
- m_pEditor = new KviActionEditor(this);
-
- m_pBase = new QWidget(this);
- QGridLayout * g = new QGridLayout(m_pBase);
-
- QPushButton * btn = new QPushButton(__tr2qs("OK"),m_pBase);
- btn->setMinimumWidth(80);
- connect(btn,SIGNAL(clicked()),this,SLOT(okClicked()));
- btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)));
- g->addWidget(btn,0,1);
-
- btn = new QPushButton(__tr2qs("Apply"),m_pBase);
- btn->setMinimumWidth(80);
- connect(btn,SIGNAL(clicked()),this,SLOT(applyClicked()));
- btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)));
- g->addWidget(btn,0,2);
-
- btn = new QPushButton(__tr2qs("Cancel"),m_pBase);
- btn->setMinimumWidth(80);
- connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked()));
- btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD)));
- g->addWidget(btn,0,3);
-
- g->setColumnStretch(0,1);
-
-}
-
-KviActionEditorWindow::~KviActionEditorWindow()
-{
- g_pActionEditorWindow = 0;
-}
-
-void KviActionEditorWindow::okClicked()
-{
- m_pEditor->commit();
- close();
-}
-
-void KviActionEditorWindow::applyClicked()
-{
- m_pEditor->commit();
-}
-
-void KviActionEditorWindow::cancelClicked()
-{
- close();
-}
-
-QPixmap * KviActionEditorWindow::myIconPtr()
-{
- return g_pIconManager->getSmallIcon(KVI_SMALLICON_SCRIPTACTION);
-}
-
-void KviActionEditorWindow::resizeEvent(QResizeEvent *e)
-{
- int hght = m_pBase->sizeHint().height();
- m_pEditor->setGeometry(0,0,width(),height()- hght);
- m_pBase->setGeometry(0,height() - hght,width(),hght);
-}
-
-void KviActionEditorWindow::getConfigGroupName(KviStr &szName)
-{
- szName = "actioneditor";
-}
-
-
-void KviActionEditorWindow::saveProperties(KviConfig *cfg)
-{
- KviWindow::saveProperties(cfg);
- cfg->writeEntry("Splitter",m_pEditor->m_pSplitter->sizes());
-}
-
-void KviActionEditorWindow::loadProperties(KviConfig *cfg)
-{
- int w = width();
- KviWindow::loadProperties(cfg);
- QList<int> def;
- def.append((w * 25) / 100);
- def.append((w * 75) / 100);
- m_pEditor->m_pSplitter->setSizes(cfg->readIntListEntry("Splitter",def));
-}
+//============================================================================= +// +// File : aliaseditor.cpp +// Creation date : Tue 29 Dec 2004 02:45:59 2002 GMT by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the linkss of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) 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 "actioneditor.h" + +#include "kvi_iconmanager.h" +#include "kvi_options.h" +#include "kvi_locale.h" +#include "kvi_imagedialog.h" +#include "kvi_config.h" +#include "kvi_filedialog.h" +#include "kvi_fileutils.h" +#include "kvi_scripteditor.h" +#include "kvi_debug.h" +#include "kvi_app.h" +#include "kvi_qstring.h" +#include "kvi_kvs_aliasmanager.h" +#include "kvi_filedialog.h" +#include "kvi_actionmanager.h" +#include "kvi_action.h" +#include "kvi_kvs_useraction.h" +#include "kvi_customtoolbarmanager.h" +#include "kvi_tal_vbox.h" +#include <kvi_tal_groupbox.h> +#include "kvi_tal_itemdelegates.h" + +#include <QList> +#include <QSplitter> +#include <QLayout> +#include <QToolTip> +#include <QPushButton> +#include <QDir> +#include <QMessageBox> +#include <QLineEdit> +#include <QComboBox> +#include <QPainter> +#include <QTabWidget> +#include <QLabel> + + +extern KviActionEditorWindow * g_pActionEditorWindow; + +static QString g_szLastEditedAction; + +#define LVI_ICON_SIZE 32 +#define LVI_BORDER 4 +#define LVI_SPACING 8 +#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER) + +KviActionEditorTreeWidgetItem::KviActionEditorTreeWidgetItem(KviTalTreeWidget * v,KviActionData * a) +: KviTalTreeWidgetItem(v) +{ + m_pActionData = a; + m_pTreeWidget = v; + //setFlags(Qt::ItemIsUserSelectable); + QString t = "<b>" + m_pActionData->m_szName + "</b>"; + t += "<br><font color=\"#808080\" size=\"-1\">" + m_pActionData->m_szVisibleName + "</font>"; + m_szKey = m_pActionData->m_szName.toUpper(); + setText(0,t); + QPixmap * p = g_pIconManager->getBigIcon(m_pActionData->m_szBigIcon); + if(p)setIcon(0,*p); +} + +KviActionEditorTreeWidgetItem::~KviActionEditorTreeWidgetItem() +{ + delete m_pActionData; +} + + +QString KviActionEditorTreeWidgetItem::key(int,bool) const +{ + return m_szKey; +} + +KviSingleActionEditor::KviSingleActionEditor(QWidget * par,KviActionEditor * ed) +: QWidget(par) +{ + m_pActionEditor = ed; + m_pActionData = 0; + + QGridLayout * g = new QGridLayout(this); + + QLabel * l = new QLabel(__tr2qs("Name:"),this); + g->addWidget(l,0,0); + m_pNameEdit = new QLineEdit(this); + g->addWidget(m_pNameEdit,0,1); + m_pNameEdit->setToolTip(__tr2qs("Internal unique name for the action")); + + l = new QLabel(__tr2qs("Label:"),this); + g->addWidget(l,1,0); + m_pVisibleNameEdit = new QLineEdit(this); + g->addWidget(m_pVisibleNameEdit,1,1); + m_pVisibleNameEdit->setToolTip(__tr2qs("Visible name for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here")); + + + QTabWidget * tw = new QTabWidget(this); + g->addWidget(tw,2,0,1,2); +// g->addMultiCellWidget(tw,2,2,0,1); + + // code tab + QWidget * tab = new QWidget(tw); + QGridLayout * gl = new QGridLayout(tab); + + m_pScriptEditor = KviScriptEditor::createInstance(tab); + gl->addWidget(m_pScriptEditor,0,0); + m_pScriptEditor->setToolTip(__tr2qs("Action code")); + + tw->addTab(tab,__tr2qs("Code")); + + // properties tab + tab = new QWidget(tw); + gl = new QGridLayout(tab); + + l = new QLabel(__tr2qs("Category:"),tab); + gl->addWidget(l,0,0); + m_pCategoryCombo = new QComboBox(tab); + gl->addWidget(m_pCategoryCombo,0,1,1,3); + //gl->addMultiCellWidget(m_pCategoryCombo,0,0,1,3); + m_pCategoryCombo->setToolTip(__tr2qs("Choose the category that best fits for this action")); + + l = new QLabel(__tr2qs("Description:"),tab); + gl->addWidget(l,1,0); + m_pDescriptionEdit = new QLineEdit(tab); + gl->addWidget(m_pDescriptionEdit,1,1,1,3); +// gl->addMultiCellWidget(m_pDescriptionEdit,1,1,1,3); + m_pDescriptionEdit->setToolTip(__tr2qs("Visible short description for this action.<br>This string will be displayed to the user so it is a good idea to use $tr() here")); + + l = new QLabel(__tr2qs("Small Icon:"),tab); + gl->addWidget(l,2,0); + m_pSmallIconEdit = new QLineEdit(tab); + gl->addWidget(m_pSmallIconEdit,2,1); + m_pSmallIconButton = new QToolButton(tab); + m_pSmallIconButton->setMinimumSize(QSize(20,20)); + connect(m_pSmallIconButton,SIGNAL(clicked()),this,SLOT(chooseSmallIcon())); + gl->addWidget(m_pSmallIconButton,2,2); + QString s= __tr2qs("The small icon associated to this action.<br>" \ + "It will appear at least in the popup menus when this action is inserted.<br>" \ + "It should be 16x16 pixels."); + m_pSmallIconEdit->setToolTip(s); + m_pSmallIconButton->setToolTip(s); + + l = new QLabel(__tr2qs("Big Icon:"),tab); + gl->addWidget(l,3,0); + m_pBigIconEdit = new QLineEdit(tab); + gl->addWidget(m_pBigIconEdit,3,1); + m_pBigIconButton = new QToolButton(tab); + m_pBigIconButton->setMinimumSize(QSize(48,48)); + m_pBigIconButton->setIconSize(QSize(32,32)); + connect(m_pBigIconButton,SIGNAL(clicked()),this,SLOT(chooseBigIcon())); + gl->addWidget(m_pBigIconButton,3,2,2,2); +// gl->addMultiCellWidget(m_pBigIconButton,3,4,2,3); + s = __tr2qs("The big icon associated to this action.<br>" \ + "It will appear at least in the toolbar buttons when this action is inserted.<br>" \ + "It should be 32x32 pixels."); + m_pBigIconEdit->setToolTip(s); + m_pBigIconButton->setToolTip(s); + + l = new QLabel(__tr2qs("Key Sequence:"),tab); + gl->addWidget(l,4,0,2,1); +// gl->addMultiCellWidget(l,4,5,0,0); + m_pKeySequenceEdit = new QLineEdit(tab); + gl->addWidget(m_pKeySequenceEdit,4,1,2,1); +// gl->addMultiCellWidget(m_pKeySequenceEdit,4,5,1,1); + m_pKeySequenceEdit->setToolTip(__tr2qs("Optional keyboard sequence that will activate this action.<br>" \ + "The sequence should be expressed as a string of up to four key codes separated by commas " \ + "eventually combined with the modifiers \"Ctrl\",\"Shift\",\"Alt\" and \"Meta\".<br>" \ + "Examples of such sequences are \"Ctrl+X\", \"Ctrl+Alt+Z\", \"Ctrl+X,Ctrl+C\" ...")); + + l = new QLabel(tab); + gl->addWidget(l,6,0,1,4); +// gl->addMultiCellWidget(l,6,6,0,3); + + gl->setColumnStretch(1,1); + gl->setRowStretch(6,1); + + + tw->addTab(tab,__tr2qs("Properties")); + + + + // flags tab + tab = new QWidget(tw); + gl = new QGridLayout(tab); + + + m_pNeedsContextCheck = new QCheckBox(__tr2qs("Needs IRC Context"),tab); + connect(m_pNeedsContextCheck,SIGNAL(toggled(bool)),this,SLOT(needsContextCheckToggled(bool))); + m_pNeedsContextCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window belongs to an irc context")); + gl->addWidget(m_pNeedsContextCheck,0,0,1,4); +// gl->addMultiCellWidget(m_pNeedsContextCheck,0,0,0,3); + + + l = new QLabel(tab); + l->setMinimumWidth(40); + gl->addWidget(l,1,0); + + m_pNeedsConnectionCheck = new QCheckBox(__tr2qs("Needs IRC Connection"),tab); + connect(m_pNeedsConnectionCheck,SIGNAL(toggled(bool)),this,SLOT(needsConnectionCheckToggled(bool))); + m_pNeedsConnectionCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window has an active IRC connection")); + gl->addWidget(m_pNeedsConnectionCheck,1,1,1,3); +// gl->addMultiCellWidget(m_pNeedsConnectionCheck,1,1,1,3); + + + l = new QLabel(tab); + l->setMinimumWidth(40); + gl->addWidget(l,2,1); + + m_pEnableAtLoginCheck = new QCheckBox(__tr2qs("Enable at Login"),tab); + m_pEnableAtLoginCheck->setToolTip(__tr2qs("Check this option if this action should be enabled also during " \ + "the login operations (so when the logical IRC connection hasn't been estabilished yet)")); + gl->addWidget(m_pEnableAtLoginCheck,2,2,1,2); +// gl->addMultiCellWidget(m_pEnableAtLoginCheck,2,2,2,3); + + m_pSpecificWindowsCheck = new QCheckBox(__tr2qs("Enable Only in Specified Windows"),tab); + connect(m_pSpecificWindowsCheck,SIGNAL(toggled(bool)),this,SLOT(specificWindowsCheckToggled(bool))); + m_pSpecificWindowsCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window is of a specified type")); + gl->addWidget(m_pSpecificWindowsCheck,3,0,1,4); +// gl->addMultiCellWidget(m_pSpecificWindowsCheck,3,3,0,3); + + + m_pWindowConsoleCheck = new QCheckBox(__tr2qs("Enable in Console Windows"),tab); + m_pWindowConsoleCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window is a console")); + connect(m_pWindowConsoleCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); + gl->addWidget(m_pWindowConsoleCheck,4,1,1,3); +// gl->addMultiCellWidget(m_pWindowConsoleCheck,4,4,1,3); + + m_pConsoleOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab); + m_pConsoleOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \ + "selected users in the active window")); + gl->addWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,2,1,2); +// gl->addMultiCellWidget(m_pConsoleOnlyIfUsersSelectedCheck,5,5,2,3); + + m_pWindowChannelCheck = new QCheckBox(__tr2qs("Enable in Channel Windows"),tab); + m_pWindowChannelCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window is a channel")); + connect(m_pWindowChannelCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); + gl->addWidget(m_pWindowChannelCheck,6,1,1,3); +// gl->addMultiCellWidget(m_pWindowChannelCheck,6,6,1,3); + + m_pChannelOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab); + m_pChannelOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \ + "selected users in the active window")); + gl->addWidget(m_pChannelOnlyIfUsersSelectedCheck,7,2,1,2); +// gl->addMultiCellWidget(m_pChannelOnlyIfUsersSelectedCheck,7,7,2,3); + + m_pWindowQueryCheck = new QCheckBox(__tr2qs("Enable in Query Windows"),tab); + m_pWindowQueryCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window is a query")); + connect(m_pWindowQueryCheck,SIGNAL(toggled(bool)),this,SLOT(channelQueryOrConsoleWindowCheckToggled(bool))); + gl->addWidget(m_pWindowQueryCheck,8,1,1,3); +// gl->addMultiCellWidget(m_pWindowQueryCheck,8,8,1,3); + + m_pQueryOnlyIfUsersSelectedCheck = new QCheckBox(__tr2qs("Only If There Are Selected Users"),tab); + m_pQueryOnlyIfUsersSelectedCheck->setToolTip(__tr2qs("This will enable the action only if there are " \ + "selected users in the active window")); + gl->addWidget(m_pQueryOnlyIfUsersSelectedCheck,9,2,1,2); +// gl->addMultiCellWidget(m_pQueryOnlyIfUsersSelectedCheck,9,9,2,3); + + m_pWindowDccChatCheck = new QCheckBox(__tr2qs("Enable in DCC Chat Windows"),tab); + m_pWindowDccChatCheck->setToolTip(__tr2qs("Check this option if this action should be enabled only when " \ + "the active window is a dcc chat")); + gl->addWidget(m_pWindowDccChatCheck,10,1,1,2); +// gl->addMultiCellWidget(m_pWindowDccChatCheck,10,10,1,3); + + l = new QLabel(tab); + gl->addWidget(l,11,0,1,4); +// gl->addMultiCellWidget(l,11,11,0,3); + gl->setColumnStretch(3,1); + gl->setRowStretch(11,1); + + tw->addTab(tab,__tr2qs("Flags")); + tw->setCurrentIndex(0); + + g->setRowStretch(2,1); + g->setColumnStretch(1,1); + + KviPointerHashTableIterator<QString,KviActionCategory> it(*(KviActionManager::instance()->categories())); + while(KviActionCategory * ac = it.current()) + { + m_pCategoryCombo->addItem(ac->visibleName() + " (" + ac->name() + ")"); + ++it; + } +} + +KviSingleActionEditor::~KviSingleActionEditor() +{ +} + +void KviSingleActionEditor::channelQueryOrConsoleWindowCheckToggled(bool) +{ + m_pChannelOnlyIfUsersSelectedCheck->setEnabled(m_pWindowChannelCheck->isChecked()); + m_pChannelOnlyIfUsersSelectedCheck->setChecked(false); + m_pQueryOnlyIfUsersSelectedCheck->setEnabled(m_pWindowQueryCheck->isChecked()); + m_pQueryOnlyIfUsersSelectedCheck->setChecked(false); + m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(m_pWindowConsoleCheck->isChecked()); + m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false); +} + +void KviSingleActionEditor::needsContextCheckToggled(bool) +{ + m_pEnableAtLoginCheck->setChecked(false); + m_pEnableAtLoginCheck->setEnabled(false); + m_pNeedsConnectionCheck->setChecked(false); + m_pNeedsConnectionCheck->setEnabled(m_pNeedsContextCheck->isChecked()); +} + +void KviSingleActionEditor::needsConnectionCheckToggled(bool) +{ + m_pEnableAtLoginCheck->setChecked(false); + m_pEnableAtLoginCheck->setEnabled(m_pNeedsConnectionCheck->isChecked()); +} + +void KviSingleActionEditor::specificWindowsCheckToggled(bool) +{ + m_pWindowConsoleCheck->setChecked(false); + m_pWindowChannelCheck->setChecked(false); + m_pWindowQueryCheck->setChecked(false); + m_pWindowDccChatCheck->setChecked(false); + m_pQueryOnlyIfUsersSelectedCheck->setChecked(false); + m_pChannelOnlyIfUsersSelectedCheck->setChecked(false); + m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false); + m_pQueryOnlyIfUsersSelectedCheck->setEnabled(false); + m_pChannelOnlyIfUsersSelectedCheck->setEnabled(false); + m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(false); + bool b = m_pSpecificWindowsCheck->isChecked(); + m_pWindowConsoleCheck->setEnabled(b); + m_pWindowChannelCheck->setEnabled(b); + m_pWindowQueryCheck->setEnabled(b); + m_pWindowDccChatCheck->setEnabled(b); +} + +void KviSingleActionEditor::chooseSmallIcon() +{ + if(!m_pActionData)return; + KviImageDialog * d = new KviImageDialog(this); + int ret = d->exec(); + QString s = d->selectedImage(); + delete d; + if(ret != QDialog::Accepted)return; + QPixmap * p = g_pIconManager->getImage(s.toUtf8().data()); + if(!p)return; + m_pSmallIconEdit->setText(s); + m_pSmallIconButton->setIcon(QIcon(*p)); +} + +void KviSingleActionEditor::chooseBigIcon() +{ + if(!m_pActionData)return; + KviImageDialog * d = new KviImageDialog(this,QString::null,KID_TYPE_ALL,KID_TYPE_FULL_PATH); + int ret = d->exec(); + QString s = d->selectedImage(); + delete d; + if(ret != QDialog::Accepted)return; + QPixmap * p = g_pIconManager->getBigIcon(s); + if(!p)return; + m_pBigIconEdit->setText(s); + m_pBigIconButton->setIcon(QIcon(*p)); +} + +void KviSingleActionEditor::setActionData(KviActionData * d) +{ + m_pActionData = d; + + if(d) + { + unsigned int uOldFlags = d->m_uFlags; + d->m_uFlags = KviAction::validateFlags(d->m_uFlags); + if(d->m_uFlags != uOldFlags) + debug("invalid action flags in KviSingleActionEditor::setActionData(): %d fixed to %d",uOldFlags,d->m_uFlags); + + m_pNameEdit->setText(d->m_szName); + m_pNameEdit->setEnabled(true); + m_pVisibleNameEdit->setText(d->m_szVisibleName); + m_pVisibleNameEdit->setEnabled(true); + m_pCategoryCombo->setEnabled(true); + int i; + for(i=0;i<m_pCategoryCombo->count();i++) + { + QString t = m_pCategoryCombo->itemText(i); + int idx = t.lastIndexOf('('); + QString r = t.right(t.length() - (idx + 1)); + QString r2 = r.left(r.length() - 1); + r2.trimmed(); + if(r2 == d->m_szCategory) + { + m_pCategoryCombo->setCurrentIndex(i); + break; + } + } + if(i == m_pCategoryCombo->count()) + { + m_pCategoryCombo->setCurrentIndex(0); + } + m_pScriptEditor->setText(d->m_szScriptCode); + m_pScriptEditor->setEnabled(true); + m_pKeySequenceEdit->setText(d->m_szKeySequence); + m_pKeySequenceEdit->setEnabled(true); + m_pDescriptionEdit->setText(d->m_szDescription); + m_pDescriptionEdit->setEnabled(true); + m_pSmallIconEdit->setEnabled(true); + m_pBigIconEdit->setEnabled(true); + QPixmap * p = g_pIconManager->getImage(d->m_szSmallIcon); + if(p) + { + m_pSmallIconEdit->setText(d->m_szSmallIcon); + m_pSmallIconButton->setIcon(QIcon(*p)); + } else { + m_pSmallIconEdit->setText(""); + m_pSmallIconButton->setIcon(QIcon()); + } + p = g_pIconManager->getImage(d->m_szBigIcon); + if(p) + { + m_pBigIconEdit->setText(d->m_szBigIcon); + m_pBigIconButton->setIcon(QIcon(*p)); + } else { + m_pBigIconEdit->setText(""); + m_pBigIconButton->setIcon(QIcon()); + } + m_pSmallIconButton->setEnabled(true); + m_pBigIconButton->setEnabled(true); + m_pNeedsContextCheck->setEnabled(true); + bool b = (d->m_uFlags & KviAction::NeedsContext) || (d->m_uFlags & KviAction::NeedsConnection); + m_pNeedsContextCheck->setChecked(b); + + m_pNeedsConnectionCheck->setEnabled(b); + b = (d->m_uFlags & KviAction::NeedsContext) && (d->m_uFlags & KviAction::NeedsConnection); + m_pNeedsConnectionCheck->setChecked(b); + + m_pEnableAtLoginCheck->setEnabled(b); + m_pEnableAtLoginCheck->setChecked(b && (d->m_uFlags & KviAction::EnableAtLogin)); + + m_pSpecificWindowsCheck->setEnabled(true); + b = d->m_uFlags & KviAction::InternalWindowMask; + m_pSpecificWindowsCheck->setChecked(b); + + m_pWindowConsoleCheck->setEnabled(b); + m_pWindowChannelCheck->setEnabled(b); + m_pWindowQueryCheck->setEnabled(b); + m_pWindowDccChatCheck->setEnabled(b); + b = d->m_uFlags & KviAction::WindowConsole; + m_pWindowConsoleCheck->setChecked(b); + m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(b); + m_pConsoleOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected)); + b = d->m_uFlags & KviAction::WindowChannel; + m_pWindowChannelCheck->setChecked(b); + m_pChannelOnlyIfUsersSelectedCheck->setEnabled(b); + m_pChannelOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected)); + b = d->m_uFlags & KviAction::WindowQuery; + m_pWindowQueryCheck->setChecked(b); + m_pQueryOnlyIfUsersSelectedCheck->setEnabled(b); + m_pQueryOnlyIfUsersSelectedCheck->setChecked(b && (d->m_uFlags & KviAction::WindowOnlyIfUsersSelected)); + m_pWindowDccChatCheck->setChecked(d->m_uFlags & KviAction::WindowDccChat); + } else { + m_pNameEdit->setText(""); + m_pNameEdit->setEnabled(false); + m_pVisibleNameEdit->setText(""); + m_pVisibleNameEdit->setEnabled(false); + m_pCategoryCombo->setEnabled(false); + m_pScriptEditor->setText(""); + m_pScriptEditor->setEnabled(false); + m_pKeySequenceEdit->setText(""); + m_pKeySequenceEdit->setEnabled(false); + m_pDescriptionEdit->setText(""); + m_pDescriptionEdit->setEnabled(false); + m_pSmallIconEdit->setText(""); + m_pSmallIconEdit->setEnabled(false); + m_pBigIconEdit->setText(""); + m_pBigIconEdit->setEnabled(false); + m_pSmallIconButton->setIcon(QIcon()); + m_pSmallIconButton->setEnabled(false); + m_pBigIconButton->setIcon(QPixmap()); + m_pBigIconButton->setEnabled(false); + m_pNeedsContextCheck->setChecked(false); + m_pNeedsContextCheck->setEnabled(false); + m_pNeedsConnectionCheck->setChecked(false); + m_pNeedsConnectionCheck->setEnabled(false); + m_pEnableAtLoginCheck->setChecked(false); + m_pEnableAtLoginCheck->setEnabled(false); + m_pWindowConsoleCheck->setChecked(false); + m_pWindowConsoleCheck->setEnabled(false); + m_pWindowChannelCheck->setChecked(false); + m_pWindowChannelCheck->setEnabled(false); + m_pWindowQueryCheck->setChecked(false); + m_pWindowQueryCheck->setEnabled(false); + m_pWindowDccChatCheck->setChecked(false); + m_pWindowDccChatCheck->setEnabled(false); + m_pSpecificWindowsCheck->setChecked(false); + m_pSpecificWindowsCheck->setEnabled(false); + m_pQueryOnlyIfUsersSelectedCheck->setChecked(false); + m_pChannelOnlyIfUsersSelectedCheck->setChecked(false); + m_pConsoleOnlyIfUsersSelectedCheck->setChecked(false); + m_pQueryOnlyIfUsersSelectedCheck->setEnabled(false); + m_pChannelOnlyIfUsersSelectedCheck->setEnabled(false); + m_pConsoleOnlyIfUsersSelectedCheck->setEnabled(false); + } +} + +void KviSingleActionEditor::commit() +{ + if(!m_pActionData)return; + + QString tmp = m_pNameEdit->text(); + if(tmp != m_pActionData->m_szName) + { + int idx = 1; + while(KviActionManager::instance()->coreActionExists(tmp) || m_pActionEditor->actionExists(tmp)) + { + QString tmp2; + tmp2.setNum(idx); + tmp = m_pNameEdit->text(); + tmp.append(tmp2); + idx++; + } + } + + m_pActionData->m_szName = tmp; + m_pScriptEditor->getText(m_pActionData->m_szScriptCode); + m_pActionData->m_szVisibleName = m_pVisibleNameEdit->text(); + m_pActionData->m_szDescription = m_pDescriptionEdit->text(); + m_pActionData->m_szBigIcon = m_pBigIconEdit->text(); + m_pActionData->m_szSmallIcon = m_pSmallIconEdit->text(); + m_pActionData->m_szKeySequence = m_pKeySequenceEdit->text(); + QString szCat = m_pCategoryCombo->currentText(); + int idx = szCat.lastIndexOf(')'); + if(idx != -1)m_pActionData->m_szCategory = szCat.left(idx); + else m_pActionData->m_szCategory = szCat; + idx = m_pActionData->m_szCategory.lastIndexOf('('); + if(idx != -1)m_pActionData->m_szCategory.remove(0,idx+1); + m_pActionData->m_uFlags = 0; + if(m_pNeedsContextCheck->isChecked()) + { + m_pActionData->m_uFlags |= KviAction::NeedsContext; + if(m_pNeedsConnectionCheck->isChecked()) + { + m_pActionData->m_uFlags |= KviAction::NeedsConnection; + if(m_pEnableAtLoginCheck->isChecked())m_pActionData->m_uFlags |= KviAction::EnableAtLogin; + } + + } + if(m_pSpecificWindowsCheck->isChecked()) + { + if(m_pWindowConsoleCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowConsole; + if(m_pWindowChannelCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowChannel; + if(m_pWindowQueryCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowQuery; + if(m_pWindowDccChatCheck->isChecked())m_pActionData->m_uFlags |= KviAction::WindowDccChat; + if(m_pActionData->m_uFlags & KviAction::InternalWindowMask) + { + if(m_pConsoleOnlyIfUsersSelectedCheck->isChecked() || + m_pChannelOnlyIfUsersSelectedCheck->isChecked() || + m_pQueryOnlyIfUsersSelectedCheck->isChecked()) + { + m_pActionData->m_uFlags |= KviAction::WindowOnlyIfUsersSelected; + } + } + } + + unsigned int uOldFlags = m_pActionData->m_uFlags; + m_pActionData->m_uFlags = KviAction::validateFlags(m_pActionData->m_uFlags); + if(m_pActionData->m_uFlags != uOldFlags) + debug("invalid action flags in KviSingleActionEditor::commit(): %d fixed to %d",uOldFlags,m_pActionData->m_uFlags); +} + + +KviActionEditorTreeView::KviActionEditorTreeView(QWidget * pParent) +: KviTalTreeWidget(pParent) +{ + setColumnCount (1); + setHeaderLabel(__tr2qs("Action")); + setSelectionMode(QAbstractItemView::ExtendedSelection); + setSortingEnabled(true); + int iWidth = viewport()->width(); + if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; + setRootIsDecorated(false); + setColumnWidth(0,iWidth); + +} + +KviActionEditorTreeView::~KviActionEditorTreeView() +{ +} + +void KviActionEditorTreeView::resizeEvent(QResizeEvent * e) +{ + KviTalTreeWidget::resizeEvent(e); + int iWidth = viewport()->width(); + if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; + setColumnWidth(0,iWidth); +} + + +KviActionEditor::KviActionEditor(QWidget * par) +: QWidget(par) +{ + + QGridLayout * l = new QGridLayout(this); + m_pSplitter = new QSplitter(Qt::Horizontal,this); + m_pSplitter->setOpaqueResize(false); + l->addWidget(m_pSplitter,0,0); + + + KviTalVBox * box = new KviTalVBox(m_pSplitter); + m_pTreeWidget = new KviActionEditorTreeView(box); + KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(m_pTreeWidget); + m_pTreeWidget->setItemDelegate(itemDelegate); + //m_pTreeWidget->setShowSortIndicator(true); + m_pTreeWidget->setFocusPolicy(Qt::StrongFocus); + connect(m_pTreeWidget,SIGNAL(currentItemChanged(KviTalTreeWidgetItem *,KviTalTreeWidgetItem *)),this,SLOT(currentItemChanged(KviTalTreeWidgetItem *,KviTalTreeWidgetItem *))); + + m_pNewActionButton = new QPushButton(__tr2qs("New Action"),box); + connect(m_pNewActionButton,SIGNAL(clicked()),this,SLOT(newAction())); + + m_pDeleteActionsButton = new QPushButton(__tr2qs("Delete Actions"),box); + connect(m_pDeleteActionsButton,SIGNAL(clicked()),this,SLOT(deleteActions())); + + m_pExportActionsButton = new QPushButton(__tr2qs("Export Actions..."),box); + connect(m_pExportActionsButton,SIGNAL(clicked()),this,SLOT(exportActions())); + + box->setSpacing(1); + + m_pSingleActionEditor = new KviSingleActionEditor(m_pSplitter,this); + + KviActionEditorTreeWidgetItem * last = 0; + KviActionEditorTreeWidgetItem * first = 0; + + KviPointerHashTableIterator<QString,KviAction> it(*(KviActionManager::instance()->actions())); + while(KviAction * a = it.current()) + { + if(a->isKviUserActionNeverOverrideThis()) + { + KviActionData * ad = new KviActionData(a->name(), + ((KviKvsUserAction *)a)->scriptCode(), + ((KviKvsUserAction *)a)->visibleNameCode(), + ((KviKvsUserAction *)a)->descriptionCode(), + a->category() ? a->category()->name() : KviActionManager::categoryGeneric()->name(), + a->bigIconString(), + ((KviKvsUserAction *)a)->smallIconString(), + a->flags(), + a->keySequence(), + 0); + KviActionEditorTreeWidgetItem * lvi = new KviActionEditorTreeWidgetItem(m_pTreeWidget,ad); + ad->m_pItem = lvi; + if(ad->m_szName == g_szLastEditedAction) + last = lvi; + if(!first) + first = lvi; + } + ++it; + } + + if(!last)last = first; // try to sleect the first one then + + if(last) + { + m_pTreeWidget->setCurrentItem(last); + currentItemChanged(last,last); + } else { + currentItemChanged(0,0); + } + +} + +KviActionEditor::~KviActionEditor() +{ +} + +void KviActionEditor::exportActions() +{ + QString szName = QDir::homePath(); + if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; + szName += "myactions.kvs"; + + QString szFile; + + if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,QString::null,true,true,true))return; + + QString szCode; + + for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++) + { + if(m_pTreeWidget->topLevelItem(i)->isSelected()) + { + KviActionData * a = ((KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->actionData(); + + KviKvsUserAction::exportToKvs(szCode, + a->m_szName, + a->m_szScriptCode, + a->m_szVisibleName, + a->m_szDescription, + a->m_szCategory, + a->m_szBigIcon, + a->m_szSmallIcon, + a->m_uFlags, + a->m_szKeySequence); + } + } + + if(!KviFileUtils::writeFile(szFile,szCode)) + { + QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the actions file."),__tr2qs("OK")); + } +} + +void KviActionEditor::deleteActions() +{ + KviPointerList<KviActionEditorTreeWidgetItem> l; + l.setAutoDelete(false); + + for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++) + { + if(m_pTreeWidget->topLevelItem(i)->isSelected()) + l.append((KviActionEditorTreeWidgetItem * )m_pTreeWidget->topLevelItem(i)); + } + + if(l.isEmpty())return; + + //if(QMessageBox::question(this,__tr2qsf("Confirm Deletion"),__tr2qsf("Do you really want to delete the selected actions ?"),__tr2qsf("Yes"),__tr2qsf("No")) != 0) + // return; + + for(KviActionEditorTreeWidgetItem * i = l.first();i;i = l.next()) + { + if(m_pSingleActionEditor->actionData() == i->actionData()) + m_pSingleActionEditor->setActionData(0); + delete i; + } +} + + +QString KviActionEditor::nameForAutomaticAction(const QString &szTemplate) +{ + QString ret; + QString szT = szTemplate; + szT.replace(" ",""); + szT.replace(".","_"); + + int i = 1; + do { + KviQString::sprintf(ret,"%Q%d",&szT,i); + i++; + } while(actionExists(ret)); + + return ret; +} + +void KviActionEditor::newAction() +{ + QString szName = nameForAutomaticAction(__tr2qs("My Action")); + QString szVis = __tr2qs("My Action"); + QString szDes = __tr2qs("Put here a short description of your action"); + + szVis.prepend("$tr(\""); + szVis.append("\")"); + szDes.prepend("$tr(\""); + szDes.append("\")"); + + KviActionData * ad = new KviActionData(szName, + QString::null, + szVis, + szDes, + KviActionManager::categoryGeneric()->name(), + QString::null, + QString::null, + 0, + QString::null, + 0); + + KviActionEditorTreeWidgetItem * lvi = new KviActionEditorTreeWidgetItem(m_pTreeWidget,ad); + ad->m_pItem = lvi; + m_pTreeWidget->setCurrentItem(lvi); + currentItemChanged(lvi,lvi); +} + +bool KviActionEditor::actionExists(const QString &szName) +{ + for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++) + { + if(((KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->actionData()->m_szName == szName)return true; + } + return false; +} + + +void KviActionEditor::currentItemChanged(KviTalTreeWidgetItem * i,KviTalTreeWidgetItem *prev) +{ + if(m_pSingleActionEditor->actionData()) + m_pSingleActionEditor->commit(); + + m_pTreeWidget->update(); + + KviActionEditorTreeWidgetItem * it = (KviActionEditorTreeWidgetItem *)i; + if(!it) + { + m_pSingleActionEditor->setActionData(0); + m_pDeleteActionsButton->setEnabled(false); + m_pExportActionsButton->setEnabled(false); + return; + } + m_pDeleteActionsButton->setEnabled(true); + m_pExportActionsButton->setEnabled(true); + + //if(!it->isSelected())m_pTreeWidget->setSelected(it,true); + + m_pSingleActionEditor->setActionData(it->actionData()); + g_szLastEditedAction = it->actionData()->m_szName; +} + +void KviActionEditor::commit() +{ + m_pSingleActionEditor->commit(); + + // the hard part: update the actions without destroying them... + + KviActionManager::instance()->killAllKvsUserActions(); + + for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++) + { + KviActionEditorTreeWidgetItem * it = (KviActionEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i); + KviKvsUserAction * a = KviKvsUserAction::createInstance( // msvc workaround + KviActionManager::instance(), + it->actionData()->m_szName, + it->actionData()->m_szScriptCode, + it->actionData()->m_szVisibleName, + it->actionData()->m_szDescription, + it->actionData()->m_szCategory, + it->actionData()->m_szBigIcon, + it->actionData()->m_szSmallIcon, + it->actionData()->m_uFlags, + it->actionData()->m_szKeySequence); + + KviActionManager::instance()->registerAction(a); + } + + KviCustomToolBarManager::instance()->updateVisibleToolBars(); +} + + +KviActionEditorWindow::KviActionEditorWindow(KviFrame * lpFrm) +: KviWindow(KVI_WINDOW_TYPE_SCRIPTEDITOR,lpFrm,"actioneditor",0) +{ + g_pActionEditorWindow = this; + setFixedCaption(__tr2qs("Action Editor")); + + m_pEditor = new KviActionEditor(this); + + m_pBase = new QWidget(this); + QGridLayout * g = new QGridLayout(m_pBase); + + QPushButton * btn = new QPushButton(__tr2qs("OK"),m_pBase); + btn->setMinimumWidth(80); + connect(btn,SIGNAL(clicked()),this,SLOT(okClicked())); + btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); + g->addWidget(btn,0,1); + + btn = new QPushButton(__tr2qs("Apply"),m_pBase); + btn->setMinimumWidth(80); + connect(btn,SIGNAL(clicked()),this,SLOT(applyClicked())); + btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); + g->addWidget(btn,0,2); + + btn = new QPushButton(__tr2qs("Cancel"),m_pBase); + btn->setMinimumWidth(80); + connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked())); + btn->setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD))); + g->addWidget(btn,0,3); + + g->setColumnStretch(0,1); + +} + +KviActionEditorWindow::~KviActionEditorWindow() +{ + g_pActionEditorWindow = 0; +} + +void KviActionEditorWindow::okClicked() +{ + m_pEditor->commit(); + close(); +} + +void KviActionEditorWindow::applyClicked() +{ + m_pEditor->commit(); +} + +void KviActionEditorWindow::cancelClicked() +{ + close(); +} + +QPixmap * KviActionEditorWindow::myIconPtr() +{ + return g_pIconManager->getSmallIcon(KVI_SMALLICON_SCRIPTACTION); +} + +void KviActionEditorWindow::resizeEvent(QResizeEvent *e) +{ + int hght = m_pBase->sizeHint().height(); + m_pEditor->setGeometry(0,0,width(),height()- hght); + m_pBase->setGeometry(0,height() - hght,width(),hght); +} + +void KviActionEditorWindow::getConfigGroupName(KviStr &szName) +{ + szName = "actioneditor"; +} + + +void KviActionEditorWindow::saveProperties(KviConfig *cfg) +{ + KviWindow::saveProperties(cfg); + cfg->writeEntry("Splitter",m_pEditor->m_pSplitter->sizes()); +} + +void KviActionEditorWindow::loadProperties(KviConfig *cfg) +{ + int w = width(); + KviWindow::loadProperties(cfg); + QList<int> def; + def.append((w * 25) / 100); + def.append((w * 75) / 100); + m_pEditor->m_pSplitter->setSizes(cfg->readIntListEntry("Splitter",def)); +} diff --git a/src/modules/actioneditor/actioneditor.vcproj b/src/modules/actioneditor/actioneditor.vcproj index d1fdf643f..d1fdf643f 100755..100644 --- a/src/modules/actioneditor/actioneditor.vcproj +++ b/src/modules/actioneditor/actioneditor.vcproj diff --git a/src/modules/actioneditor/actioneditor_QT4_vc05.vcproj b/src/modules/actioneditor/actioneditor_QT4_vc05.vcproj index d91f66444..8dc172633 100644 --- a/src/modules/actioneditor/actioneditor_QT4_vc05.vcproj +++ b/src/modules/actioneditor/actioneditor_QT4_vc05.vcproj @@ -1,261 +1,261 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="actioneditor"
- ProjectGUID="{19556833-0BCA-4E3A-B208-2772D4ABC725}"
- RootNamespace="actioneditor"
- Keyword="Win32Proj"
- TargetFrameworkVersion="131072"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)\win32build\bin\modules\"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(QTDIR)\include";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar";"$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\config";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ACTIONEDITOR_EXPORTS;_CRT_SECURE_NO_DEPRECATE;"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="qt3support4.lib qtcore4.lib qtgui4.lib qtmain.lib kvilib.lib kvirc.lib"
- OutputFile="$(OutDir)/kvi$(ProjectName).dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)""
- GenerateManifest="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/actioneditor.pdb"
- SubSystem="2"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TurnOffAssemblyGeneration="true"
- ImportLibrary="$(OutDir)/actioneditor.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest"
- EmbedManifest="true"
- VerboseOutput="true"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)\win32build\bin\modules"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="1"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
- EnableFiberSafeOptimizations="true"
- WholeProgramOptimization="true"
- AdditionalIncludeDirectories=""$(QTDIR)\include";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar";"$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\config";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ACTIONEDITOR_EXPORTS;_CRT_SECURE_NO_DEPRECATE;QT3_SUPPORT"
- StringPooling="true"
- MinimalRebuild="true"
- ExceptionHandling="1"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kvilib.lib kvirc.lib qt3support4.lib qtgui4.lib qtcore4.lib"
- OutputFile="$(OutDir)/kvi$(ProjectName).dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)""
- GenerateManifest="true"
- IgnoreAllDefaultLibraries="false"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- LinkTimeCodeGeneration="1"
- RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
- TurnOffAssemblyGeneration="true"
- ImportLibrary="$(OutDir)/actioneditor.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest"
- EmbedManifest="false"
- VerboseOutput="true"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\actioneditor.cpp"
- >
- </File>
- <File
- RelativePath=".\libkviactioneditor.cpp"
- >
- </File>
- <File
- RelativePath=".\moc_actioneditor.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\actioneditor.h"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
"
- Outputs="$(InputDir)\moc_$(InputName).cpp"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
"
- Outputs="$(InputDir)\moc_$(InputName).cpp"
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="actioneditor" + ProjectGUID="{19556833-0BCA-4E3A-B208-2772D4ABC725}" + RootNamespace="actioneditor" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules\" + IntermediateDirectory="Debug" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(QTDIR)\include";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar";"$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\config";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ACTIONEDITOR_EXPORTS;_CRT_SECURE_NO_DEPRECATE;" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qt3support4.lib qtcore4.lib qtgui4.lib qtmain.lib kvilib.lib kvirc.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/actioneditor.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/actioneditor.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest" + EmbedManifest="true" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules" + IntermediateDirectory="Release" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="1" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="1" + OmitFramePointers="true" + EnableFiberSafeOptimizations="true" + WholeProgramOptimization="true" + AdditionalIncludeDirectories=""$(QTDIR)\include";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar";"$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\config";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ACTIONEDITOR_EXPORTS;_CRT_SECURE_NO_DEPRECATE;QT3_SUPPORT" + StringPooling="true" + MinimalRebuild="true" + ExceptionHandling="1" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="kvilib.lib kvirc.lib qt3support4.lib qtgui4.lib qtcore4.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + IgnoreAllDefaultLibraries="false" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + OptimizeForWindows98="1" + LinkTimeCodeGeneration="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/actioneditor.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest" + EmbedManifest="false" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\actioneditor.cpp" + > + </File> + <File + RelativePath=".\libkviactioneditor.cpp" + > + </File> + <File + RelativePath=".\moc_actioneditor.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\actioneditor.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\moc_$(InputName).cpp" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |
