WIP: API version of packages is checked now.

This commit is contained in:
Matthias Koefferlein 2017-04-22 21:45:49 +02:00
parent 38f60ad3fd
commit 42756a76f6
2 changed files with 22 additions and 4 deletions

View File

@ -17,11 +17,11 @@
<item>
<widget class="QTabWidget" name="mode_tab">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Browse Installed Packages</string>
<string>Installed Packages</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
@ -231,8 +231,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>343</width>
<height>207</height>
<width>537</width>
<height>284</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">

View File

@ -25,6 +25,7 @@
#include "laySaltGrainPropertiesDialog.h"
#include "laySaltDownloadManager.h"
#include "laySalt.h"
#include "layVersion.h"
#include "ui_SaltGrainTemplateSelectionDialog.h"
#include "tlString.h"
#include "tlExceptions.h"
@ -685,6 +686,14 @@ SaltManagerDialog::update_models ()
}
}
// Establish a message indicating whether the API version does not match
for (Salt::flat_iterator g = m_salt_mine.begin_flat (); g != m_salt_mine.end_flat (); ++g) {
if (SaltGrain::compare_versions (lay::Version::version (), (*g)->api_version ()) < 0) {
mine_model->set_message ((*g)->name (), SaltModel::Warning, tl::to_string (tr ("This package requires a newer API (%1)").arg (tl::to_qstring ((*g)->api_version ()))));
mine_model->set_enabled ((*g)->name (), false);
}
}
if (has_warning) {
mode_tab->setTabIcon (1, QIcon (":/warn_16.png"));
} else {
@ -704,6 +713,15 @@ SaltManagerDialog::update_models ()
mine_model->clear_order ();
mine_model->clear_messages ();
mine_model->enable_all ();
// Establish a message indicating whether the API version does not match
for (Salt::flat_iterator g = m_salt_mine.begin_flat (); g != m_salt_mine.end_flat (); ++g) {
if (SaltGrain::compare_versions (lay::Version::version (), (*g)->api_version ()) < 0) {
mine_model->set_message ((*g)->name (), SaltModel::Warning, tl::to_string (tr ("This package requires a newer API (%1)").arg (tl::to_qstring ((*g)->api_version ()))));
mine_model->set_enabled ((*g)->name (), false);
}
}
mine_model->update ();
// select the first grain