NOISSUE fix a bunch of warnings thrown by Qt internals

Badly connected signals/slots and similar things.
This commit is contained in:
Petr Mrázek 2017-12-14 00:29:00 +01:00
parent ef2cbe16e6
commit f18afd3d1e
8 changed files with 27 additions and 20 deletions

View File

@ -205,6 +205,10 @@ void VersionList::merge(const BaseEntity::Ptr &other)
// TODO: do not reset the whole model. maybe? // TODO: do not reset the whole model. maybe?
beginResetModel(); beginResetModel();
m_versions.clear(); m_versions.clear();
if(list->m_versions.isEmpty())
{
qWarning() << "Empty list loaded ...";
}
for (const VersionPtr &version : list->m_versions) for (const VersionPtr &version : list->m_versions)
{ {
// we already have the version. merge the contents // we already have the version. merge the contents

View File

@ -744,23 +744,23 @@ bool ComponentList::revertToBase(int index)
return true; return true;
} }
ComponentPtr ComponentList::getComponent(const QString &id) Component * ComponentList::getComponent(const QString &id)
{ {
auto iter = d->componentIndex.find(id); auto iter = d->componentIndex.find(id);
if (iter == d->componentIndex.end()) if (iter == d->componentIndex.end())
{ {
return nullptr; return nullptr;
} }
return *iter; return (*iter).get();
} }
ComponentPtr ComponentList::getComponent(int index) Component * ComponentList::getComponent(int index)
{ {
if(index < 0 || index >= d->components.size()) if(index < 0 || index >= d->components.size())
{ {
return nullptr; return nullptr;
} }
return d->components[index]; return d->components[index].get();
} }
bool ComponentList::isVanilla() bool ComponentList::isVanilla()

View File

@ -110,10 +110,10 @@ public:
public: public:
/// get the profile component by id /// get the profile component by id
ComponentPtr getComponent(const QString &id); Component * getComponent(const QString &id);
/// get the profile component by index /// get the profile component by index
ComponentPtr getComponent(int index); Component * getComponent(int index);
private: private:
void scheduleSave(); void scheduleSave();

View File

@ -779,6 +779,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
{ {
bool updatesAllowed = MMC->updatesAreAllowed(); bool updatesAllowed = MMC->updatesAreAllowed();
updatesAllowedChanged(updatesAllowed); updatesAllowedChanged(updatesAllowed);
connect(ui->actionCheckUpdate, &QAction::triggered, this, &MainWindow::checkForUpdates);
// set up the updater object. // set up the updater object.
auto updater = MMC->updateChecker(); auto updater = MMC->updateChecker();
connect(updater.get(), &UpdateChecker::updateAvailable, this, &MainWindow::updateAvailable); connect(updater.get(), &UpdateChecker::updateAvailable, this, &MainWindow::updateAvailable);
@ -868,7 +871,7 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
QVariantMap data; QVariantMap data;
data["group"] = group; data["group"] = group;
actionDeleteGroup->setData(data); actionDeleteGroup->setData(data);
connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(on_actionDeleteGroup_triggered())); connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup()));
actions.append(actionDeleteGroup); actions.append(actionDeleteGroup);
} }
} }
@ -1080,7 +1083,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
on_actionDeleteInstance_triggered(); on_actionDeleteInstance_triggered();
return true; return true;
case Qt::Key_F5: case Qt::Key_F5:
on_actionRefresh_triggered(); refreshInstances();
return true; return true;
case Qt::Key_F2: case Qt::Key_F2:
on_actionRenameInstance_triggered(); on_actionRenameInstance_triggered();
@ -1450,7 +1453,7 @@ void MainWindow::on_actionChangeInstGroup_triggered()
m_selectedInstance->setGroupPost(name); m_selectedInstance->setGroupPost(name);
} }
void MainWindow::on_actionDeleteGroup_triggered() void MainWindow::deleteGroup()
{ {
QObject* obj = sender(); QObject* obj = sender();
if(!obj) if(!obj)
@ -1474,7 +1477,7 @@ void MainWindow::on_actionViewInstanceFolder_triggered()
DesktopServices::openDirectory(str); DesktopServices::openDirectory(str);
} }
void MainWindow::on_actionRefresh_triggered() void MainWindow::refreshInstances()
{ {
MMC->instances()->loadList(true); MMC->instances()->loadList(true);
} }
@ -1493,7 +1496,7 @@ void MainWindow::on_actionConfig_Folder_triggered()
} }
} }
void MainWindow::on_actionCheckUpdate_triggered() void MainWindow::checkForUpdates()
{ {
if(BuildConfig.UPDATER_ENABLED) if(BuildConfig.UPDATER_ENABLED)
{ {

View File

@ -85,11 +85,11 @@ private slots:
void on_actionViewSelectedInstFolder_triggered(); void on_actionViewSelectedInstFolder_triggered();
void on_actionRefresh_triggered(); void refreshInstances();
void on_actionViewCentralModsFolder_triggered(); void on_actionViewCentralModsFolder_triggered();
void on_actionCheckUpdate_triggered(); void checkForUpdates();
void on_actionSettings_triggered(); void on_actionSettings_triggered();
@ -113,7 +113,7 @@ private slots:
void on_actionDeleteInstance_triggered(); void on_actionDeleteInstance_triggered();
void on_actionDeleteGroup_triggered(); void deleteGroup();
void on_actionExportInstance_triggered(); void on_actionExportInstance_triggered();

View File

@ -141,9 +141,9 @@ LogPage::LogPage(InstancePtr instance, QWidget *parent)
auto launchTask = m_instance->getLaunchTask(); auto launchTask = m_instance->getLaunchTask();
if(launchTask) if(launchTask)
{ {
on_InstanceLaunchTask_changed(launchTask); onInstanceLaunchTaskChanged(launchTask);
} }
connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::on_InstanceLaunchTask_changed); connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::onInstanceLaunchTaskChanged);
} }
ui->text->setWordWrap(true); ui->text->setWordWrap(true);
@ -162,7 +162,7 @@ LogPage::~LogPage()
delete ui; delete ui;
} }
void LogPage::on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc) void LogPage::onInstanceLaunchTaskChanged(std::shared_ptr<LaunchTask> proc)
{ {
m_process = proc; m_process = proc;
if(m_process) if(m_process)

View File

@ -69,7 +69,7 @@ private slots:
void findNextActivated(); void findNextActivated();
void findPreviousActivated(); void findPreviousActivated();
void on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc); void onInstanceLaunchTaskChanged(std::shared_ptr<LaunchTask> proc);
private: private:
Ui::LogPage *ui; Ui::LogPage *ui;

View File

@ -9,7 +9,7 @@ SystemTheme::SystemTheme()
const auto & style = QApplication::style(); const auto & style = QApplication::style();
systemPalette = style->standardPalette(); systemPalette = style->standardPalette();
QString lowerThemeName = style->objectName(); QString lowerThemeName = style->objectName();
qWarning() << systemTheme; qDebug() << systemTheme;
QStringList styles = QStyleFactory::keys(); QStringList styles = QStyleFactory::keys();
for(auto &st: styles) for(auto &st: styles)
{ {
@ -21,7 +21,7 @@ SystemTheme::SystemTheme()
} }
// fall back to fusion if we can't find the current theme. // fall back to fusion if we can't find the current theme.
systemTheme = "Fusion"; systemTheme = "Fusion";
qWarning() << "System theme not found, defaulted to Fusion"; qDebug() << "System theme not found, defaulted to Fusion";
} }
void SystemTheme::apply(bool initial) void SystemTheme::apply(bool initial)