diff options
Diffstat (limited to 'src/modules/objects')
21 files changed, 120 insertions, 314 deletions
diff --git a/src/modules/objects/class_button.cpp b/src/modules/objects/class_button.cpp index 32763d0b3..2ac81395d 100644 --- a/src/modules/objects/class_button.cpp +++ b/src/modules/objects/class_button.cpp @@ -5,7 +5,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 @@ -58,13 +58,15 @@ !fn: $setImage(<image_id_or_pixmap_object>) Sets the icon for this button. See the [doc:image_id]image identifier[/doc] documentation for the explaination of the <image_id> parameter. - @signals: + !fn: $clickEvent() + Called by KVIrc when the mouse button is clicked. + The default implementation emits the [classfnc]$clicked[/classfnc]()signal. + @signals: !sg: $clicked() This signal is emitted by the default implementation of [classfnc]$clickEvent[/classfnc](). - @properties: + @properties: !pr: $scaledContents() This property holds whether the label will scale its contents to fill all available space. - */ diff --git a/src/modules/objects/class_button.h b/src/modules/objects/class_button.h index 45fe6cd8e..6043319a1 100644 --- a/src/modules/objects/class_button.h +++ b/src/modules/objects/class_button.h @@ -7,7 +7,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 diff --git a/src/modules/objects/class_buttongroup.cpp b/src/modules/objects/class_buttongroup.cpp index 094e441c1..33167c1b8 100644 --- a/src/modules/objects/class_buttongroup.cpp +++ b/src/modules/objects/class_buttongroup.cpp @@ -5,7 +5,7 @@ // by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) // // This file is part of the KVirc irc client distribution -// Copyright (C) 2005 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2009 Alessandro Carbone (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -48,8 +48,8 @@ @description: This object organizes buttons in a group. @functions: - !fn: $addButton(<checkbutton or radiobutton:object>) - Adds the given button to the button group. + !fn: <id:integer> $addButton(<checkbutton or radiobutton:object>) + Adds the given button to the button group and returns an unique identifier. !fn: <object> $checkedButton() Returns the button group's checked button, or 0 if no buttons are checked. */ @@ -57,7 +57,6 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_buttongroup,"buttongroup","object") KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_buttongroup,addButton) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_buttongroup,checkedButton) - KVSO_END_REGISTERCLASS(KviKvsObject_buttongroup) KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_buttongroup,KviKvsObject) diff --git a/src/modules/objects/class_buttongroup.h b/src/modules/objects/class_buttongroup.h index 54975f1b6..1028174ba 100644 --- a/src/modules/objects/class_buttongroup.h +++ b/src/modules/objects/class_buttongroup.h @@ -7,7 +7,7 @@ // by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) // // This file is part of the KVirc irc client distribution -// Copyright (C) 2005 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2009 Alessandro Carbone (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/modules/objects/class_checkbox.cpp b/src/modules/objects/class_checkbox.cpp index 031c71bdd..d808cc968 100644 --- a/src/modules/objects/class_checkbox.cpp +++ b/src/modules/objects/class_checkbox.cpp @@ -5,7 +5,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 @@ -105,6 +105,17 @@ KVSO_CLASS_FUNCTION(checkbox,setChecked) return true; } +KVSO_CLASS_FUNCTION(checkbox,setText) +{ + CHECK_INTERNAL_POINTER(widget()) + QString szText; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("<text>",KVS_PT_STRING,0,szText) + KVSO_PARAMETERS_END(c) + ((QCheckBox *)widget())->setText(szText); + return true; +} + KVSO_CLASS_FUNCTION(checkbox,toggleEvent) { emitSignal("toggled",c,c->params()); diff --git a/src/modules/objects/class_checkbox.h b/src/modules/objects/class_checkbox.h index 54baeb667..9c89e0627 100644 --- a/src/modules/objects/class_checkbox.h +++ b/src/modules/objects/class_checkbox.h @@ -8,7 +8,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 diff --git a/src/modules/objects/class_combobox.cpp b/src/modules/objects/class_combobox.cpp index 628aef9b9..558002711 100644 --- a/src/modules/objects/class_combobox.cpp +++ b/src/modules/objects/class_combobox.cpp @@ -5,7 +5,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 @@ -83,8 +83,7 @@ !fn: $textAt(<index:uint>) Returns item at given index. !fn: $setCurrentItem(<index:uint>) - Sets the current combobox item. This is the item to be - displayed on the combobox button. + Sets the current combobox item. This is the item to be displayed on the combobox button. !fn: $activatedEvent(<index:integer>) This function is called by the framework when a new item has activated. The index value is the position of the new item.[br] The default implementation emits the [classfnc]$activated[/classfnc]() signal, diff --git a/src/modules/objects/class_combobox.h b/src/modules/objects/class_combobox.h index 9a88ead32..4fc5a3aee 100644 --- a/src/modules/objects/class_combobox.h +++ b/src/modules/objects/class_combobox.h @@ -8,7 +8,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 diff --git a/src/modules/objects/class_datetimeedit.cpp b/src/modules/objects/class_datetimeedit.cpp index 763818474..4ffdcfa0d 100644 --- a/src/modules/objects/class_datetimeedit.cpp +++ b/src/modules/objects/class_datetimeedit.cpp @@ -4,7 +4,7 @@ // Creation date : Wed 30 Gen 2009 09:30:05 CEST by Carbone Alessandro // // This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2009 Carbone Alessandro (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -47,8 +47,33 @@ @description: This widget provides a datetimeedit. @functions: - !fn: $setDate([<text:string>]) - !fn: <string> $date([<format:string>]) + !fn: $setDate(<text:string>,<format:string>) + Sets the date of the widget using the format <format>. Possible values for format are: + d the day as number without a leading zero (1 to 31) + dd the day as number with a leading zero (01 to 31) + ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses QDate::shortDayName(). + dddd the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). Uses QDate::longDayName(). + M the month as number without a leading zero (1-12) + MM the month as number with a leading zero (01-12) + MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses QDate::shortMonthName(). + MMMM the long localized month name (e.g. 'January' to 'December'). Uses QDate::longMonthName(). + yy the year as two digit number (00-99) + yyyy the year as four digit number + !fn: <string> $date(<format:string>) + Returns the widget date according to format. + !fn: $setTime(<text:string>,<format:string>) + Sets the date of the widget using the format <format>. Possibile values for format are: + h the hour without a leading zero + hh the hour with a leading zero + m the minute without a leading zero + mm the minute with a leading zero + s the second without a leading zero + ss the second with a leading zero + z the milliseconds without leading zeroes + zzz the milliseconds with leading zeroes + AP(or ap) use AM/PM display. AP will be replaced by either "AM" or "PM". + !fn: $time(<format:string>) + Returns the widget time according to format. */ diff --git a/src/modules/objects/class_datetimeedit.h b/src/modules/objects/class_datetimeedit.h index 5fc23bcda..975557601 100644 --- a/src/modules/objects/class_datetimeedit.h +++ b/src/modules/objects/class_datetimeedit.h @@ -6,8 +6,7 @@ // Creation date : Wed 30 Gen 2009 09:30:05 CEST by Carbone Alessandro // // This file is part of the KVirc irc client distribution -// Copyright (C) 2000 Krzysztof Godlewski -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2009 Carbone Alessandro (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/modules/objects/class_dialog.cpp b/src/modules/objects/class_dialog.cpp index 3b4ab4084..63eb78885 100644 --- a/src/modules/objects/class_dialog.cpp +++ b/src/modules/objects/class_dialog.cpp @@ -4,7 +4,7 @@ // Creation date : Sun Apr 10 22:51:48 CEST 2002 by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 2002-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2002-2009 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 @@ -48,6 +48,7 @@ similar to the widget class, it has only a couple of minor differences. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's windowlist entry. + !fn; setModal (<boolean>) If you call $setModal(1) then the dialog will have non-blocking modal behaviour: it will appear above its parent widget and block its input until it's closed. @functions: diff --git a/src/modules/objects/class_dialog.h b/src/modules/objects/class_dialog.h index bd9097d0e..090108bd2 100644 --- a/src/modules/objects/class_dialog.h +++ b/src/modules/objects/class_dialog.h @@ -6,7 +6,7 @@ // Creation date : Sun Apr 10 22:51:48 CEST 2002 by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 2002-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2002-2009 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 diff --git a/src/modules/objects/class_dockwindow.cpp b/src/modules/objects/class_dockwindow.cpp index 70cbaeaf1..e15c2186f 100644 --- a/src/modules/objects/class_dockwindow.cpp +++ b/src/modules/objects/class_dockwindow.cpp @@ -4,7 +4,7 @@ // Creation date : Thu 29 Dec 2005 23:45:11 by Szymon Stefanek // // This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2005-2008 Szymon Stefanek <pragma at kvirc dot net> +// Copyright (C) 2005-2009 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 @@ -33,7 +33,7 @@ #include <QLayout> /* - @doc: dockwindow + @doc: dockwindow @title: dockwindow class @type: @@ -47,27 +47,21 @@ A window dockable to the KVIrc main frame borders (like a toolbar). @functions: !fn: $addWidget(<widget:hobject>) - Adds <widget> to the internal layout of this dock window.[br] - The widget must be a child of this dock window (otherwise strange things may happen). - !fn: <bool> $resizeEnabled() - Returns $true if resizing of this window is enabled and false otherwise. - !fn: $setResizeEnabled(<bEnabled:bool>) - Enabled or disabled resizing of this window. - !fn: $setAllowedDockAreas(<docks:string>) - Sets the allowed main window dock areas for this dock window.[br] - <docks> must be a combination of "l","r","t","b","f" and "m".[br] - "l" stands for left dock area, "r" stands for right dock area, "t" stands for the top dock areas, "b" stands for the bottom dock area, "f" stands for "floating" and "m" for "minimized".[br] - If a flag is present then the related block area is enabled,otherwise it is disabled. + Adds <widget> to the internal layout of this dock window.[br] + The widget must be a child of this dock window (otherwise strange things may happen). + !fn: $setAllowedDockAreas(<docks:string>) + Sets the allowed main window dock areas for this dock window.[br] + <docks> must be a combination of "l","r","t","b","f" and "m".[br] + "l" stands for left dock area, "r" stands for right dock area, "t" stands for the top dock areas, "b" stands for the bottom dock area, "f" stands for "floating" and "m" for "minimized".[br] + If a flag is present then the related block area is enabled,otherwise it is disabled. !fn: $dock(<dockarea:string>) - Docks this dock window to the specified dockarea of the main KVIrc window which can be one of "l" (left dock area), "t" (top dock area), "r" (right dock area), "b" (bottom dock area), "f" (floating) and "m" (minimized). + Docks this dock window to the specified dockarea of the main KVIrc window which can be one of "l" (left dock area), "t" (top dock area), "r" (right dock area), "b" (bottom dock area), "f" (floating) and "m" (minimized). */ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_dockwindow,"dockwindow","widget") KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,addWidget) - KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,resizeEnabled) - KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,setResizeEnabled) - KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,setAllowedDockAreas) + KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,setAllowedDockAreas) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_dockwindow,dock) KVSO_END_REGISTERCLASS(KviKvsObject_dockwindow) @@ -130,24 +124,7 @@ KVSO_CLASS_FUNCTION(dockwindow,addWidget) _pDockWindow->setWidget((QWidget *)(pWidget->object())); return true; } -// Fix me -KVSO_CLASS_FUNCTION(dockwindow,resizeEnabled) -{ - CHECK_INTERNAL_POINTER(widget()) - c->returnValue()->setBoolean(false); - return true; -} -// Fix me -KVSO_CLASS_FUNCTION(dockwindow,setResizeEnabled) -{ - CHECK_INTERNAL_POINTER(widget()) - bool bResizeEnabled; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bResizeEnabled) - KVSO_PARAMETERS_END(c) - return true; -} KVSO_CLASS_FUNCTION(dockwindow,setAllowedDockAreas) { diff --git a/src/modules/objects/class_dockwindow.h b/src/modules/objects/class_dockwindow.h index 74f784a8b..072a4c4dc 100644 --- a/src/modules/objects/class_dockwindow.h +++ b/src/modules/objects/class_dockwindow.h @@ -6,7 +6,7 @@ // Creation date : Thu 29 Dec 2005 23:45:11 by Szymon Stefanek // // This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2005-2008 Szymon Stefanek <pragma at kvirc dot net> +// Copyright (C) 2005-2009 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 diff --git a/src/modules/objects/class_file.cpp b/src/modules/objects/class_file.cpp index b1b383f5c..dc3c6ea49 100644 --- a/src/modules/objects/class_file.cpp +++ b/src/modules/objects/class_file.cpp @@ -1,11 +1,11 @@ //============================================================================= // -// File : class_memorybuffer.cpp +// File : class_file.cpp // Creation date : Fri Mar 18 21:30:48 CEST 2005 // by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) // // This file is part of the KVirc irc client distribution -// Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2000-2009 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 @@ -235,23 +235,24 @@ KVSO_CLASS_FUNCTION(file,open) { for ( int idx=0;idx<modes.count();idx++) { - mod = QIODevice::ReadOnly; - for(unsigned int j = 0; j < mod_num; j++) + int found=false; + for(unsigned int j = 0; j < mod_num; j++) { - if(KviQString::equalCI(modes.at(idx), mod_tbl[j])) + + if(KviQString::equalCI(modes.at(idx), mod_tbl[j])) { - mod=mod_cod[j]; + mod=mod_cod[j]; + found=true; break; } } - if(mod!=QIODevice::ReadOnly) + if(found) sum = sum | mod; else c->warning(__tr2qs_ctx("No such open mode '%Q'","objects"),&modes.at(idx)); } } - - m_pFile->open(QIODevice::ReadOnly); + c->returnValue()->setBoolean(m_pFile->open(sum)); return true; } @@ -533,8 +534,9 @@ KVSO_CLASS_FUNCTION(file,readLine) CHECK_INTERNAL_POINTER(m_pFile) CHECK_FILE_IS_OPEN QString buffer; - bool ok=KviFileUtils::readLine(m_pFile,buffer); - debug("ok %d",ok); + //bool ok=KviFileUtils::readLine(m_pFile,buffer); + buffer=m_pFile->readLine(); + // debug("ok %d",ok); c->returnValue()->setString(buffer); return true; } diff --git a/src/modules/objects/class_file.h b/src/modules/objects/class_file.h index 0a9337402..fcd6544f6 100644 --- a/src/modules/objects/class_file.h +++ b/src/modules/objects/class_file.h @@ -7,7 +7,7 @@ // by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) // // This file is part of the KVirc irc client distribution -// Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2005-2009 Alessandro Carbone (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/modules/objects/class_ftp.cpp b/src/modules/objects/class_ftp.cpp index 6dbf69f57..2e17c7aed 100644 --- a/src/modules/objects/class_ftp.cpp +++ b/src/modules/objects/class_ftp.cpp @@ -4,7 +4,7 @@ // Creation date : Mon Sep 1 08:13:45 2008 GMT by Carbone Alesssandro // // This file is part of the KVirc irc client distribution -// Copyright (C) 2008 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2009 Alessandro Carbone (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -45,21 +45,42 @@ @description: This class provides a standard FTP functionality.[br] @functions: - !fn: $dataAvailableEvent(<data_length>) + !fn:$dataAvailableEvent(<data_length>) This function is called when some data is available to be read: the <data_length> parameter specifies the length of the available data in bytes.[br] You can use one of the $read* functions to obtain the data. - - !fn: $connect(<host:string>,<remote_port:integer>) + !fn: <id:integer> $connect(<host:string>,<remote_port:integer>) Connects to the FTP server host using port port.The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by commandStarted() and commandFinished().[br] - !fn: $abort() - !fn: $login - !fn: $get - !fn: $cd - !fn: $list - !fn: - */ + !fn:$abort() + Aborts the current command and deletes all scheduled commands. + !fn:<id:integer> $login(<user:string>,<pass:string>) + Logs in to the FTP server with the username user and the password <pass>. + The function returns a unique identifier which is passed by commandStarted() and commandFinished().[br] + !fn:<id:integer> $get(<remotefile:string>,<localfile:string>) + Downloads the <remotefile> file from the server. + !fn:<id:integer> $cd(<remotedir:string>) + Changes the working directory of the server to <remotedir>. + !fn:<id:integer> $list() + Lists the contents of directory dir on the FTP server. + !fn: $commandFinishedEvent(<id:integer>,<error:boolean>) + Called by KVIrc when the ftp command identified by id has finished. + error is true if an error occurred during the processing; otherwise error is false. + The default implementation emits the [classfnc]$commandFinished[/classfnc]() signal. + !fn: $listInfoEvent(<dir_entry_name:string>) + This event is triggered for each directory entry found by [classfnc]$list[/classfnc]() command. + The default implementation emits the [classfnc]$listInfo[/classfnc]() signal. + !fn: $dataTransferProgressEvent(<done:integer>,<total:integer>) + This event is triggered in response to a [classfnc]get[/classfnc]() or [classfnc]put[/classfnc]() request to indicate the current progress of the download or upload. + The default implementation emits the [classfnc]$dataTransferProgress[/classfnc]() signal. + @signals: + !sg: $commandFinished(<id:integer>,<status:string>,<error:boolean>) + This signal is emitted by the default implementation of [classfnc]$commandFinishedEvent[/classfnc]() + !sg: $listInfo(<dir_entry_name:string>) + This signal is emitted by the default implementation of [classfnc]$listInfoEvent[/classfnc]() + !sg: $dataTransferProgress(<done:integer>,<total:integer>) + This signal is emitted by the default implementation of [classfnc]$dataTransferProgressEvent[/classfnc]() +*/ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_ftp,"ftp","object") KVSO_REGISTER_HANDLER(KviKvsObject_ftp,"connect",functionConnect) diff --git a/src/modules/objects/class_ftp.h b/src/modules/objects/class_ftp.h index d12f270d7..69f1deeb5 100644 --- a/src/modules/objects/class_ftp.h +++ b/src/modules/objects/class_ftp.h @@ -6,7 +6,7 @@ // Creation date : Mon Sep 1 08:13:45 2008 GMT by Carbone Alesssandro // // This file is part of the KVirc irc client distribution -// Copyright (C) 2008 Alessandro Carbone (elfonol at gmail dot com) +// Copyright (C) 2009 Alessandro Carbone (elfonol at gmail dot com) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/modules/objects/class_label.cpp b/src/modules/objects/class_label.cpp index b01b7841d..da9e7d867 100644 --- a/src/modules/objects/class_label.cpp +++ b/src/modules/objects/class_label.cpp @@ -245,25 +245,6 @@ KVSO_CLASS_FUNCTION(label,margin) c->returnValue()->setInteger(((QLabel *)widget())->margin()); return true; } -/* -// FIX ME -bool KviKvsObject_label::functionSetAutoResize(KviKvsObjectFunctionCall *c) -{ - bool bEnabled; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) - KVSO_PARAMETERS_END(c) - return true; - -} - -// FIX ME -bool KviKvsObject_label::functionAutoResize(KviKvsObjectFunctionCall *c) -{ - if (widget()) c->returnValue()->setBoolean(true); - return true; -} -*/ KVSO_CLASS_FUNCTION(label,setAlignment) { diff --git a/src/modules/objects/class_layout.cpp b/src/modules/objects/class_layout.cpp index 92839be92..b87636bbb 100644 --- a/src/modules/objects/class_layout.cpp +++ b/src/modules/objects/class_layout.cpp @@ -82,7 +82,7 @@ const int align_cod[] = { Sets the stretch value for a particular row of this layout. The <stretch_value> must be a positive integer. The rows with bigger stretch values will take more space in the layout. - !fn: $setColStretch(<column:uint>,<stretch:uint>) + !fn: $setColumnStretch(<column:uint>,<stretch:uint>) Sets the stretch value for a particular column in this layout. The <stretch_value> must be a positive integer. The rows with bigger stretch values will take more space in the layout. @@ -111,7 +111,6 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_layout,"layout","object") KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,addWidget) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,addMultiCellWidget) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,setRowStretch) - KVSO_REGISTER_HANDLER(KviKvsObject_layout,"setColStretch",setColumnStretch) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,setColumnStretch) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,addRowSpacing) KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_layout,addColSpacing) diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index 12d3cec22..ff3cfeb3d 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -4,7 +4,7 @@ // Creation date : Wed Sep 09 2000 20:59:01 by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 2000-2009 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 @@ -612,215 +612,7 @@ static bool objects_kvs_cmd_disconnect(KviKvsModuleCommandCall * c) } -static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) -{ - /* - @doc: objects.bitblt - @type: - command - @title: - objects.bitblt - @keyterms: - widget pixmap painter - @short: - Copies a block of pixels from a source to a destination. - @syntax: - objects.bitblt <source> <x> <y> <destination> - @description: - Copies a block of pixels from <source> to <destination> at the coordinates <x>,<y> .[br] - Source and destination must be a widget or pixmap.[br] - - */ - - KviKvsObject *obSrc; - KviKvsObject *obDst; - kvs_int_t iXdst,iYdst,iXsrc,iYsrc,uW,uH; - kvs_hobject_t hDst,hSrc; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hDst) - KVSO_PARAMETER("x offset dest",KVS_PT_INT,0,iXdst) - KVSO_PARAMETER("y offset dest",KVS_PT_INT,0,iYdst) - KVSO_PARAMETER("source",KVS_PT_HOBJECT,0,hSrc) - KVSO_PARAMETER("x offset source",KVS_PT_INT,0,iXsrc) - KVSO_PARAMETER("y offset source",KVS_PT_INT,0,iYsrc) - KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uW) - KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uH) - KVSO_PARAMETERS_END(c) - obSrc=KviKvsKernel::instance()->objectController()->lookupObject(hSrc); - if (!obSrc) - { - c->warning(__tr2qs_ctx("Source is not an object","objects")); - return true; - } - obDst=KviKvsKernel::instance()->objectController()->lookupObject(hDst); - if (!obDst) - { - c->warning(__tr2qs_ctx("Destination is not an object","objects")); - return true; - } - - QPaintDevice * pdSource = 0; - - if(obSrc->inheritsClass("pixmap")) pdSource =((KviKvsObject_pixmap *)obSrc)->getPixmap(); - else if (obSrc->inheritsClass("widget")) pdSource=((KviKvsObject_widget *)obSrc)->widget(); - if (!pdSource) - { - c->warning(__tr2qs_ctx("Widget, Image or Pixmap required ","objects")); - return true; - } - QPaintDevice * pdDest = 0; - if(obDst->inheritsClass("pixmap")){ - pdDest= ((KviKvsObject_pixmap *)obDst)->getPixmap(); - } - else if (obDst->inheritsClass("widget")) pdDest=((KviKvsObject_widget *)obDst)->widget(); - if (!pdDest) - { - c->warning(__tr2qs_ctx("Widget or Pixmap required","objects")); - return true; - } - if(obDst->inheritsClass("pixmap")){ - //((KviKvsObject_pixmap *)obDst)->pixmapChanged(); - } - - /*FIXME - QPainter p(pdDest); - QRect rectdest(iXdst,iYdst,uW,uH); - QRect rectsrc(iXsrc,iYsrc,uW,uH); - - p.drawPixmap(rectdest,pdSource,rectsrc); - */ - return true; -} - /* - @doc: objects.blend - @type: - command - @title: - objects.blend - @keyterms: - widget pixmap image - @short: - Blends two images to a destination. - @syntax: - objects.blend <background: image hobject> <x_offset_bkg:unsigned integer> <y_offset_bkg:unsigned integer> - <foreground: image hobject> <x_offset_fgr:unsigned integer> <y_offset_fgr:unsigned integer> - <destination: image, pixmap. widget hobject> <x_offset_dest:unsigned integer> <y_offset_dest:unsigned integer> <width:unsigned integer> <height:unsigned integer> <blend_factor> - @description: - Blends two images <background> and <foreground> and copy the result to <destination> at the coordinates <x_offset>,<y_offset> with a <blend_factor> value .[br] - Destination must be a widget or pixmap.[br] - */ - -static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) -{ -/* KviKvsObject *obFor; - KviKvsObject *obBck; - KviKvsObject *obDest; - - kvs_int_t iBkX,iBkY; - kvs_int_t iFoX,iFoY; - kvs_int_t iDesX,iDesY,uW,uH; - kvs_real_t dBlend; - - kvs_hobject_t hBk,hFo,hDest; - - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("destination",KVS_PT_HOBJECT,0,hDest) - KVSO_PARAMETER("x_offset_dest",KVS_PT_INT,0,iDesX) - KVSO_PARAMETER("y_offset_dest",KVS_PT_INT,0,iDesY) - - KVSO_PARAMETER("image_background",KVS_PT_HOBJECT,0,hBk) - KVSO_PARAMETER("x_offset_background",KVS_PT_UNSIGNEDINTEGER,0,iBkX) - KVSO_PARAMETER("y_offset_background",KVS_PT_UNSIGNEDINTEGER,0,iBkY) - KVSO_PARAMETER("image_foreground",KVS_PT_HOBJECT,0,hFo) - KVSO_PARAMETER("x_offset_foreground",KVS_PT_UNSIGNEDINTEGER,0,iFoX) - KVSO_PARAMETER("y_offset_foreground",KVS_PT_UNSIGNEDINTEGER,0,iFoY) - KVSO_PARAMETER("width",KVS_PT_UNSIGNEDINTEGER,0,uW) - KVSO_PARAMETER("height",KVS_PT_UNSIGNEDINTEGER,0,uH) - - KVSO_PARAMETER("blend_value",KVS_PT_REAL,0,dBlend) - - - - KVSO_PARAMETERS_END(c) - - obFor=KviKvsKernel::instance()->objectController()->lookupObject(hFo); - - - obBck=KviKvsKernel::instance()->objectController()->lookupObject(hBk); - obDest=KviKvsKernel::instance()->objectController()->lookupObject(hDest); - if (!obFor || !obBck || !obDest) - { - c->warning(__tr2qs_ctx("One or more of background, foreground or destination aren't objects","objects")); - return true; - } - - if (!obBck->inheritsClass("pixmap") || !obFor->inherits("KviKvsObject_pixmap")) - { - c->warning(__tr2qs_ctx("Pixmap objects required","objects")); - return true; - } - - QPaintDevice * pdDest = 0; - if(obDest->inheritsClass("pixmap")) pdDest = ((KviKvsObject_pixmap *)obDest)->getPixmap(); - else if (obDest->inheritsClass("widget")) pdDest=((KviKvsObject_widget *)obDest)->widget(); - - if (!pdDest) - { - c->warning(__tr2qs_ctx("Widget or Pixmap required ","objects")); - return true; - } - -// if(obDest->inheritsClass("pixmap")) ((KviKvsObject_pixmap *)obDest)->pixmapChanged(); - - - //QImage *img_back=((KviKvsObject_pixmap *)obBck)->getImage(); - //QImage *img_fore=((KviKvsObject_pixmap *)obFor)->getImage(); - - // check size - if ((iBkX+uW>img_back->width())||(iBkY+uH>img_back->height())) - { - c->warning(__tr2qs_ctx("Values for background are out of image size ","objects")); - return true; - } - if ((iFoX+uW>img_fore->width())||(iFoY+uH>img_fore->height())) - { - c->warning(__tr2qs_ctx("Values for foreground are out of image size ","objects")); - return true; - } - QImage buffer; - buffer = QImage(uW,uH,QImage::Format_ARGB32); - for(int y = 0;y < buffer.height();y++) - { - QRgb * dst = (QRgb *)buffer.scanLine(y); - QRgb * end = dst + buffer.width(); - QRgb * bkg = (QRgb *)img_back->scanLine(y+iBkY); - bkg += iBkX; - QRgb * fgn = (QRgb *)img_fore->scanLine(y+iFoY); - fgn += iFoX; - double dRemaining = 1.0 - dBlend; - - while(dst < end) - { - *dst = qRgba( - (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * dBlend)), - (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * dBlend)), - (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * dBlend)), - (int)((qAlpha(*bkg) * dRemaining) + (qAlpha(*fgn) * dBlend)) - ); - - dst++; - bkg++; - fgn++; - } - } - QPainter p(pdDest); - QRect rect(iDesX,iDesY,buffer.width(),buffer.height()); - p.drawImage(rect,buffer); - */ - return true; - -} // ASSASSINS! YOU MUST INDENT IT WELL :D @@ -950,8 +742,6 @@ static bool objects_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"variables",objects_kvs_fnc_variables); // commands - KVSM_REGISTER_SIMPLE_COMMAND(m,"bitblt",objects_kvs_cmd_bitBlt); - KVSM_REGISTER_SIMPLE_COMMAND(m,"blend",objects_kvs_cmd_blend); KVSM_REGISTER_SIMPLE_COMMAND(m,"clearObjects",objects_kvs_cmd_clearObjects); KVSM_REGISTER_SIMPLE_COMMAND(m,"connect",objects_kvs_cmd_connect); KVSM_REGISTER_SIMPLE_COMMAND(m,"disconnect",objects_kvs_cmd_disconnect); |
