mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Code style: formatting and refactoring of launcher code
This commit is contained in:
committed by
ArseniyShestakov
parent
d9d5b7b6e5
commit
9da3f48274
@@ -58,12 +58,24 @@ QVariant toVariant(const JsonNode & node)
|
|||||||
{
|
{
|
||||||
switch(node.getType())
|
switch(node.getType())
|
||||||
{
|
{
|
||||||
break; case JsonNode::JsonType::DATA_NULL: return QVariant();
|
break;
|
||||||
break; case JsonNode::JsonType::DATA_BOOL: return QVariant(node.Bool());
|
case JsonNode::JsonType::DATA_NULL:
|
||||||
break; case JsonNode::JsonType::DATA_FLOAT: return QVariant(node.Float());
|
return QVariant();
|
||||||
break; case JsonNode::JsonType::DATA_STRING: return QVariant(QString::fromUtf8(node.String().c_str()));
|
break;
|
||||||
break; case JsonNode::JsonType::DATA_VECTOR: return JsonToList(node.Vector());
|
case JsonNode::JsonType::DATA_BOOL:
|
||||||
break; case JsonNode::JsonType::DATA_STRUCT: return JsonToMap(node.Struct());
|
return QVariant(node.Bool());
|
||||||
|
break;
|
||||||
|
case JsonNode::JsonType::DATA_FLOAT:
|
||||||
|
return QVariant(node.Float());
|
||||||
|
break;
|
||||||
|
case JsonNode::JsonType::DATA_STRING:
|
||||||
|
return QVariant(QString::fromUtf8(node.String().c_str()));
|
||||||
|
break;
|
||||||
|
case JsonNode::JsonType::DATA_VECTOR:
|
||||||
|
return JsonToList(node.Vector());
|
||||||
|
break;
|
||||||
|
case JsonNode::JsonType::DATA_STRUCT:
|
||||||
|
return JsonToMap(node.Struct());
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,8 @@ void MainWindow::load()
|
|||||||
settings.init(true);
|
settings.init(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget * parent) :
|
MainWindow::MainWindow(QWidget * parent)
|
||||||
QMainWindow(parent),
|
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
ui(new Ui::MainWindow)
|
|
||||||
{
|
{
|
||||||
load(); // load FS before UI
|
load(); // load FS before UI
|
||||||
|
|
||||||
@@ -54,9 +53,7 @@ MainWindow::MainWindow(QWidget * parent) :
|
|||||||
auto tab_icon_size = ui->tabSelectList->iconSize();
|
auto tab_icon_size = ui->tabSelectList->iconSize();
|
||||||
if(tab_icon_size.width() < width)
|
if(tab_icon_size.width() < width)
|
||||||
{
|
{
|
||||||
ui->tabSelectList->setIconSize(QSize(
|
ui->tabSelectList->setIconSize(QSize(width, width + tab_icon_size.height() - tab_icon_size.width()));
|
||||||
width,
|
|
||||||
width + tab_icon_size.height() - tab_icon_size.width()));
|
|
||||||
ui->tabSelectList->setGridSize(QSize(width, width));
|
ui->tabSelectList->setGridSize(QSize(width, width));
|
||||||
// 4 is a dirty hack to make it look right
|
// 4 is a dirty hack to make it look right
|
||||||
ui->tabSelectList->setMaximumWidth(width + 4);
|
ui->tabSelectList->setMaximumWidth(width + 4);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,10 +21,12 @@ class QTableWidgetItem;
|
|||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow * ui;
|
Ui::MainWindow * ui;
|
||||||
void load();
|
void load();
|
||||||
void startExecutable(QString name);
|
void startExecutable(QString name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget * parent = 0);
|
explicit MainWindow(QWidget * parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class CDownloadManager: public QObject
|
|||||||
QList<FileEntry> currentDownloads;
|
QList<FileEntry> currentDownloads;
|
||||||
|
|
||||||
FileEntry & getEntry(QNetworkReply * reply);
|
FileEntry & getEntry(QNetworkReply * reply);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDownloadManager();
|
CDownloadManager();
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,8 @@ QString CModEntry::sizeToString(double size)
|
|||||||
return sizes[index].arg(QString::number(size, 'f', 1));
|
return sizes[index].arg(QString::number(size, 'f', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
CModEntry::CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname):
|
CModEntry::CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname)
|
||||||
repository(repository),
|
: repository(repository), localData(localData), modSettings(modSettings), modname(modname)
|
||||||
localData(localData),
|
|
||||||
modSettings(modSettings),
|
|
||||||
modname(modname)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,10 +99,15 @@ bool CModEntry::isInstalled() const
|
|||||||
|
|
||||||
int CModEntry::getModStatus() const
|
int CModEntry::getModStatus() const
|
||||||
{
|
{
|
||||||
return
|
int status = 0;
|
||||||
(isEnabled() ? ModStatus::ENABLED : 0) |
|
if(isEnabled())
|
||||||
(isInstalled() ? ModStatus::INSTALLED : 0) |
|
status |= ModStatus::ENABLED;
|
||||||
(isUpdateable()? ModStatus::UPDATEABLE : 0);
|
if(isInstalled())
|
||||||
|
status |= ModStatus::INSTALLED;
|
||||||
|
if(isUpdateable())
|
||||||
|
status |= ModStatus::UPDATEABLE;
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CModEntry::getName() const
|
QString CModEntry::getName() const
|
||||||
@@ -218,7 +220,9 @@ CModEntry CModList::getMod(QString modname) const
|
|||||||
if(repoVal.isValid())
|
if(repoVal.isValid())
|
||||||
{
|
{
|
||||||
if(repo.empty())
|
if(repo.empty())
|
||||||
|
{
|
||||||
repo = repoVal.toMap();
|
repo = repoVal.toMap();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(CModEntry::compareVersions(repo["version"].toString(), repoVal.toMap()["version"].toString()))
|
if(CModEntry::compareVersions(repo["version"].toString(), repoVal.toMap()["version"].toString()))
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class CModEntry
|
|||||||
QVariantMap modSettings;
|
QVariantMap modSettings;
|
||||||
|
|
||||||
QString modname;
|
QString modname;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname);
|
CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname);
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ class CModList
|
|||||||
QVariantMap modSettings;
|
QVariantMap modSettings;
|
||||||
|
|
||||||
QVariantMap copyField(QVariantMap data, QString from, QString to);
|
QVariantMap copyField(QVariantMap data, QString from, QString to);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void resetRepositories();
|
virtual void resetRepositories();
|
||||||
virtual void addRepository(QVariantMap data);
|
virtual void addRepository(QVariantMap data);
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ namespace ModStatus
|
|||||||
static const QString iconUpdate = "icons:mod-update.png";
|
static const QString iconUpdate = "icons:mod-update.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
CModListModel::CModListModel(QObject *parent) :
|
CModListModel::CModListModel(QObject * parent)
|
||||||
QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,11 +121,16 @@ QVariant CModListModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
switch(role)
|
switch(role)
|
||||||
{
|
{
|
||||||
case Qt::DecorationRole: return getIcon(mod, index.column());
|
case Qt::DecorationRole:
|
||||||
case Qt::DisplayRole: return getText(mod, index.column());
|
return getIcon(mod, index.column());
|
||||||
case Qt::TextAlignmentRole: return getTextAlign(index.column());
|
case Qt::DisplayRole:
|
||||||
case ModRoles::ValueRole: return getValue(mod, index.column());
|
return getText(mod, index.column());
|
||||||
case ModRoles::ModNameRole: return mod.getName();
|
case Qt::TextAlignmentRole:
|
||||||
|
return getTextAlign(index.column());
|
||||||
|
case ModRoles::ValueRole:
|
||||||
|
return getValue(mod, index.column());
|
||||||
|
case ModRoles::ModNameRole:
|
||||||
|
return mod.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -262,11 +267,8 @@ bool CModFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CModFilterModel::CModFilterModel(CModListModel * model, QObject * parent):
|
CModFilterModel::CModFilterModel(CModListModel * model, QObject * parent)
|
||||||
QSortFilterProxyModel(parent),
|
: QSortFilterProxyModel(parent), base(model), filteredType(ModStatus::MASK_NONE), filterMask(ModStatus::MASK_NONE)
|
||||||
base(model),
|
|
||||||
filteredType(ModStatus::MASK_NONE),
|
|
||||||
filterMask(ModStatus::MASK_NONE)
|
|
||||||
{
|
{
|
||||||
setSourceModel(model);
|
setSourceModel(model);
|
||||||
setSortRole(ModRoles::ValueRole);
|
setSortRole(ModRoles::ValueRole);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class CModListModel : public QAbstractItemModel, public CModList
|
|||||||
QVariant getValue(const CModEntry & mod, int field) const;
|
QVariant getValue(const CModEntry & mod, int field) const;
|
||||||
QVariant getText(const CModEntry & mod, int field) const;
|
QVariant getText(const CModEntry & mod, int field) const;
|
||||||
QVariant getIcon(const CModEntry & mod, int field) const;
|
QVariant getIcon(const CModEntry & mod, int field) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModListModel(QObject * parent = 0);
|
explicit CModListModel(QObject * parent = 0);
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ public:
|
|||||||
QModelIndex parent(const QModelIndex & child) const override;
|
QModelIndex parent(const QModelIndex & child) const override;
|
||||||
|
|
||||||
Qt::ItemFlags flags(const QModelIndex & index) const override;
|
Qt::ItemFlags flags(const QModelIndex & index) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -88,6 +90,7 @@ class CModFilterModel : public QSortFilterProxyModel
|
|||||||
bool filterMatchesThis(const QModelIndex & source) const;
|
bool filterMatchesThis(const QModelIndex & source) const;
|
||||||
|
|
||||||
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
|
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setTypeFilter(int filteredType, int filterMask);
|
void setTypeFilter(int filteredType, int filterMask);
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,8 @@ void CModListView::setupModsView()
|
|||||||
this, SLOT(dataChanged(QModelIndex,QModelIndex)));
|
this, SLOT(dataChanged(QModelIndex,QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CModListView::CModListView(QWidget *parent) :
|
CModListView::CModListView(QWidget * parent)
|
||||||
QWidget(parent),
|
: QWidget(parent), settingsListener(settings.listen["launcher"]["repositoryURL"]), ui(new Ui::CModListView)
|
||||||
settingsListener(settings.listen["launcher"]["repositoryURL"]),
|
|
||||||
ui(new Ui::CModListView)
|
|
||||||
{
|
{
|
||||||
settingsListener([&](const JsonNode &){ repositoriesChanged = true; });
|
settingsListener([&](const JsonNode &){ repositoriesChanged = true; });
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -347,12 +345,24 @@ void CModListView::on_comboBox_currentIndexChanged(int index)
|
|||||||
{
|
{
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
break; case 0: filterModel->setTypeFilter(ModStatus::MASK_NONE, ModStatus::MASK_NONE);
|
case 0:
|
||||||
break; case 1: filterModel->setTypeFilter(ModStatus::MASK_NONE, ModStatus::INSTALLED);
|
filterModel->setTypeFilter(ModStatus::MASK_NONE, ModStatus::MASK_NONE);
|
||||||
break; case 2: filterModel->setTypeFilter(ModStatus::INSTALLED, ModStatus::INSTALLED);
|
break;
|
||||||
break; case 3: filterModel->setTypeFilter(ModStatus::UPDATEABLE, ModStatus::UPDATEABLE);
|
case 1:
|
||||||
break; case 4: filterModel->setTypeFilter(ModStatus::ENABLED | ModStatus::INSTALLED, ModStatus::ENABLED | ModStatus::INSTALLED);
|
filterModel->setTypeFilter(ModStatus::MASK_NONE, ModStatus::INSTALLED);
|
||||||
break; case 5: filterModel->setTypeFilter(ModStatus::INSTALLED, ModStatus::ENABLED | ModStatus::INSTALLED);
|
break;
|
||||||
|
case 2:
|
||||||
|
filterModel->setTypeFilter(ModStatus::INSTALLED, ModStatus::INSTALLED);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
filterModel->setTypeFilter(ModStatus::UPDATEABLE, ModStatus::UPDATEABLE);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
filterModel->setTypeFilter(ModStatus::ENABLED | ModStatus::INSTALLED, ModStatus::ENABLED | ModStatus::INSTALLED);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
filterModel->setTypeFilter(ModStatus::INSTALLED, ModStatus::ENABLED | ModStatus::INSTALLED);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,10 +390,12 @@ QStringList CModListView::findBlockingMods(QString mod)
|
|||||||
{
|
{
|
||||||
// one of enabled mods have requirement (or this mod) marked as conflict
|
// one of enabled mods have requirement (or this mod) marked as conflict
|
||||||
for(auto conflict : mod.getValue("conflicts").toStringList())
|
for(auto conflict : mod.getValue("conflicts").toStringList())
|
||||||
|
{
|
||||||
if(required.contains(conflict))
|
if(required.contains(conflict))
|
||||||
ret.push_back(name);
|
ret.push_back(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -398,10 +410,12 @@ QStringList CModListView::findDependentMods(QString mod, bool excludeDisabled)
|
|||||||
if(!current.isInstalled())
|
if(!current.isInstalled())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (current.getValue("depends").toStringList().contains(mod) &&
|
if(current.getValue("depends").toStringList().contains(mod))
|
||||||
!(current.isDisabled() && excludeDisabled))
|
{
|
||||||
|
if(!(current.isDisabled() && excludeDisabled))
|
||||||
ret += modName;
|
ret += modName;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,8 +427,10 @@ void CModListView::on_enableButton_clicked()
|
|||||||
assert(findInvalidDependencies(modName).empty());
|
assert(findInvalidDependencies(modName).empty());
|
||||||
|
|
||||||
for(auto & name : modModel->getRequirements(modName))
|
for(auto & name : modModel->getRequirements(modName))
|
||||||
|
{
|
||||||
if(modModel->getMod(name).isDisabled())
|
if(modModel->getMod(name).isDisabled())
|
||||||
manager->enableMod(name);
|
manager->enableMod(name);
|
||||||
|
}
|
||||||
checkManagerErrors();
|
checkManagerErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,8 +438,7 @@ void CModListView::on_disableButton_clicked()
|
|||||||
{
|
{
|
||||||
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
||||||
|
|
||||||
if (modModel->hasMod(modName) &&
|
if(modModel->hasMod(modName) && modModel->getMod(modName).isEnabled())
|
||||||
modModel->getMod(modName).isEnabled())
|
|
||||||
manager->disableMod(modName);
|
manager->disableMod(modName);
|
||||||
|
|
||||||
checkManagerErrors();
|
checkManagerErrors();
|
||||||
@@ -449,8 +464,7 @@ void CModListView::on_uninstallButton_clicked()
|
|||||||
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
||||||
// NOTE: perhaps add "manually installed" flag and uninstall those dependencies that don't have it?
|
// NOTE: perhaps add "manually installed" flag and uninstall those dependencies that don't have it?
|
||||||
|
|
||||||
if (modModel->hasMod(modName) &&
|
if(modModel->hasMod(modName) && modModel->getMod(modName).isInstalled())
|
||||||
modModel->getMod(modName).isInstalled())
|
|
||||||
{
|
{
|
||||||
if(modModel->getMod(modName).isEnabled())
|
if(modModel->getMod(modName).isEnabled())
|
||||||
manager->disableMod(modName);
|
manager->disableMod(modName);
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
#include "../StdInc.h"
|
#include "../StdInc.h"
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class CModListView;
|
class CModListView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ class CModListView : public QWidget
|
|||||||
|
|
||||||
QString genChangelogText(CModEntry & mod);
|
QString genChangelogText(CModEntry & mod);
|
||||||
QString genModInfoText(CModEntry & mod);
|
QString genModInfoText(CModEntry & mod);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModListView(QWidget * parent = 0);
|
explicit CModListView(QWidget * parent = 0);
|
||||||
~CModListView();
|
~CModListView();
|
||||||
|
|||||||
@@ -34,13 +34,15 @@ static QString detectModArchive(QString path, QString modName)
|
|||||||
modDirName = filename.section('/', 0, 0);
|
modDirName = filename.section('/', 0, 0);
|
||||||
}
|
}
|
||||||
else // all files must be in <modname> directory
|
else // all files must be in <modname> directory
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return modDirName;
|
return modDirName;
|
||||||
}
|
}
|
||||||
|
|
||||||
CModManager::CModManager(CModList * modList):
|
CModManager::CModManager(CModList * modList)
|
||||||
modList(modList)
|
: modList(modList)
|
||||||
{
|
{
|
||||||
loadMods();
|
loadMods();
|
||||||
loadModSettings();
|
loadModSettings();
|
||||||
@@ -178,8 +180,8 @@ bool CModManager::canEnableMod(QString modname)
|
|||||||
|
|
||||||
for(auto modEntry : mod.getValue("conflicts").toStringList())
|
for(auto modEntry : mod.getValue("conflicts").toStringList())
|
||||||
{
|
{
|
||||||
if (modList->hasMod(modEntry) &&
|
// check if conflicting mod installed and enabled
|
||||||
modList->getMod(modEntry).isEnabled()) // conflicting mod installed and enabled
|
if(modList->hasMod(modEntry) && modList->getMod(modEntry).isEnabled())
|
||||||
return addError(modname, QString("This mod conflicts with %1").arg(modEntry));
|
return addError(modname, QString("This mod conflicts with %1").arg(modEntry));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -199,8 +201,7 @@ bool CModManager::canDisableMod(QString modname)
|
|||||||
{
|
{
|
||||||
auto current = modList->getMod(modEntry);
|
auto current = modList->getMod(modEntry);
|
||||||
|
|
||||||
if (current.getValue("depends").toStringList().contains(modname) &&
|
if(current.getValue("depends").toStringList().contains(modname) && current.isEnabled())
|
||||||
current.isEnabled())
|
|
||||||
return addError(modname, QString("This mod is needed to run %1").arg(modEntry));
|
return addError(modname, QString("This mod is needed to run %1").arg(modEntry));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class CModManager
|
|||||||
QStringList recentErrors;
|
QStringList recentErrors;
|
||||||
bool addError(QString modname, QString message);
|
bool addError(QString modname, QString message);
|
||||||
bool removeModDir(QString mod);
|
bool removeModDir(QString mod);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CModManager(CModList * modList);
|
CModManager(CModList * modList);
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
#include "imageviewer_moc.h"
|
#include "imageviewer_moc.h"
|
||||||
#include "ui_imageviewer_moc.h"
|
#include "ui_imageviewer_moc.h"
|
||||||
|
|
||||||
ImageViewer::ImageViewer(QWidget *parent) :
|
ImageViewer::ImageViewer(QWidget * parent)
|
||||||
QDialog(parent),
|
: QDialog(parent), ui(new Ui::ImageViewer)
|
||||||
ui(new Ui::ImageViewer)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ImageViewer;
|
class ImageViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,12 +28,12 @@ public:
|
|||||||
void setPixmap(QPixmap & pixmap);
|
void setPixmap(QPixmap & pixmap);
|
||||||
|
|
||||||
static void showPixmap(QPixmap & pixmap, QWidget * parent = 0);
|
static void showPixmap(QPixmap & pixmap, QWidget * parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent * event) override;
|
void mousePressEvent(QMouseEvent * event) override;
|
||||||
void keyPressEvent(QKeyEvent * event) override;
|
void keyPressEvent(QKeyEvent * event) override;
|
||||||
QSize calculateWindowSize();
|
QSize calculateWindowSize();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ImageViewer * ui;
|
Ui::ImageViewer * ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -97,9 +97,8 @@ void CSettingsView::loadSettings()
|
|||||||
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
|
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingsView::CSettingsView(QWidget *parent) :
|
CSettingsView::CSettingsView(QWidget * parent)
|
||||||
QWidget(parent),
|
: QWidget(parent), ui(new Ui::CSettingsView)
|
||||||
ui(new Ui::CSettingsView)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../StdInc.h"
|
#include "../StdInc.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class CSettingsView;
|
class CSettingsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CSettingsView : public QWidget
|
class CSettingsView : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CSettingsView(QWidget * parent = 0);
|
explicit CSettingsView(QWidget * parent = 0);
|
||||||
~CSettingsView();
|
~CSettingsView();
|
||||||
|
|||||||
Reference in New Issue
Block a user