mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-29 06:15:24 +00:00
Move icon loader to utility class
This commit is contained in:
parent
25dfbd2698
commit
cabe0059d0
@ -6,8 +6,12 @@
|
||||
#include "mmg-qt/util/file_identifier.h"
|
||||
#include "mmg-qt/util/file_type_filter.h"
|
||||
#include "mmg-qt/util/settings.h"
|
||||
#include "mmg-qt/util/util.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow{parent}
|
||||
@ -15,9 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QIcon icon{":/icons/32x32/mkvmergeGUI.png"};
|
||||
icon.addFile(":/icons/64x64/mkvmergeGUI.png");
|
||||
setWindowIcon(icon);
|
||||
setWindowIcon(Util::loadIcon(Q("mkvmergeGUI.png"), QList<int>{} << 32 << 48 << 64 << 128 << 256));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
|
18
src/mmg-qt/util/util.cpp
Normal file
18
src/mmg-qt/util/util.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "common/common_pch.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include "common/qt.h"
|
||||
#include "mmg-qt/util/util.h"
|
||||
|
||||
QIcon
|
||||
Util::loadIcon(QString const &name,
|
||||
QList<int> const &sizes) {
|
||||
QIcon icon;
|
||||
for (auto size : sizes)
|
||||
icon.addFile(QString{":/icons/%1x%1/%2"}.arg(size).arg(name));
|
||||
|
||||
return icon;
|
||||
}
|
15
src/mmg-qt/util/util.h
Normal file
15
src/mmg-qt/util/util.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef MTX_MMGQT_UTIL_H
|
||||
#define MTX_MMGQT_UTIL_H
|
||||
|
||||
#include "common/common_pch.h"
|
||||
|
||||
class QIcon;
|
||||
class QString;
|
||||
template<typename T> class QList;
|
||||
|
||||
class Util {
|
||||
public:
|
||||
static QIcon loadIcon(QString const &name, QList<int> const &sizes);
|
||||
};
|
||||
|
||||
#endif // MTX_MMGQT_UTIL_H
|
Loading…
Reference in New Issue
Block a user