aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Fabio Bas2011-05-08 22:25:35 +0000
committerGravatar Fabio Bas2011-05-08 22:25:35 +0000
commit3d8714d797ce5b09cea2e3b36edee2fc231f28a1 (patch)
tree5b13cd3775c52333155ff349f3e45dc24b271b04
parentFix fix (diff)
downloadKVIrc-3d8714d797ce5b09cea2e3b36edee2fc231f28a1.tar.gz
KVIrc-3d8714d797ce5b09cea2e3b36edee2fc231f28a1.tar.bz2
KVIrc-3d8714d797ce5b09cea2e3b36edee2fc231f28a1.zip
Objects module: fixed indentation (2nd part)
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5837 17fca916-40b9-46aa-a4ea-0a15b648b75c
-rw-r--r--src/modules/objects/KvsObject_button.cpp16
-rw-r--r--src/modules/objects/KvsObject_buttonGroup.cpp4
-rw-r--r--src/modules/objects/KvsObject_checkBox.cpp14
-rw-r--r--src/modules/objects/KvsObject_colorDialog.cpp23
-rw-r--r--src/modules/objects/KvsObject_comboBox.cpp2
-rw-r--r--src/modules/objects/KvsObject_dateTimeEdit.cpp146
-rw-r--r--src/modules/objects/KvsObject_dateTimeEdit.h10
-rw-r--r--src/modules/objects/KvsObject_dialog.cpp2
-rw-r--r--src/modules/objects/KvsObject_dockWindow.cpp20
-rw-r--r--src/modules/objects/KvsObject_dockWindow.h2
-rw-r--r--src/modules/objects/KvsObject_file.cpp23
-rw-r--r--src/modules/objects/KvsObject_groupBox.cpp2
-rw-r--r--src/modules/objects/KvsObject_http.cpp97
-rw-r--r--src/modules/objects/KvsObject_layout.cpp2
-rw-r--r--src/modules/objects/KvsObject_lineEdit.cpp124
-rw-r--r--src/modules/objects/KvsObject_lineEdit.h10
-rw-r--r--src/modules/objects/KvsObject_list.cpp8
-rw-r--r--src/modules/objects/KvsObject_listWidget.cpp46
-rw-r--r--src/modules/objects/KvsObject_mainWindow.cpp6
-rw-r--r--src/modules/objects/KvsObject_memoryBuffer.cpp5
-rw-r--r--src/modules/objects/KvsObject_menuBar.h2
-rw-r--r--src/modules/objects/KvsObject_multiLineEdit.cpp62
-rw-r--r--src/modules/objects/KvsObject_painter.cpp483
-rw-r--r--src/modules/objects/KvsObject_painter.h6
-rw-r--r--src/modules/objects/KvsObject_popupMenu.cpp6
-rw-r--r--src/modules/objects/KvsObject_process.cpp34
-rw-r--r--src/modules/objects/KvsObject_progressBar.cpp4
-rw-r--r--src/modules/objects/KvsObject_slider.cpp10
-rw-r--r--src/modules/objects/KvsObject_socket.cpp6
-rw-r--r--src/modules/objects/KvsObject_socket.h4
-rw-r--r--src/modules/objects/KvsObject_spinBox.cpp6
-rw-r--r--src/modules/objects/KvsObject_sql.cpp887
-rw-r--r--src/modules/objects/KvsObject_sql.h66
-rw-r--r--src/modules/objects/KvsObject_tabWidget.cpp21
-rw-r--r--src/modules/objects/KvsObject_tableWidget.cpp16
-rw-r--r--src/modules/objects/KvsObject_tableWidget.h1
-rw-r--r--src/modules/objects/KvsObject_toolButton.cpp12
-rw-r--r--src/modules/objects/KvsObject_trayIcon.cpp244
-rw-r--r--src/modules/objects/KvsObject_trayIcon.h25
-rw-r--r--src/modules/objects/KvsObject_treeWidget.cpp267
-rw-r--r--src/modules/objects/KvsObject_treeWidget.h4
-rw-r--r--src/modules/objects/KvsObject_treeWidgeteItem.cpp120
-rw-r--r--src/modules/objects/KvsObject_treeWidgeteItem.h4
-rw-r--r--src/modules/objects/KvsObject_vBox.cpp12
44 files changed, 1426 insertions, 1438 deletions
diff --git a/src/modules/objects/KvsObject_button.cpp b/src/modules/objects/KvsObject_button.cpp
index 1730379ae..511934d3f 100644
--- a/src/modules/objects/KvsObject_button.cpp
+++ b/src/modules/objects/KvsObject_button.cpp
@@ -58,15 +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.
- !fn: $clickEvent()
- Called by KVIrc when the mouse button is clicked.
- The default implementation emits the [classfnc]$clicked[/classfnc]()signal.
- @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:
- !pr: $scaledContents()
- This property holds whether the label will scale its contents to fill all available space.
+ @properties:
+ !pr: $scaledContents()
+ This property holds whether the label will scale its contents to fill all available space.
*/
@@ -91,7 +91,7 @@ KVSO_END_DESTRUCTOR(KvsObject_button)
bool KvsObject_button::init(KviKvsRunTimeContext *,KviKvsVariantList *)
{
SET_OBJECT(QPushButton);
- connect(widget(),SIGNAL(clicked()),this,SLOT(slotClicked()));
+ connect(widget(),SIGNAL(clicked()),this,SLOT(slotClicked()));
return true;
}
diff --git a/src/modules/objects/KvsObject_buttonGroup.cpp b/src/modules/objects/KvsObject_buttonGroup.cpp
index 82f4c1f89..356946d64 100644
--- a/src/modules/objects/KvsObject_buttonGroup.cpp
+++ b/src/modules/objects/KvsObject_buttonGroup.cpp
@@ -67,8 +67,8 @@ KVSO_END_CONSTRUCTOR(KvsObject_buttonGroup)
KVSO_BEGIN_DESTRUCTOR(KvsObject_buttonGroup)
-btnDict.clear();
-delete m_pButtonGroup;
+ btnDict.clear();
+ delete m_pButtonGroup;
KVSO_END_CONSTRUCTOR(KvsObject_buttonGroup)
diff --git a/src/modules/objects/KvsObject_checkBox.cpp b/src/modules/objects/KvsObject_checkBox.cpp
index 17daa7113..60638d793 100644
--- a/src/modules/objects/KvsObject_checkBox.cpp
+++ b/src/modules/objects/KvsObject_checkBox.cpp
@@ -108,13 +108,13 @@ KVSO_CLASS_FUNCTION(checkBox,setChecked)
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;
+ 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)
diff --git a/src/modules/objects/KvsObject_colorDialog.cpp b/src/modules/objects/KvsObject_colorDialog.cpp
index cd80b224b..986ffcb0c 100644
--- a/src/modules/objects/KvsObject_colorDialog.cpp
+++ b/src/modules/objects/KvsObject_colorDialog.cpp
@@ -39,9 +39,9 @@ const char * const option_tbl[] = {
};
const int option_cod[] = {
- QColorDialog::ShowAlphaChannel,
- QColorDialog::NoButtons,
- QColorDialog::DontUseNativeDialog
+ QColorDialog::ShowAlphaChannel,
+ QColorDialog::NoButtons,
+ QColorDialog::DontUseNativeDialog
};
#define option_num (sizeof(option_tbl) / sizeof(option_tbl[0]))
@@ -144,16 +144,17 @@ KVSO_CLASS_FUNCTION(colorDialog,setCurrentColor)
c->error(__tr2qs_ctx("One of the triplette parameters didn't evaluate to an integer","objects"));\
return true;
}
- if (c->paramCount()<4) iOpacity=255;
+ if (c->paramCount()<4)
+ iOpacity=255;
else
{
- if (c->paramCount()>4)
- {
- if(KviQString::equalCI(szColorMode, "HSV"))
- col.setHsv(iCol1,iCol2,iCol3,iOpacity);
- else
- col.setRgb(iCol1,iCol2,iCol3,iOpacity);
- }
+ if (c->paramCount()>4)
+ {
+ if(KviQString::equalCI(szColorMode, "HSV"))
+ col.setHsv(iCol1,iCol2,iCol3,iOpacity);
+ else
+ col.setRgb(iCol1,iCol2,iCol3,iOpacity);
+ }
}
col.setAlpha(iOpacity);
}
diff --git a/src/modules/objects/KvsObject_comboBox.cpp b/src/modules/objects/KvsObject_comboBox.cpp
index 83dfc51ab..8951e4200 100644
--- a/src/modules/objects/KvsObject_comboBox.cpp
+++ b/src/modules/objects/KvsObject_comboBox.cpp
@@ -355,7 +355,7 @@ void KvsObject_comboBox::editTextChanged(const QString &text)
void KvsObject_comboBox::slotActivated(int i)
{
- KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i));
+ KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i));
callFunction(this,"activatedEvent",&params);
}
diff --git a/src/modules/objects/KvsObject_dateTimeEdit.cpp b/src/modules/objects/KvsObject_dateTimeEdit.cpp
index 77f4b02e5..cc3a2af71 100644
--- a/src/modules/objects/KvsObject_dateTimeEdit.cpp
+++ b/src/modules/objects/KvsObject_dateTimeEdit.cpp
@@ -31,58 +31,58 @@
#include "KvsObject_dateTimeEdit.h"
#include "KvsObject_pixmap.h"
- #include <QDateTimeEdit>
+#include <QDateTimeEdit>
/*
- @doc:datetimeedit
+ @doc:datetimeedit
@title:
- datetimeedit class
+ datetimeedit class
@type:
class
@short:
- Datetimeedit widget.
+ Datetimeedit widget.
@inherits:
[class]object[/class]
- [class]widget[/class]
+ [class]widget[/class]
@description:
- This widget provides a datetimeedit.
+ This widget provides a datetimeedit.
@functions:
- !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.
+ !fn: $setDate(<text:string>,<format:string>)
+ Sets the date of the widget using the format <format>. Possible values for format are:
+ [br]d the day as number without a leading zero (1 to 31)
+ [br]dd the day as number with a leading zero (01 to 31)
+ [br]ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses QDate::shortDayName().
+ [br]dddd the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). Uses QDate::longDayName().
+ [br]M the month as number without a leading zero (1-12)
+ [br]MM the month as number with a leading zero (01-12)
+ [br]MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses QDate::shortMonthName().
+ [br]MMMM the long localized month name (e.g. 'January' to 'December'). Uses QDate::longMonthName().
+ [br]yy the year as two digit number (00-99)
+ [br]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:
+ [br]h the hour without a leading zero
+ [br]hh the hour with a leading zero
+ [br]m the minute without a leading zero
+ [br]mm the minute with a leading zero
+ [br]s the second without a leading zero
+ [br]ss the second with a leading zero
+ [br]z the milliseconds without leading zeroes
+ [br]zzz the milliseconds with leading zeroes
+ [br]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.
*/
KVSO_BEGIN_REGISTERCLASS(KvsObject_dateTimeEdit,"datetimeedit","widget")
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,date)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,setDate)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,setTime)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,time)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,date)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,setDate)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,setTime)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,time)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,timeChangedEvent)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,dateTimeChangedEvent)
@@ -101,8 +101,8 @@ KVSO_END_DESTRUCTOR(KvsObject_dateTimeEdit)
bool KvsObject_dateTimeEdit::init(KviKvsRunTimeContext *,KviKvsVariantList *)
{
- QDateTimeEdit *obj=new QDateTimeEdit(QDate::currentDate(),parentScriptWidget());
- obj->setObjectName(getName());
+ QDateTimeEdit *obj=new QDateTimeEdit(QDate::currentDate(),parentScriptWidget());
+ obj->setObjectName(getName());
connect(obj,SIGNAL(dateChanged(const QDate &)),this,SLOT(slotDateChanged(const QDate &)));
connect(obj,SIGNAL(dateTimeChanged(const QDateTime & )),this,SLOT(slotDateTimeChanged(const QDateTime &)));
connect(obj,SIGNAL(timeChanged(const QTime &)),this,SLOT(slotTimeChanged(const QTime &)));
@@ -114,56 +114,56 @@ bool KvsObject_dateTimeEdit::init(KviKvsRunTimeContext *,KviKvsVariantList *)
KVSO_CLASS_FUNCTION(dateTimeEdit,date)
{
- CHECK_INTERNAL_POINTER(widget())
- QString szFormat;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
- KVSO_PARAMETERS_END(c)
+ CHECK_INTERNAL_POINTER(widget())
+ QString szFormat;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
+ KVSO_PARAMETERS_END(c)
- c->returnValue()->setString(((QDateTimeEdit *)widget())->date().toString(szFormat));
+ c->returnValue()->setString(((QDateTimeEdit *)widget())->date().toString(szFormat));
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(dateTimeEdit,setDate)
{
- CHECK_INTERNAL_POINTER(widget())
- QString szFormat,szDate;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
- KVSO_PARAMETER("date",KVS_PT_STRING,0,szDate)
- KVSO_PARAMETERS_END(c)
- QDate date;
- date=date.fromString(szDate,szFormat);
- ((QDateTimeEdit *)widget())->setDate(date);
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ QString szFormat,szDate;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
+ KVSO_PARAMETER("date",KVS_PT_STRING,0,szDate)
+ KVSO_PARAMETERS_END(c)
+ QDate date;
+ date=date.fromString(szDate,szFormat);
+ ((QDateTimeEdit *)widget())->setDate(date);
+ return true;
}
KVSO_CLASS_FUNCTION(dateTimeEdit,time)
{
- CHECK_INTERNAL_POINTER(widget())
- QString szFormat;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
- KVSO_PARAMETERS_END(c)
+ CHECK_INTERNAL_POINTER(widget())
+ QString szFormat;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
+ KVSO_PARAMETERS_END(c)
- c->returnValue()->setString(((QDateTimeEdit *)widget())->time().toString(szFormat));
+ c->returnValue()->setString(((QDateTimeEdit *)widget())->time().toString(szFormat));
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(dateTimeEdit,setTime)
{
- CHECK_INTERNAL_POINTER(widget())
- QString szFormat,szTime;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
- KVSO_PARAMETER("date",KVS_PT_STRING,0,szTime)
- KVSO_PARAMETERS_END(c)
- QTime time;
- time=time.fromString(szTime,szFormat);
- ((QDateTimeEdit *)widget())->setTime(time);
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ QString szFormat,szTime;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
+ KVSO_PARAMETER("date",KVS_PT_STRING,0,szTime)
+ KVSO_PARAMETERS_END(c)
+ QTime time;
+ time=time.fromString(szTime,szFormat);
+ ((QDateTimeEdit *)widget())->setTime(time);
+ return true;
}
// slots
diff --git a/src/modules/objects/KvsObject_dateTimeEdit.h b/src/modules/objects/KvsObject_dateTimeEdit.h
index 981ebc7eb..4b67a3a51 100644
--- a/src/modules/objects/KvsObject_dateTimeEdit.h
+++ b/src/modules/objects/KvsObject_dateTimeEdit.h
@@ -37,16 +37,16 @@ class KvsObject_dateTimeEdit : public KvsObject_widget
{
Q_OBJECT
public:
- KVSO_DECLARE_OBJECT(KvsObject_dateTimeEdit)
+ KVSO_DECLARE_OBJECT(KvsObject_dateTimeEdit)
public:
QWidget * widget() { return (QWidget *)object(); };
protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
- bool date(KviKvsObjectFunctionCall *c);
- bool setDate(KviKvsObjectFunctionCall *c);
- bool time(KviKvsObjectFunctionCall *c);
- bool setTime(KviKvsObjectFunctionCall *c);
+ bool date(KviKvsObjectFunctionCall *c);
+ bool setDate(KviKvsObjectFunctionCall *c);
+ bool time(KviKvsObjectFunctionCall *c);
+ bool setTime(KviKvsObjectFunctionCall *c);
bool timeChangedEvent(KviKvsObjectFunctionCall *c);
bool dateTimeChangedEvent(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/KvsObject_dialog.cpp b/src/modules/objects/KvsObject_dialog.cpp
index f3feb53ff..3752490d9 100644
--- a/src/modules/objects/KvsObject_dialog.cpp
+++ b/src/modules/objects/KvsObject_dialog.cpp
@@ -48,7 +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>)
+ !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/KvsObject_dockWindow.cpp b/src/modules/objects/KvsObject_dockWindow.cpp
index 38a3246e0..e93096899 100644
--- a/src/modules/objects/KvsObject_dockWindow.cpp
+++ b/src/modules/objects/KvsObject_dockWindow.cpp
@@ -33,7 +33,7 @@
#include <QLayout>
/*
- @doc: dockwindow
+ @doc: dockwindow
@title:
dockwindow class
@type:
@@ -47,21 +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: $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(KvsObject_dockWindow,"dockwindow","widget")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,addWidget)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,setAllowedDockAreas)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,setAllowedDockAreas)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,dock)
KVSO_END_REGISTERCLASS(KvsObject_dockWindow)
diff --git a/src/modules/objects/KvsObject_dockWindow.h b/src/modules/objects/KvsObject_dockWindow.h
index df6a4a6e1..38ab7a006 100644
--- a/src/modules/objects/KvsObject_dockWindow.h
+++ b/src/modules/objects/KvsObject_dockWindow.h
@@ -37,7 +37,7 @@ protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
bool addWidget(KviKvsObjectFunctionCall *c);
- bool setAllowedDockAreas(KviKvsObjectFunctionCall * c);
+ bool setAllowedDockAreas(KviKvsObjectFunctionCall * c);
bool dock(KviKvsObjectFunctionCall * c);
};
diff --git a/src/modules/objects/KvsObject_file.cpp b/src/modules/objects/KvsObject_file.cpp
index f8b5c8870..bfc827588 100644
--- a/src/modules/objects/KvsObject_file.cpp
+++ b/src/modules/objects/KvsObject_file.cpp
@@ -90,7 +90,7 @@ const QIODevice::OpenMode mod_cod[] = {
Attempts to open the file in specified mode or modes "sum".
Valid modes are:[br]
[pre]
- Raw - raw, non-buffered access[br]
+ Raw - raw, non-buffered access[br]
ReadOnly - opens the file read-only[br]
WriteOnly - opens the file write-only[br]
ReadWrite - opens the file in read-write mode[br]
@@ -235,24 +235,23 @@ KVSO_CLASS_FUNCTION(file,open)
{
for ( int idx=0;idx<modes.count();idx++)
{
- int found=false;
- 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];
- found=true;
+ mod=mod_cod[j];
+ found=true;
break;
}
}
- if(found)
+ if(found)
sum = sum | mod;
else
c->warning(__tr2qs_ctx("No such open mode '%Q'","objects"),&modes.at(idx));
}
}
- c->returnValue()->setBoolean(m_pFile->open(sum));
+ c->returnValue()->setBoolean(m_pFile->open(sum));
return true;
}
@@ -560,9 +559,9 @@ KVSO_CLASS_FUNCTION(file,readLine)
CHECK_INTERNAL_POINTER(m_pFile)
CHECK_FILE_IS_OPEN
QString buffer;
- //bool ok=KviFileUtils::readLine(m_pFile,buffer);
- buffer=m_pFile->readLine();
- c->returnValue()->setString(buffer);
+ //bool ok=KviFileUtils::readLine(m_pFile,buffer);
+ buffer=m_pFile->readLine();
+ c->returnValue()->setString(buffer);
return true;
}
diff --git a/src/modules/objects/KvsObject_groupBox.cpp b/src/modules/objects/KvsObject_groupBox.cpp
index 03042d795..ccc8a2d41 100644
--- a/src/modules/objects/KvsObject_groupBox.cpp
+++ b/src/modules/objects/KvsObject_groupBox.cpp
@@ -260,7 +260,7 @@ KVSO_CLASS_FUNCTION(groupBox,setInsideSpacing)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("spacing",KVS_PT_UNSIGNEDINTEGER,0,uSpacing)
KVSO_PARAMETERS_END(c)
- ((KviTalGroupBox *)widget())->setInsideSpacing(uSpacing);
+ ((KviTalGroupBox *)widget())->setInsideSpacing(uSpacing);
return true;
}
KVSO_CLASS_FUNCTION(groupBox,insideSpacing)
diff --git a/src/modules/objects/KvsObject_http.cpp b/src/modules/objects/KvsObject_http.cpp
index c0adda535..91c9e8db2 100644
--- a/src/modules/objects/KvsObject_http.cpp
+++ b/src/modules/objects/KvsObject_http.cpp
@@ -198,15 +198,15 @@ KVSO_END_CONSTRUCTOR(KvsObject_http)
KVSO_BEGIN_DESTRUCTOR(KvsObject_http)
QHashIterator<int,QFile *> t(getDict);
- while (t.hasNext())
- {
- t.next();
- int key=t.key();
- QFile *pFile=getDict.value(key);
- pFile->close();
- delete pFile;
- }
- getDict.clear();
+ while (t.hasNext())
+ {
+ t.next();
+ int key=t.key();
+ QFile *pFile=getDict.value(key);
+ pFile->close();
+ delete pFile;
+ }
+ getDict.clear();
delete m_pHttp;
KVSO_END_DESTRUCTOR(KvsObject_http)
@@ -316,8 +316,9 @@ bool KvsObject_http::functionPost(KviKvsObjectFunctionCall *c)
QFile *pFile=0;
if (!szDest.isEmpty()){
pFile=new QFile(szDest);
- if (pFile){
- pFile->open(QIODevice::WriteOnly);
+ if (pFile)
+ {
+ pFile->open(QIODevice::WriteOnly);
}
}
if (szPath.isEmpty()) szPath="/";
@@ -358,43 +359,43 @@ bool KvsObject_http::functionFollowRedirect(KviKvsObjectFunctionCall *c)
bool KvsObject_http::functionRequestFinishedEvent(KviKvsObjectFunctionCall *c)
{
- emitSignal("requestFinished",c,c->params());
+ emitSignal("requestFinished",c,c->params());
return true;
}
void KvsObject_http::slotRequestFinished ( int id, bool error )
{
- if (m_bAbort)
- {
- m_bAbort=false;
- QHashIterator<int,QFile *> t(getDict);
- while (t.hasNext())
- {
- t.next();
- int key=t.key();
- QFile *pFile=getDict.value(key);
- pFile->close();
- delete pFile;
- }
- getDict.clear();
- return;
- }
- QFile *pFile=getDict.value(id);
- if (pFile)
- {
- QString name=pFile->fileName();
- pFile->close();
- getDict.remove(id);
- int res=m_pHttp->lastResponse().statusCode();
- if ((res==301 || res==302 || res==307) && m_bEnableForceRedirect)
- redirect(name,m_pHttp->lastResponse());
- delete pFile;
- }
- KviKvsVariantList lParams;
- lParams.append(new KviKvsVariant((kvs_int_t) id));
- lParams.append(new KviKvsVariant(error));
- callFunction(this,"requestFinishedEvent",0,&lParams);
+ if (m_bAbort)
+ {
+ m_bAbort=false;
+ QHashIterator<int,QFile *> t(getDict);
+ while (t.hasNext())
+ {
+ t.next();
+ int key=t.key();
+ QFile *pFile=getDict.value(key);
+ pFile->close();
+ delete pFile;
+ }
+ getDict.clear();
+ return;
+ }
+ QFile *pFile=getDict.value(id);
+ if (pFile)
+ {
+ QString name=pFile->fileName();
+ pFile->close();
+ getDict.remove(id);
+ int res=m_pHttp->lastResponse().statusCode();
+ if ((res==301 || res==302 || res==307) && m_bEnableForceRedirect)
+ redirect(name,m_pHttp->lastResponse());
+ delete pFile;
+ }
+ KviKvsVariantList lParams;
+ lParams.append(new KviKvsVariant((kvs_int_t) id));
+ lParams.append(new KviKvsVariant(error));
+ callFunction(this,"requestFinishedEvent",0,&lParams);
}
bool KvsObject_http::functionRequestStartedEvent(KviKvsObjectFunctionCall *c)
@@ -476,13 +477,13 @@ void KvsObject_http::slotResponseHeaderReceived(const QHttpResponseHeader &r)
case 303: szResponse="See Other" ;break;
case 307: szResponse="Temporary Redirect" ;break;
default: szResponse=r.reasonPhrase();
- m_bAbort=true;
+ m_bAbort=true;
+ }
+ if (r.statusCode()==400)
+ {
+ m_bAbort=true;
+ m_pHttp->abort();
}
- if (r.statusCode()==400)
- {
- m_bAbort=true;
- m_pHttp->abort();
- }
KviKvsVariantList lParams;
lParams.append(new KviKvsVariant(szResponse));
callFunction(this,"responseHeaderReceivedEvent",0,&lParams);
diff --git a/src/modules/objects/KvsObject_layout.cpp b/src/modules/objects/KvsObject_layout.cpp
index 8d923da2e..26588041a 100644
--- a/src/modules/objects/KvsObject_layout.cpp
+++ b/src/modules/objects/KvsObject_layout.cpp
@@ -226,7 +226,7 @@ KVSO_CLASS_FUNCTION(layout,setSpacing)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("spacing",KVS_PT_UNSIGNEDINTEGER,0,uSpacing)
KVSO_PARAMETERS_END(c)
- ((QGridLayout *)object())->setSpacing(uSpacing);
+ ((QGridLayout *)object())->setSpacing(uSpacing);
return true;
}
diff --git a/src/modules/objects/KvsObject_lineEdit.cpp b/src/modules/objects/KvsObject_lineEdit.cpp
index be41500da..c10def50b 100644
--- a/src/modules/objects/KvsObject_lineEdit.cpp
+++ b/src/modules/objects/KvsObject_lineEdit.cpp
@@ -134,10 +134,10 @@ static const int mode_cod[] = {
Sets the validation input mask to inputMask.[br]
Example:[br]
[br]
- %ledit_example->$setInputMask( "+99 99 99 99 99;_" );[br]
- %ledit_example->$setInputMask( "000.000.000.000;_" );[br]
- %ledit_example->Ip Number Mask.[br]
- %ledit_example->setInputMask( ">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#" );[br]
+ %ledit_example->$setInputMask( "+99 99 99 99 99;_" );[br]
+ %ledit_example->$setInputMask( "000.000.000.000;_" );[br]
+ %ledit_example->Ip Number Mask.[br]
+ %ledit_example->setInputMask( ">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#" );[br]
[br]
The mask format understands these mask characters:[br]
Character Meaning[br]
@@ -166,18 +166,18 @@ static const int mode_cod[] = {
Called when the lineedit lost focus.
!fn: $textChangedEvent(<new text:string>)
This event is called when the text changed, In $0 there is the new text.
- !fn: $setCompleter(<completion_mode:string>,<items:stringlist>)
- Provides completions based on an stringlist.
- Valid completion_mode are:
- PopupCompletion: Current completions are displayed in a popup below the lineedit.
- UnfilteredPopupCompletion: All possible completions are displayed in a popup window with the most likely suggestion selected.
- InlineCompletion: Completions appear as selected text.
- !fn: $disableCompleter()
- Disable temporally the completer.
- !fn: $enableCompleter()
- Enable the completer.
- !fn: $removeCompleter()
- Remove the completer.
+ !fn: $setCompleter(<completion_mode:string>,<items:stringlist>)
+ Provides completions based on an stringlist.
+ Valid completion_mode are:
+ PopupCompletion: Current completions are displayed in a popup below the lineedit.
+ UnfilteredPopupCompletion: All possible completions are displayed in a popup window with the most likely suggestion selected.
+ InlineCompletion: Completions appear as selected text.
+ !fn: $disableCompleter()
+ Disable temporally the completer.
+ !fn: $enableCompleter()
+ Enable the completer.
+ !fn: $removeCompleter()
+ Remove the completer.
@signals:
!sg: $returnPressed()
This signal is emitted by the default implementation of [classfnc]$returnPressedEvent[/classfnc]().
@@ -195,11 +195,11 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_lineEdit,"lineedit","widget")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,text)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,setText)
- // completer
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,setCompleter)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,enableCompleter)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,disableCompleter)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,unsetCompleter)
+ // completer
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,setCompleter)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,enableCompleter)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,disableCompleter)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,unsetCompleter)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,maxLength)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,setMaxLength)
@@ -228,15 +228,15 @@ KVSO_END_REGISTERCLASS(KvsObject_lineEdit)
KVSO_BEGIN_CONSTRUCTOR(KvsObject_lineEdit,KvsObject_widget)
-m_pCompleter=0;
+ m_pCompleter=0;
KVSO_END_CONSTRUCTOR(KvsObject_lineEdit)
KVSO_BEGIN_DESTRUCTOR(KvsObject_lineEdit)
-if (m_pCompleter)
-{
- delete m_pCompleter;
- m_pCompleter=0;
-}
+ if (m_pCompleter)
+ {
+ delete m_pCompleter;
+ m_pCompleter=0;
+ }
KVSO_END_CONSTRUCTOR(KvsObject_lineEdit)
@@ -286,8 +286,8 @@ KVSO_CLASS_FUNCTION(lineEdit,maxLength)
KVSO_CLASS_FUNCTION(lineEdit,setMaxLength)
{
- CHECK_INTERNAL_POINTER(widget())
- kvs_uint_t iMaxlen;
+ CHECK_INTERNAL_POINTER(widget())
+ kvs_uint_t iMaxlen;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("maxlen",KVS_PT_UNSIGNEDINTEGER,0,iMaxlen)
KVSO_PARAMETERS_END(c)
@@ -451,49 +451,47 @@ KVSO_CLASS_FUNCTION(lineEdit,setInputMask)
KVSO_CLASS_FUNCTION(lineEdit,setCompleter)
{
- CHECK_INTERNAL_POINTER(widget())
- QStringList szCompletionList;
- QString szMode;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szMode)
- KVSO_PARAMETER("completion_list",KVS_PT_STRINGLIST,0,szCompletionList)
- KVSO_PARAMETERS_END(c)
- if(m_pCompleter)
- {
- delete m_pCompleter;
-
- }
- m_pCompleter=new QCompleter(szCompletionList);
- QCompleter::CompletionMode mode=QCompleter::PopupCompletion;
- if(KviQString::equalCI(szMode,"InlineCompletion")) mode=QCompleter::InlineCompletion;
- else if(KviQString::equalCI(szMode,"UnfilteredPopupCompletion")) mode=QCompleter::UnfilteredPopupCompletion;
- else if(!KviQString::equalCI(szMode,"PopupCompletion"))
- c->warning(__tr2qs_ctx("Unkonwn '%Q' completition mode, switching to default popupCompletition","objects"),&szMode);
- m_pCompleter->setCompletionMode(mode);
- ((QLineEdit *)widget())->setCompleter(m_pCompleter);
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ QStringList szCompletionList;
+ QString szMode;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szMode)
+ KVSO_PARAMETER("completion_list",KVS_PT_STRINGLIST,0,szCompletionList)
+ KVSO_PARAMETERS_END(c)
+ if(m_pCompleter)
+ delete m_pCompleter;
+ m_pCompleter=new QCompleter(szCompletionList);
+ QCompleter::CompletionMode mode=QCompleter::PopupCompletion;
+ if(KviQString::equalCI(szMode,"InlineCompletion")) mode=QCompleter::InlineCompletion;
+ else if(KviQString::equalCI(szMode,"UnfilteredPopupCompletion")) mode=QCompleter::UnfilteredPopupCompletion;
+ else if(!KviQString::equalCI(szMode,"PopupCompletion"))
+ c->warning(__tr2qs_ctx("Unkonwn '%Q' completition mode, switching to default popupCompletition","objects"),&szMode);
+ m_pCompleter->setCompletionMode(mode);
+ ((QLineEdit *)widget())->setCompleter(m_pCompleter);
+ return true;
}
KVSO_CLASS_FUNCTION(lineEdit,enableCompleter)
{
- CHECK_INTERNAL_POINTER(widget())
- if (m_pCompleter) ((QLineEdit *)widget())->setCompleter(m_pCompleter);
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ if (m_pCompleter) ((QLineEdit *)widget())->setCompleter(m_pCompleter);
+ return true;
}
KVSO_CLASS_FUNCTION(lineEdit,disableCompleter)
{
- CHECK_INTERNAL_POINTER(widget())
- ((QLineEdit *)widget())->setCompleter(0);
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ ((QLineEdit *)widget())->setCompleter(0);
+ return true;
}
KVSO_CLASS_FUNCTION(lineEdit,unsetCompleter)
{
- CHECK_INTERNAL_POINTER(widget())
- if (m_pCompleter){
- ((QLineEdit *)widget())->setCompleter(0);
- delete m_pCompleter;
- m_pCompleter=0;
- }
- return true;
+ CHECK_INTERNAL_POINTER(widget())
+ if (m_pCompleter)
+ {
+ ((QLineEdit *)widget())->setCompleter(0);
+ delete m_pCompleter;
+ m_pCompleter=0;
+ }
+ return true;
}
diff --git a/src/modules/objects/KvsObject_lineEdit.h b/src/modules/objects/KvsObject_lineEdit.h
index f561bf682..5f72e8970 100644
--- a/src/modules/objects/KvsObject_lineEdit.h
+++ b/src/modules/objects/KvsObject_lineEdit.h
@@ -41,14 +41,14 @@ public:
public:
QWidget * widget() { return (QWidget *)object(); };
protected:
- QCompleter * m_pCompleter;
+ QCompleter * m_pCompleter;
protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
- bool setCompleter(KviKvsObjectFunctionCall *c);
- bool enableCompleter(KviKvsObjectFunctionCall *c);
- bool disableCompleter(KviKvsObjectFunctionCall *c);
- bool unsetCompleter(KviKvsObjectFunctionCall *c);
+ bool setCompleter(KviKvsObjectFunctionCall *c);
+ bool enableCompleter(KviKvsObjectFunctionCall *c);
+ bool disableCompleter(KviKvsObjectFunctionCall *c);
+ bool unsetCompleter(KviKvsObjectFunctionCall *c);
bool text(KviKvsObjectFunctionCall *c);
bool setText(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/KvsObject_list.cpp b/src/modules/objects/KvsObject_list.cpp
index a07b3a3e2..bd187f226 100644
--- a/src/modules/objects/KvsObject_list.cpp
+++ b/src/modules/objects/KvsObject_list.cpp
@@ -167,8 +167,8 @@ KVSO_END_CONSTRUCTOR(KvsObject_list)
KVSO_BEGIN_DESTRUCTOR(KvsObject_list)
-delete m_pDataList;
-m_pDataList = 0;
+ delete m_pDataList;
+ m_pDataList = 0;
KVSO_END_CONSTRUCTOR(KvsObject_list)
KVSO_CLASS_FUNCTION(list,current)
@@ -215,7 +215,7 @@ KVSO_CLASS_FUNCTION(list,moveNext)
KVSO_CLASS_FUNCTION(list,moveFirst)
{
- CHECK_INTERNAL_POINTER(m_pDataList)
+ CHECK_INTERNAL_POINTER(m_pDataList)
c->returnValue()->setBoolean(m_pDataList->first() != 0);
return true;
}
@@ -309,7 +309,7 @@ KVSO_CLASS_FUNCTION(list,append)
KVSO_CLASS_FUNCTION(list,clear)
{
- CHECK_INTERNAL_POINTER(m_pDataList)
+ CHECK_INTERNAL_POINTER(m_pDataList)
m_pDataList->clear();
return true;
}
diff --git a/src/modules/objects/KvsObject_listWidget.cpp b/src/modules/objects/KvsObject_listWidget.cpp
index 773cfe0b4..081627caa 100644
--- a/src/modules/objects/KvsObject_listWidget.cpp
+++ b/src/modules/objects/KvsObject_listWidget.cpp
@@ -56,19 +56,19 @@ const char * const itemflags_tbl[] = {
#define itemflags_num (sizeof(itemflags_tbl) / sizeof(itemflags_tbl[0]))
/*
- @doc:listbox
- @title:
- listbox class
- @type:
- class
- @short:
- A widget displaying a list of items.
- @inherits:
- [class]object[/class]
- [class]widget[/class]
+ @doc:listbox
+ @title:
+ listbox class
+ @type:
+ class
+ @short:
+ A widget displaying a list of items.
+ @inherits:
+ [class]object[/class]
+ [class]widget[/class]
@description:
- The listbox class is a widget displaying a list of string items.[br]
- The listbox can operate in four selection modes: single, multi, extended
+ The listbox class is a widget displaying a list of string items.[br]
+ The listbox can operate in four selection modes: single, multi, extended
and none. In the "single" mode only one item can be selected at a time
and that item is also the current one. In the "multi" mode multiple
items can be selected and unselected and the current item may or may not
@@ -92,14 +92,14 @@ const char * const itemflags_tbl[] = {
!fn: $setFlag(<idx:integer>,<flag1:string>, <flag2:string>, ...)
Sets the flags for the item at index idz to the given flags. These determine whether the item can be selected or modified. This is often used to disable an item.
Supported flags are:
- - noitemflag : no flag sets;
- - selectable : item is selecatble;
- - editable : item is editable;
- - dragEnabled : item can dragged;
- - dropEnabled : item can used as drop target;
- - userCheckable : item is checkable;
- - enabled :item is enabled;
- - tristate : item is checkable with three separate states.
+ [br]- noitemflag : no flag sets;
+ [br]- selectable : item is selecatble;
+ [br]- editable : item is editable;
+ [br]- dragEnabled : item can dragged;
+ [br]- dropEnabled : item can used as drop target;
+ [br]- userCheckable : item is checkable;
+ [br]- enabled :item is enabled;
+ [br]- tristate : item is checkable with three separate states.
!fn: $setChecked(<checkstate:bool>)
Sets the eventual item check box 'checked state' to <bool>.
!fn: <bool> $isChecked()
@@ -122,7 +122,7 @@ const char * const itemflags_tbl[] = {
!fn: $textAt(<index:integer>)
Returns item at given index.
!fn: $setCurrentItem(<index:integer>)
- Sets the current listbox item.
+ Sets the current listbox item.
!fn: $clear()
Removes all the items
!fn: $setFont(<idx:integer>,<family:string>,<size:integer>[,<style1:string>, <style2:string>, ...])
@@ -234,8 +234,8 @@ KVSO_CLASS_FUNCTION(listWidget,setFlags)
QStringList itemflags;
kvs_uint_t iIdx;
KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIdx)
- KVSO_PARAMETER("flags",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,itemflags)
+ KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIdx)
+ KVSO_PARAMETER("flags",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,itemflags)
KVSO_PARAMETERS_END(c)
int flag,sum=0;
QListWidgetItem *pItem=((QListWidget *)widget())->item(iIdx);
diff --git a/src/modules/objects/KvsObject_mainWindow.cpp b/src/modules/objects/KvsObject_mainWindow.cpp
index 71844c67a..2c4a557ec 100644
--- a/src/modules/objects/KvsObject_mainWindow.cpp
+++ b/src/modules/objects/KvsObject_mainWindow.cpp
@@ -91,10 +91,10 @@ KVSO_CLASS_FUNCTION(mainWindow,setCentralWidget)
return true;
}
if(!pObject->inheritsClass("widget"))
- {
+ {
c->warning(__tr2qs_ctx("Widget object required","objects"));
- return TRUE;
- }
+ return TRUE;
+ }
((KviTalMainWindow *)widget())->setCentralWidget(((QWidget *)(pObject->object())));
return true;
}
diff --git a/src/modules/objects/KvsObject_memoryBuffer.cpp b/src/modules/objects/KvsObject_memoryBuffer.cpp
index 617970239..9f7e594a7 100644
--- a/src/modules/objects/KvsObject_memoryBuffer.cpp
+++ b/src/modules/objects/KvsObject_memoryBuffer.cpp
@@ -128,9 +128,10 @@ KVSO_CLASS_FUNCTION(memoryBuffer,saveToFile)
}
return true;
}
-/*
+
+
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
#include "m_KvsObject_memoryBuffer.moc"
-#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES*/
+#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES
diff --git a/src/modules/objects/KvsObject_menuBar.h b/src/modules/objects/KvsObject_menuBar.h
index 64e9b62fb..32516f58b 100644
--- a/src/modules/objects/KvsObject_menuBar.h
+++ b/src/modules/objects/KvsObject_menuBar.h
@@ -24,7 +24,7 @@
//
//=============================================================================
-#include <qmenubar.h>
+#include <QMenuBar>
#include "KvsObject_widget.h"
#include "object_macros.h"
diff --git a/src/modules/objects/KvsObject_multiLineEdit.cpp b/src/modules/objects/KvsObject_multiLineEdit.cpp
index e7df905e5..45e3ee119 100644
--- a/src/modules/objects/KvsObject_multiLineEdit.cpp
+++ b/src/modules/objects/KvsObject_multiLineEdit.cpp
@@ -259,8 +259,10 @@ bool KvsObject_textedit::functionTextLine(KviKvsObjectFunctionCall * c)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("line",KVS_PT_INT,0,iBlock)
KVSO_PARAMETERS_END(c)
- if(!widget())return true;
- if(iBlock > ((QTextEdit *)widget())->document()->blockCount() || iBlock < 0) c->warning(__tr2qs_ctx("No such line '%d'","objects"),&iBlock);
+ if(!widget())
+ return true;
+ if(iBlock > ((QTextEdit *)widget())->document()->blockCount() || iBlock < 0)
+ c->warning(__tr2qs_ctx("No such line '%d'","objects"),&iBlock);
else
c->returnValue()->setString(((QTextEdit *)widget())->document()->findBlockByNumber(iBlock).text());
@@ -268,7 +270,8 @@ bool KvsObject_textedit::functionTextLine(KviKvsObjectFunctionCall * c)
}
bool KvsObject_textedit::functionNumLines(KviKvsObjectFunctionCall * c)
{
- if(widget()) c->returnValue()->setInteger(((QTextEdit *)widget())->document()->blockCount());
+ if(widget())
+ c->returnValue()->setInteger(((QTextEdit *)widget())->document()->blockCount());
return true;
}
bool KvsObject_textedit::functionCursorPosition(KviKvsObjectFunctionCall * c)
@@ -314,7 +317,8 @@ bool KvsObject_textedit::functionSetWordWrap(KviKvsObjectFunctionCall * c)
((QTextEdit *)widget())->setLineWrapMode(QTextEdit::FixedPixelWidth);
else if(KviQString::equalCI(szWrap,"FixedColumnWidth"))
((QTextEdit *)widget())->setLineWrapMode(QTextEdit::FixedColumnWidth);
- else c->warning(__tr2qs_ctx("Unknown word wrap '%Q'","objects"),&szWrap);
+ else
+ c->warning(__tr2qs_ctx("Unknown word wrap '%Q'","objects"),&szWrap);
return true;
}
@@ -603,29 +607,29 @@ bool KvsObject_textedit::functionsetColor(KviKvsObjectFunctionCall * c)
} else {
if (c->params()->count()==1)
+ {
+ bool bOk,bOk1,bOk2;
+ QString value;
+ pColArray->asString(value);
+ if (value.length()!=6)
+ {
+ c->warning(__tr2qs_ctx("A string of 6 hex digits is required","objects"));
+ return true;
+ }
+ QString buffer(value.mid(0,2));
+ iColR=buffer.toInt(&bOk,16);
+ buffer=value.mid(2,2);
+ iColG=buffer.toInt(&bOk1,16);
+ buffer=value.mid(4,2);
+ iColB=buffer.toInt(&bOk2,16);
+ if (!bOk || !bOk1 || !bOk2)
{
- bool bOk,bOk1,bOk2;
- QString value;
- pColArray->asString(value);
- if (value.length()!=6)
- {
- c->warning(__tr2qs_ctx("A string of 6 hex digits is required","objects"));
- return true;
- }
- QString buffer(value.mid(0,2));
- iColR=buffer.toInt(&bOk,16);
- buffer=value.mid(2,2);
- iColG=buffer.toInt(&bOk1,16);
- buffer=value.mid(4,2);
- iColB=buffer.toInt(&bOk2,16);
- if (!bOk || !bOk1 || !bOk2)
- {
- c->warning(__tr2qs_ctx("Not an hex digit","objects"));
+ c->warning(__tr2qs_ctx("Not an hex digit","objects"));
return true;
- }
+ }
if (widget()) ((QTextEdit *)widget())->setTextColor(QColor(iColR,iColG,iColB));
return true;
- }
+ }
if(c->params()->count() < 3)
{
c->error(__tr2qs_ctx("$setColor requires either an array as first parameter or three integers","objects"));
@@ -705,7 +709,8 @@ bool KvsObject_textedit::functionsetTextFormat(KviKvsObjectFunctionCall * c)
((QTextEdit *)widget())->setAcceptRichText(false);
else if(KviQString::equalCI(szFormat,"RichText"))
((QTextEdit *)widget())->setAcceptRichText(true);
- else c->warning(__tr2qs_ctx("Unknown text format '%Q'","objects"),&szFormat);
+ else
+ c->warning(__tr2qs_ctx("Unknown text format '%Q'","objects"),&szFormat);
return true;
}
@@ -721,14 +726,14 @@ bool KvsObject_textedit::functionloadFile(KviKvsObjectFunctionCall * c)
if ( !QFile::exists(szFile))
{
c->warning(__tr2qs_ctx("I can't find the specified file '%Q'.","objects"),&szFile);
- return true;
+ return true;
}
QFile file( szFile );
if ( !file.open( QIODevice::ReadOnly ) )
{
- c->warning(__tr2qs_ctx("I cannot read the file '%Q'.","objects"),&szFile);
- return true;
+ c->warning(__tr2qs_ctx("I cannot read the file '%Q'.","objects"),&szFile);
+ return true;
}
QTextStream ts( &file );
@@ -755,7 +760,8 @@ bool KvsObject_textedit::functionsetAlignment(KviKvsObjectFunctionCall * c)
((QTextEdit *)widget())->setAlignment(Qt::AlignCenter);
else if(KviQString::equalCI(szAlignment,"Justify"))
((QTextEdit *)widget())->setAlignment(Qt::AlignJustify);
- else c->warning(__tr2qs_ctx("Unknown alignment '%Q'","objects"),&szAlignment);
+ else
+ c->warning(__tr2qs_ctx("Unknown alignment '%Q'","objects"),&szAlignment);
return true;
}
diff --git a/src/modules/objects/KvsObject_painter.cpp b/src/modules/objects/KvsObject_painter.cpp
index fa37a8072..bd1ada9cf 100644
--- a/src/modules/objects/KvsObject_painter.cpp
+++ b/src/modules/objects/KvsObject_painter.cpp
@@ -33,29 +33,29 @@
#include "KviError.h"
#include "KviIconManager.h"
#include "KviMemory.h"
- #include <QPrintDialog>
+#include <QPrintDialog>
#include <QTextDocument>
#include <QIcon>
#define PAINTER_ROTATE(__angle,__axis)\
- QTransform transform;\
- transform.rotate(__angle,__axis);\
- m_pPainter->setTransform(transform,true);
+ QTransform transform;\
+ transform.rotate(__angle,__axis);\
+ m_pPainter->setTransform(transform,true);
#define PAINTER_TRANSLATE(__x,__y)\
- QTransform transform;\
- transform.translate(__x,__y);\
- m_pPainter->setTransform(transform,true);
+ QTransform transform;\
+ transform.translate(__x,__y);\
+ m_pPainter->setTransform(transform,true);
#define PAINTER_SHEAR(__sH,__sV)\
- QTransform transform;\
- transform.shear(__sH,__sV);\
- m_pPainter->setTransform(transform,true);
+ QTransform transform;\
+ transform.shear(__sH,__sV);\
+ m_pPainter->setTransform(transform,true);
#define PAINTER_SCALE(__sX,__sY)\
- QTransform transform;\
- transform.scale(__sX,__sY);\
- m_pPainter->setTransform(transform,true);
+ QTransform transform;\
+ transform.scale(__sX,__sY);\
+ m_pPainter->setTransform(transform,true);
const Qt::PenStyle penstyles_cod[] = {
@@ -77,56 +77,56 @@ const char * const penstyles_tbl[] = {
};
const QPainter::CompositionMode composition_cod[] = {
- QPainter::CompositionMode_SourceOver,
- QPainter::CompositionMode_DestinationOver,
- QPainter::CompositionMode_Clear,
- QPainter::CompositionMode_Source,
- QPainter::CompositionMode_Destination,
- QPainter::CompositionMode_SourceIn,
- QPainter::CompositionMode_DestinationIn,
- QPainter::CompositionMode_SourceOut,
- QPainter::CompositionMode_DestinationOut,
- QPainter::CompositionMode_SourceAtop,
- QPainter::CompositionMode_DestinationAtop,
- QPainter::CompositionMode_Xor,
- QPainter::CompositionMode_Plus,
- QPainter::CompositionMode_Multiply,
- QPainter::CompositionMode_Screen,
- QPainter::CompositionMode_Overlay,
- QPainter::CompositionMode_Darken,
- QPainter::CompositionMode_Lighten,
- QPainter::CompositionMode_ColorDodge,
- QPainter::CompositionMode_ColorBurn,
- QPainter::CompositionMode_HardLight,
- QPainter::CompositionMode_SoftLight,
- QPainter::CompositionMode_Difference,
- QPainter::CompositionMode_Exclusion,
+ QPainter::CompositionMode_SourceOver,
+ QPainter::CompositionMode_DestinationOver,
+ QPainter::CompositionMode_Clear,
+ QPainter::CompositionMode_Source,
+ QPainter::CompositionMode_Destination,
+ QPainter::CompositionMode_SourceIn,
+ QPainter::CompositionMode_DestinationIn,
+ QPainter::CompositionMode_SourceOut,
+ QPainter::CompositionMode_DestinationOut,
+ QPainter::CompositionMode_SourceAtop,
+ QPainter::CompositionMode_DestinationAtop,
+ QPainter::CompositionMode_Xor,
+ QPainter::CompositionMode_Plus,
+ QPainter::CompositionMode_Multiply,
+ QPainter::CompositionMode_Screen,
+ QPainter::CompositionMode_Overlay,
+ QPainter::CompositionMode_Darken,
+ QPainter::CompositionMode_Lighten,
+ QPainter::CompositionMode_ColorDodge,
+ QPainter::CompositionMode_ColorBurn,
+ QPainter::CompositionMode_HardLight,
+ QPainter::CompositionMode_SoftLight,
+ QPainter::CompositionMode_Difference,
+ QPainter::CompositionMode_Exclusion,
};
const char * const composition_tbl[] = {
- "SourceOver",
- "DestinationOver",
- "Clear",
- "Source",
- "Destination",
- "SourceIn",
- "DestinationIn",
- "SourceOut",
- "DestinationOut",
- "SourceAtop",
- "DestinationAtop",
- "Xor",
- "Plus",
- "Multiply",
- "Screen",
- "Overlay",
- "Darken",
- "Lighten",
- "ColorDodge",
- "ColorBurn",
- "HardLight",
- "SoftLight",
- "Difference",
- "Exclusion"
+ "SourceOver",
+ "DestinationOver",
+ "Clear",
+ "Source",
+ "Destination",
+ "SourceIn",
+ "DestinationIn",
+ "SourceOut",
+ "DestinationOut",
+ "SourceAtop",
+ "DestinationAtop",
+ "Xor",
+ "Plus",
+ "Multiply",
+ "Screen",
+ "Overlay",
+ "Darken",
+ "Lighten",
+ "ColorDodge",
+ "ColorBurn",
+ "HardLight",
+ "SoftLight",
+ "Difference",
+ "Exclusion"
};
#define penstyles_num (sizeof(penstyles_tbl) / sizeof(penstyles_tbl[0]))
@@ -234,7 +234,7 @@ const char * const brushstyles_tbl[] = {
%aa->$show()[br]
!fn: $drawRect(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>)
Draws a rectangle with upper left corner at (x, y) and with width w and height h.
- !fn: $drawRoundRect(<start_angle:integer>,<angle_length:integer>,<width:unsigned integer>,<height:unsigned integer>,<xr:integer>,<y:integer>)
+ !fn: $drawRoundRect(<start_angle:integer>,<angle_length:integer>,<width:unsigned integer>,<height:unsigned integer>,<xr:integer>,<y:integer>)
Draws a rectangle with rounded corners at (x, y), with width w and height h.[rb]
The xCor and yCor arguments specify how rounded the corners should be (range is 0->99).
!fn: $drawPie(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>,<angle:integer>,<alen:integer>)
@@ -281,10 +281,10 @@ const char * const brushstyles_tbl[] = {
Returns the font metrics width for the painter's current font.
!fn: <integer>$fontMetricsHeight()
Returns the font metrics height for the painter's current font.
- !fn: $rotate(<angle:real>,[<axis:string>])
- Rotates the coordinate system a degrees counterclockwise by the given angle about the optional parameter <axis>.
- Valid values for axis are: ZAxis, XAxis, YAxis.
- Optional parameter <axis>
+ !fn: $rotate(<angle:real>,[<axis:string>])
+ Rotates the coordinate system a degrees counterclockwise by the given angle about the optional parameter <axis>.
+ Valid values for axis are: ZAxis, XAxis, YAxis.
+ Optional parameter <axis>
!fn: $translate(<dx:real>,<dy:real>)
Translates the coordinate system by <dx>, <dy>.
!fn: $shear(<dh:real>,<dv:real>)
@@ -295,16 +295,16 @@ const char * const brushstyles_tbl[] = {
Sets the background mode of the painter to <bgMode>: valid values are:[br]
- Transparent (that is the default value);[br]
- Opaque.[br]
- !fn: $setOpacity(<opacity_factor:real>)
+ !fn: $setOpacity(<opacity_factor:real>)
Sets the painter opacity that affects all painter operations (drawpixmap, drawtext...). Valid values range are from 0 (total transparency) to 1 (total opacity)[br]
You must invoke the [classfnc]$begin[/classfnc] before using it.
- !fn: $setTextAntialiasing(<boolean>)
+ !fn: $setTextAntialiasing(<boolean>)
Enable/disable antialias in text if possible.
You must call the [classfnc]$begin[/classfnc] before using it.
- !fn: $setAntialiasing(<boolean>)
+ !fn: $setAntialiasing(<boolean>)
Enable/disable antialias in edges of primitives if possible.
You must call the [classfnc]$begin[/classfnc] before using it.
- !fn: $setSmoothPixmapTransform(<boolean>)
+ !fn: $setSmoothPixmapTransform(<boolean>)
Enable/disable smooth bilinear pixmap transformation algorithm (such as bilinear).
You must call the [classfnc]$begin[/classfnc] before using it.
Example:[br]
@@ -378,7 +378,7 @@ const char * const brushstyles_tbl[] = {
if ($$->%scrollright >= 550) return[br]
%P->$scale(0.$$->%Zoomindex,0.$$->%Zoomindex)[br]
%P->$translate(400,350)[br]
- %P->$drawText($$->%scrollright,10,"Another cool class brought to you by...",-1,Auto) [br]
+ %P->$drawText($$->%scrollright,10,"Another cool class brought to you by...",-1,Auto) [br]
$$->%scrollright += 3;[br]
%P->$reset()[br]
}[br]
@@ -496,7 +496,7 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_painter,"painter","object")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawRect)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawLine)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawRoundRect)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawPoint)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawPoint)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawArc)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawEllipse)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,drawPie)
@@ -511,7 +511,7 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_painter,"painter","object")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,htmlTextSize)
- // Transform Operation
+ // Transform Operation
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,rotate)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,shear)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_painter,scale)
@@ -588,14 +588,14 @@ KVSO_END_CONSTRUCTOR(KvsObject_painter)
KVSO_BEGIN_DESTRUCTOR(KvsObject_painter)
-if (m_pPainterPath) delete m_pPainterPath;
- m_pPainterPath=0;
-if (m_pGradient) delete m_pGradient;
- m_pGradient=0;
-if (m_pPainter && !bDonotdeleteinternalqpainter) delete m_pPainter;
- m_pPainter = 0;
-if (m_pPrinter) delete m_pPrinter;
- m_pPrinter = 0;
+ if (m_pPainterPath) delete m_pPainterPath;
+ m_pPainterPath=0;
+ if (m_pGradient) delete m_pGradient;
+ m_pGradient=0;
+ if (m_pPainter && !bDonotdeleteinternalqpainter) delete m_pPainter;
+ m_pPainter = 0;
+ if (m_pPrinter) delete m_pPrinter;
+ m_pPrinter = 0;
KVSO_END_CONSTRUCTOR(KvsObject_painter)
@@ -1078,83 +1078,75 @@ KVSO_CLASS_FUNCTION(painter,begin)
CHECK_INTERNAL_POINTER(m_pPainter)
KviKvsObject * pObject;
kvs_hobject_t hObject;
- KviKvsVariant *v;
- QString szFileName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("paint_device",KVS_PT_VARIANT,0,v)
- KVSO_PARAMETER("file_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szFileName)
+ KviKvsVariant *v;
+ QString szFileName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("paint_device",KVS_PT_VARIANT,0,v)
+ KVSO_PARAMETER("file_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szFileName)
KVSO_PARAMETERS_END(c)
- QPaintDevice * pd;
- if(v->isString())
- {
- QString szDev;
- v->asString(szDev);
- if(KviQString::equalCI(szDev,"printer") || KviQString::equalCI(szDev,"pdf"))
- {
- if (m_pPrinter) delete m_pPrinter;
- m_pPrinter=new QPrinter();
- if ( KviQString::equalCI(szDev,"pdf"))
- {
- // m_pPrinter=new QPrinter();
- if(szFileName.isEmpty())
- {
- c->warning(__tr2qs_ctx("Missing filename","objects"));
- return true;
- }
- m_pPrinter->setOutputFormat(QPrinter::PdfFormat);
- m_pPrinter->setOutputFileName(szFileName);
- }
- else
- {
- QPrintDialog printDialog(m_pPrinter, 0);
- if (printDialog.exec() == QDialog::Accepted)
- {
- qDebug("papersize %d",m_pPrinter->paperSize());
- m_pPainter->begin(m_pPrinter);
- return true;
- }
- else
- {
- m_pPrinter=0;
- return true;
- }
- }
- //if (i==3) m_pPrinter->setPaperSize(QPrinter::A3);
- //if (i==4) m_pPrinter->setPaperSize(QPrinter::A4);
- }
- else
- {
- c->warning(__tr2qs_ctx("No valid paint device","objects"));
- return true;
- }
- m_pPainter->begin(m_pPrinter);
- return true;
- }
- else if (v->isHObject())
- {
- v->asHObject(hObject);
- pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
- if (!pObject)
- {
- c->warning(__tr2qs_ctx("Pixmap or Widget parameter is not an object","objects"));
- return true;
- }
- if(pObject->inheritsClass("pixmap"))pd=((KvsObject_pixmap *)pObject)->getImage();
- else if (pObject->inheritsClass("widget")) pd=((KvsObject_widget *)pObject)->widget();
- else
- {
- c->warning(__tr2qs_ctx("Widget or Pixmap required ","objects"));
- return true;
- }
- }
- else
- {
- c->warning(__tr2qs_ctx("No valid paint device","objects"));
- return true;
- }
- attachDevice(pObject,pd);
- //if (pObject->inheritsClass("pixmap")) ((KvsObject_pixmap *)pObject)->pixmapChanged();
- return true;
+ QPaintDevice * pd;
+ if(v->isString())
+ {
+ QString szDev;
+ v->asString(szDev);
+ if(KviQString::equalCI(szDev,"printer") || KviQString::equalCI(szDev,"pdf"))
+ {
+ if (m_pPrinter) delete m_pPrinter;
+ m_pPrinter=new QPrinter();
+ if ( KviQString::equalCI(szDev,"pdf"))
+ {
+ //m_pPrinter=new QPrinter();
+ if(szFileName.isEmpty())
+ {
+ c->warning(__tr2qs_ctx("Missing filename","objects"));
+ return true;
+ }
+ m_pPrinter->setOutputFormat(QPrinter::PdfFormat);
+ m_pPrinter->setOutputFileName(szFileName);
+ } else {
+ QPrintDialog printDialog(m_pPrinter, 0);
+ if (printDialog.exec() == QDialog::Accepted)
+ {
+ qDebug("papersize %d",m_pPrinter->paperSize());
+ m_pPainter->begin(m_pPrinter);
+ return true;
+ } else {
+ m_pPrinter=0;
+ return true;
+ }
+ }
+ //if (i==3) m_pPrinter->setPaperSize(QPrinter::A3);
+ //if (i==4) m_pPrinter->setPaperSize(QPrinter::A4);
+ } else {
+ c->warning(__tr2qs_ctx("No valid paint device","objects"));
+ return true;
+ }
+ m_pPainter->begin(m_pPrinter);
+ return true;
+ } else if (v->isHObject()) {
+ v->asHObject(hObject);
+ pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
+ if (!pObject)
+ {
+ c->warning(__tr2qs_ctx("Pixmap or Widget parameter is not an object","objects"));
+ return true;
+ }
+ if(pObject->inheritsClass("pixmap"))
+ pd=((KvsObject_pixmap *)pObject)->getImage();
+ else if (pObject->inheritsClass("widget"))
+ pd=((KvsObject_widget *)pObject)->widget();
+ else
+ {
+ c->warning(__tr2qs_ctx("Widget or Pixmap required ","objects"));
+ return true;
+ }
+ } else {
+ c->warning(__tr2qs_ctx("No valid paint device","objects"));
+ return true;
+ }
+ attachDevice(pObject,pd);
+ //if (pObject->inheritsClass("pixmap")) ((KvsObject_pixmap *)pObject)->pixmapChanged();
+ return true;
}
void KvsObject_painter::attachDevice(KviKvsObject * o,QPaintDevice * p)
@@ -1164,7 +1156,7 @@ void KvsObject_painter::attachDevice(KviKvsObject * o,QPaintDevice * p)
// KvsObject_pixmap and KvsObject_widget object have this signal
// it is emitted BEFORE the real QPaintDevice is deleted, so we can eventually
// call m_pPainter->end() in time
- qDebug("Begin painter");
+ qDebug("Begin painter");
QObject::connect(m_pDeviceObject,SIGNAL(aboutToDie()),this,SLOT(detachDevice()));
m_pPainter->begin(p);
}
@@ -1217,7 +1209,7 @@ KVSO_CLASS_FUNCTION(painter,drawText)
{
CHECK_INTERNAL_POINTER(m_pPainter)
QString szText,szMode;
- kvs_int_t iX,iY,iN=-1,iW,iH;
+ kvs_int_t iX,iY,iW,iH; //,iN=-1;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("x",KVS_PT_INT,0,iX)
KVSO_PARAMETER("y",KVS_PT_INT,0,iY)
@@ -1228,12 +1220,14 @@ KVSO_CLASS_FUNCTION(painter,drawText)
KVSO_PARAMETERS_END(c)
if (!szMode.isEmpty() && !KviQString::equalCI(szMode,"Auto"))
{
- if(KviQString::equalCI(szMode,"RTL"))m_pPainter->setLayoutDirection(Qt::RightToLeft);
- else if(KviQString::equalCI(szMode,"LTR"))m_pPainter->setLayoutDirection(Qt::LeftToRight);
+ if(KviQString::equalCI(szMode,"RTL"))
+ m_pPainter->setLayoutDirection(Qt::RightToLeft);
+ else if(KviQString::equalCI(szMode,"LTR"))
+ m_pPainter->setLayoutDirection(Qt::LeftToRight);
else
{
- c->warning(__tr2qs_ctx("Invalid mode '%Q'","objects"),&szMode);
- return true;
+ c->warning(__tr2qs_ctx("Invalid mode '%Q'","objects"),&szMode);
+ return true;
}
}
//if(!iN) iN = szText.length();
@@ -1285,7 +1279,7 @@ KVSO_CLASS_FUNCTION(painter,drawPixmapWithEffect)
{
CHECK_INTERNAL_POINTER(m_pPainter)
QString szEffect;
- kvs_real_t iX,iY,factor;
+ kvs_real_t iX,iY; //,factor;
kvs_int_t r,g,b;
KviKvsObject *obj;
kvs_hobject_t hObject;
@@ -1319,45 +1313,45 @@ KVSO_CLASS_FUNCTION(painter,drawPixmapWithEffect)
if(KviQString::equalCI(szEffect,"add"))
{
- int sumR, sumG, sumB;
- for(int y=0; y<h; y++)
- {
- dataSource = (QRgb *) pImage->scanLine(y);
- dataDest = (QRgb *) pDest.scanLine(y);
- for (int x=0; x<w; x++)
- {
- col = *dataSource;
- sumR=qRed(col)+r;
- sumG=qGreen(col)+g;
- sumB=qBlue(col)+b;
- *dataDest++ = qRgba(sumR<255 ?sumR : 255,
- sumG<255 ?sumG : 255,
- sumB<255 ?sumB : 255,
- qAlpha(col));
- dataSource++;
- }
- }
+ int sumR, sumG, sumB;
+ for(int y=0; y<h; y++)
+ {
+ dataSource = (QRgb *) pImage->scanLine(y);
+ dataDest = (QRgb *) pDest.scanLine(y);
+ for (int x=0; x<w; x++)
+ {
+ col = *dataSource;
+ sumR=qRed(col)+r;
+ sumG=qGreen(col)+g;
+ sumB=qBlue(col)+b;
+ *dataDest++ = qRgba(sumR<255 ?sumR : 255,
+ sumG<255 ?sumG : 255,
+ sumB<255 ?sumB : 255,
+ qAlpha(col));
+ dataSource++;
+ }
+ }
}
else if(KviQString::equalCI(szEffect,"sub"))
{
- int subR, subG, subB;
- for(int y=0; y<h; y++)
- {
- dataSource = (QRgb *) pImage->scanLine(y);
- dataDest = (QRgb *) pDest.scanLine(y);
- for (int x=0; x<w; x++)
- {
- col = *dataSource;
- subR=qRed(col)-r;
- subG=qGreen(col)-g;
- subB=qBlue(col)-b;
- *dataDest++ = qRgba(subR>0 ? subR : 0,
- subG>0 ? subG : 0,
- subB>0 ? subB : 0,
- qAlpha(col));
- dataSource++;
- }
- }
+ int subR, subG, subB;
+ for(int y=0; y<h; y++)
+ {
+ dataSource = (QRgb *) pImage->scanLine(y);
+ dataDest = (QRgb *) pDest.scanLine(y);
+ for (int x=0; x<w; x++)
+ {
+ col = *dataSource;
+ subR=qRed(col)-r;
+ subG=qGreen(col)-g;
+ subB=qBlue(col)-b;
+ *dataDest++ = qRgba(subR>0 ? subR : 0,
+ subG>0 ? subG : 0,
+ subB>0 ? subB : 0,
+ qAlpha(col));
+ dataSource++;
+ }
+ }
}
m_pPainter->drawImage(QPointF(iX,iY),pDest);
return true;
@@ -1365,21 +1359,21 @@ KVSO_CLASS_FUNCTION(painter,drawPixmapWithEffect)
KVSO_CLASS_FUNCTION(painter,rotate)
{
CHECK_INTERNAL_POINTER(m_pPainter)
- kvs_real_t dAngle;
- QString szAxis;
+ kvs_real_t dAngle;
+ QString szAxis;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("angle",KVS_PT_DOUBLE,0,dAngle)
- KVSO_PARAMETER("axis",KVS_PT_STRING,KVS_PF_OPTIONAL,szAxis)
+ KVSO_PARAMETER("axis",KVS_PT_STRING,KVS_PF_OPTIONAL,szAxis)
KVSO_PARAMETERS_END(c)
- Qt::Axis axis = Qt::ZAxis;
- if(!szAxis.isEmpty())
- {
- if (KviQString::equalCI(szAxis,"XAxis"))axis=Qt::XAxis;
- else if (KviQString::equalCI(szAxis,"YAxis")) axis=Qt::YAxis;
- else if (KviQString::equalCI(szAxis,"ZAxis")) axis=Qt::ZAxis;
- else c->warning(__tr2qs_ctx("Unknown axis '%Q' switching to default ZAxis","objects"),&szAxis);
- }
- PAINTER_ROTATE(dAngle,axis)
+ Qt::Axis axis = Qt::ZAxis;
+ if(!szAxis.isEmpty())
+ {
+ if (KviQString::equalCI(szAxis,"XAxis"))axis=Qt::XAxis;
+ else if (KviQString::equalCI(szAxis,"YAxis")) axis=Qt::YAxis;
+ else if (KviQString::equalCI(szAxis,"ZAxis")) axis=Qt::ZAxis;
+ else c->warning(__tr2qs_ctx("Unknown axis '%Q' switching to default ZAxis","objects"),&szAxis);
+ }
+ PAINTER_ROTATE(dAngle,axis)
return true;
}
@@ -1392,7 +1386,7 @@ KVSO_CLASS_FUNCTION(painter,translate)
KVSO_PARAMETER("trasl_y",KVS_PT_DOUBLE,0,dYtrasl)
KVSO_PARAMETERS_END(c)
PAINTER_TRANSLATE(dXtrasl,dYtrasl)
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(painter,shear)
@@ -1404,7 +1398,7 @@ KVSO_CLASS_FUNCTION(painter,shear)
KVSO_PARAMETER("shear_v",KVS_PT_DOUBLE,0,dShearv)
KVSO_PARAMETERS_END(c)
PAINTER_SHEAR(dShearh,dShearv);
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(painter,scale)
@@ -1416,13 +1410,13 @@ KVSO_CLASS_FUNCTION(painter,scale)
KVSO_PARAMETER("scale_y",KVS_PT_DOUBLE,0,dScaley)
KVSO_PARAMETERS_END(c)
PAINTER_SCALE(dScalex,dScaley);
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(painter,reset)
{
CHECK_INTERNAL_POINTER(m_pPainter)
- m_pPainter->resetTransform();
+ m_pPainter->resetTransform();
return true;
}
@@ -1436,16 +1430,16 @@ KVSO_CLASS_FUNCTION(painter,drawHtmlText)
KVSO_PARAMETER("x",KVS_PT_INT,0,iX)
KVSO_PARAMETER("y",KVS_PT_INT,0,iY)
KVSO_PARAMETER("text",KVS_PT_STRING,0,szText)
- KVSO_PARAMETER("w",KVS_PT_INT,0,iW)
- KVSO_PARAMETER("h",KVS_PT_INT,0,iH)
+ KVSO_PARAMETER("w",KVS_PT_INT,0,iW)
+ KVSO_PARAMETER("h",KVS_PT_INT,0,iH)
KVSO_PARAMETERS_END(c)
- QTextDocument doc;
+ QTextDocument doc;
doc.setHtml(szText);
doc.setDefaultFont(m_pPainter->font());
m_pPainter->save();
m_pPainter->translate(iX,iY);
- doc.setPageSize(QSize(iW,iH));
+ doc.setPageSize(QSize(iW,iH));
doc.drawContents(m_pPainter);
m_pPainter->restore();
return true;
@@ -1585,14 +1579,14 @@ KVSO_CLASS_FUNCTION(painter,save)
{
CHECK_INTERNAL_POINTER(m_pPainter)
m_pPainter->save();
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(painter,restore)
{
CHECK_INTERNAL_POINTER(m_pPainter)
m_pPainter->restore();
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(painter,setPenStyle)
@@ -1613,7 +1607,8 @@ KVSO_CLASS_FUNCTION(painter,setPenStyle)
}
}
QPen pen=m_pPainter->pen();
- if (found){
+ if (found)
+ {
pen.setStyle(penstyles_cod[j]);
m_pPainter->setPen(pen);
}
@@ -1639,7 +1634,8 @@ KVSO_CLASS_FUNCTION(painter,setBrushStyle)
}
}
QBrush brush=m_pPainter->brush();
- if (found){
+ if (found)
+ {
brush.setStyle(brushstyles_cod[j]);
m_pPainter->setBrush(brush);
}
@@ -1690,7 +1686,7 @@ KVSO_CLASS_FUNCTION(painter,setGradientColor)
KVSO_PARAMETERS_END(c)
if (!var1->asInteger(iCol1))
{
- var1->asString(szColor);
+ var1->asString(szColor);
if (c->paramCount()<3) iOpacity=255;
else
{
@@ -1704,9 +1700,7 @@ KVSO_CLASS_FUNCTION(painter,setGradientColor)
QColor col(szColor);
col.setAlpha(iOpacity);
m_pGradient->setColorAt(dAt,col);
- }
- else
- {
+ } else {
if(c->paramCount()<4)
{
c->error(__tr2qs_ctx("Color name or triplette RGB/HSV values required","objects"));
@@ -1717,13 +1711,15 @@ KVSO_CLASS_FUNCTION(painter,setGradientColor)
c->error(__tr2qs_ctx("One of the triplette parameters didn't evaluate to an integer","objects"));\
return true;
}
- if (c->paramCount()<5) iOpacity=255;
+ if (c->paramCount()<5)
+ iOpacity=255;
QColor col;
if(KviQString::equalCI(szColorMode, "HSV"))
- col.setHsv(iCol1,iCol2,iCol3,iOpacity);
+ col.setHsv(iCol1,iCol2,iCol3,iOpacity);
else
- col.setRgb(iCol1,iCol2,iCol3,iOpacity);
- if (!m_pGradient) m_pGradient=new(QLinearGradient);
+ col.setRgb(iCol1,iCol2,iCol3,iOpacity);
+ if (!m_pGradient)
+ m_pGradient=new(QLinearGradient);
m_pGradient->setColorAt(dAt,col);
}
@@ -1792,9 +1788,7 @@ KVSO_CLASS_FUNCTION(painter,fillRect)
}
col.setNamedColor(szColor);
col.setAlpha(iOpacity);
- }
- else
- {
+ } else {
if(c->paramCount()<7)
{
c->error(__tr2qs_ctx("Color name or triplette rgb/hsv value required","objects"));
@@ -1805,12 +1799,13 @@ KVSO_CLASS_FUNCTION(painter,fillRect)
c->error(__tr2qs_ctx("One of the triplette parameters didn't evaluate to an integer","objects"));\
return true;
}
- if (c->paramCount()<5) iOpacity=255;
+ if (c->paramCount()<5)
+ iOpacity=255;
QColor col;
if(KviQString::equalCI(szColorMode, "HSV"))
- col.setHsv(iCol1,iCol2,iCol3,iOpacity);
+ col.setHsv(iCol1,iCol2,iCol3,iOpacity);
else
- col.setRgb(iCol1,iCol2,iCol3,iOpacity);
+ col.setRgb(iCol1,iCol2,iCol3,iOpacity);
}
m_pPainter->fillRect(iX,iY,iW,iH,col);
return true;
@@ -1910,7 +1905,8 @@ KVSO_CLASS_FUNCTION(painter,setCompositionMode)
break;
}
}
- if (found){
+ if (found)
+ {
m_pPainter->setCompositionMode(composition_cod[j]);
}
else c->warning(__tr2qs_ctx("Unknown composition mode '%Q'","objects"),&szComposition);
@@ -1919,7 +1915,8 @@ KVSO_CLASS_FUNCTION(painter,setCompositionMode)
KVSO_CLASS_FUNCTION(painter,resetPath)
{
Q_UNUSED(c);
- if (m_pPainterPath){
+ if (m_pPainterPath)
+ {
delete m_pPainterPath;
m_pPainterPath=0;
}
@@ -1927,9 +1924,9 @@ KVSO_CLASS_FUNCTION(painter,resetPath)
}
void KvsObject_painter::setInternalPainter(QPainter *p)
{
- delete m_pPainter;
- m_pPainter=p;
- bDonotdeleteinternalqpainter=true;
+ delete m_pPainter;
+ m_pPainter=p;
+ bDonotdeleteinternalqpainter=true;
}
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
#include "m_KvsObject_painter.moc"
diff --git a/src/modules/objects/KvsObject_painter.h b/src/modules/objects/KvsObject_painter.h
index 7f9508a94..f1bfd971d 100644
--- a/src/modules/objects/KvsObject_painter.h
+++ b/src/modules/objects/KvsObject_painter.h
@@ -41,8 +41,8 @@ public:
KVSO_DECLARE_OBJECT(KvsObject_painter)
protected:
QPrinter * m_pPrinter;
- bool bDonotdeleteinternalqpainter;
- QPainter * m_pPainter;
+ bool bDonotdeleteinternalqpainter;
+ QPainter * m_pPainter;
QMatrix m_pMatrix;
QLinearGradient *m_pGradient;
QPainterPath *m_pPainterPath;
@@ -114,7 +114,7 @@ public:
bool resetPath(KviKvsObjectFunctionCall *c);
bool beginPdf(KviKvsObjectFunctionCall *c);
-bool drawPixmapWithEffect(KviKvsObjectFunctionCall *c);
+ bool drawPixmapWithEffect(KviKvsObjectFunctionCall *c);
bool painterDeviceWidth(KviKvsObjectFunctionCall *c);
bool painterDeviceHeight(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/KvsObject_popupMenu.cpp b/src/modules/objects/KvsObject_popupMenu.cpp
index ea250b0b2..39e6ebeea 100644
--- a/src/modules/objects/KvsObject_popupMenu.cpp
+++ b/src/modules/objects/KvsObject_popupMenu.cpp
@@ -57,9 +57,9 @@
@functions:
!fn: $insertItem(<text:string>,[icon_id:string])
Inserts menu items into a popup menu with optional icon and return the popup identifier.
- !fn: $addMenu(<popupmenu:hobject,[idx:uinteger])
- Add a popupmenu.
- With the optional parameter idx the popup will be inserted.
+ !fn: $addMenu(<popupmenu:hobject,[idx:uinteger])
+ Add a popupmenu.
+ With the optional parameter idx the popup will be inserted.
!fn: $setTitle(<text:string>)
Sets the popupmenu title to text.
!fn: $exec([<widget:objects>,<x:uinteger>,<y:integer>])
diff --git a/src/modules/objects/KvsObject_process.cpp b/src/modules/objects/KvsObject_process.cpp
index 7934127c6..5c2a00c4c 100644
--- a/src/modules/objects/KvsObject_process.cpp
+++ b/src/modules/objects/KvsObject_process.cpp
@@ -46,10 +46,10 @@
The Process class is used to start external programs and to communicate with them.[br]
!WARNING AT LAST YOU HAVE TO CLOSE THE PROCESS!
@functions:
- !fn: $addArgument(<process-name:string>)
+ !fn: $addArgument(<process-name:string>)
With this command you give the process name (or more arguments) for comunication.
Es: see the next example.
- !fn: $startProcess()
+ !fn: $startProcess()
Tries to run the process.[br]
Es: [br]
%process=$new(process);[br]
@@ -65,16 +65,16 @@
{[br]
slotReadStdout()[br]
{[br]
- %stdo = %Process->$readStdout()[br]
+ %stdo = %Process->$readStdout()[br]
#%Aoutput->$append(%stdo);// coming soon in the new texteditor class[br]
- %Aoutput->$settext(%stdo);[br]
- }[br]
+ %Aoutput->$settext(%stdo);[br]
+ }[br]
slotReadStderr()[br]
{[br]
- %stderr= %Process->$readStderr()[br]
- #%Aoutput->$append(%stderr);// coming soon in the new texteditor class[br]
+ %stderr= %Process->$readStderr()[br]
+ #%Aoutput->$append(%stderr);// coming soon in the new texteditor class[br]
%Aoutput->$settext(%stderr);[br]
- }[br]
+ }[br]
}[br]
%tt=$new(test)[br]
@@ -97,16 +97,16 @@
%layoutA->$addwidget(%bterminate,5,0)[br]
%Process=$new(process)[br]
- %Process->$addArgument("cmd.exe")[br]
- %Process->$startProcess();[br]
+ %Process->$addArgument("cmd.exe")[br]
+ %Process->$startProcess();[br]
connect %Process readyReadStdout %tt slotReadStdout[br]
connect %Process readyReadStderr %tt slotReadStderr[br]
privateimpl(%Ainput,returnPressedEvent)[br]
{
- %command=%Ainput->$text() "\r\n"[br]
- %Process->$writeToStdin(%command);[br]
- %Ainput->$setText("");[br]
+ %command=%Ainput->$text() "\r\n"[br]
+ %Process->$writeToStdin(%command);[br]
+ %Ainput->$setText("");[br]
}[br]
privateimpl(%bclosekill,mousepressevent)[br]
@@ -173,7 +173,7 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_process,"process","object")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_process,isRunning);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_process,normalExit);
- // Events
+ // Events
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_process,readyReadStdoutEvent);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_process,readyReadStderrEvent);
@@ -203,7 +203,7 @@ KVSO_CLASS_FUNCTION(process,addArgument)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("argument",KVS_PT_NONEMPTYSTRING,0,szArgument)
KVSO_PARAMETERS_END(c)
- m_szArgs.append(szArgument);
+ m_szArgs.append(szArgument);
return true;
}
@@ -213,8 +213,8 @@ KVSO_CLASS_FUNCTION(process,startProcess)
CHECK_INTERNAL_POINTER(m_pProcess)
QString szcmd;
- szcmd = m_szArgs.takeFirst();
- m_pProcess->start(szcmd, m_szArgs);
+ szcmd = m_szArgs.takeFirst();
+ m_pProcess->start(szcmd, m_szArgs);
if(m_pProcess->state()==QProcess::NotRunning)
{
diff --git a/src/modules/objects/KvsObject_progressBar.cpp b/src/modules/objects/KvsObject_progressBar.cpp
index 07cddba24..294bcc866 100644
--- a/src/modules/objects/KvsObject_progressBar.cpp
+++ b/src/modules/objects/KvsObject_progressBar.cpp
@@ -98,7 +98,7 @@ KVSO_CLASS_FUNCTION(progressBar,setProgress)
KVSO_PARAMETER("step_value",KVS_PT_UNSIGNEDINTEGER,0,iValue)
KVSO_PARAMETERS_END(c)
((QProgressBar *)widget())->setValue(iValue);
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(progressBar,setTotalSteps)
@@ -109,7 +109,7 @@ KVSO_CLASS_FUNCTION(progressBar,setTotalSteps)
KVSO_PARAMETER("total_steps",KVS_PT_UNSIGNEDINTEGER,0,iMax)
KVSO_PARAMETERS_END(c)
((QProgressBar *)widget())->setMaximum(iMax);
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(progressBar,reset)
diff --git a/src/modules/objects/KvsObject_slider.cpp b/src/modules/objects/KvsObject_slider.cpp
index 7bf2f4923..fbd4744c3 100644
--- a/src/modules/objects/KvsObject_slider.cpp
+++ b/src/modules/objects/KvsObject_slider.cpp
@@ -33,7 +33,7 @@
/*
-@doc: slider
+ @doc: slider
@keyterms:
slider object class
@title:
@@ -157,7 +157,7 @@ KVSO_CLASS_FUNCTION(slider,setValue)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("value",KVS_PT_INT,0,iValue)
KVSO_PARAMETERS_END(c)
- ((QSlider *)widget())->setValue(iValue);
+ ((QSlider *)widget())->setValue(iValue);
return true;
}
KVSO_CLASS_FUNCTION(slider,setMinValue)
@@ -177,7 +177,7 @@ KVSO_CLASS_FUNCTION(slider,setMaxValue)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("max_value",KVS_PT_INT,0,iMaxvalue)
KVSO_PARAMETERS_END(c)
- ((QSlider *)widget())->setMaximum(iMaxvalue);
+ ((QSlider *)widget())->setMaximum(iMaxvalue);
return true;
}
@@ -198,7 +198,7 @@ KVSO_CLASS_FUNCTION(slider,setPageStep)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("page_step",KVS_PT_INT,0,iPagestep)
KVSO_PARAMETERS_END(c)
- if (widget()) ((QSlider *)widget())->setPageStep(iPagestep);
+ if (widget()) ((QSlider *)widget())->setPageStep(iPagestep);
return true;
}
@@ -208,7 +208,7 @@ KVSO_CLASS_FUNCTION(slider,setTickInterval)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("tick_interval",KVS_PT_INT,0,iInterval)
KVSO_PARAMETERS_END(c)
- ((QSlider *)widget())->setTickInterval(iInterval);
+ ((QSlider *)widget())->setTickInterval(iInterval);
return true;
}
diff --git a/src/modules/objects/KvsObject_socket.cpp b/src/modules/objects/KvsObject_socket.cpp
index 03f991895..dd361d501 100644
--- a/src/modules/objects/KvsObject_socket.cpp
+++ b/src/modules/objects/KvsObject_socket.cpp
@@ -210,7 +210,7 @@ const char * const sockerrors_tbl[] = {
Returns the port of the local end of this socket.[br]
The return value is meaningful only if the socket is in connected, listening or connecting state.
-@examples:
+ @examples:
[example]
// Server socket: listen 8080 port and answer to requests (multi-threaded)
class("webserver","socket")
@@ -408,7 +408,7 @@ KVSO_CLASS_FUNCTION(socket,read)
c->warning(__tr2qs_ctx("File is not open!","objects"));
return true;
}
- pFile->write(m_pSocket->read(iLen));
+ pFile->write(m_pSocket->read(iLen));
} else {
c->warning(__tr2qs_ctx("Buffer parameter is not a memorybuffer object","objects"));
return true;
@@ -482,7 +482,7 @@ KVSO_CLASS_FUNCTION(socket,write)
{
if(iValue < 256 && iValue >= 0)
{
- m_pSocket->putChar(iValue);
+ m_pSocket->putChar(iValue);
continue;
} else {
c->warning(__tr2qs_ctx("Only values in the range of 0-255 are allowed: integer %d is out of range","objects"),iValue);
diff --git a/src/modules/objects/KvsObject_socket.h b/src/modules/objects/KvsObject_socket.h
index f1b740014..017e88acd 100644
--- a/src/modules/objects/KvsObject_socket.h
+++ b/src/modules/objects/KvsObject_socket.h
@@ -45,8 +45,8 @@ protected:
void setInternalSocket(QAbstractSocket *pSocket)
{
- delete m_pSocket;
- m_pSocket=pSocket;
+ delete m_pSocket;
+ m_pSocket=pSocket;
}
bool status(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/KvsObject_spinBox.cpp b/src/modules/objects/KvsObject_spinBox.cpp
index 080cddc0e..7bb3c1c9e 100644
--- a/src/modules/objects/KvsObject_spinBox.cpp
+++ b/src/modules/objects/KvsObject_spinBox.cpp
@@ -157,7 +157,7 @@ KVSO_CLASS_FUNCTION(spinBox,setMinValue)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("min_value",KVS_PT_INT,0,iMinvalue)
KVSO_PARAMETERS_END(c)
- ((QSpinBox *)widget())->setMinimum(iMinvalue);
+ ((QSpinBox *)widget())->setMinimum(iMinvalue);
return true;
}
KVSO_CLASS_FUNCTION(spinBox,setMaxValue)
@@ -167,7 +167,7 @@ KVSO_CLASS_FUNCTION(spinBox,setMaxValue)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("max_value",KVS_PT_INT,0,iMaxvalue)
KVSO_PARAMETERS_END(c)
- ((QSpinBox *)widget())->setMaximum(iMaxvalue);
+ ((QSpinBox *)widget())->setMaximum(iMaxvalue);
return true;
}
@@ -178,7 +178,7 @@ KVSO_CLASS_FUNCTION(spinBox,setLineStep)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("line_step",KVS_PT_INT,0,iLinestep)
KVSO_PARAMETERS_END(c)
- ((QSpinBox *)widget())->setSingleStep(iLinestep);
+ ((QSpinBox *)widget())->setSingleStep(iLinestep);
return true;
}
diff --git a/src/modules/objects/KvsObject_sql.cpp b/src/modules/objects/KvsObject_sql.cpp
index 2c7b32438..fc1da4276 100644
--- a/src/modules/objects/KvsObject_sql.cpp
+++ b/src/modules/objects/KvsObject_sql.cpp
@@ -35,553 +35,548 @@ static KviPointerList <KvsObject_sql> sql_instances;
static bool checkDuplicatedConnection(QString &szConnectionName)
{
- if(!sql_instances.count()) return false;
- bool bFound=false;
- for(KvsObject_sql *i = sql_instances.first(); i; i = sql_instances.next())
- {
- QSqlQuery *q=i->getQueryConnectionsDict().value(szConnectionName);
- if (q)
- {
- i->closeQueryConnection(q);
- bFound=true;
- break;
- }
- }
- return bFound;
+ if(!sql_instances.count()) return false;
+ bool bFound=false;
+ for(KvsObject_sql *i = sql_instances.first(); i; i = sql_instances.next())
+ {
+ QSqlQuery *q=i->getQueryConnectionsDict().value(szConnectionName);
+ if (q)
+ {
+ i->closeQueryConnection(q);
+ bFound=true;
+ break;
+ }
+ }
+ return bFound;
}
static void KviKvsSqlInstanceRegister(KvsObject_sql *instance)
{
- sql_instances.setAutoDelete(false);
- sql_instances.append(instance);
+ sql_instances.setAutoDelete(false);
+ sql_instances.append(instance);
}
static void KviKvsSqlInstanceUnregister(KvsObject_sql *instance)
{
- int idx=sql_instances.findRef(instance);
- sql_instances.remove(idx);
+ int idx=sql_instances.findRef(instance);
+ sql_instances.remove(idx);
}
#define CHECK_QUERY_IS_INIT if (!m_pCurrentSQlQuery)\
- {\
- c->error("No query has been initialized!");\
- return false;}
+ {\
+ c->error("No query has been initialized!");\
+ return false;}
/*
- @doc: sql
- @keyterms:
- Sql database.
- @title:
- sql class
- @type:
- class
- @short:
- A sql database interface.
- @inherits:
- [class]object[/class]
- @description:
- This class permits KVIrc to have an interface with a SQL database supported by Qt library drivers.
- @functions:
- !fn: <boolean> $setConnection(<connection_name:string>,<database_name:string>,[<user:string>,<host_name_string>,<password:string>,<database_driver:string>])
- Connects to the DBMS using the connection <connection_name> and selecting the database <database_name>.[br]
- If the optional parameter <database_driver> is passed, it will be used the corresponding driver (if present), otherwise Sqlite will be used.
- Returns true if the operation is successful, false otherwise.
- !fn:: <array or string> $connectionNames([<stringreturnflag>:'s'])
- Returns as array or, if the flag 's' is passed, as a comma separate string all the database active connection's names.
- !fn: <array> $tablesList(<connection_name:string>)
- Returns as array the database tables list.
- !fn: $queryInit(<connection_name:string>)
- Initialize the query for the database <connection_name> which has to be already connected.
- !fn: $transaction()
- Begin a transaction.
- !fn: $commit()
- Commit the transaction.
- !fn: $setCurrentQuery(<connection_name:string>)
- Sets the query for the database connection <connection_name>, which has to be already connected, as current query.
- !fn: <connection_name:string> $currentQuery()
- Returns the name of the database connection for the current query, or an empty string if there aren't any initialized queries.
- !fn: $closeConnection(<connection_name:string>)
- Closes the connection <connection_name>.
- !fn: <size:integer> $queryResultsSize()
- Returns the query size in rows or -1 if the query is empty or the database driver doesn' support the function.
- !fn: <error:string> $lastError(<more_details:boolean>)
- Returns last error occurred. Use the more_details flag for more info about the error.
- !fn: <ok:boolean> $queryExec([<query:string>])
- Execs the current query <query>. The string must follow the right syntax against the database in use.
- If there are no parameters, it will exec the query previously done.
- After the execution, the query will positioned on the first resulting record.
- Returns true if the operation is successful, false otherwise.
- See also [classfnc]$queryPrepare[/classfnc]()
- !fn: <ok:boolean> $queryPrepare(<query_string>)
- Prepare the query <query> to execute. The string must follow the right syntax against the database in use.
- It's possible to use the placeholders. It's supported either the identifier ':' and '?' but it's not possible to use them together.
- Returns true if the operation is successful, false otherwise.
- See also [classfnc]$queryExec[/classfnc]and[classfnc]$queryBindValue[/classfnc.
- !fn: $queryBindValue()
- Sets the placeholder <placeholder> to be bound to the value <val> in the prepared statement.
- Note that the placeholder mark (e.g :) must be included when specifing the placeholder name.
- !fn: <boolean> $queryPrevious()
- Sets the current query position to the previous resulting record.
- Returns true if the operation is successful, false otherwise.
- !fn: <boolean> $queryNext()
- Sets the current query position to the next resulting record.
- Returns true if the operation is successful, false otherwise.
- !fn: <boolean> $queryLast()
- Sets the current query position to the last resulting record.
- Returns true if the operation is successful, false otherwise.
- !fn: <boolean> $queryFirst()
- Sets the current query position to the first resulting record.
- Returns true if the operation is successful, false otherwise.
- !fn: <record:hash> $queryRecord()
- Returns a hash containing the current query's record fields.
- !fn: $queryFinish()
- Sets the current query to inactive.
+ @doc: sql
+ @keyterms:
+ Sql database.
+ @title:
+ sql class
+ @type:
+ class
+ @short:
+ A sql database interface.
+ @inherits:
+ [class]object[/class]
+ @description:
+ This class permits KVIrc to have an interface with a SQL database supported by Qt library drivers.
+ @functions:
+ !fn: <boolean> $setConnection(<connection_name:string>,<database_name:string>,[<user:string>,<host_name_string>,<password:string>,<database_driver:string>])
+ Connects to the DBMS using the connection <connection_name> and selecting the database <database_name>.[br]
+ If the optional parameter <database_driver> is passed, it will be used the corresponding driver (if present), otherwise Sqlite will be used.
+ Returns true if the operation is successful, false otherwise.
+ !fn:: <array or string> $connectionNames([<stringreturnflag>:'s'])
+ Returns as array or, if the flag 's' is passed, as a comma separate string all the database active connection's names.
+ !fn: <array> $tablesList(<connection_name:string>)
+ Returns as array the database tables list.
+ !fn: $queryInit(<connection_name:string>)
+ Initialize the query for the database <connection_name> which has to be already connected.
+ !fn: $transaction()
+ Begin a transaction.
+ !fn: $commit()
+ Commit the transaction.
+ !fn: $setCurrentQuery(<connection_name:string>)
+ Sets the query for the database connection <connection_name>, which has to be already connected, as current query.
+ !fn: <connection_name:string> $currentQuery()
+ Returns the name of the database connection for the current query, or an empty string if there aren't any initialized queries.
+ !fn: $closeConnection(<connection_name:string>)
+ Closes the connection <connection_name>.
+ !fn: <size:integer> $queryResultsSize()
+ Returns the query size in rows or -1 if the query is empty or the database driver doesn' support the function.
+ !fn: <error:string> $lastError(<more_details:boolean>)
+ Returns last error occurred. Use the more_details flag for more info about the error.
+ !fn: <ok:boolean> $queryExec([<query:string>])
+ Execs the current query <query>. The string must follow the right syntax against the database in use.
+ If there are no parameters, it will exec the query previously done.
+ After the execution, the query will positioned on the first resulting record.
+ Returns true if the operation is successful, false otherwise.
+ See also [classfnc]$queryPrepare[/classfnc]()
+ !fn: <ok:boolean> $queryPrepare(<query_string>)
+ Prepare the query <query> to execute. The string must follow the right syntax against the database in use.
+ It's possible to use the placeholders. It's supported either the identifier ':' and '?' but it's not possible to use them together.
+ Returns true if the operation is successful, false otherwise.
+ See also [classfnc]$queryExec[/classfnc]and[classfnc]$queryBindValue[/classfnc.
+ !fn: $queryBindValue()
+ Sets the placeholder <placeholder> to be bound to the value <val> in the prepared statement.
+ Note that the placeholder mark (e.g :) must be included when specifing the placeholder name.
+ !fn: <boolean> $queryPrevious()
+ Sets the current query position to the previous resulting record.
+ Returns true if the operation is successful, false otherwise.
+ !fn: <boolean> $queryNext()
+ Sets the current query position to the next resulting record.
+ Returns true if the operation is successful, false otherwise.
+ !fn: <boolean> $queryLast()
+ Sets the current query position to the last resulting record.
+ Returns true if the operation is successful, false otherwise.
+ !fn: <boolean> $queryFirst()
+ Sets the current query position to the first resulting record.
+ Returns true if the operation is successful, false otherwise.
+ !fn: <record:hash> $queryRecord()
+ Returns a hash containing the current query's record fields.
+ !fn: $queryFinish()
+ Sets the current query to inactive.
*/
KVSO_BEGIN_REGISTERCLASS(KvsObject_sql,"sql","object")
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryLastInsertId)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,commit)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,beginTransaction)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,setConnection)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,connectionNames)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,setCurrentQuery)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,tablesList)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,currentQuery)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,closeConnection)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryInit)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryFinish)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryResultsSize)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryExec)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryPrepare)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryBindValue)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryPrevious)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryNext)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryLast)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryFirst)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryRecord)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,lastError)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,features)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryLastInsertId)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,commit)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,beginTransaction)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,setConnection)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,connectionNames)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,setCurrentQuery)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,tablesList)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,currentQuery)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,closeConnection)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryInit)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryFinish)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryResultsSize)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryExec)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryPrepare)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryBindValue)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryPrevious)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryNext)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryLast)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryFirst)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryRecord)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,lastError)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,features)
KVSO_END_REGISTERCLASS(KvsObject_sql)
KVSO_BEGIN_CONSTRUCTOR(KvsObject_sql,KviKvsObject)
-m_pCurrentSQlQuery=0;
-KviKvsSqlInstanceRegister(this);
+ m_pCurrentSQlQuery=0;
+ KviKvsSqlInstanceRegister(this);
KVSO_END_CONSTRUCTOR(KvsObject_sql)
KVSO_BEGIN_DESTRUCTOR(KvsObject_sql)
-QHashIterator<QString,QSqlQuery *> t(queryConnectionsDict);
-while (t.hasNext())
-{
- t.next();
- QString szConnectionName=t.key();
- queryConnectionsDict.value(szConnectionName)->finish();
- delete queryConnectionsDict.value(szConnectionName);
- QSqlDatabase::removeDatabase(szConnectionName);
-}
-KviKvsSqlInstanceUnregister(this);
-queryConnectionsDict.clear();
-
+ QHashIterator<QString,QSqlQuery *> t(queryConnectionsDict);
+ while (t.hasNext())
+ {
+ t.next();
+ QString szConnectionName=t.key();
+ queryConnectionsDict.value(szConnectionName)->finish();
+ delete queryConnectionsDict.value(szConnectionName);
+ QSqlDatabase::removeDatabase(szConnectionName);
+ }
+ KviKvsSqlInstanceUnregister(this);
+ queryConnectionsDict.clear();
KVSO_END_DESTRUCTOR(KvsObject_sql)
KVSO_CLASS_FUNCTION(sql,setConnection)
{
- QString szConnectionName,szDbName,szDbDriver,szUserName,szHostName,szPassword;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETER("database_name",KVS_PT_STRING,0,szDbName)
- KVSO_PARAMETER("user_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szUserName)
- KVSO_PARAMETER("host_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szHostName)
- KVSO_PARAMETER("password",KVS_PT_STRING,KVS_PF_OPTIONAL,szPassword)
- KVSO_PARAMETER("database_type",KVS_PT_STRING,KVS_PF_OPTIONAL,szDbDriver)
- KVSO_PARAMETERS_END(c)
- if(!szDbDriver.isEmpty())
- {
- QStringList drivers = QSqlDatabase::drivers();
- if (!drivers.contains(szDbDriver))
- {
- c->error(__tr2qs_ctx("Missing Qt plugin for database %Q","objects"),&szDbDriver);
- return false;
- }
- }
- else szDbDriver="QSQLITE";
- if (checkDuplicatedConnection(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Duplicate connection name '%Q', old query connection removed","objects"),&szConnectionName);
- }
- QSqlDatabase db=QSqlDatabase::addDatabase(szDbDriver,szConnectionName);
- db.setDatabaseName(szDbName);
- db.setHostName(szHostName);
- db.setUserName(szUserName);
- db.setPassword(szPassword);
+ QString szConnectionName,szDbName,szDbDriver,szUserName,szHostName,szPassword;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETER("database_name",KVS_PT_STRING,0,szDbName)
+ KVSO_PARAMETER("user_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szUserName)
+ KVSO_PARAMETER("host_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szHostName)
+ KVSO_PARAMETER("password",KVS_PT_STRING,KVS_PF_OPTIONAL,szPassword)
+ KVSO_PARAMETER("database_type",KVS_PT_STRING,KVS_PF_OPTIONAL,szDbDriver)
+ KVSO_PARAMETERS_END(c)
+ if(!szDbDriver.isEmpty())
+ {
+ QStringList drivers = QSqlDatabase::drivers();
+ if (!drivers.contains(szDbDriver))
+ {
+ c->error(__tr2qs_ctx("Missing Qt plugin for database %Q","objects"),&szDbDriver);
+ return false;
+ }
+ }
+ else szDbDriver="QSQLITE";
+ if (checkDuplicatedConnection(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Duplicate connection name '%Q', old query connection removed","objects"),&szConnectionName);
+ }
+ QSqlDatabase db=QSqlDatabase::addDatabase(szDbDriver,szConnectionName);
+ db.setDatabaseName(szDbName);
+ db.setHostName(szHostName);
+ db.setUserName(szUserName);
+ db.setPassword(szPassword);
- c->returnValue()->setBoolean(db.open());
- return true;
+ c->returnValue()->setBoolean(db.open());
+ return true;
}
KVSO_CLASS_FUNCTION(sql,connectionNames)
{
-
- QString szFlag;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("stringreturnflag",KVS_PT_STRING,KVS_PF_OPTIONAL,szFlag)
- KVSO_PARAMETERS_END(c)
- QStringList szConnectionsList=QSqlDatabase::connectionNames();
- if(szFlag.indexOf('s',0,Qt::CaseInsensitive) != -1)
- {
- QString szConnections=szConnectionsList.join(",");
- c->returnValue()->setString(szConnections);
- }
- else
- {
- KviKvsArray *pArray=new KviKvsArray();
- for(int i=0;i<szConnectionsList.count();i++)
- {
- pArray->set(i,new KviKvsVariant(szConnectionsList.at(i)));
- }
- c->returnValue()->setArray(pArray);
- }
- return true;
+ QString szFlag;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("stringreturnflag",KVS_PT_STRING,KVS_PF_OPTIONAL,szFlag)
+ KVSO_PARAMETERS_END(c)
+ QStringList szConnectionsList=QSqlDatabase::connectionNames();
+ if(szFlag.indexOf('s',0,Qt::CaseInsensitive) != -1)
+ {
+ QString szConnections=szConnectionsList.join(",");
+ c->returnValue()->setString(szConnections);
+ } else {
+ KviKvsArray *pArray=new KviKvsArray();
+ for(int i=0;i<szConnectionsList.count();i++)
+ {
+ pArray->set(i,new KviKvsVariant(szConnectionsList.at(i)));
+ }
+ c->returnValue()->setArray(pArray);
+ }
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryLastInsertId)
{
- CHECK_QUERY_IS_INIT
- QVariant value=m_pCurrentSQlQuery->lastInsertId();
- if (value.type()==QVariant::LongLong){
- c->returnValue()->setInteger((kvs_int_t) value.toLongLong());
- }
- return true;
- }
+ CHECK_QUERY_IS_INIT
+ QVariant value=m_pCurrentSQlQuery->lastInsertId();
+ if (value.type()==QVariant::LongLong)
+ c->returnValue()->setInteger((kvs_int_t) value.toLongLong());
+ return true;
+}
KVSO_CLASS_FUNCTION(sql,features)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
- QStringList connections = QSqlDatabase::connectionNames();
- if (!connections.contains(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- QSqlDatabase db=QSqlDatabase::database(szConnectionName);
- QSqlDriver *sqlDriver=db.driver();
- QStringList features;
- if (sqlDriver->hasFeature(QSqlDriver::Transactions)) features.append("transactions");
- if (sqlDriver->hasFeature(QSqlDriver::QuerySize)) features.append("querysize");
- if (sqlDriver->hasFeature(QSqlDriver::BLOB)) features.append("blob");
- if (sqlDriver->hasFeature(QSqlDriver::PreparedQueries)) features.append("preparedqueries");
- if (sqlDriver->hasFeature(QSqlDriver::NamedPlaceholders)) features.append("namedplaceholders");
- if (sqlDriver->hasFeature(QSqlDriver::PositionalPlaceholders)) features.append("positionaplaceholders");
- if (sqlDriver->hasFeature(QSqlDriver::LastInsertId)) features.append("lastinsertid");
- if (sqlDriver->hasFeature(QSqlDriver::BatchOperations)) features.append("batchoperations");
- if (sqlDriver->hasFeature(QSqlDriver::SimpleLocking)) features.append("simplelocking");
- if (sqlDriver->hasFeature(QSqlDriver::LowPrecisionNumbers)) features.append("lowprecisionnumbers");
- if (sqlDriver->hasFeature(QSqlDriver::EventNotifications)) features.append("eventnotifications");
- if (sqlDriver->hasFeature(QSqlDriver::FinishQuery)) features.append("finishquery");
- if (sqlDriver->hasFeature(QSqlDriver::MultipleResultSets)) features.append("multipleresults");
- c->returnValue()->setString(features.join(","));
- return true;
+ QStringList connections = QSqlDatabase::connectionNames();
+ if (!connections.contains(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ QSqlDatabase db=QSqlDatabase::database(szConnectionName);
+ QSqlDriver *sqlDriver=db.driver();
+ QStringList features;
+ if (sqlDriver->hasFeature(QSqlDriver::Transactions)) features.append("transactions");
+ if (sqlDriver->hasFeature(QSqlDriver::QuerySize)) features.append("querysize");
+ if (sqlDriver->hasFeature(QSqlDriver::BLOB)) features.append("blob");
+ if (sqlDriver->hasFeature(QSqlDriver::PreparedQueries)) features.append("preparedqueries");
+ if (sqlDriver->hasFeature(QSqlDriver::NamedPlaceholders)) features.append("namedplaceholders");
+ if (sqlDriver->hasFeature(QSqlDriver::PositionalPlaceholders)) features.append("positionaplaceholders");
+ if (sqlDriver->hasFeature(QSqlDriver::LastInsertId)) features.append("lastinsertid");
+ if (sqlDriver->hasFeature(QSqlDriver::BatchOperations)) features.append("batchoperations");
+ if (sqlDriver->hasFeature(QSqlDriver::SimpleLocking)) features.append("simplelocking");
+ if (sqlDriver->hasFeature(QSqlDriver::LowPrecisionNumbers)) features.append("lowprecisionnumbers");
+ if (sqlDriver->hasFeature(QSqlDriver::EventNotifications)) features.append("eventnotifications");
+ if (sqlDriver->hasFeature(QSqlDriver::FinishQuery)) features.append("finishquery");
+ if (sqlDriver->hasFeature(QSqlDriver::MultipleResultSets)) features.append("multipleresults");
+ c->returnValue()->setString(features.join(","));
+ return true;
}
KVSO_CLASS_FUNCTION(sql,beginTransaction)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
- QStringList connections = QSqlDatabase::connectionNames();
- if (!connections.contains(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- QSqlDatabase db=QSqlDatabase::database(szConnectionName);
- db.transaction();
- return true;
+ QStringList connections = QSqlDatabase::connectionNames();
+ if (!connections.contains(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ QSqlDatabase db=QSqlDatabase::database(szConnectionName);
+ db.transaction();
+ return true;
}
KVSO_CLASS_FUNCTION(sql,commit)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
- QStringList connections = QSqlDatabase::connectionNames();
- if (!connections.contains(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- QSqlDatabase db=QSqlDatabase::database(szConnectionName);
- db.commit();
- return true;
+ QStringList connections = QSqlDatabase::connectionNames();
+ if (!connections.contains(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ QSqlDatabase db=QSqlDatabase::database(szConnectionName);
+ db.commit();
+ return true;
}
KVSO_CLASS_FUNCTION(sql,closeConnection)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
- QStringList connections = QSqlDatabase::connectionNames();
- if (!connections.contains(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- QSqlQuery *q=queryConnectionsDict.value(szConnectionName);
- if (q) closeQueryConnection(q);
- QSqlDatabase::removeDatabase(szConnectionName);
- return true;
+ QStringList connections = QSqlDatabase::connectionNames();
+ if (!connections.contains(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ QSqlQuery *q=queryConnectionsDict.value(szConnectionName);
+ if (q) closeQueryConnection(q);
+ QSqlDatabase::removeDatabase(szConnectionName);
+ return true;
}
KVSO_CLASS_FUNCTION(sql,tablesList)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
- QStringList connections = QSqlDatabase::connectionNames();
- if (!connections.contains(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- QSqlDatabase db=QSqlDatabase::database(szConnectionName);
- QStringList tables=db.tables();
- KviKvsArray *pArray=new KviKvsArray();
- for(int i=0;i<tables.count();i++)
- {
- pArray->set(i,new KviKvsVariant(tables.at(i)));
- }
- c->returnValue()->setArray(pArray);
- return true;
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connectionName",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
+ QStringList connections = QSqlDatabase::connectionNames();
+ if (!connections.contains(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ QSqlDatabase db=QSqlDatabase::database(szConnectionName);
+ QStringList tables=db.tables();
+ KviKvsArray *pArray=new KviKvsArray();
+ for(int i=0;i<tables.count();i++)
+ {
+ pArray->set(i,new KviKvsVariant(tables.at(i)));
+ }
+ c->returnValue()->setArray(pArray);
+ return true;
}
KVSO_CLASS_FUNCTION(sql,setCurrentQuery)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
- QSqlQuery *q=queryConnectionsDict.value(szConnectionName);
- if(!q)
- {
- c->warning(__tr2qs_ctx("Connection query %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- m_pCurrentSQlQuery=q;
- return true;
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
+ QSqlQuery *q=queryConnectionsDict.value(szConnectionName);
+ if(!q)
+ {
+ c->warning(__tr2qs_ctx("Connection query %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ m_pCurrentSQlQuery=q;
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryFinish)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connection_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szConnectionName)
- KVSO_PARAMETERS_END(c)
- QSqlQuery *q;
- if(szConnectionName.isEmpty())
- {
- q=m_pCurrentSQlQuery;
- if (!q)
- {
- c->warning(__tr2qs_ctx("No query connection is open","objects"));
- return true;
- }
- }
- else
- {
- q=queryConnectionsDict.value(szConnectionName);
- if(!q)
- {
- c->warning(__tr2qs_ctx("Query for connection %Q does not exists","objects"),&szConnectionName);
- return true;
- }
- }
- q->finish();
- return true;
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connection_name",KVS_PT_STRING,KVS_PF_OPTIONAL,szConnectionName)
+ KVSO_PARAMETERS_END(c)
+ QSqlQuery *q;
+ if(szConnectionName.isEmpty())
+ {
+ q=m_pCurrentSQlQuery;
+ if (!q)
+ {
+ c->warning(__tr2qs_ctx("No query connection is open","objects"));
+ return true;
+ }
+ }
+ else
+ {
+ q=queryConnectionsDict.value(szConnectionName);
+ if(!q)
+ {
+ c->warning(__tr2qs_ctx("Query for connection %Q does not exists","objects"),&szConnectionName);
+ return true;
+ }
+ }
+ q->finish();
+ return true;
}
KVSO_CLASS_FUNCTION(sql,currentQuery)
{
- if (!m_pCurrentSQlQuery) c->returnValue()->setString(QString());
- else
- {
- QString szKey=queryConnectionsDict.key(m_pCurrentSQlQuery);
- c->returnValue()->setString(szKey);
- }
- return true;
+ if (!m_pCurrentSQlQuery) c->returnValue()->setString(QString());
+ else
+ {
+ QString szKey=queryConnectionsDict.key(m_pCurrentSQlQuery);
+ c->returnValue()->setString(szKey);
+ }
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryInit)
{
- QString szConnectionName;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
- KVSO_PARAMETERS_END(c)
- if (queryConnectionsDict.value(szConnectionName))
- {
- c->warning(__tr2qs_ctx("Query %Q already initialized","objects"),&szConnectionName);
- return true;
- }
- if(!QSqlDatabase::connectionNames().contains(szConnectionName))
- {
- c->error(__tr2qs_ctx("Connection %Q is not open!","objects"),&szConnectionName);
- return false;
- }
- m_pCurrentSQlQuery=new QSqlQuery(QSqlDatabase::database(szConnectionName));
- queryConnectionsDict[szConnectionName]=m_pCurrentSQlQuery;
- return true;
+ QString szConnectionName;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("connection_name",KVS_PT_STRING,0,szConnectionName)
+ KVSO_PARAMETERS_END(c)
+ if (queryConnectionsDict.value(szConnectionName))
+ {
+ c->warning(__tr2qs_ctx("Query %Q already initialized","objects"),&szConnectionName);
+ return true;
+ }
+ if(!QSqlDatabase::connectionNames().contains(szConnectionName))
+ {
+ c->error(__tr2qs_ctx("Connection %Q is not open!","objects"),&szConnectionName);
+ return false;
+ }
+ m_pCurrentSQlQuery=new QSqlQuery(QSqlDatabase::database(szConnectionName));
+ queryConnectionsDict[szConnectionName]=m_pCurrentSQlQuery;
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryPrepare)
{
- CHECK_QUERY_IS_INIT
- QString szQuery;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("query",KVS_PT_STRING,0,szQuery)
- KVSO_PARAMETERS_END(c)
- c->returnValue()->setBoolean(m_pCurrentSQlQuery->prepare(szQuery));
- return true;
+ CHECK_QUERY_IS_INIT
+ QString szQuery;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("query",KVS_PT_STRING,0,szQuery)
+ KVSO_PARAMETERS_END(c)
+ c->returnValue()->setBoolean(m_pCurrentSQlQuery->prepare(szQuery));
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryBindValue)
{
- CHECK_QUERY_IS_INIT
- QString szFieldName;
- KviKvsVariant *v;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("bindName",KVS_PT_STRING,0,szFieldName)
- KVSO_PARAMETER("value",KVS_PT_VARIANT,0,v)
- KVSO_PARAMETERS_END(c)
- QString szType;
- v->getTypeName(szType);
- if (v->isString()|| v->isNothing())
- {
- QString szText;
- v->asString(szText);
- m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(szText));
- }
- else if (v->isReal())
- {
- kvs_real_t i;
- v->asReal(i);
- m_pCurrentSQlQuery->bindValue(szFieldName,QVariant((double)i));
- }
- else if (v->isInteger())
- {
- kvs_int_t i;
- v->asInteger(i);
- m_pCurrentSQlQuery->bindValue(szFieldName,QVariant((int)i));
- }
- else if (v->isBoolean())
- {
- bool b=v->asBoolean();
- m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(b));
- }
- else if (v->isHObject())
- {
- kvs_hobject_t hOb;
- v->asHObject(hOb);
- KviKvsObject *pObject;
- pObject=KviKvsKernel::instance()->objectController()->lookupObject(hOb);
- if (pObject->inheritsClass("memorybuffer"))
- m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(*((KvsObject_memoryBuffer *)pObject)->pBuffer()));
- else c->warning(__tr2qs_ctx("Only memorybuffer class object is supported","objects"));
- }
- else
- {
- QString szTypeName;
- v->getTypeName(szTypeName);
- c->warning(__tr2qs_ctx("Type value %Q not supported","objects"),&szTypeName);
- }
- return true;
+ CHECK_QUERY_IS_INIT
+ QString szFieldName;
+ KviKvsVariant *v;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("bindName",KVS_PT_STRING,0,szFieldName)
+ KVSO_PARAMETER("value",KVS_PT_VARIANT,0,v)
+ KVSO_PARAMETERS_END(c)
+ QString szType;
+ v->getTypeName(szType);
+ if (v->isString()|| v->isNothing())
+ {
+ QString szText;
+ v->asString(szText);
+ m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(szText));
+ }
+ else if (v->isReal())
+ {
+ kvs_real_t i;
+ v->asReal(i);
+ m_pCurrentSQlQuery->bindValue(szFieldName,QVariant((double)i));
+ }
+ else if (v->isInteger())
+ {
+ kvs_int_t i;
+ v->asInteger(i);
+ m_pCurrentSQlQuery->bindValue(szFieldName,QVariant((int)i));
+ }
+ else if (v->isBoolean())
+ {
+ bool b=v->asBoolean();
+ m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(b));
+ }
+ else if (v->isHObject())
+ {
+ kvs_hobject_t hOb;
+ v->asHObject(hOb);
+ KviKvsObject *pObject;
+ pObject=KviKvsKernel::instance()->objectController()->lookupObject(hOb);
+ if (pObject->inheritsClass("memorybuffer"))
+ m_pCurrentSQlQuery->bindValue(szFieldName,QVariant(*((KvsObject_memoryBuffer *)pObject)->pBuffer()));
+ else c->warning(__tr2qs_ctx("Only memorybuffer class object is supported","objects"));
+ }
+ else
+ {
+ QString szTypeName;
+ v->getTypeName(szTypeName);
+ c->warning(__tr2qs_ctx("Type value %Q not supported","objects"),&szTypeName);
+ }
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryExec)
{
- CHECK_QUERY_IS_INIT
- QString szQuery;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("query",KVS_PT_STRING,KVS_PF_OPTIONAL,szQuery)
- KVSO_PARAMETERS_END(c)
- bool bOk;
- if (szQuery.isEmpty()) bOk=m_pCurrentSQlQuery->exec();
- else bOk=m_pCurrentSQlQuery->exec(szQuery.toLatin1());
- c->returnValue()->setBoolean(bOk);
- return true;
+ CHECK_QUERY_IS_INIT
+ QString szQuery;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("query",KVS_PT_STRING,KVS_PF_OPTIONAL,szQuery)
+ KVSO_PARAMETERS_END(c)
+ bool bOk;
+ if (szQuery.isEmpty()) bOk=m_pCurrentSQlQuery->exec();
+ else bOk=m_pCurrentSQlQuery->exec(szQuery.toLatin1());
+ c->returnValue()->setBoolean(bOk);
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryNext)
{
- CHECK_QUERY_IS_INIT
- if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->next());
- else c->returnValue()->setNothing();
- return true;
+ CHECK_QUERY_IS_INIT
+ if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->next());
+ else c->returnValue()->setNothing();
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryPrevious)
{
- CHECK_QUERY_IS_INIT
- if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->previous());
- else c->returnValue()->setNothing();
- return true;
+ CHECK_QUERY_IS_INIT
+ if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->previous());
+ else c->returnValue()->setNothing();
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryResultsSize)
{
- CHECK_QUERY_IS_INIT
- c->returnValue()->setInteger(m_pCurrentSQlQuery->size());
- return true;
+ CHECK_QUERY_IS_INIT
+ c->returnValue()->setInteger(m_pCurrentSQlQuery->size());
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryFirst)
{
- CHECK_QUERY_IS_INIT
- if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->first());
- return true;
+ CHECK_QUERY_IS_INIT
+ if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->first());
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryLast)
{
- CHECK_QUERY_IS_INIT
- if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->last());
- return true;
+ CHECK_QUERY_IS_INIT
+ if (m_pCurrentSQlQuery->isActive() && m_pCurrentSQlQuery->isSelect()) c->returnValue()->setBoolean(m_pCurrentSQlQuery->last());
+ return true;
}
KVSO_CLASS_FUNCTION(sql,queryRecord)
{
- CHECK_QUERY_IS_INIT
- KviKvsHash *pHash=new KviKvsHash();
- QSqlRecord record=m_pCurrentSQlQuery->record();
- for(int i=0;i<record.count();i++)
- {
- KviKvsVariant *pValue=0;
- QVariant value=record.value(i);
- if (value.type()==QVariant::LongLong) pValue=new KviKvsVariant((kvs_int_t) value.toLongLong());
- else if (value.type()==QVariant::String) pValue=new KviKvsVariant(value.toString());
- else if (value.type()==QVariant::ByteArray)
- {
- KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass("memoryBuffer");
- KviKvsVariantList params(new KviKvsVariant(QString()));
- KviKvsObject * pObject = pClass->allocateInstance(0,"",c->context(),&params);
- *((KvsObject_memoryBuffer *)pObject)->pBuffer()=value.toByteArray();
- pValue=new KviKvsVariant(pObject->handle());
- }
- else pValue=new KviKvsVariant(QString());
- pHash->set(record.fieldName(i),pValue);
- KviKvsVariant *value2=pHash->get(record.fieldName(i));
- value2->type();
- }
- c->returnValue()->setHash(pHash);
- return true;
+ CHECK_QUERY_IS_INIT
+ KviKvsHash *pHash=new KviKvsHash();
+ QSqlRecord record=m_pCurrentSQlQuery->record();
+ for(int i=0;i<record.count();i++)
+ {
+ KviKvsVariant *pValue=0;
+ QVariant value=record.value(i);
+ if (value.type()==QVariant::LongLong) pValue=new KviKvsVariant((kvs_int_t) value.toLongLong());
+ else if (value.type()==QVariant::String) pValue=new KviKvsVariant(value.toString());
+ else if (value.type()==QVariant::ByteArray)
+ {
+ KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass("memoryBuffer");
+ KviKvsVariantList params(new KviKvsVariant(QString()));
+ KviKvsObject * pObject = pClass->allocateInstance(0,"",c->context(),&params);
+ *((KvsObject_memoryBuffer *)pObject)->pBuffer()=value.toByteArray();
+ pValue=new KviKvsVariant(pObject->handle());
+ }
+ else pValue=new KviKvsVariant(QString());
+ pHash->set(record.fieldName(i),pValue);
+ KviKvsVariant *value2=pHash->get(record.fieldName(i));
+ value2->type();
+ }
+ c->returnValue()->setHash(pHash);
+ return true;
}
KVSO_CLASS_FUNCTION(sql,lastError)
{
- CHECK_QUERY_IS_INIT
+ CHECK_QUERY_IS_INIT
bool bMoreErrorDetails;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("more",KVS_PT_BOOLEAN,KVS_PF_OPTIONAL,bMoreErrorDetails)
KVSO_PARAMETERS_END(c)
QString szError;
- QSqlError error=m_pCurrentSQlQuery->lastError();
+ QSqlError error=m_pCurrentSQlQuery->lastError();
if (bMoreErrorDetails) szError=error.text();
else
{
@@ -590,14 +585,14 @@ KVSO_CLASS_FUNCTION(sql,lastError)
else if (error.type()==QSqlError::TransactionError) szError="TransactionError";
else szError="UnkonwnError";
}
- c->returnValue()->setString(szError);
- return true;
+ c->returnValue()->setString(szError);
+ return true;
}
void KvsObject_sql::closeQueryConnection(QSqlQuery * query)
{
- if (query==m_pCurrentSQlQuery) m_pCurrentSQlQuery=0;
- query->finish();
- queryConnectionsDict.remove(queryConnectionsDict.key(query));
- delete query;
- }
+ if (query==m_pCurrentSQlQuery) m_pCurrentSQlQuery=0;
+ query->finish();
+ queryConnectionsDict.remove(queryConnectionsDict.key(query));
+ delete query;
+}
diff --git a/src/modules/objects/KvsObject_sql.h b/src/modules/objects/KvsObject_sql.h
index 51ade479b..5089574fa 100644
--- a/src/modules/objects/KvsObject_sql.h
+++ b/src/modules/objects/KvsObject_sql.h
@@ -35,43 +35,43 @@
class KvsObject_sql : public KviKvsObject
{
public:
- KVSO_DECLARE_OBJECT(KvsObject_sql)
+ KVSO_DECLARE_OBJECT(KvsObject_sql)
protected:
- QSqlQuery *m_pCurrentSQlQuery;
- QHash<QString,QSqlQuery *> queryConnectionsDict;
+ QSqlQuery *m_pCurrentSQlQuery;
+ QHash<QString,QSqlQuery *> queryConnectionsDict;
- public:
- QHash<QString,QSqlQuery *> & getQueryConnectionsDict(){return queryConnectionsDict;};
- void closeQueryConnection(QSqlQuery *);
- QSqlQuery & getQuery()
- {
- //if (currentSQlQuery) return *currentSQlQuery;
- return *m_pCurrentSQlQuery;
- };
- bool setConnection(KviKvsObjectFunctionCall *c);
- bool connectionNames(KviKvsObjectFunctionCall *c);
- bool features(KviKvsObjectFunctionCall *c);
- bool queryLastInsertId(KviKvsObjectFunctionCall *c);
+public:
+ QHash<QString,QSqlQuery *> & getQueryConnectionsDict() { return queryConnectionsDict; };
+ void closeQueryConnection(QSqlQuery *);
+ QSqlQuery & getQuery()
+ {
+ //if (currentSQlQuery) return *currentSQlQuery;
+ return *m_pCurrentSQlQuery;
+ };
+ bool setConnection(KviKvsObjectFunctionCall *c);
+ bool connectionNames(KviKvsObjectFunctionCall *c);
+ bool features(KviKvsObjectFunctionCall *c);
+ bool queryLastInsertId(KviKvsObjectFunctionCall *c);
- bool tablesList(KviKvsObjectFunctionCall *c);
- bool beginTransaction(KviKvsObjectFunctionCall *c);
- bool commit(KviKvsObjectFunctionCall *c);
+ bool tablesList(KviKvsObjectFunctionCall *c);
+ bool beginTransaction(KviKvsObjectFunctionCall *c);
+ bool commit(KviKvsObjectFunctionCall *c);
- bool queryResultsSize(KviKvsObjectFunctionCall *c);
- bool queryNext(KviKvsObjectFunctionCall *c);
- bool queryPrevious(KviKvsObjectFunctionCall *c);
- bool queryFirst(KviKvsObjectFunctionCall *c);
- bool queryLast(KviKvsObjectFunctionCall *c);
- bool queryExec(KviKvsObjectFunctionCall *c);
- bool queryRecord(KviKvsObjectFunctionCall *c);
- bool queryPrepare(KviKvsObjectFunctionCall *c);
- bool queryBindValue(KviKvsObjectFunctionCall *c);
- bool setCurrentQuery(KviKvsObjectFunctionCall *c);
- bool currentQuery(KviKvsObjectFunctionCall *c);
- bool queryFinish(KviKvsObjectFunctionCall *c);
- bool queryInit(KviKvsObjectFunctionCall *c);
- bool closeConnection(KviKvsObjectFunctionCall *c);
- bool lastError(KviKvsObjectFunctionCall *c);
+ bool queryResultsSize(KviKvsObjectFunctionCall *c);
+ bool queryNext(KviKvsObjectFunctionCall *c);
+ bool queryPrevious(KviKvsObjectFunctionCall *c);
+ bool queryFirst(KviKvsObjectFunctionCall *c);
+ bool queryLast(KviKvsObjectFunctionCall *c);
+ bool queryExec(KviKvsObjectFunctionCall *c);
+ bool queryRecord(KviKvsObjectFunctionCall *c);
+ bool queryPrepare(KviKvsObjectFunctionCall *c);
+ bool queryBindValue(KviKvsObjectFunctionCall *c);
+ bool setCurrentQuery(KviKvsObjectFunctionCall *c);
+ bool currentQuery(KviKvsObjectFunctionCall *c);
+ bool queryFinish(KviKvsObjectFunctionCall *c);
+ bool queryInit(KviKvsObjectFunctionCall *c);
+ bool closeConnection(KviKvsObjectFunctionCall *c);
+ bool lastError(KviKvsObjectFunctionCall *c);
};
diff --git a/src/modules/objects/KvsObject_tabWidget.cpp b/src/modules/objects/KvsObject_tabWidget.cpp
index 215cb4c81..4f2a515ae 100644
--- a/src/modules/objects/KvsObject_tabWidget.cpp
+++ b/src/modules/objects/KvsObject_tabWidget.cpp
@@ -249,8 +249,10 @@ KVSO_CLASS_FUNCTION(tabWidget,widgetAt)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("index",KVS_PT_INTEGER,0,iIndex)
KVSO_PARAMETERS_END(c)
- if (iIndex>=tabsList.count()||iIndex<0) c->returnValue()->setHObject((kvs_hobject_t)0);
- else c->returnValue()->setHObject(tabsList.at(iIndex));
+ if (iIndex>=tabsList.count()||iIndex<0)
+ c->returnValue()->setHObject((kvs_hobject_t)0);
+ else
+ c->returnValue()->setHObject(tabsList.at(iIndex));
return true;
}
@@ -270,10 +272,10 @@ KVSO_CLASS_FUNCTION(tabWidget,insertTab)
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
CHECK_HOBJECT_IS_WIDGET(pObject)
QPixmap * pix = g_pIconManager->getImage(szIcon);
- if(pix){
- ((QTabWidget *)widget())->insertTab(uIndex,(QWidget *)(pObject->object()),QIcon(*pix),szLabel);
- }
- else ((QTabWidget *)widget())->insertTab(uIndex,((QWidget *)(pObject->object())),szLabel);
+ if(pix)
+ ((QTabWidget *)widget())->insertTab(uIndex,(QWidget *)(pObject->object()),QIcon(*pix),szLabel);
+ else
+ ((QTabWidget *)widget())->insertTab(uIndex,((QWidget *)(pObject->object())),szLabel);
tabsList.insert(uIndex,hObject);
return true;
}
@@ -286,7 +288,7 @@ KVSO_CLASS_FUNCTION(tabWidget,setCurrentPage)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIndex)
KVSO_PARAMETERS_END(c)
((QTabWidget *)widget())->setCurrentIndex(iIndex);
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(tabWidget,setTabToolTip)
{
@@ -443,13 +445,13 @@ KVSO_CLASS_FUNCTION(tabWidget,setTabPosition)
((QTabWidget *)widget())->setTabPosition(QTabWidget::North);
else if(KviQString::equalCI(szPos,"Bottom"))
((QTabWidget *)widget())->setTabPosition(QTabWidget::South);
- else c->warning( __tr2qs_ctx("Unknown position '%Q'","objects"),&szPos);
+ else
+ c->warning( __tr2qs_ctx("Unknown position '%Q'","objects"),&szPos);
return true;
}
KVSO_CLASS_FUNCTION(tabWidget,currentChangedEvent)
{
-
emitSignal("currentChanged",c,c->params());
return true;
}
@@ -462,7 +464,6 @@ void KvsObject_tabWidget::slotCurrentChanged(int value)
KVSO_CLASS_FUNCTION(tabWidget,tabCloseRequestEvent)
{
-
emitSignal("tabCloseRequested",c,c->params());
return true;
}
diff --git a/src/modules/objects/KvsObject_tableWidget.cpp b/src/modules/objects/KvsObject_tableWidget.cpp
index a5a3331b2..6299b42f5 100644
--- a/src/modules/objects/KvsObject_tableWidget.cpp
+++ b/src/modules/objects/KvsObject_tableWidget.cpp
@@ -136,14 +136,14 @@ const char * const itemflags_tbl[] = {
Sets the flags for the cell pointed by row and col to the given flags.
These determine whether the cell can be selected or modified.
Supported flags are:
- - noitemflag : no flag sets;
- - selectable : cell is selecatble;
- - editable : cell is editable;
- - dragEnabled : cell can dragged;
- - dropEnabled : cell can used as drop target;
- - userCheckable : cell is checkable;
- - enabled :cell is enabled;
- - tristate : cell is checkable with three separate states.
+ [br]- noitemflag : no flag sets;
+ [br]- selectable : cell is selecatble;
+ [br]- editable : cell is editable;
+ [br]- dragEnabled : cell can dragged;
+ [br]- dropEnabled : cell can used as drop target;
+ [br]- userCheckable : cell is checkable;
+ [br]- enabled :cell is enabled;
+ [br]- tristate : cell is checkable with three separate states.
!fn: $setCellWidget(<row:uint>,<column:uint>,<widget:hobject>)
Sets the given widget to be displayed in the cell in the given row and column, passing the ownership of the widget to the table.
!fn: $setIcon(<row:uint>,<column:uint>,<icon:imageid or hobject>)
diff --git a/src/modules/objects/KvsObject_tableWidget.h b/src/modules/objects/KvsObject_tableWidget.h
index 3bf7bf229..97b475e83 100644
--- a/src/modules/objects/KvsObject_tableWidget.h
+++ b/src/modules/objects/KvsObject_tableWidget.h
@@ -43,7 +43,6 @@ public:
KviCellItemDelegate(QAbstractItemView * pWidget = 0,KvsObject_tableWidget *pParent=0);
~KviCellItemDelegate();
protected:
-// QAbstractItemView * m_pParent;
KvsObject_tableWidget *m_pParentScript;
public:
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
diff --git a/src/modules/objects/KvsObject_toolButton.cpp b/src/modules/objects/KvsObject_toolButton.cpp
index 884a3e92d..84d05560f 100644
--- a/src/modules/objects/KvsObject_toolButton.cpp
+++ b/src/modules/objects/KvsObject_toolButton.cpp
@@ -139,9 +139,8 @@ KVSO_CLASS_FUNCTION(toolButton,setImage)
KVSO_PARAMETER("icon_id",KVS_PT_STRING,0,icon)
KVSO_PARAMETERS_END(c)
QPixmap * pix = g_pIconManager->getImage(icon);
- if(pix){
- ((QToolButton *)widget())->setIcon(QIcon(*pix));
- }
+ if(pix)
+ ((QToolButton *)widget())->setIcon(QIcon(*pix));
else
((QToolButton *)widget())->setIcon(QIcon());
return true;
@@ -310,10 +309,11 @@ KVSO_CLASS_FUNCTION(toolButton,setTextPosition)
KVSO_PARAMETER("position",KVS_PT_STRING,0,szPos)
KVSO_PARAMETERS_END(c)
if(KviQString::equalCI(szPos,"BesideIcon"))
- ((QToolButton *)widget())->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ ((QToolButton *)widget())->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
else if(KviQString::equalCI(szPos,"BelowIcon"))
- ((QToolButton *)widget())->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
- else c->warning(__tr2qs_ctx("Unknown text position '%Q'","objects"),&szPos);
+ ((QToolButton *)widget())->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+ else
+ c->warning(__tr2qs_ctx("Unknown text position '%Q'","objects"),&szPos);
return true;
}
diff --git a/src/modules/objects/KvsObject_trayIcon.cpp b/src/modules/objects/KvsObject_trayIcon.cpp
index 67fb17c43..f2265b8d8 100644
--- a/src/modules/objects/KvsObject_trayIcon.cpp
+++ b/src/modules/objects/KvsObject_trayIcon.cpp
@@ -49,67 +49,67 @@
@description:
This class provides a standard trayicon functionality.[br]
@functions:
- !fn: setIcon(<image_id>).
- Sets the tray icon.
- See the [doc:image_id]image identifier[/doc] documentation for the explaination of the <image_id> parameter.
- !fn: setTooltip(<tooltip:string>).
- Sets the tray icon tooltip.
- !fn: show()
- Shows the tray icon.
- !fn: hide()
- Hides the tray icon.
- !fn: isVisible()
- Returns '1' if the tray icon is currently visible.
- !fn: showMessage(<title:string>,<message:string>,<message_icon:string>,<timeout:integer>)
- Shows a balloon message for the entry with the given title, message and message_icon for the time specified in millisecondsTimeoutHint. title and message must be plain text strings.
- Message can be clicked by the user; the messageClickedEvent() will be triggered when this occurs.
- Valid values for message_icon are:
- - NoIcon : No icon is shown.
- - Information : An information icon is shown.
- - Warning : A standard warning icon is shown.
- - Critical : A critical warning icon is shown.
- !fn: setContextMenu(<popupmenu:hobject>).
- Associates the given <popupmenu> with the tray icon.
- !fn: activatedEvent(<reason:string>)
- This event is triggered when the user click the tray icon.
- If you reimplement this function the reason parameter will be passed as $0.
- Values for reason are:
- - Unknown : Unknown reason.
- - Context : The context menu for the tray icon was requested.
- - DoubleClick : The tray icon was double clicked.
- - Trigger : The tray icon was clicked.
- - MiddleClick : The tray icon was clicked with the middle mouse button.
- The default implementation emits the [classfnc]$activated[/classfnc]() signal.
- !fn: messageClickedEvent()
- This event is triggered when the message displayed using [classfnc]$showMessage[/classfnc]() was clicked by the user.
- The default implementation emits the [classfnc]$messageClicked[/classfnc]() signal.
+ !fn: setIcon(<image_id>).
+ Sets the tray icon.
+ See the [doc:image_id]image identifier[/doc] documentation for the explaination of the <image_id> parameter.
+ !fn: setTooltip(<tooltip:string>).
+ Sets the tray icon tooltip.
+ !fn: show()
+ Shows the tray icon.
+ !fn: hide()
+ Hides the tray icon.
+ !fn: isVisible()
+ Returns '1' if the tray icon is currently visible.
+ !fn: showMessage(<title:string>,<message:string>,<message_icon:string>,<timeout:integer>)
+ Shows a balloon message for the entry with the given title, message and message_icon for the time specified in millisecondsTimeoutHint. title and message must be plain text strings.
+ Message can be clicked by the user; the messageClickedEvent() will be triggered when this occurs.
+ Valid values for message_icon are:
+ [br]- NoIcon : No icon is shown.
+ [br]- Information : An information icon is shown.
+ [br]- Warning : A standard warning icon is shown.
+ [br]- Critical : A critical warning icon is shown.
+ !fn: setContextMenu(<popupmenu:hobject>).
+ Associates the given <popupmenu> with the tray icon.
+ !fn: activatedEvent(<reason:string>)
+ This event is triggered when the user click the tray icon.
+ If you reimplement this function the reason parameter will be passed as $0.
+ Values for reason are:
+ [br]- Unknown : Unknown reason.
+ [br]- Context : The context menu for the tray icon was requested.
+ [br]- DoubleClick : The tray icon was double clicked.
+ [br]- Trigger : The tray icon was clicked.
+ [br]- MiddleClick : The tray icon was clicked with the middle mouse button.
+ The default implementation emits the [classfnc]$activated[/classfnc]() signal.
+ !fn: messageClickedEvent()
+ This event is triggered when the message displayed using [classfnc]$showMessage[/classfnc]() was clicked by the user.
+ The default implementation emits the [classfnc]$messageClicked[/classfnc]() signal.
@signals:
!sg: $activated()
- This signal is emitted by the default implementation of [classfnc]$activatedEvent[/classfnc].
- !sg: $messageClicked()
- This signal is emitted by the default implementation of [classfnc]$messageClickedEvent[/classfnc].
+ This signal is emitted by the default implementation of [classfnc]$activatedEvent[/classfnc].
+ !sg: $messageClicked()
+ This signal is emitted by the default implementation of [classfnc]$messageClickedEvent[/classfnc].
*/
KVSO_BEGIN_REGISTERCLASS(KvsObject_trayIcon,"trayicon","object")
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,show)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,hide)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,isVisible)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,show)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,hide)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,isVisible)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setIcon)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setTooltip)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,showMessage)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,setContextMenu)
// events
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,activatedEvent)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,messageClickedEvent)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,activatedEvent)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_trayIcon,messageClickedEvent)
KVSO_END_REGISTERCLASS(KvsObject_trayIcon)
KVSO_BEGIN_CONSTRUCTOR(KvsObject_trayIcon,KviKvsObject)
- m_pTrayIcon = new QSystemTrayIcon(0);
+ m_pTrayIcon = new QSystemTrayIcon(0);
connect(m_pTrayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(slotActivated(QSystemTrayIcon::ActivationReason)));
- connect(m_pTrayIcon,SIGNAL(messageClicked()),this,SLOT(slotMessageClicked()));
+ connect(m_pTrayIcon,SIGNAL(messageClicked()),this,SLOT(slotMessageClicked()));
KVSO_END_CONSTRUCTOR(KvsObject_trayIcon)
@@ -120,91 +120,91 @@ KVSO_END_DESTRUCTOR(KvsObject_trayIcon)
KVSO_CLASS_FUNCTION(trayIcon,setIcon)
{
- CHECK_INTERNAL_POINTER(m_pTrayIcon)
- QString szIcon;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("icon",KVS_PT_STRING,0,szIcon)
- KVSO_PARAMETERS_END(c)
- QPixmap * pix = g_pIconManager->getImage(szIcon);
- if(pix) m_pTrayIcon->setIcon(*pix);
- return true;
+ CHECK_INTERNAL_POINTER(m_pTrayIcon)
+ QString szIcon;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("icon",KVS_PT_STRING,0,szIcon)
+ KVSO_PARAMETERS_END(c)
+ QPixmap * pix = g_pIconManager->getImage(szIcon);
+ if(pix) m_pTrayIcon->setIcon(*pix);
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,setTooltip)
{
CHECK_INTERNAL_POINTER(m_pTrayIcon)
- QString szTooltip;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("icon",KVS_PT_STRING,0,szTooltip)
- KVSO_PARAMETERS_END(c)
- m_pTrayIcon->setToolTip(szTooltip);
+ QString szTooltip;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("icon",KVS_PT_STRING,0,szTooltip)
+ KVSO_PARAMETERS_END(c)
+ m_pTrayIcon->setToolTip(szTooltip);
return true;
}
KVSO_CLASS_FUNCTION(trayIcon,show)
{
- CHECK_INTERNAL_POINTER(m_pTrayIcon)
- m_pTrayIcon->show();
- return true;
+ CHECK_INTERNAL_POINTER(m_pTrayIcon)
+ m_pTrayIcon->show();
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,hide)
{
- CHECK_INTERNAL_POINTER(m_pTrayIcon)
- m_pTrayIcon->show();
- return true;
+ CHECK_INTERNAL_POINTER(m_pTrayIcon)
+ m_pTrayIcon->show();
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,isVisible)
{
- CHECK_INTERNAL_POINTER(m_pTrayIcon)
- c->returnValue()->setBoolean(m_pTrayIcon->isVisible());
- return true;
+ CHECK_INTERNAL_POINTER(m_pTrayIcon)
+ c->returnValue()->setBoolean(m_pTrayIcon->isVisible());
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,showMessage)
{
CHECK_INTERNAL_POINTER(m_pTrayIcon)
- QString szMessage,szTitle,szMessageIcon;
- kvs_uint_t uTimeout;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("title",KVS_PT_STRING,0,szTitle)
- KVSO_PARAMETER("message",KVS_PT_STRING,0,szMessage)
- KVSO_PARAMETER("icon",KVS_PT_STRING,0,szMessageIcon)
- KVSO_PARAMETER("timeout",KVS_PT_UINT,0,uTimeout)
- KVSO_PARAMETERS_END(c)
- QSystemTrayIcon::MessageIcon message=QSystemTrayIcon::NoIcon;
- if(KviQString::equalCI(szMessageIcon,"NoIcon")) message= QSystemTrayIcon::NoIcon;
- else if(KviQString::equalCI(szMessageIcon,"Information"))message= QSystemTrayIcon::Information;
- else if(KviQString::equalCI(szMessageIcon,"Warning")) message= QSystemTrayIcon::Warning;
- else if(KviQString::equalCI(szMessageIcon,"Critical")) message= QSystemTrayIcon::Critical;
- else c->warning(__tr2qs_ctx("Invalid message Icon: switch to default NoIcon '%Q'","objects"),&szMessageIcon);
- m_pTrayIcon->showMessage(szTitle,szMessage,message,uTimeout);
- return true;
+ QString szMessage,szTitle,szMessageIcon;
+ kvs_uint_t uTimeout;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("title",KVS_PT_STRING,0,szTitle)
+ KVSO_PARAMETER("message",KVS_PT_STRING,0,szMessage)
+ KVSO_PARAMETER("icon",KVS_PT_STRING,0,szMessageIcon)
+ KVSO_PARAMETER("timeout",KVS_PT_UINT,0,uTimeout)
+ KVSO_PARAMETERS_END(c)
+ QSystemTrayIcon::MessageIcon message=QSystemTrayIcon::NoIcon;
+ if(KviQString::equalCI(szMessageIcon,"NoIcon")) message= QSystemTrayIcon::NoIcon;
+ else if(KviQString::equalCI(szMessageIcon,"Information"))message= QSystemTrayIcon::Information;
+ else if(KviQString::equalCI(szMessageIcon,"Warning")) message= QSystemTrayIcon::Warning;
+ else if(KviQString::equalCI(szMessageIcon,"Critical")) message= QSystemTrayIcon::Critical;
+ else c->warning(__tr2qs_ctx("Invalid message Icon: switch to default NoIcon '%Q'","objects"),&szMessageIcon);
+ m_pTrayIcon->showMessage(szTitle,szMessage,message,uTimeout);
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,setContextMenu)
{
CHECK_INTERNAL_POINTER(m_pTrayIcon)
- KviKvsObject *ob;
- kvs_hobject_t hObject;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
- KVSO_PARAMETERS_END(c)
- ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
- if (!ob)
- {
- c->warning(__tr2qs_ctx("Widget parameter is not an object","objects"));
- return true;
- }
- if (!ob->object())
- {
- c->warning(__tr2qs_ctx("Widget parameter is not a valid object","objects"));
- return true;
- }
- if(!ob->inheritsClass("popupmenu"))
- {
- c->warning(__tr2qs_ctx("Can't add a non-popupmenu object","objects"));
- return true;
- }
- m_pTrayIcon->setContextMenu(((QMenu *)(ob->object())));
- return true;
+ KviKvsObject *ob;
+ kvs_hobject_t hObject;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
+ KVSO_PARAMETERS_END(c)
+ ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
+ if (!ob)
+ {
+ c->warning(__tr2qs_ctx("Widget parameter is not an object","objects"));
+ return true;
+ }
+ if (!ob->object())
+ {
+ c->warning(__tr2qs_ctx("Widget parameter is not a valid object","objects"));
+ return true;
+ }
+ if(!ob->inheritsClass("popupmenu"))
+ {
+ c->warning(__tr2qs_ctx("Can't add a non-popupmenu object","objects"));
+ return true;
+ }
+ m_pTrayIcon->setContextMenu(((QMenu *)(ob->object())));
+ return true;
}
KVSO_CLASS_FUNCTION(trayIcon,activatedEvent)
{
@@ -213,30 +213,30 @@ KVSO_CLASS_FUNCTION(trayIcon,activatedEvent)
}
KVSO_CLASS_FUNCTION(trayIcon,messageClickedEvent)
{
- emitSignal("messageClicked",c,c->params());
- return true;
+ emitSignal("messageClicked",c,c->params());
+ return true;
}
void KvsObject_trayIcon::slotMessageClicked()
{
- KviKvsVariantList *lParams=0;
- callFunction(this,"messageClickedEvent",0,lParams);
+ KviKvsVariantList *lParams=0;
+ callFunction(this,"messageClickedEvent",0,lParams);
}
void KvsObject_trayIcon::slotActivated(QSystemTrayIcon::ActivationReason reason)
{
- QString szReason;
- if (reason==QSystemTrayIcon::Unknown)
- szReason="Unknown";
- else if(reason==QSystemTrayIcon::Context)
- szReason="Context";
- else if(reason==QSystemTrayIcon::DoubleClick)
- szReason="DoubleClick";
- else if(reason==QSystemTrayIcon::Trigger)
- szReason="Trigger";
- else szReason="MiddleClick";
- KviKvsVariantList lParams;
- lParams.append(new KviKvsVariant(szReason));
- callFunction(this,"activatedEvent",0,&lParams);
+ QString szReason;
+ if (reason==QSystemTrayIcon::Unknown)
+ szReason="Unknown";
+ else if(reason==QSystemTrayIcon::Context)
+ szReason="Context";
+ else if(reason==QSystemTrayIcon::DoubleClick)
+ szReason="DoubleClick";
+ else if(reason==QSystemTrayIcon::Trigger)
+ szReason="Trigger";
+ else szReason="MiddleClick";
+ KviKvsVariantList lParams;
+ lParams.append(new KviKvsVariant(szReason));
+ callFunction(this,"activatedEvent",0,&lParams);
}
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
#include "m_KvsObject_trayIcon.moc"
diff --git a/src/modules/objects/KvsObject_trayIcon.h b/src/modules/objects/KvsObject_trayIcon.h
index 4bec98e67..bc615852f 100644
--- a/src/modules/objects/KvsObject_trayIcon.h
+++ b/src/modules/objects/KvsObject_trayIcon.h
@@ -26,8 +26,6 @@
-
-//===============================================================
#include "object_macros.h"
#include <QSystemTrayIcon>
#include <QMenu>
@@ -38,21 +36,20 @@ class KvsObject_trayIcon : public KviKvsObject
public:
KVSO_DECLARE_OBJECT(KvsObject_trayIcon)
protected:
- QSystemTrayIcon *m_pTrayIcon;
+ QSystemTrayIcon *m_pTrayIcon;
protected:
- bool setIcon(KviKvsObjectFunctionCall *c);
- bool show(KviKvsObjectFunctionCall *c);
- bool hide(KviKvsObjectFunctionCall *c);
- bool isVisible(KviKvsObjectFunctionCall *c);
- bool setTooltip(KviKvsObjectFunctionCall *c);
- bool showMessage(KviKvsObjectFunctionCall *c);
- bool setContextMenu(KviKvsObjectFunctionCall *c);
- bool activatedEvent(KviKvsObjectFunctionCall *c);
- bool messageClickedEvent(KviKvsObjectFunctionCall *c);
-
+ bool setIcon(KviKvsObjectFunctionCall *c);
+ bool show(KviKvsObjectFunctionCall *c);
+ bool hide(KviKvsObjectFunctionCall *c);
+ bool isVisible(KviKvsObjectFunctionCall *c);
+ bool setTooltip(KviKvsObjectFunctionCall *c);
+ bool showMessage(KviKvsObjectFunctionCall *c);
+ bool setContextMenu(KviKvsObjectFunctionCall *c);
+ bool activatedEvent(KviKvsObjectFunctionCall *c);
+ bool messageClickedEvent(KviKvsObjectFunctionCall *c);
protected slots:
void slotActivated(QSystemTrayIcon::ActivationReason);
- void slotMessageClicked();
+ void slotMessageClicked();
};
#endif //_CLASS_TRAYICON_H_
diff --git a/src/modules/objects/KvsObject_treeWidget.cpp b/src/modules/objects/KvsObject_treeWidget.cpp
index 8bc3e5bb7..373f39333 100644
--- a/src/modules/objects/KvsObject_treeWidget.cpp
+++ b/src/modules/objects/KvsObject_treeWidget.cpp
@@ -31,8 +31,6 @@
#include "KviIconManager.h"
#include <QTreeWidget>
- #include <QSqlDatabase>
-
#include <QEvent>
#include <QDragEnterEvent>
#include <QDropEvent>
@@ -40,142 +38,142 @@
#include <QUrl>
/*
- @doc: listview
- @keyterms:
- listview widget class
- @title:
- listview class
- @type:
- class
- @short:
- A listview widget class
- @inherits:
- [class]widget[/class]
- @description:
- It can display and control a hierarchy of multi-column items, and provides the ability to add new items at any time.
- The items are added by creating children [class]listviewitem[/class] objects: simply allocating them with $new
- will add the items to the listview and simply deleting them will remove them.
- Allocating a [class]listviewtitem[/class] item2 as a child of item1 will insert it to the same listview creating
- a subtree of items spannig from item1. The subtree can be opened or closed by a simple click either
- on the parent item or on the little plus sign on the side of it (when [classfnc:listview]$setRootIsDecorated[/classfnc]
- is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode.
- In single selection mode there can be only one selected item at a time and the selected item is also
- the current item (this mode is the default). In Multi and Extended selection mode there can be multiple selected items
- and the current item is one of them. The difference between Multi and Extended is in the way
- that items can be selected by the mouse actions: experiment with the two modes :).
- The NoSelection mode has obviously no selection at all.
- @functions:
+ @doc: listview
+ @keyterms:
+ listview widget class
+ @title:
+ listview class
+ @type:
+ class
+ @short:
+ A listview widget class
+ @inherits:
+ [class]widget[/class]
+ @description:
+ It can display and control a hierarchy of multi-column items, and provides the ability to add new items at any time.
+ The items are added by creating children [class]listviewitem[/class] objects: simply allocating them with $new
+ will add the items to the listview and simply deleting them will remove them.
+ Allocating a [class]listviewtitem[/class] item2 as a child of item1 will insert it to the same listview creating
+ a subtree of items spannig from item1. The subtree can be opened or closed by a simple click either
+ on the parent item or on the little plus sign on the side of it (when [classfnc:listview]$setRootIsDecorated[/classfnc]
+ is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode.
+ In single selection mode there can be only one selected item at a time and the selected item is also
+ the current item (this mode is the default). In Multi and Extended selection mode there can be multiple selected items
+ and the current item is one of them. The difference between Multi and Extended is in the way
+ that items can be selected by the mouse actions: experiment with the two modes :).
+ The NoSelection mode has obviously no selection at all.
+ @functions:
!fn: $addColumn(<text_label:string>,[<width:integer>])
- Adds a width pixels wide column with the column header label to the list view.
+ Adds a width pixels wide column with the column header label to the list view.
- !fn: $setSorting(<column:integer>,<sort_order:string>)
- Sets the list view to be sorted by column in ascending order if sort_order is "ascending" or descending order if it is "descending".
- !fn: $setSortingEnabled(<bEnabled:boolean>)
- If <bEnabled> is true, user sorting is enabled for the tree. The default value is false.
- In order to avoid performance issues, it is recommended that sorting is enabled after inserting the items into the tree.
- !fn: $hideListViewHeader()
- Hide the listview column header.
+ !fn: $setSorting(<column:integer>,<sort_order:string>)
+ Sets the list view to be sorted by column in ascending order if sort_order is "ascending" or descending order if it is "descending".
+ !fn: $setSortingEnabled(<bEnabled:boolean>)
+ If <bEnabled> is true, user sorting is enabled for the tree. The default value is false.
+ In order to avoid performance issues, it is recommended that sorting is enabled after inserting the items into the tree.
+ !fn: $hideListViewHeader()
+ Hide the listview column header.
- !fn: $showListViewHeader()
- Show the listview column header.
+ !fn: $showListViewHeader()
+ Show the listview column header.
- !fn: <boolean> $isListViewHeaderVisible()
- Returns '1' if the listview header is currently visible. Otherwise this function returns '0'.
+ !fn: <boolean> $isListViewHeaderVisible()
+ Returns '1' if the listview header is currently visible. Otherwise this function returns '0'.
- !fn: $setAllColumnsShowFocus(<bAllColumnsShowFocus:boolean>)
- When the argument is $true, causes the listview to display the focus and selection
- by highlighting all the columns of the item. When the argument is $false then
- only the first column is selected/highlighted.
+ !fn: $setAllColumnsShowFocus(<bAllColumnsShowFocus:boolean>)
+ When the argument is $true, causes the listview to display the focus and selection
+ by highlighting all the columns of the item. When the argument is $false then
+ only the first column is selected/highlighted.
- !fn: $setSelectionMode(<mode:string>)
- Sets the selection mode for this listview. <mode> can be one of "Single","NoSelection","Multi" or "Extended".
+ !fn: $setSelectionMode(<mode:string>)
+ Sets the selection mode for this listview. <mode> can be one of "Single","NoSelection","Multi" or "Extended".
- !fn: <listviewitem> $selectedItems()
- Returns the currently selected [class]listviewitem[/class] or $null if no items are selected.
- This function works only if the list view is in single selection mode.
+ !fn: <listviewitem> $selectedItems()
+ Returns the currently selected [class]listviewitem[/class] or $null if no items are selected.
+ This function works only if the list view is in single selection mode.
!fn: <listviewitem:hobject> $itemAt(<x_global_pos:integer>,<y_global_pos:integer>)
Returns the listviewitem object at the x,y globals coordinates or $null if no item at.
- !fn: <listviewitem> $currentItem()
- Returns the current [class]listviewitem[/class] or $null if no item is current at the moment.
+ !fn: <listviewitem> $currentItem()
+ Returns the current [class]listviewitem[/class] or $null if no item is current at the moment.
- !fn: <listviewitem> $firstChild()
- Returns the first child [class]listviewitem[/class] of this listview or $null if there are no items at all.
+ !fn: <listviewitem> $firstChild()
+ Returns the first child [class]listviewitem[/class] of this listview or $null if there are no items at all.
- !fn: <listviewitem> $topLevelItem(<index:int>)
- Returns the <index> child [class]listviewitem[/class] of this listview or $null if it does not exists.
+ !fn: <listviewitem> $topLevelItem(<index:int>)
+ Returns the <index> child [class]listviewitem[/class] of this listview or $null if it does not exists.
- !fn: <int> $topLevelItemCount()
- Returns the number of top level items of this listview.
+ !fn: <int> $topLevelItemCount()
+ Returns the number of top level items of this listview.
- !fn: setAcceptDrops(<benabled:boolean>)
- If <bEnabled> is true, user can drop files for this listview. The default value is true.
+ !fn: setAcceptDrops(<benabled:boolean>)
+ If <bEnabled> is true, user can drop files for this listview. The default value is true.
- !fn: $clickEvent(<item:object>)
- This function is called when the user clicks in the list view.
- In its argument the [class]listviewitem[/class] object clicked or 0 if the user didn't click on an item.[br]
- The default implementation emits the [classfnc]$clicked[/classfnc]() signal.
+ !fn: $clickEvent(<item:object>)
+ This function is called when the user clicks in the list view.
+ In its argument the [class]listviewitem[/class] object clicked or 0 if the user didn't click on an item.[br]
+ The default implementation emits the [classfnc]$clicked[/classfnc]() signal.
- !fn: $selectionChangedEvent(<item:object>)
- This event handle whenever the set of selected items has changed.
- The argument is the newly selected item if the listview is in single selection mode.[br]
- When the listview is in Multi or Extended selection mode then item is always $null.[br]
- The default implementation emits the [classfnc]$selectionChanged[/classfnc]() signal.
+ !fn: $selectionChangedEvent(<item:object>)
+ This event handle whenever the set of selected items has changed.
+ The argument is the newly selected item if the listview is in single selection mode.[br]
+ When the listview is in Multi or Extended selection mode then item is always $null.[br]
+ The default implementation emits the [classfnc]$selectionChanged[/classfnc]() signal.
- !fn: $currentChangedEvent(<item:object>)
- This event are called whenever the current item has changed.
- In its argument is the newly selected item or 0 if the change made no item current.[br]
- The default implementation emits the [classfnc]$currentChanged[/classfnc]() signal.
+ !fn: $currentChangedEvent(<item:object>)
+ This event are called whenever the current item has changed.
+ In its argument is the newly selected item or 0 if the change made no item current.[br]
+ The default implementation emits the [classfnc]$currentChanged[/classfnc]() signal.
- !fn: $itemActivatedEvent(<item:object>)
- This s signal is emitted when the user activates an item by single- or double-clicking or pressing 'Enter'.[br]
- In its argument the currrent item.[br]
- The default implementation emits the [classfnc]$itemActivated[/classfnc]() signal.
+ !fn: $itemActivatedEvent(<item:object>)
+ This s signal is emitted when the user activates an item by single- or double-clicking or pressing 'Enter'.[br]
+ In its argument the currrent item.[br]
+ The default implementation emits the [classfnc]$itemActivated[/classfnc]() signal.
- !fn: $spacePressedEvent(<item:object>)
- This function is called by the framework when the space key is pressed.[br]
- In its arument the currrent item.[br]
- The default implementation emits the [classfnc]$spacePressed[/classfnc]() signal.
+ !fn: $spacePressedEvent(<item:object>)
+ This function is called by the framework when the space key is pressed.[br]
+ In its arument the currrent item.[br]
+ The default implementation emits the [classfnc]$spacePressed[/classfnc]() signal.
- !fn: $onItemEvent(<item:object>)
- This event is called by framwork when the user moves the mouse cursor onto item.
- The default implementation emits the [classfnc]$onItem[/classfnc]() signal.
+ !fn: $onItemEvent(<item:object>)
+ This event is called by framwork when the user moves the mouse cursor onto item.
+ The default implementation emits the [classfnc]$onItem[/classfnc]() signal.
- !fn: $itemExpandedEvent(<item:object>)
- This event is called when an item has been expanded, i.e. when the children of item are shown.
- The default implementation emits the [classfnc]$expanded[/classfnc]() signal.
+ !fn: $itemExpandedEvent(<item:object>)
+ This event is called when an item has been expanded, i.e. when the children of item are shown.
+ The default implementation emits the [classfnc]$expanded[/classfnc]() signal.
- !fn: $itemCollapsedEvent(<item:object>)
- This event is called when an item has been collapsed, i.e. when the children of item are hidden.
- The default implementation emits the [classfnc]$collapsed[/classfnc]() signal.
+ !fn: $itemCollapsedEvent(<item:object>)
+ This event is called when an item has been collapsed, i.e. when the children of item are hidden.
+ The default implementation emits the [classfnc]$collapsed[/classfnc]() signal.
- !fn: $itemChangedEvent(<item:object>,<col:integer>,<text:string>)
- This event is called when the item has been renamed in text, e.g. by in in-place renaming, in column col.[br]
- The default implementation emits the [classfnc]$itemChanged[/classfnc]() signal.
+ !fn: $itemChangedEvent(<item:object>,<col:integer>,<text:string>)
+ This event is called when the item has been renamed in text, e.g. by in in-place renaming, in column col.[br]
+ The default implementation emits the [classfnc]$itemChanged[/classfnc]() signal.
- @signals:
- !sg: $clicked()
- This signal is emitted by the default implementation of [classfnc]$clickEvent[/classfnc]().
- !sg: $selectionChanged()
- This signal is emitted by the default implementation of [classfnc]$selectionChangedEvent[/classfnc]().
- !sg: $currentChanged()
- This signal is emitted by the default implementation of [classfnc]$currentChangedEvent[/classfnc]().
- !sg: $itemActivated()
- This signal is emitted by the default implementation of [classfnc]$itemActivatedEvent[/classfnc]().
- !sg: $spacePressed()
- This signal is emitted by the default implementation of [classfnc]$spacePredssedEvent[/classfnc]().
- !sg: $onItem()
- This signal is emitted by the default implementation of [classfnc]$onItemEvent[/classfnc]().
- !sg: $itemExpanded()
- This signal is emitted by the default implementation of [classfnc]$itemExpandedEvent[/classfnc]().
- !sg: $itemCollapsed()
- This signal is emitted by the default implementation of [classfnc]$itemCollapsedEvent[/classfnc]().
- !sg: $itemChanged()
- This signal is emitted by the default implementation of [classfnc]$itemChangedEvent[/classfnc]().
- !sg: $rightButtonClicked()
- This signal is emitted by the default implementation of [classfnc]$rightButtonClickedEvent[/classfnc]().
+ @signals:
+ !sg: $clicked()
+ This signal is emitted by the default implementation of [classfnc]$clickEvent[/classfnc]().
+ !sg: $selectionChanged()
+ This signal is emitted by the default implementation of [classfnc]$selectionChangedEvent[/classfnc]().
+ !sg: $currentChanged()
+ This signal is emitted by the default implementation of [classfnc]$currentChangedEvent[/classfnc]().
+ !sg: $itemActivated()
+ This signal is emitted by the default implementation of [classfnc]$itemActivatedEvent[/classfnc]().
+ !sg: $spacePressed()
+ This signal is emitted by the default implementation of [classfnc]$spacePressedEvent[/classfnc]().
+ !sg: $onItem()
+ This signal is emitted by the default implementation of [classfnc]$onItemEvent[/classfnc]().
+ !sg: $itemExpanded()
+ This signal is emitted by the default implementation of [classfnc]$itemExpandedEvent[/classfnc]().
+ !sg: $itemCollapsed()
+ This signal is emitted by the default implementation of [classfnc]$itemCollapsedEvent[/classfnc]().
+ !sg: $itemChanged()
+ This signal is emitted by the default implementation of [classfnc]$itemChangedEvent[/classfnc]().
+ !sg: $rightButtonClicked()
+ This signal is emitted by the default implementation of [classfnc]$rightButtonClickedEvent[/classfnc]().
*/
@@ -206,14 +204,14 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_treeWidget,"listview","widget")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,hideListViewHeader)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,showListViewHeader)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,firstChild)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,topLevelItem)
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,topLevelItemCount)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,topLevelItem)
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,topLevelItemCount)
- //events
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,selectionChangedEvent);
+ //events
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,selectionChangedEvent);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,currentChangedEvent);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,itemActivatedEvent);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,onItemEvent);
@@ -258,10 +256,9 @@ KVSO_CLASS_FUNCTION(treeWidget,setHeaderLabels)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("labels",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,columns)
KVSO_PARAMETERS_END(c)
- if (widget()){
+ if (widget())
((QTreeWidget *)object())->setHeaderLabels(columns);
- }
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(treeWidget,setColumnText)
@@ -280,15 +277,15 @@ KVSO_CLASS_FUNCTION(treeWidget,setColumnText)
KVSO_CLASS_FUNCTION(treeWidget,topLevelItem)
{
- if (!widget()) return true;
- kvs_int_t iIdx;
- KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("index",KVS_PT_INT,0,iIdx)
- KVSO_PARAMETERS_END(c)
- QTreeWidgetItem *pItem=((QTreeWidget *)widget())->topLevelItem(iIdx);
- if (!pItem) c->returnValue()->setHObject((kvs_hobject_t)0);
- else c->returnValue()->setHObject(KvsObject_treeWidgetItem::itemToHandle(pItem));
- return true;
+ if (!widget()) return true;
+ kvs_int_t iIdx;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("index",KVS_PT_INT,0,iIdx)
+ KVSO_PARAMETERS_END(c)
+ QTreeWidgetItem *pItem=((QTreeWidget *)widget())->topLevelItem(iIdx);
+ if (!pItem) c->returnValue()->setHObject((kvs_hobject_t)0);
+ else c->returnValue()->setHObject(KvsObject_treeWidgetItem::itemToHandle(pItem));
+ return true;
}
KVSO_CLASS_FUNCTION(treeWidget,itemAt)
{
@@ -306,9 +303,9 @@ KVSO_CLASS_FUNCTION(treeWidget,itemAt)
}
KVSO_CLASS_FUNCTION(treeWidget,topLevelItemCount)
{
- if (!widget()) return true;
+ if (!widget()) return true;
c->returnValue()->setInteger(((QTreeWidget *)widget())->topLevelItemCount());
- return true;
+ return true;
}
KVSO_CLASS_FUNCTION(treeWidget,addColumn)
@@ -515,8 +512,7 @@ void KvsObject_treeWidget::slotSelectionChanged()
QTreeWidgetItem *it=(QTreeWidgetItem *) ((QTreeWidget *)widget())->currentItem();
KviKvsVariantList params(new KviKvsVariant(KvsObject_treeWidgetItem::itemToHandle(it)));
callFunction(this,"selectionChangedEvent",0,&params);
- }
- else{
+ } else {
KviKvsVariantList params(new KviKvsVariant((kvs_hobject_t)0));
callFunction(this,"selectionChangedEvent",0,&params);
}
@@ -549,7 +545,6 @@ void KvsObject_treeWidget::slotItemActivated(QTreeWidgetItem * i,int col)
KVSO_CLASS_FUNCTION(treeWidget,onItemEvent)
{
-
emitSignal("onItem",c,c->params());
return true;
}
@@ -586,8 +581,6 @@ void KvsObject_treeWidget::slotItemCollapsed(QTreeWidgetItem * i)
callFunction(this,"itemCollapsedEvent",0,&params);
}
-
-
KVSO_CLASS_FUNCTION(treeWidget,itemChangedEvent)
{
emitSignal("itemChanged",c,c->params());
@@ -627,10 +620,10 @@ void KviKvsTreeWidget::dragEnterEvent( QDragEnterEvent * e )
{
if(!e->mimeData()->hasUrls())
{
- e->ignore();
+ e->ignore();
return;
}
- e->acceptProposedAction();
+ e->acceptProposedAction();
}
void KviKvsTreeWidget::dragMoveEvent( QDragMoveEvent * )
diff --git a/src/modules/objects/KvsObject_treeWidget.h b/src/modules/objects/KvsObject_treeWidget.h
index aabbafdf7..48bb99d51 100644
--- a/src/modules/objects/KvsObject_treeWidget.h
+++ b/src/modules/objects/KvsObject_treeWidget.h
@@ -71,8 +71,8 @@ protected:
bool setAcceptDrops(KviKvsObjectFunctionCall *c);
bool setHeaderLabels(KviKvsObjectFunctionCall *c);
bool setColumnCount(KviKvsObjectFunctionCall *c);
- bool topLevelItem(KviKvsObjectFunctionCall *c);
- bool topLevelItemCount(KviKvsObjectFunctionCall *c);
+ bool topLevelItem(KviKvsObjectFunctionCall *c);
+ bool topLevelItemCount(KviKvsObjectFunctionCall *c);
bool itemAt(KviKvsObjectFunctionCall *c);
protected slots:
void slotClicked(QTreeWidgetItem *,int);
diff --git a/src/modules/objects/KvsObject_treeWidgeteItem.cpp b/src/modules/objects/KvsObject_treeWidgeteItem.cpp
index 8e7903227..0220c8810 100644
--- a/src/modules/objects/KvsObject_treeWidgeteItem.cpp
+++ b/src/modules/objects/KvsObject_treeWidgeteItem.cpp
@@ -33,7 +33,7 @@
#include <QIcon>
const int item_flags[] = {
- Qt::NoItemFlags,
+ Qt::NoItemFlags,
Qt::ItemIsSelectable,
Qt::ItemIsEditable,
Qt::ItemIsDragEnabled,
@@ -45,7 +45,7 @@ const int item_flags[] = {
const char * const itemflags_tbl[] = {
"noitemflag",
- "selectable",
+ "selectable",
"editable",
"dragEnabled",
"dropEnabled",
@@ -59,25 +59,25 @@ const char * const itemflags_tbl[] = {
/*
- @doc: listviewitem
+ @doc: listviewitem
@keyterms:
- listview tlistviewitem class
+ listview tlistviewitem class
@title:
- listviewtitem class
+ listviewtitem class
@type:
class
@short:
- A listviewitem class
+ A listviewitem class
@inherits:
- [class]listviewitem[/class]
+ [class]listviewitem[/class]
@description:
- The listviewitem class implements a list view item.
- A list view item is a multi-column object capable of displaying itself in a [class]listview[/class].
- To use this class you must instantiate it with another listviewitem or a [class]listview[/class]
+ The listviewitem class implements a list view item.
+ A list view item is a multi-column object capable of displaying itself in a [class]listview[/class].
+ To use this class you must instantiate it with another listviewitem or a [class]listview[/class]
as parent. The item will be automatically displayed.
You can set the text and a pixmap in each column and you can make it checkable
- with [classfnc:listviewitem]$setCheckable[/classfnc]().
- A checkable listviewitem will display a small check mark in the first column.
+ with [classfnc:listviewitem]$setCheckable[/classfnc]().
+ A checkable listviewitem will display a small check mark in the first column.
@functions:
!fn: $setText(<column:integer>,<text:string>)
Sets the text in column column to text, if column is a valid column number and text is different from the existing text.
@@ -89,20 +89,20 @@ const char * const itemflags_tbl[] = {
Sets the pixmap in column column to pm, if pm is non-null and different from the current pixmap, and if column is non-negative.
Pixmap can be a Kvirc imageid, an image file or a [class]pixmap[/class] object.
- !fn: $setItemEditable(<bEnabled:boolean>)
- If bEnabled is TRUE (1), this item can be in-place editable by the user; otherwise it cannot be editable in-place.
+ !fn: $setItemEditable(<bEnabled:boolean>)
+ If bEnabled is TRUE (1), this item can be in-place editable by the user; otherwise it cannot be editable in-place.
- !fn: $isItemEditable()
- Returns $true if this item is editable and $false otherwise.
+ !fn: $isItemEditable()
+ Returns $true if this item is editable and $false otherwise.
!fn: $setEnabled(<bEnabled:boolean>)
- Enables or disables the item.
+ Enables or disables the item.
!fn: $isEnabled()
- Returns $true if this item is enabled and $false otherwise.
+ Returns $true if this item is enabled and $false otherwise.
!fn: $setOpen(<bOpen:boolean>)
- Opens or closes the item to show its children items.
+ Opens or closes the item to show its children items.
!fn: $isOpen()
Returns the open state of this item
@@ -117,24 +117,24 @@ const char * const itemflags_tbl[] = {
Returns $true if this item is checkable and $false otherwise
!fn: $setChecked(<bChecked:boolean>)
- Sets this item to be checked or not. [classfnc:listviewitem]$setCheckable[/classfnc]() must
+ Sets this item to be checked or not. [classfnc:listviewitem]$setCheckable[/classfnc]() must
have been previously called.
!fn: $isChecked()
- Returns the check status of this item. [classfnc:listviewitem]$setCheckable[/classfnc]() must
+ Returns the check status of this item. [classfnc:listviewitem]$setCheckable[/classfnc]() must
have been previously called.
!fn: $setFlags(<flag1:string>, <flag2:string>, ...)
- Sets the flags for the item to the given flags. These determine whether the item can be selected or modified. This is often used to disable an item.
- Supported flags are:
- - noitemflag : no flag sets;
- - selectable : item is selecatble;
- - editable : item is editable;
- - dragEnabled : item can dragged;
- - dropEnabled : item can used as drop target;
- - userCheckable : item is checkable;
- - enabled :item is enabled;
- - tristate : item is checkable with three separate states.
+ Sets the flags for the item to the given flags. These determine whether the item can be selected or modified. This is often used to disable an item.
+ Supported flags are:
+ [br]- noitemflag : no flag sets;
+ [br]- selectable : item is selecatble;
+ [br]- editable : item is editable;
+ [br]- dragEnabled : item can dragged;
+ [br]- dropEnabled : item can used as drop target;
+ [br]- userCheckable : item is checkable;
+ [br]- enabled :item is enabled;
+ [br]- tristate : item is checkable with three separate states.
*/
@@ -146,17 +146,17 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_treeWidgetItem,"listviewitem","object")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setText)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,text)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setPixmap);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setItemEditable);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isItemEditable);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setEnabled);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isEnabled);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setItemEditable);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isItemEditable);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setEnabled);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isEnabled);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setOpen);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isOpen);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setCheckable);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isCheckable);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setCheckable);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isCheckable);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setChecked);
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,isChecked);
- KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setFlags);
+ KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setFlags);
KVSO_END_REGISTERCLASS(KvsObject_treeWidgetItem)
@@ -188,7 +188,7 @@ bool KvsObject_treeWidgetItem::init(KviKvsRunTimeContext * pContext,KviKvsVarian
if(parentObject()->inheritsClass("listview"))
m_pTreeWidgetItem = new KviKvsStandardTreeWidgetItem(this,((QTreeWidget *)parentScriptWidget()));
else {
- pContext->error(__tr2qs_ctx("The parent of the listviewitem must be either another listviewitem or a listview","objects"));
+ pContext->error(__tr2qs_ctx("The parent of the listviewitem must be either another listviewitem or a listview","objects"));
return false;
}
}
@@ -243,23 +243,23 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,setText)
KVSO_CLASS_FUNCTION(treeWidgetItem,setItemEditable)
{
- bool bEnabled;
+ bool bEnabled;
KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled)
- KVSO_PARAMETERS_END(c)
+ KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled)
+ KVSO_PARAMETERS_END(c)
if(m_pTreeWidgetItem)
- m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsEditable:m_pTreeWidgetItem->flags()&~Qt::ItemIsEditable);
+ m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsEditable:m_pTreeWidgetItem->flags()&~Qt::ItemIsEditable);
return true;
}
KVSO_CLASS_FUNCTION(treeWidgetItem,isItemEditable)
{
- if(!m_pTreeWidgetItem)
- {
- c->returnValue()->setBoolean(false);
- return true;
- }
- c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsEditable);
- return true;
+ if(!m_pTreeWidgetItem)
+ {
+ c->returnValue()->setBoolean(false);
+ return true;
+ }
+ c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsEditable);
+ return true;
}
KVSO_CLASS_FUNCTION(treeWidgetItem,setFlags)
{
@@ -285,7 +285,7 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,setFlags)
sum = sum | flag;
}
else
- c->warning(__tr2qs_ctx("Unknown item flag '%Q'","objects"),&itemflags.at(i));
+ c->warning(__tr2qs_ctx("Unknown item flag '%Q'","objects"),&itemflags.at(i));
}
if(m_pTreeWidgetItem)
m_pTreeWidgetItem->setFlags((Qt::ItemFlags)sum);
@@ -300,7 +300,7 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,setEnabled)
KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled)
KVSO_PARAMETERS_END(c)
if(m_pTreeWidgetItem)
- m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsEnabled:m_pTreeWidgetItem->flags()&~Qt::ItemIsEnabled);
+ m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsEnabled:m_pTreeWidgetItem->flags()&~Qt::ItemIsEnabled);
return true;
}
@@ -311,7 +311,7 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,isEnabled)
c->returnValue()->setBoolean(false);
return true;
}
- c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsEnabled);
+ c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsEnabled);
return true;
}
@@ -361,12 +361,12 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,isChecked)
KVSO_CLASS_FUNCTION(treeWidgetItem,setCheckable)
{
- bool bEnabled;
+ bool bEnabled;
KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("bCheckable",KVS_PT_BOOL,0,bEnabled)
+ KVSO_PARAMETER("bCheckable",KVS_PT_BOOL,0,bEnabled)
KVSO_PARAMETERS_END(c)
if(!m_pTreeWidgetItem)return true;
- m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsUserCheckable:m_pTreeWidgetItem->flags()&~Qt::ItemIsUserCheckable);
+ m_pTreeWidgetItem->setFlags(bEnabled?m_pTreeWidgetItem->flags()|Qt::ItemIsUserCheckable:m_pTreeWidgetItem->flags()&~Qt::ItemIsUserCheckable);
return true;
}
@@ -377,7 +377,7 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,isCheckable)
c->returnValue()->setBoolean(false);
return true;
}
- c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsUserCheckable);
+ c->returnValue()->setBoolean(m_pTreeWidgetItem->flags()&Qt::ItemIsUserCheckable);
return true;
}
@@ -403,14 +403,14 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,setPixmap)
KVSO_PARAMETER("pixmap",KVS_PT_VARIANT,0,vPixmap)
KVSO_PARAMETERS_END(c)
QPixmap *pix = 0;
- if (vPixmap->isEmpty()) {m_pTreeWidgetItem->setIcon(uCol,QIcon());return true;}
+ if (vPixmap->isEmpty()) {m_pTreeWidgetItem->setIcon(uCol,QIcon());return true;}
if(vPixmap->isHObject())
{
vPixmap->asHObject(obHpixmap);
obPixmap=KviKvsKernel::instance()->objectController()->lookupObject(obHpixmap);
if (!obPixmap->inheritsClass("pixmap"))
{
- c->warning(__tr2qs_ctx("Pixmap object or image Id required","objects"));
+ c->warning(__tr2qs_ctx("Pixmap object or image Id required","objects"));
return true;
}
pix=((KvsObject_pixmap *)obPixmap)->getPixmap();
@@ -420,7 +420,7 @@ KVSO_CLASS_FUNCTION(treeWidgetItem,setPixmap)
pix=g_pIconManager->getImage(szPix);
if(!pix)
{
- c->warning(__tr2qs_ctx("Error occured: the suitable file '%Q' is not of the correct format or it is not a valid icon number.","objects"),&szPix);
+ c->warning(__tr2qs_ctx("Error occured: the suitable file '%Q' is not of the correct format or it is not a valid icon number.","objects"),&szPix);
return true;
}
}
diff --git a/src/modules/objects/KvsObject_treeWidgeteItem.h b/src/modules/objects/KvsObject_treeWidgeteItem.h
index d2c56b8c6..14b81b6ce 100644
--- a/src/modules/objects/KvsObject_treeWidgeteItem.h
+++ b/src/modules/objects/KvsObject_treeWidgeteItem.h
@@ -44,8 +44,8 @@ protected:
bool setText(KviKvsObjectFunctionCall *c);
bool insertItem(KviKvsObjectFunctionCall *c);
bool setPixmap(KviKvsObjectFunctionCall *c);
- bool setItemEditable(KviKvsObjectFunctionCall *c);
- bool isItemEditable(KviKvsObjectFunctionCall *c);
+ bool setItemEditable(KviKvsObjectFunctionCall *c);
+ bool isItemEditable(KviKvsObjectFunctionCall *c);
bool setEnabled(KviKvsObjectFunctionCall *c);
bool isEnabled(KviKvsObjectFunctionCall *c);
bool setOpen(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/KvsObject_vBox.cpp b/src/modules/objects/KvsObject_vBox.cpp
index 65fced903..59f0882ad 100644
--- a/src/modules/objects/KvsObject_vBox.cpp
+++ b/src/modules/objects/KvsObject_vBox.cpp
@@ -49,12 +49,12 @@ const char * const align_tbl[] = {
const int align_cod[] = {
Qt::AlignLeft,
Qt::AlignRight,
- Qt::AlignHCenter,
- Qt::AlignVCenter,
- Qt::AlignCenter,
- Qt::AlignTop,
- Qt::AlignBottom,
- Qt::AlignJustify,
+ Qt::AlignHCenter,
+ Qt::AlignVCenter,
+ Qt::AlignCenter,
+ Qt::AlignTop,
+ Qt::AlignBottom,
+ Qt::AlignJustify,
};
#define align_num (sizeof(align_tbl) / sizeof(align_tbl[0]))