2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-03-09 17:01:34 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-03-09 17:01:34 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-03-09 17:01:34 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-03-09 17:01:34 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-03-09 17:01:34 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-03-09 17:01:34 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QStringList>
|
2010-03-09 17:01:34 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2011-05-19 11:30:38 +02:00
|
|
|
class QDesignerFormWindowInterface;
|
2010-03-09 17:01:34 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Designer {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
/* ResourceHandler: Constructed on a form window and activated on open/save as
|
|
|
|
|
* (see README.txt). The form can have 2 states:
|
|
|
|
|
* 1) standalone: Uses the form editor's list of resource files.
|
|
|
|
|
* 2) Within a project: Use the list of resources files of the projects.
|
|
|
|
|
*
|
|
|
|
|
* When initializing, store the original list of qrc files of the form and
|
|
|
|
|
* connect to various signals of the project explorer to re-check.
|
|
|
|
|
* In updateResources, check whether the form is part of a project and use
|
|
|
|
|
* the project's resource files or the stored ones. */
|
|
|
|
|
|
|
|
|
|
class ResourceHandler : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2014-08-20 16:09:26 +02:00
|
|
|
explicit ResourceHandler(QDesignerFormWindowInterface *fw);
|
2010-03-09 17:01:34 +01:00
|
|
|
virtual ~ResourceHandler();
|
|
|
|
|
|
2015-06-02 09:14:40 +02:00
|
|
|
void updateResources() { updateResourcesHelper(false); }
|
|
|
|
|
void updateProjectResources() { updateResourcesHelper(true); }
|
2010-03-09 17:01:34 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void ensureInitialized();
|
2015-06-02 09:14:40 +02:00
|
|
|
void updateResourcesHelper(bool updateProjectResources);
|
|
|
|
|
|
2017-10-16 20:47:05 +02:00
|
|
|
QDesignerFormWindowInterface * const m_form = nullptr;
|
2010-03-09 17:01:34 +01:00
|
|
|
QStringList m_originalUiQrcPaths;
|
2015-06-01 17:00:02 +02:00
|
|
|
bool m_initialized = false;
|
|
|
|
|
bool m_handlingResources = false;
|
2010-03-09 17:01:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Designer
|