Skip to content

Commit

Permalink
GUI: Move resource info panel into its own class/form
Browse files Browse the repository at this point in the history
  • Loading branch information
fdde authored and DrMcCoy committed Dec 29, 2017
1 parent da07fd3 commit dd9a20e
Show file tree
Hide file tree
Showing 23 changed files with 769 additions and 685 deletions.
22 changes: 22 additions & 0 deletions src/aurora/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

#include <algorithm>

#include <QFileInfo>
#include <QString>

#include "src/common/util.h"
#include "src/common/ustring.h"
#include "src/common/filepath.h"
Expand Down Expand Up @@ -392,6 +395,21 @@ FileType FileTypeManager::getFileType(const Common::UString &path) {
return kFileTypeNone;
}

FileType FileTypeManager::getFileType(const QString &path) {
buildExtensionLookup();

QString ext = QFileInfo(path).completeSuffix();

ExtensionLookup::const_iterator t = _extensionLookup.find(
Common::UString(
QString(ext).prepend(".").toStdString()
));
if (t != _extensionLookup.end())
return t->second->type;

return kFileTypeNone;
}

Common::UString FileTypeManager::addFileType(const Common::UString &path, FileType type) {
return setFileType(path + ".", type);
}
Expand Down Expand Up @@ -478,6 +496,10 @@ ResourceType FileTypeManager::getResourceType(const Common::UString &path) {
return getResourceType(getFileType(path));
}

ResourceType FileTypeManager::getResourceType(const QString &path) {
return getResourceType(getFileType(path));
}

ResourceType FileTypeManager::getResourceType(Common::HashAlgo algo, uint64 hashedExtension) {
return getResourceType(getFileType(algo, hashedExtension));
}
Expand Down
7 changes: 6 additions & 1 deletion src/aurora/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class FileTypeManager : public Common::Singleton<FileTypeManager> {
/** Return the file type of a file name, detected by its extension. */
FileType getFileType(const Common::UString &path);

/** QString variant */
FileType getFileType(const QString &path);

/** Return the file type of a file name, detected by its hashed extension. */
FileType getFileType(Common::HashAlgo algo, uint64 hashedExtension);

Expand All @@ -65,7 +68,9 @@ class FileTypeManager : public Common::Singleton<FileTypeManager> {
/** Return the resource type of a file type. */
ResourceType getResourceType(FileType type);
/** Return the resource type of a file name, detected by its extension. */
ResourceType getResourceType(const Common::UString &path);
ResourceType getResourceType(const Common::UString &path);
/** QString variant. */
ResourceType getResourceType(const QString &path);
/** Return the resource type of a file name, detected by its hashed extension. */
ResourceType getResourceType(Common::HashAlgo algo, uint64 hashedExtension);

Expand Down

0 comments on commit dd9a20e

Please sign in to comment.