Added methods to format a date/time string.
git-svn-id: http://voip.null.ro/svn/yate@2149 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
747785a175
commit
2579f97fac
|
@ -1762,6 +1762,14 @@ bool QtClient::createSound(const char* name, const char* file, const char* devic
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QtClient::formatDateTime(String& dest, unsigned int secs, const char* format)
|
||||
{
|
||||
if (!(format && *format))
|
||||
return false;
|
||||
dest = qtGetUtf8(formatDateTime(secs,format));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set/get an object's property
|
||||
bool QtClient::property(bool set, QObject* obj, const char* name, String& value)
|
||||
{
|
||||
|
|
|
@ -148,6 +148,26 @@ public:
|
|||
*/
|
||||
virtual bool createSound(const char* name, const char* file, const char* device = 0);
|
||||
|
||||
/**
|
||||
* Build a date/time string
|
||||
* @param dest Destination string
|
||||
* @param secs Seconds since EPOCH
|
||||
* @param format Format string used to build the destination
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool formatDateTime(String& dest, unsigned int secs, const char* format);
|
||||
|
||||
/**
|
||||
* Build a date/time QT string
|
||||
* @param secs Seconds since EPOCH
|
||||
* @param format Format string
|
||||
* @return The formated string
|
||||
*/
|
||||
static QString formatDateTime(unsigned int secs, const char* format) {
|
||||
QDateTime time = QDateTime::fromTime_t(secs);
|
||||
return time.toString(format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set or get an object's property
|
||||
* @param set True to set, false to get the property
|
||||
|
|
10
yatecbase.h
10
yatecbase.h
|
@ -1085,6 +1085,16 @@ public:
|
|||
*/
|
||||
bool setBoolOpt(ClientToggle toggle, bool value, bool updateUi = false);
|
||||
|
||||
/**
|
||||
* Build a date/time string
|
||||
* @param dest Destination string
|
||||
* @param secs Seconds since EPOCH
|
||||
* @param format Format string used to build the destination
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool formatDateTime(String& dest, unsigned int secs, const char* format)
|
||||
{ return false; }
|
||||
|
||||
/**
|
||||
* Add a logic to the list. The added object is not owned by the client
|
||||
* @param logic Pointer to the logic to add
|
||||
|
|
Loading…
Reference in New Issue