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 ** |
45 #include <QtGui/QHBoxLayout> |
45 #include <QtGui/QHBoxLayout> |
46 #include <QtGui/QMouseEvent> |
46 #include <QtGui/QMouseEvent> |
47 #include <QtGui/QCheckBox> |
47 #include <QtGui/QCheckBox> |
48 #include <QtGui/QLineEdit> |
48 #include <QtGui/QLineEdit> |
49 #include <QtGui/QMenu> |
49 #include <QtGui/QMenu> |
|
50 #include <QtCore/QLocale> |
50 |
51 |
51 QT_BEGIN_NAMESPACE |
52 QT_BEGIN_NAMESPACE |
52 |
53 |
53 QtCursorDatabase::QtCursorDatabase() |
54 QtCursorDatabase::QtCursorDatabase() |
54 { |
55 { |
90 QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-whatsthis.png"))); |
91 QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-whatsthis.png"))); |
91 appendCursor(Qt::BusyCursor, QApplication::translate("QtCursorDatabase", "Busy", 0, |
92 appendCursor(Qt::BusyCursor, QApplication::translate("QtCursorDatabase", "Busy", 0, |
92 QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png"))); |
93 QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png"))); |
93 } |
94 } |
94 |
95 |
|
96 void QtCursorDatabase::clear() |
|
97 { |
|
98 m_cursorNames.clear(); |
|
99 m_cursorIcons.clear(); |
|
100 m_valueToCursorShape.clear(); |
|
101 m_cursorShapeToValue.clear(); |
|
102 } |
|
103 |
95 void QtCursorDatabase::appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon) |
104 void QtCursorDatabase::appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon) |
96 { |
105 { |
97 if (m_cursorShapeToValue.contains(shape)) |
106 if (m_cursorShapeToValue.contains(shape)) |
98 return; |
107 return; |
99 int value = m_cursorNames.count(); |
108 const int value = m_cursorNames.count(); |
100 m_cursorNames.append(name); |
109 m_cursorNames.append(name); |
101 m_cursorIcons[value] = icon; |
110 m_cursorIcons.insert(value, icon); |
102 m_valueToCursorShape[value] = shape; |
111 m_valueToCursorShape.insert(value, shape); |
103 m_cursorShapeToValue[shape] = value; |
112 m_cursorShapeToValue.insert(shape, value); |
104 } |
113 } |
105 |
114 |
106 QStringList QtCursorDatabase::cursorShapeNames() const |
115 QStringList QtCursorDatabase::cursorShapeNames() const |
107 { |
116 { |
108 return m_cursorNames; |
117 return m_cursorNames; |
206 return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2]", 0, QApplication::UnicodeUTF8) |
215 return QApplication::translate("QtPropertyBrowserUtils", "[%1, %2]", 0, QApplication::UnicodeUTF8) |
207 .arg(f.family()) |
216 .arg(f.family()) |
208 .arg(f.pointSize()); |
217 .arg(f.pointSize()); |
209 } |
218 } |
210 |
219 |
|
220 QString QtPropertyBrowserUtils::dateFormat() |
|
221 { |
|
222 QLocale loc; |
|
223 return loc.dateFormat(QLocale::ShortFormat); |
|
224 } |
|
225 |
|
226 QString QtPropertyBrowserUtils::timeFormat() |
|
227 { |
|
228 QLocale loc; |
|
229 // ShortFormat is missing seconds on UNIX. |
|
230 return loc.timeFormat(QLocale::LongFormat); |
|
231 } |
|
232 |
|
233 QString QtPropertyBrowserUtils::dateTimeFormat() |
|
234 { |
|
235 QString format = dateFormat(); |
|
236 format += QLatin1Char(' '); |
|
237 format += timeFormat(); |
|
238 return format; |
|
239 } |
211 |
240 |
212 QtBoolEdit::QtBoolEdit(QWidget *parent) : |
241 QtBoolEdit::QtBoolEdit(QWidget *parent) : |
213 QWidget(parent), |
242 QWidget(parent), |
214 m_checkBox(new QCheckBox(this)), |
243 m_checkBox(new QCheckBox(this)), |
215 m_textVisible(true) |
244 m_textVisible(true) |