diff --git a/src/libs/utils/tooltip/tipfactory.cpp b/src/libs/utils/tooltip/tipfactory.cpp deleted file mode 100644 index 56a3713742a40e52f548c093fa9d1e1422d6be85..0000000000000000000000000000000000000000 --- a/src/libs/utils/tooltip/tipfactory.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "tipfactory.h" -#include "tipcontents.h" -#include "tips.h" - -#include <utils/qtcassert.h> - -#include <QVBoxLayout> - -using namespace Utils; -using namespace Internal; - -TipFactory::TipFactory() -{} - -TipFactory::~TipFactory() -{} - -Internal::QTipLabel *TipFactory::createTip(const TipContent &content, QWidget *w) -{ - if (content.typeId() == TextContent::TEXT_CONTENT_ID) - return new TextTip(w); - if (content.typeId() == ColorContent::COLOR_CONTENT_ID) - return new ColorTip(w); - if (content.typeId() == WidgetContent::WIDGET_CONTENT_ID) - return new WidgetTip(w); - - QTC_CHECK(false); - return 0; -} diff --git a/src/libs/utils/tooltip/tipfactory.h b/src/libs/utils/tooltip/tipfactory.h deleted file mode 100644 index 1b8b78a2f0a311b6231debc40538a34cc7cb4cc6..0000000000000000000000000000000000000000 --- a/src/libs/utils/tooltip/tipfactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef TIPFACTORY_H -#define TIPFACTORY_H - -#include <QWidget> - -namespace Utils { - -class TipContent; - -namespace Internal { -class QTipLabel; - -class TipFactory -{ -public: - TipFactory(); - virtual ~TipFactory(); - Q_DISABLE_COPY(TipFactory) - - virtual QTipLabel *createTip(const TipContent &content, QWidget *w); -}; - -} // namespace Internal -} // namespace Utils - -#endif // TIPFACTORY_H diff --git a/src/libs/utils/tooltip/tooltip.cpp b/src/libs/utils/tooltip/tooltip.cpp index ea9ee0f953d4e031caf0a45ec813303acf27fd70..06a3e4a1cd545c13015a0d81c7ccf0f6223ab1b3 100644 --- a/src/libs/utils/tooltip/tooltip.cpp +++ b/src/libs/utils/tooltip/tooltip.cpp @@ -30,7 +30,6 @@ #include "tooltip.h" #include "tips.h" #include "tipcontents.h" -#include "tipfactory.h" #include "effects.h" #include "reuse.h" @@ -41,6 +40,7 @@ #include <QApplication> #include <QKeyEvent> #include <QMouseEvent> +#include <QWidget> #include <QMenu> #include <QDebug> @@ -48,7 +48,7 @@ using namespace Utils; using namespace Internal; -ToolTip::ToolTip() : m_tipFactory(new TipFactory), m_tip(0), m_widget(0) +ToolTip::ToolTip() : m_tip(0), m_widget(0) { connect(&m_showTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately())); connect(&m_hideDelayTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately())); @@ -57,7 +57,6 @@ ToolTip::ToolTip() : m_tipFactory(new TipFactory), m_tip(0), m_widget(0) ToolTip::~ToolTip() { m_tip = 0; - delete m_tipFactory; } ToolTip *ToolTip::instance() @@ -69,12 +68,23 @@ ToolTip *ToolTip::instance() void ToolTip::show(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect) { if (acceptShow(content, pos, w, rect)) { -#ifndef Q_OS_WIN - m_tip = m_tipFactory->createTip(content, w); -#else - m_tip = m_tipFactory->createTip( - content, QApplication::desktop()->screen(Internal::screenNumber(pos, w))); -#endif + QWidget *target = 0; + if (HostOsInfo::isWindowsHost()) + target = QApplication::desktop()->screen(Internal::screenNumber(pos, w)); + else + target = w; + + switch (content.typeId()) { + case TextContent::TEXT_CONTENT_ID: + m_tip = new TextTip(target); + break; + case ColorContent::COLOR_CONTENT_ID: + m_tip = new ColorTip(target); + break; + case WidgetContent::WIDGET_CONTENT_ID: + m_tip = new WidgetTip(target); + break; + } setUp(pos, content, w, rect); qApp->installEventFilter(this); showTip(); diff --git a/src/libs/utils/tooltip/tooltip.h b/src/libs/utils/tooltip/tooltip.h index d4cadb1422b6401aca574de0e15d9edae4950871..01bae1d2d9360b3142afb25b6625d3f9b973c2c8 100644 --- a/src/libs/utils/tooltip/tooltip.h +++ b/src/libs/utils/tooltip/tooltip.h @@ -53,11 +53,7 @@ class QWidget; QT_END_NAMESPACE namespace Utils { - -namespace Internal { -class TipFactory; -class QTipLabel; -} +namespace Internal { class QTipLabel; } class TipContent; @@ -95,7 +91,6 @@ private: void showTip(); void hideTipWithDelay(); - Internal::TipFactory *m_tipFactory; Internal::QTipLabel *m_tip; QWidget *m_widget; QRect m_rect; diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri index 27c02610e5b208c808545bdbcff5e079bd23b44e..12feb9898491719d6616c3ba8d40eb41481ce827 100644 --- a/src/libs/utils/utils-lib.pri +++ b/src/libs/utils/utils-lib.pri @@ -84,7 +84,6 @@ SOURCES += $$PWD/environment.cpp \ $$PWD/tooltip/tooltip.cpp \ $$PWD/tooltip/tips.cpp \ $$PWD/tooltip/tipcontents.cpp \ - $$PWD/tooltip/tipfactory.cpp \ $$PWD/unixutils.cpp win32 { @@ -174,7 +173,6 @@ HEADERS += \ $$PWD/tooltip/tipcontents.h \ $$PWD/tooltip/reuse.h \ $$PWD/tooltip/effects.h \ - $$PWD/tooltip/tipfactory.h \ $$PWD/unixutils.h FORMS += $$PWD/filewizardpage.ui \ diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs index 1e08bc3c4e8349224463bc0ae95462f1f72a90d9..9a1a6d897bc538c5b8723d32cd0ce79607a74efe 100644 --- a/src/libs/utils/utils.qbs +++ b/src/libs/utils/utils.qbs @@ -188,8 +188,6 @@ QtcLibrary { "reuse.h", "tipcontents.cpp", "tipcontents.h", - "tipfactory.cpp", - "tipfactory.h", "tips.cpp", "tips.h", "tooltip.cpp",