Skip to content

Commit

Permalink
Merge 22e8c9c into dd6a04a
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 20, 2018
2 parents dd6a04a + 22e8c9c commit 467ea04
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
39 changes: 39 additions & 0 deletions src/plugins/miscellaneous/Core/src/corecliutils.cpp
Expand Up @@ -887,6 +887,45 @@ QByteArray serialiseDomDocument(const QDomDocument &pDomDocument)

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces,
bool pCheckMimeTypes, const QString &pMimeType)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces, using the given MIME types, if any

QStringList res = QStringList();

foreach (FileTypeInterface *fileTypeInterface, pFileTypeInterfaces) {
if (!pCheckMimeTypes || !pMimeType.compare(fileTypeInterface->mimeType()))
res << fileTypeInterface->fileTypeDescription()+" (*."+fileTypeInterface->fileExtension()+")";
}

return res;
}

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces

return filters(pFileTypeInterfaces, false, QString());
}

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces,
const QString &pMimeType)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces, using the given MIME types

return filters(pFileTypeInterfaces, true, pMimeType);
}

//==============================================================================

} // namespace Core
} // namespace OpenCOR

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/miscellaneous/Core/src/corecliutils.h
Expand Up @@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

#include "coreglobal.h"
#include "filetypeinterface.h"
#include "plugin.h"
#include "plugininfo.h"

Expand Down Expand Up @@ -163,6 +164,10 @@ bool CORE_EXPORT validXmlFile(const QString &pXmlFileName,

QByteArray CORE_EXPORT serialiseDomDocument(const QDomDocument &pDomDocument);

QStringList CORE_EXPORT filters(const FileTypeInterfaces &pFileTypeInterfaces);
QStringList CORE_EXPORT filters(const FileTypeInterfaces &pFileTypeInterfaces,
const QString &pMimeType);

//==============================================================================

} // namespace Core
Expand Down
41 changes: 1 addition & 40 deletions src/plugins/miscellaneous/Core/src/coreguiutils.cpp
Expand Up @@ -659,7 +659,7 @@ QIcon overlayedIcon(const QIcon &pBaseIcon, const QIcon &pOverlayIcon,
{
// Create and return an overlayed icon using the given base and overlay
// icons
// Note: there is a bug in QIcon::pixmap() when it comes to HiDPI screens
// Note: there is a bug in QIcon::pixmap() when it comes to HiDPI screens
// (see https://bugreports.qt.io/browse/QTBUG-71333), hence we need to
// scale things...

Expand Down Expand Up @@ -778,45 +778,6 @@ QColor lockedColor(const QColor &pColor)

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces,
bool pCheckMimeTypes, const QString &pMimeType)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces, using the given MIME types, if any

QStringList res = QStringList();

foreach (FileTypeInterface *fileTypeInterface, pFileTypeInterfaces) {
if (!pCheckMimeTypes || !pMimeType.compare(fileTypeInterface->mimeType()))
res << fileTypeInterface->fileTypeDescription()+" (*."+fileTypeInterface->fileExtension()+")";
}

return res;
}

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces

return filters(pFileTypeInterfaces, false, QString());
}

//==============================================================================

QStringList filters(const FileTypeInterfaces &pFileTypeInterfaces,
const QString &pMimeType)
{
// Convert and return as a list of strings the filters corresponding to the
// given file type interfaces, using the given MIME types

return filters(pFileTypeInterfaces, true, pMimeType);
}

//==============================================================================

bool opencorActive()
{
// Return whether OpenCOR is active
Expand Down
5 changes: 0 additions & 5 deletions src/plugins/miscellaneous/Core/src/coreguiutils.h
Expand Up @@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

#include "coreglobal.h"
#include "filetypeinterface.h"

//==============================================================================

Expand Down Expand Up @@ -208,10 +207,6 @@ void CORE_EXPORT showEnableWidget(QWidget *pWidget, bool pVisible,

QColor CORE_EXPORT lockedColor(const QColor &pColor);

QStringList CORE_EXPORT filters(const FileTypeInterfaces &pFileTypeInterfaces);
QStringList CORE_EXPORT filters(const FileTypeInterfaces &pFileTypeInterfaces,
const QString &pMimeType);

bool CORE_EXPORT opencorActive();

//==============================================================================
Expand Down

0 comments on commit 467ea04

Please sign in to comment.