tools/shared/qtpropertybrowser/qtpropertymanager.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 8 3f74d0d4af4c
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the tools applications of the Qt Toolkit.
     7 ** This file is part of the tools applications of the Qt Toolkit.
     8 **
     8 **
  1551 class QtDatePropertyManagerPrivate
  1551 class QtDatePropertyManagerPrivate
  1552 {
  1552 {
  1553     QtDatePropertyManager *q_ptr;
  1553     QtDatePropertyManager *q_ptr;
  1554     Q_DECLARE_PUBLIC(QtDatePropertyManager)
  1554     Q_DECLARE_PUBLIC(QtDatePropertyManager)
  1555 public:
  1555 public:
       
  1556     explicit QtDatePropertyManagerPrivate(QtDatePropertyManager *q);
  1556 
  1557 
  1557     struct Data
  1558     struct Data
  1558     {
  1559     {
  1559         Data() : val(QDate::currentDate()), minVal(QDate(1752, 9, 14)),
  1560         Data() : val(QDate::currentDate()), minVal(QDate(1752, 9, 14)),
  1560                 maxVal(QDate(7999, 12, 31)) {}
  1561                 maxVal(QDate(7999, 12, 31)) {}
  1571 
  1572 
  1572     typedef QMap<const QtProperty *, Data> PropertyValueMap;
  1573     typedef QMap<const QtProperty *, Data> PropertyValueMap;
  1573     QMap<const QtProperty *, Data> m_values;
  1574     QMap<const QtProperty *, Data> m_values;
  1574 };
  1575 };
  1575 
  1576 
       
  1577 QtDatePropertyManagerPrivate::QtDatePropertyManagerPrivate(QtDatePropertyManager *q) :
       
  1578     q_ptr(q),
       
  1579     m_format(QtPropertyBrowserUtils::dateFormat())
       
  1580 {
       
  1581 }
       
  1582 
  1576 /*!
  1583 /*!
  1577     \class QtDatePropertyManager
  1584     \class QtDatePropertyManager
  1578     \internal
  1585     \internal
  1579     \inmodule QtDesigner
  1586     \inmodule QtDesigner
  1580     \since 4.4
  1587     \since 4.4
  1620 
  1627 
  1621 /*!
  1628 /*!
  1622     Creates a manager with the given \a parent.
  1629     Creates a manager with the given \a parent.
  1623 */
  1630 */
  1624 QtDatePropertyManager::QtDatePropertyManager(QObject *parent)
  1631 QtDatePropertyManager::QtDatePropertyManager(QObject *parent)
  1625     : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate)
  1632     : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate(this))
  1626 {
  1633 {
  1627     d_ptr->q_ptr = this;
       
  1628 
       
  1629     QLocale loc;
       
  1630     d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
       
  1631 }
  1634 }
  1632 
  1635 
  1633 /*!
  1636 /*!
  1634     Destroys this manager, and all the properties it has created.
  1637     Destroys this manager, and all the properties it has created.
  1635 */
  1638 */
  1784 class QtTimePropertyManagerPrivate
  1787 class QtTimePropertyManagerPrivate
  1785 {
  1788 {
  1786     QtTimePropertyManager *q_ptr;
  1789     QtTimePropertyManager *q_ptr;
  1787     Q_DECLARE_PUBLIC(QtTimePropertyManager)
  1790     Q_DECLARE_PUBLIC(QtTimePropertyManager)
  1788 public:
  1791 public:
  1789 
  1792     explicit QtTimePropertyManagerPrivate(QtTimePropertyManager *q);
  1790     QString m_format;
  1793 
       
  1794     const QString m_format;
  1791 
  1795 
  1792     typedef QMap<const QtProperty *, QTime> PropertyValueMap;
  1796     typedef QMap<const QtProperty *, QTime> PropertyValueMap;
  1793     PropertyValueMap m_values;
  1797     PropertyValueMap m_values;
  1794 };
  1798 };
       
  1799 
       
  1800 QtTimePropertyManagerPrivate::QtTimePropertyManagerPrivate(QtTimePropertyManager *q) :
       
  1801     q_ptr(q),
       
  1802     m_format(QtPropertyBrowserUtils::timeFormat())
       
  1803 {
       
  1804 }
  1795 
  1805 
  1796 /*!
  1806 /*!
  1797     \class QtTimePropertyManager
  1807     \class QtTimePropertyManager
  1798     \internal
  1808     \internal
  1799     \inmodule QtDesigner
  1809     \inmodule QtDesigner
  1823 
  1833 
  1824 /*!
  1834 /*!
  1825     Creates a manager with the given \a parent.
  1835     Creates a manager with the given \a parent.
  1826 */
  1836 */
  1827 QtTimePropertyManager::QtTimePropertyManager(QObject *parent)
  1837 QtTimePropertyManager::QtTimePropertyManager(QObject *parent)
  1828     : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate)
  1838     : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate(this))
  1829 {
  1839 {
  1830     d_ptr->q_ptr = this;
       
  1831 
       
  1832     QLocale loc;
       
  1833     d_ptr->m_format = loc.timeFormat(QLocale::ShortFormat);
       
  1834 }
  1840 }
  1835 
  1841 
  1836 /*!
  1842 /*!
  1837     Destroys this manager, and all the properties it has created.
  1843     Destroys this manager, and all the properties it has created.
  1838 */
  1844 */
  1901 class QtDateTimePropertyManagerPrivate
  1907 class QtDateTimePropertyManagerPrivate
  1902 {
  1908 {
  1903     QtDateTimePropertyManager *q_ptr;
  1909     QtDateTimePropertyManager *q_ptr;
  1904     Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
  1910     Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
  1905 public:
  1911 public:
  1906 
  1912     explicit QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q);
  1907     QString m_format;
  1913 
       
  1914     const QString m_format;
  1908 
  1915 
  1909     typedef QMap<const QtProperty *, QDateTime> PropertyValueMap;
  1916     typedef QMap<const QtProperty *, QDateTime> PropertyValueMap;
  1910     PropertyValueMap m_values;
  1917     PropertyValueMap m_values;
  1911 };
  1918 };
       
  1919 
       
  1920 QtDateTimePropertyManagerPrivate::QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q) :
       
  1921     q_ptr(q),
       
  1922     m_format(QtPropertyBrowserUtils::dateTimeFormat())
       
  1923 {
       
  1924 }
  1912 
  1925 
  1913 /*! \class QtDateTimePropertyManager
  1926 /*! \class QtDateTimePropertyManager
  1914     \internal
  1927     \internal
  1915     \inmodule QtDesigner
  1928     \inmodule QtDesigner
  1916     \since 4.4
  1929     \since 4.4
  1936 
  1949 
  1937 /*!
  1950 /*!
  1938     Creates a manager with the given \a parent.
  1951     Creates a manager with the given \a parent.
  1939 */
  1952 */
  1940 QtDateTimePropertyManager::QtDateTimePropertyManager(QObject *parent)
  1953 QtDateTimePropertyManager::QtDateTimePropertyManager(QObject *parent)
  1941     : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate)
  1954     : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate(this))
  1942 {
  1955 {
  1943     d_ptr->q_ptr = this;
       
  1944 
       
  1945     QLocale loc;
       
  1946     d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
       
  1947     d_ptr->m_format += QLatin1Char(' ');
       
  1948     d_ptr->m_format += loc.timeFormat(QLocale::ShortFormat);
       
  1949 }
  1956 }
  1950 
  1957 
  1951 /*!
  1958 /*!
  1952     Destroys this manager, and all the properties it has created.
  1959     Destroys this manager, and all the properties it has created.
  1953 */
  1960 */