summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-17 02:42:04 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-17 02:42:04 -0600
commitd5fcca47a697f9901e9ff97f5a7fe1ca41616fee (patch)
tree885cdb629fa54f400115a5f42a027e50e0ca88a6
parentca9d4d7d227386aba0f30bdacee1c5aa0a053204 (diff)
downloadtqt3-d5fcca47a697f9901e9ff97f5a7fe1ca41616fee.tar.gz
tqt3-d5fcca47a697f9901e9ff97f5a7fe1ca41616fee.zip
Automated update from Qt3
-rw-r--r--src/styles/qcommonstyle.cpp77
-rw-r--r--src/tools/qstring.cpp73
2 files changed, 69 insertions, 81 deletions
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index bf8507786..a1ede1ad2 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -140,6 +140,27 @@ static const char * const check_list_controller_xpm[] = {
" ",
" "};
+// Increase speed by avoiding constant allocation/deallocation of commonly used strings
+static TQString TQPushButton_static_string("TQPushButton");
+static TQString TQToolButton_static_string("TQToolButton");
+static TQString TQButton_static_string("TQButton");
+static TQString TQTabBar_static_string("TQTabBar");
+static TQString TQTitleBar_static_string("TQTitleBar");
+static TQString TQToolBox_static_string("TQToolBox");
+static TQString TQProgressBar_static_string("TQProgressBar");
+static TQString TQPopupMenu_static_string("TQPopupMenu");
+static TQString TQComboBox_static_string("TQComboBox");
+static TQString TQCheckBox_static_string("TQCheckBox");
+static TQString TQRadioButton_static_string("TQRadioButton");
+static TQString TQHeader_static_string("TQHeader");
+static TQString TQScrollBar_static_string("TQScrollBar");
+static TQString TQSlider_static_string("TQSlider");
+static TQString TQDialogButtons_static_string("TQDialogButtons");
+static TQString TQSpinWidget_static_string("TQSpinWidget");
+static TQString TQListView_static_string("TQListView");
+static TQString TQDockWindow_static_string("TQDockWindow");
+static TQString TQFrame_static_string("TQFrame");
+
#include <ntqmetaobject.h>
TQStringList getObjectTypeListForObject(const TQObject* object) {
@@ -163,7 +184,7 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
TQStyle::ControlElementFlags cef = TQStyle::CEF_None;
if (object) {
- if (objectTypeList.contains("TQPushButton")) {
+ if (objectTypeList.contains(TQPushButton_static_string)) {
const TQPushButton *button = dynamic_cast<const TQPushButton*>(object);
if (button) {
if (button->isDefault()) cef = cef | TQStyle::CEF_IsDefault;
@@ -173,7 +194,7 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button->isFlat()) cef = cef | TQStyle::CEF_IsFlat;
}
}
- if (objectTypeList.contains("TQToolButton")) {
+ if (objectTypeList.contains(TQToolButton_static_string)) {
const TQToolButton *button = dynamic_cast<const TQToolButton*>(object);
if (button) {
if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState;
@@ -182,7 +203,7 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button->popup()) cef = cef | TQStyle::CEF_HasPopupMenu;
}
}
- if (objectTypeList.contains("TQButton")) {
+ if (objectTypeList.contains(TQButton_static_string)) {
const TQButton *button = dynamic_cast<const TQButton*>(object);
if (button) {
if (button->isDown()) cef = cef | TQStyle::CEF_IsDown;
@@ -190,39 +211,39 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState;
}
}
- if (objectTypeList.contains("TQTabBar")) {
+ if (objectTypeList.contains(TQTabBar_static_string)) {
const TQTabBar *tb = dynamic_cast<const TQTabBar*>(object);
TQTab * t = opt.tab();
if ((t) && (tb)) {
if (t->identifier() == tb->currentTab()) cef = cef | TQStyle::CEF_IsActive;
}
}
- if (objectTypeList.contains("TQTitleBar")) {
+ if (objectTypeList.contains(TQTitleBar_static_string)) {
const TQTitleBar *tb = dynamic_cast<const TQTitleBar*>(object);
if (tb) {
if (tb->isActive()) cef = cef | TQStyle::CEF_IsActive;
}
}
- if (objectTypeList.contains("TQToolBox")) {
+ if (objectTypeList.contains(TQToolBox_static_string)) {
const TQToolBox *tb = dynamic_cast<const TQToolBox*>(object);
if (tb) {
if (!tb->currentItem()) cef = cef | TQStyle::CEF_IsContainerEmpty;
}
}
- if (objectTypeList.contains("TQProgressBar")) {
+ if (objectTypeList.contains(TQProgressBar_static_string)) {
const TQProgressBar *pb = dynamic_cast<const TQProgressBar*>(object);
if (pb) {
if (pb->centerIndicator()) cef = cef | TQStyle::CEF_CenterIndicator;
if (pb->indicatorFollowsStyle()) cef = cef | TQStyle::CEF_IndicatorFollowsStyle;
}
}
- if (objectTypeList.contains("TQPopupMenu")) {
+ if (objectTypeList.contains(TQPopupMenu_static_string)) {
const TQPopupMenu *pm = dynamic_cast<const TQPopupMenu*>(object);
if (pm) {
if (pm->isCheckable()) cef = cef | TQStyle::CEF_IsCheckable;
}
}
- if (objectTypeList.contains("TQComboBox")) {
+ if (objectTypeList.contains(TQComboBox_static_string)) {
const TQComboBox *cb = dynamic_cast<const TQComboBox*>(object);
if (cb) {
if (cb->editable()) cef = cef | TQStyle::CEF_IsEditable;
@@ -295,7 +316,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.name = widget->name();
ceData.caption = widget->caption();
if (!populateMinimumNumberOfFields) {
- if (ceData.widgetObjectTypes.contains("TQPushButton")) {
+ if (ceData.widgetObjectTypes.contains(TQPushButton_static_string)) {
const TQPushButton *button = dynamic_cast<const TQPushButton*>(widget);
if (button) {
TQIconSet* iconSet = 0;
@@ -310,7 +331,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQToolButton")) {
+ if (ceData.widgetObjectTypes.contains(TQToolButton_static_string)) {
const TQToolButton *button = dynamic_cast<const TQToolButton*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
@@ -324,7 +345,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.popupDelay = button->popupDelay();
}
}
- if (ceData.widgetObjectTypes.contains("TQCheckBox")) {
+ if (ceData.widgetObjectTypes.contains(TQCheckBox_static_string)) {
const TQCheckBox *button = dynamic_cast<const TQCheckBox*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
@@ -334,7 +355,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQRadioButton")) {
+ if (ceData.widgetObjectTypes.contains(TQRadioButton_static_string)) {
const TQRadioButton *button = dynamic_cast<const TQRadioButton*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
@@ -344,7 +365,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQButton")) {
+ if (ceData.widgetObjectTypes.contains(TQButton_static_string)) {
const TQButton *button = dynamic_cast<const TQButton*>(widget);
if (button) {
ceData.text = button->text();
@@ -355,7 +376,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQTabBar")) {
+ if (ceData.widgetObjectTypes.contains(TQTabBar_static_string)) {
const TQTabBar *tb = dynamic_cast<const TQTabBar*>(widget);
if (tb) {
ceData.tabBarData.tabCount = tb->count();
@@ -403,7 +424,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQToolBox")) {
+ if (ceData.widgetObjectTypes.contains(TQToolBox_static_string)) {
const TQToolBox *tb = dynamic_cast<const TQToolBox*>(widget);
if (tb) {
const TQWidget* currentItem = tb->currentItem();
@@ -412,7 +433,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQProgressBar")) {
+ if (ceData.widgetObjectTypes.contains(TQProgressBar_static_string)) {
const TQProgressBar *pb = dynamic_cast<const TQProgressBar*>(widget);
if (pb) {
ceData.currentStep = pb->progress();
@@ -422,7 +443,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.orientation = pb->orientation();
}
}
- if (ceData.widgetObjectTypes.contains("TQHeader")) {
+ if (ceData.widgetObjectTypes.contains(TQHeader_static_string)) {
const TQHeader *header = dynamic_cast<const TQHeader*>(widget);
if (header) {
int section = opt.headerSection();
@@ -435,7 +456,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
// Complex Controls
- if (ceData.widgetObjectTypes.contains("TQScrollBar")) {
+ if (ceData.widgetObjectTypes.contains(TQScrollBar_static_string)) {
const TQScrollBar *sb = dynamic_cast<const TQScrollBar*>(widget);
if (sb) {
ceData.orientation = sb->orientation();
@@ -450,7 +471,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQSlider")) {
+ if (ceData.widgetObjectTypes.contains(TQSlider_static_string)) {
const TQSlider *sl = dynamic_cast<const TQSlider*>(widget);
if (sl) {
ceData.orientation = sl->orientation();
@@ -467,7 +488,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQDialogButtons")) {
+ if (ceData.widgetObjectTypes.contains(TQDialogButtons_static_string)) {
const TQDialogButtons *dlgbtns = dynamic_cast<const TQDialogButtons*>(widget);
if (dlgbtns) {
ceData.orientation = dlgbtns->orientation();
@@ -481,7 +502,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
- if (ceData.widgetObjectTypes.contains("TQTitleBar")) {
+ if (ceData.widgetObjectTypes.contains(TQTitleBar_static_string)) {
const TQTitleBar *tb = dynamic_cast<const TQTitleBar*>(widget);
if (tb) {
ceData.titleBarData.hasWindow = !!(tb->window());
@@ -494,7 +515,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.titleBarData.visibleText = tb->visibleText();
}
}
- if (ceData.widgetObjectTypes.contains("TQSpinWidget")) {
+ if (ceData.widgetObjectTypes.contains(TQSpinWidget_static_string)) {
const TQSpinWidget *sw = dynamic_cast<const TQSpinWidget*>(widget);
if (sw) {
ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols();
@@ -504,7 +525,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.spinWidgetData.downEnabled = sw->isDownEnabled();
}
}
- if (ceData.widgetObjectTypes.contains("TQListView")) {
+ if (ceData.widgetObjectTypes.contains(TQListView_static_string)) {
const TQListView *lv = dynamic_cast<const TQListView*>(widget);
if (lv) {
ceData.listViewData.rootDecorated = lv->rootIsDecorated();
@@ -546,7 +567,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQComboBox")) {
+ if (ceData.widgetObjectTypes.contains(TQComboBox_static_string)) {
const TQComboBox *cb = dynamic_cast<const TQComboBox*>(widget);
if (cb) {
const TQLineEdit* lineEdit = cb->lineEdit();
@@ -559,7 +580,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains("TQFrame")) {
+ if (ceData.widgetObjectTypes.contains(TQFrame_static_string)) {
const TQFrame *frame = dynamic_cast<const TQFrame*>(widget);
if (frame) {
ceData.frameStyle = frame->frameStyle();
@@ -2776,7 +2797,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
if ( ceData.wflags & WStyle_Tool ) {
ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 16 );
#ifndef QT_NO_MAINWINDOW
- } else if ( ceData.widgetObjectTypes.contains("TQDockWindow") ) {
+ } else if ( ceData.widgetObjectTypes.contains(TQDockWindow_static_string) ) {
ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 13 );
#endif
} else {
@@ -2924,7 +2945,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
#ifndef QT_NO_TABBAR
case PM_TabBarTabVSpace:
{
- if ( ceData.widgetObjectTypes.contains("TQTabBar") && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
+ if ( ceData.widgetObjectTypes.contains(TQTabBar_static_string) && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
ceData.tabBarData.shape == TQTabBar::RoundedBelow ) )
ret = 10;
else
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp
index 9b76dd9c0..24339fcdb 100644
--- a/src/tools/qstring.cpp
+++ b/src/tools/qstring.cpp
@@ -1048,13 +1048,9 @@ TQStringData::TQStringData() : TQShared(),
islatin1(FALSE),
security_unpaged(FALSE) {
#ifdef QT_THREAD_SUPPORT
- mutex = new TQMutex( TRUE );
- mutex->lock();
+ mutex = new TQMutex(FALSE);
#endif // QT_THREAD_SUPPORT
ref();
-#ifdef QT_THREAD_SUPPORT
- mutex->unlock();
-#endif // QT_THREAD_SUPPORT
}
TQStringData::TQStringData(TQChar *u, uint l, uint m) : TQShared(),
@@ -1066,7 +1062,7 @@ TQStringData::TQStringData(TQChar *u, uint l, uint m) : TQShared(),
islatin1(FALSE),
security_unpaged(FALSE) {
#ifdef QT_THREAD_SUPPORT
- mutex = new TQMutex( TRUE );
+ mutex = new TQMutex(FALSE);
#endif // QT_THREAD_SUPPORT
}
@@ -1494,13 +1490,6 @@ TQString::TQString() :
d(0)
{
d = shared_null ? shared_null : makeSharedNull();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->lock();
-#endif // QT_THREAD_SUPPORT
- d->ref();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT
}
/*!
@@ -1519,15 +1508,15 @@ TQString::TQString( TQChar ch )
TQString::TQString( const TQString &s ) :
d(s.d)
{
+ if (d != shared_null) {
#ifdef QT_THREAD_SUPPORT
- d->mutex->lock();
+ d->mutex->lock();
#endif // QT_THREAD_SUPPORT
-
- d->ref();
-
+ d->ref();
#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
+ d->mutex->unlock();
#endif // QT_THREAD_SUPPORT
+ }
}
/*!
@@ -1550,13 +1539,6 @@ TQString::TQString( int size, bool /*dummy*/ )
d = new TQStringData( uc, 0, l );
} else {
d = shared_null ? shared_null : (shared_null=new TQStringData);
-#ifdef QT_THREAD_SUPPORT
- d->mutex->lock();
-#endif // QT_THREAD_SUPPORT
- d->ref();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT
}
}
@@ -1598,13 +1580,6 @@ TQString::TQString( const TQChar* unicode, uint length )
{
if ( !unicode && !length ) {
d = shared_null ? shared_null : makeSharedNull();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->lock();
-#endif // QT_THREAD_SUPPORT
- d->ref();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT
}
else {
TQChar* uc = QT_ALLOC_QCHAR_VEC( length );
@@ -1689,22 +1664,19 @@ TQString::~TQString()
}
#endif
+ if (d == shared_null) {
+ return;
+ }
+
#ifdef QT_THREAD_SUPPORT
d->mutex->lock();
#endif // QT_THREAD_SUPPORT
if ( d->deref() ) {
- if ( d != shared_null ) {
#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT
- d->deleteSelf();
- d = NULL;
- }
- else {
-#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
+ d->mutex->unlock();
#endif // QT_THREAD_SUPPORT
- }
+ d->deleteSelf();
+ d = NULL;
}
else {
#ifdef QT_THREAD_SUPPORT
@@ -1730,7 +1702,7 @@ void TQString::real_detach()
void TQString::deref()
{
- if ( d ) {
+ if ( d && (d != shared_null) ) {
#ifdef QT_THREAD_SUPPORT
d->mutex->lock();
#endif // QT_THREAD_SUPPORT
@@ -1788,13 +1760,15 @@ void TQStringData::deleteSelf()
*/
TQString &TQString::operator=( const TQString &s )
{
+ if (s.d != shared_null) {
#ifdef QT_THREAD_SUPPORT
- s.d->mutex->lock();
+ s.d->mutex->lock();
#endif // QT_THREAD_SUPPORT
- s.d->ref();
+ s.d->ref();
#ifdef QT_THREAD_SUPPORT
- s.d->mutex->unlock();
+ s.d->mutex->unlock();
#endif // QT_THREAD_SUPPORT
+ }
deref();
d = s.d;
@@ -6527,13 +6501,6 @@ TQString& TQString::setUnicode( const TQChar *unicode, uint len )
if ( d != shared_null ) { // beware of nullstring being set to nullstring
deref();
d = shared_null ? shared_null : makeSharedNull();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->lock();
-#endif // QT_THREAD_SUPPORT
- d->ref();
-#ifdef QT_THREAD_SUPPORT
- d->mutex->unlock();
-#endif // QT_THREAD_SUPPORT
}
}
else {