diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/kvirc_vc05.vcproj | 29 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_htmldialog.cpp | 1 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_htmldialog.h | 172 | ||||
| -rw-r--r-- | src/modules/file/libkvifile.cpp | 57 | ||||
| -rw-r--r-- | src/modules/objects/class_listbox.cpp | 13 | ||||
| -rw-r--r-- | src/modules/theme/managementdialog.cpp | 34 | ||||
| -rw-r--r-- | src/modules/theme/theme_vc05.vcproj | 63 |
7 files changed, 250 insertions, 119 deletions
diff --git a/src/kvirc/kvirc_vc05.vcproj b/src/kvirc/kvirc_vc05.vcproj index 1bcb082af..8c7ab4db0 100644 --- a/src/kvirc/kvirc_vc05.vcproj +++ b/src/kvirc/kvirc_vc05.vcproj @@ -341,6 +341,18 @@ </FileConfiguration>
</File>
<File
+ RelativePath=".\ui\moc_kvi_htmldialog.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="__KVIRC__"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="ui\moc_kvi_imagedialog.cpp"
>
<FileConfiguration
@@ -1109,6 +1121,10 @@ >
</File>
<File
+ RelativePath=".\ui\kvi_htmldialog.cpp"
+ >
+ </File>
+ <File
RelativePath="ui\kvi_imagedialog.cpp"
>
</File>
@@ -3084,6 +3100,19 @@ </FileConfiguration>
</File>
<File
+ RelativePath=".\ui\kvi_htmldialog.h"
+ >
+ <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>
+ <File
RelativePath="ui\kvi_imagedialog.h"
>
<FileConfiguration
diff --git a/src/kvirc/ui/kvi_htmldialog.cpp b/src/kvirc/ui/kvi_htmldialog.cpp index d9006458d..671c4de63 100644 --- a/src/kvirc/ui/kvi_htmldialog.cpp +++ b/src/kvirc/ui/kvi_htmldialog.cpp @@ -21,6 +21,7 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //============================================================================= +#define __KVIRC__ #include "kvi_htmldialog.h" #include "kvi_locale.h" diff --git a/src/kvirc/ui/kvi_htmldialog.h b/src/kvirc/ui/kvi_htmldialog.h index 7b182b7fa..6bb811a31 100644 --- a/src/kvirc/ui/kvi_htmldialog.h +++ b/src/kvirc/ui/kvi_htmldialog.h @@ -1,85 +1,87 @@ -#ifndef _KVI_HTMLDIALOG_H_ -#define _KVI_HTMLDIALOG_H_ -//============================================================================= -// -// File : kvi_htmldialog.h -// Created on Wed 03 Jan 2007 03:36:36 by Szymon Stefanek -// -// This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2007 Szymon Stefanek <pragma at kvirc dot net> -// -// 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 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 "kvi_qstring.h" - -#include <qpixmap.h> -#include <qdialog.h> - -class KviHtmlDialogData -{ -public: - // input - - // mandatory fields - enum Flags { ForceMinimumSize = 1 }; - int iFlags; // da flags :) - int iDefaultButton; // the button to use when Enter is pressed (1,2 or 3) - int iCancelButton; // the button to use when Esc is pressed (1,2 or 3) - QString szHtmlText; // Shouldn't be empty :D - - // optional fields - QString szCaption; // KVIrc is used when this is empty - QString szUpperLabelText; // no label is shown if this is empty - QString szLowerLabelText; // no label is shown if this is empty - QString szButton1Text; // OK is used if this is empty - QString szButton2Text; // no button is shown if this is empty - QString szButton3Text; // no button is shown if this is empty - - int iMinimumWidth; - int iMinimumHeight; - - QPixmap pixIcon; // may be null - - // output - int iSelectedButton; // returns 1,2 or 3 -}; - -class KviHtmlDialog : public QDialog -{ - Q_OBJECT -public: - // the dialog does NOT delete this structure and assumes that - // it remains alive until the dialog closes (i.e. it may access - // the structure in the destructor - KviHtmlDialog(QWidget * pParent,KviHtmlDialogData * pData); - ~KviHtmlDialog(); -protected: - KviHtmlDialogData * m_pData; -public: - // displays the dialog as modal and returns 1,2 or 3 - static int display(QWidget * pParent,KviHtmlDialogData * pData); -protected slots: - void button1Pressed(); - void button2Pressed(); - void button3Pressed(); -protected: - virtual void reject(); -}; - - - -#endif //!_KVI_HTMLDIALOG_H_ +#ifndef _KVI_HTMLDIALOG_H_
+#define _KVI_HTMLDIALOG_H_
+//=============================================================================
+//
+// File : kvi_htmldialog.h
+// Created on Wed 03 Jan 2007 03:36:36 by Szymon Stefanek
+//
+// This file is part of the KVIrc IRC Client distribution
+// Copyright (C) 2007 Szymon Stefanek <pragma at kvirc dot net>
+//
+// 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 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 "kvi_qstring.h"
+#include "kvi_settings.h"
+
+
+#include <qpixmap.h>
+#include <qdialog.h>
+
+class KviHtmlDialogData
+{
+public:
+ // input
+
+ // mandatory fields
+ enum Flags { ForceMinimumSize = 1 };
+ int iFlags; // da flags :)
+ int iDefaultButton; // the button to use when Enter is pressed (1,2 or 3)
+ int iCancelButton; // the button to use when Esc is pressed (1,2 or 3)
+ QString szHtmlText; // Shouldn't be empty :D
+
+ // optional fields
+ QString szCaption; // KVIrc is used when this is empty
+ QString szUpperLabelText; // no label is shown if this is empty
+ QString szLowerLabelText; // no label is shown if this is empty
+ QString szButton1Text; // OK is used if this is empty
+ QString szButton2Text; // no button is shown if this is empty
+ QString szButton3Text; // no button is shown if this is empty
+
+ int iMinimumWidth;
+ int iMinimumHeight;
+
+ QPixmap pixIcon; // may be null
+
+ // output
+ int iSelectedButton; // returns 1,2 or 3
+};
+
+class KVIRC_API KviHtmlDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ // the dialog does NOT delete this structure and assumes that
+ // it remains alive until the dialog closes (i.e. it may access
+ // the structure in the destructor
+ KviHtmlDialog(QWidget * pParent,KviHtmlDialogData * pData);
+ ~KviHtmlDialog();
+protected:
+ KviHtmlDialogData * m_pData;
+public:
+ // displays the dialog as modal and returns 1,2 or 3
+ static int display(QWidget * pParent,KviHtmlDialogData * pData);
+protected slots:
+ void button1Pressed();
+ void button2Pressed();
+ void button3Pressed();
+protected:
+ virtual void reject();
+};
+
+
+
+#endif //!_KVI_HTMLDIALOG_H_
diff --git a/src/modules/file/libkvifile.cpp b/src/modules/file/libkvifile.cpp index 74bfe3885..9be088131 100644 --- a/src/modules/file/libkvifile.cpp +++ b/src/modules/file/libkvifile.cpp @@ -452,6 +452,59 @@ static bool file_kvs_fnc_size(KviKvsModuleFunctionCall * c) c->returnValue()->setInteger(f.size()); return true; } +/* + @doc: file.allSizese + @type: + function + @title: + $file.allSizes + @short: + Returns all sizes of a specified directory. + @syntax: + <array> $file.allSize(<dirname:string>) + @description: + Returns the size of every files of the specified directory as an array.[br] +*/ + +static bool file_kvs_fnc_allSizes(KviKvsModuleFunctionCall * c) +{ + QString szDir; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("directory",KVS_PT_NONEMPTYSTRING,0,szDir) + KVSM_PARAMETERS_END(c) + KviFileUtils::adjustFilePath(szDir); + + QDir d(szDir); + if(!d.exists()) + { + c->warning(__tr2qs("The specified directory does not exist '%Q'"),&szDir); + return true; + } + + int iFlags = QDir::Files; + QStringList sl; + sl = d.entryList(iFlags); + + KviKvsArray * a = new KviKvsArray(); + QString szFile; + if(!sl.isEmpty()) + { + int idx = 0; + for(QStringList::Iterator it = sl.begin();it != sl.end();++it) + { + szFile=szDir+(*it); + QFileInfo f(szFile); + a->set(idx,new KviKvsVariant((kvs_int_t)f.size())); + idx++; + } + } + c->returnValue()->setArray(a); + + + + + return true; +} /* @doc: file.fixpath @@ -745,7 +798,6 @@ static bool file_kvs_fnc_read(KviKvsModuleFunctionCall * c) static bool file_kvs_fnc_readLines(KviKvsModuleFunctionCall * c) { QString szName; - kvs_uint_t uSize; QString szFlags; kvs_int_t iStartLine; kvs_int_t iCount; @@ -1172,6 +1224,9 @@ static bool file_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"exists",file_kvs_fnc_exists); KVSM_REGISTER_FUNCTION(m,"type",file_kvs_fnc_type); KVSM_REGISTER_FUNCTION(m,"size",file_kvs_fnc_size); + + KVSM_REGISTER_FUNCTION(m,"allsizes",file_kvs_fnc_allSizes); + KVSM_REGISTER_FUNCTION(m,"fixpath",file_kvs_fnc_fixpath); KVSM_REGISTER_FUNCTION(m,"ps",file_kvs_fnc_ps); KVSM_REGISTER_FUNCTION(m,"read",file_kvs_fnc_read); diff --git a/src/modules/objects/class_listbox.cpp b/src/modules/objects/class_listbox.cpp index 8d9f3381a..93e25aecc 100644 --- a/src/modules/objects/class_listbox.cpp +++ b/src/modules/objects/class_listbox.cpp @@ -98,10 +98,16 @@ This function is called by KVIrc when the selection in the listbox changes. !fn: $currentItemChangeEvent() This function is called by KVIrc when the current item changes. + !fn: <index:integer> $onItemEvent() + This function is called by KVIrc when the current item pointed by the mouse changes and gives in $0 the item index. + @signals: !sg: <string> $currentItemChange() This signal is emitted by the default implementation of [classfnc]$currentItemChangeEvent[/classfnc]().[br] -*/ + !sg: <string> $onItem() + This signal is emitted by the default implementation of [classfnc]$onItemEvent[/classfnc]().[br] + + */ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_listbox,"listbox","widget") @@ -123,7 +129,7 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_listbox,"listbox","widget") KVSO_REGISTER_HANDLER(KviKvsObject_listbox,"setSelected",functionsetSelected); KVSO_REGISTER_HANDLER(KviKvsObject_listbox,"isSelected",functionisSelected); KVSO_REGISTER_HANDLER(KviKvsObject_listbox,"currentItemChangeEvent",functioncurrentItemChangeEvent); - KVSO_REGISTER_HANDLER(KviKvsObject_listbox,"currentnItemEvent",functiononItemEvent); + KVSO_REGISTER_HANDLER(KviKvsObject_listbox,"onItemEvent",functiononItemEvent); KVSO_REGISTER_STANDARD_NOTHINGRETURN_HANDLER(KviKvsObject_listbox,"selectionChangeEvent") @@ -352,7 +358,8 @@ bool KviKvsObject_listbox::functiononItemEvent(KviKvsObjectFunctionCall *c) void KviKvsObject_listbox::onItem(QListBoxItem *item) { - KviKvsVariantList params(new KviKvsVariant(item->text())); + QListBox *lbx(item->listBox()); + KviKvsVariantList params(new KviKvsVariant((kvs_int_t)lbx->index(item))); callFunction(this,"onItemEvent",0,¶ms); } diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp index c066da522..9c252e769 100644 --- a/src/modules/theme/managementdialog.cpp +++ b/src/modules/theme/managementdialog.cpp @@ -69,7 +69,6 @@ #include "kvi_packagefile.h" #include "kvi_fileextensions.h" #include "kvi_filedialog.h" -#include "kvi_dynamictooltip.h" #include <stdlib.h> // rand & srand @@ -117,7 +116,7 @@ KviThemeListBoxItem::~KviThemeListBoxItem() delete m_pText; } -void KviThemeListBoxItem::paint(QPainter * p) +void KviThemeListBoxItem::paint ( QPainter * p ) { QListBoxText::paint(p); p->drawPixmap(LVI_BORDER,LVI_BORDER, *(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME))) ); @@ -127,7 +126,7 @@ void KviThemeListBoxItem::paint(QPainter * p) m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,p->window().height() - (LVI_BORDER * 2)),listBox()->viewport()->colorGroup()); } -int KviThemeListBoxItem::height(const QListBox * lb) const +int KviThemeListBoxItem::height ( const QListBox * lb ) const { int iHeight = m_pText->height() + (2 * LVI_BORDER); if(iHeight < (LVI_ICON_SIZE + (2 * LVI_BORDER)))iHeight = LVI_ICON_SIZE + (2 * LVI_BORDER); @@ -206,8 +205,6 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(enableDisableButtons())); g->addMultiCellWidget(m_pListBox,1,1,0,1); - KviDynamicToolTip * tip = new KviDynamicToolTip(m_pListBox); - connect(tip,SIGNAL(tipRequest(KviDynamicToolTip *,const QPoint &)),this,SLOT(tipRequest(KviDynamicToolTip *,const QPoint &))); QPushButton * b = new QPushButton(__tr2qs("Close"),this); connect(b,SIGNAL(clicked()),this,SLOT(closeClicked())); @@ -241,34 +238,11 @@ void KviThemeManagementDialog::closeClicked() m_pInstance = 0; } -void KviThemeManagementDialog::tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt) -{ - KviThemeListBoxItem * it = (KviThemeListBoxItem *)(m_pListBox->itemAt(pnt)); - if(!it)return; - KviThemeInfo * pThemeInfo = it->themeInfo(); - - QString szThemeDescription; - KviThemeFunctions::getThemeHtmlDescription( - szThemeDescription, - pThemeInfo->name(), - pThemeInfo->version(), - pThemeInfo->description(), - pThemeInfo->subdirectory(), - pThemeInfo->application(), - pThemeInfo->author(), - pThemeInfo->date(), - pThemeInfo->themeEngineVersion(), - pThemeInfo->mediumScreenshot(), - 0 - ); - - pTip->tip(m_pListBox->itemRect(it),szThemeDescription); -} void KviThemeManagementDialog::display() { - if(m_pInstance)return; - m_pInstance = new KviThemeManagementDialog(g_pFrame); + if(!m_pInstance) + m_pInstance = new KviThemeManagementDialog(g_pFrame); m_pInstance->show(); } diff --git a/src/modules/theme/theme_vc05.vcproj b/src/modules/theme/theme_vc05.vcproj index 0d275d635..d4733bc7c 100644 --- a/src/modules/theme/theme_vc05.vcproj +++ b/src/modules/theme/theme_vc05.vcproj @@ -221,6 +221,30 @@ RelativePath=".\moc_managementdialog.cpp"
>
</File>
+ <File
+ RelativePath=".\moc_packthemedialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\moc_savethemedialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\moc_themefunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\packthemedialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\savethemedialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\themefunctions.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
@@ -249,6 +273,45 @@ />
</FileConfiguration>
</File>
+ <File
+ RelativePath=".\packthemedialog.h"
+ >
+ <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>
+ <File
+ RelativePath=".\savethemedialog.h"
+ >
+ <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>
+ <File
+ RelativePath=".\themefunctions.h"
+ >
+ <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"
|
