Skip to content

Commit

Permalink
Merge pull request #1788 from subutai-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jadilet authored Nov 6, 2018
2 parents eeb5650 + 1025084 commit a1f4b3f
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions commons/src/VagrantProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,44 +68,31 @@ const QString& VagrantProvider::ProviderToVal(PROVIDERS p) {
}

QString VagrantProvider::CurrentVal() {
QString provider = VagrantProvider::ProviderToVal(VagrantProvider::VIRTUALBOX);

if (VagrantProvider::PROVIDER_LAST >= CSettingsManager::Instance().vagrant_provider()) {
provider = VagrantProvider::ProviderToVal(
(VagrantProvider::PROVIDERS)CSettingsManager::Instance().vagrant_provider());
}
QString provider = VagrantProvider::ProviderToVal(VagrantProvider::CurrentProvider());

return provider;
}

QString VagrantProvider::CurrentName() {
QString provider = VagrantProvider::ProviderToName(VagrantProvider::VIRTUALBOX);

if (VagrantProvider::PROVIDER_LAST >= CSettingsManager::Instance().vagrant_provider()) {
provider = VagrantProvider::ProviderToName(
(VagrantProvider::PROVIDERS)CSettingsManager::Instance().vagrant_provider());
}
QString provider = VagrantProvider::ProviderToName(VagrantProvider::CurrentProvider());

return provider;
}

VagrantProvider::PROVIDERS VagrantProvider::CurrentProvider() {
VagrantProvider::PROVIDERS provider = VagrantProvider::VIRTUALBOX;
std::vector<int> providers = VagrantProvider::List(); // list of providers by os

if (VagrantProvider::PROVIDER_LAST >= (int)CSettingsManager::Instance().vagrant_provider()) {
if (VagrantProvider::PROVIDER_LAST >= (int)CSettingsManager::Instance().vagrant_provider() &&
std::find(providers.begin(), providers.end(), (int)CSettingsManager::Instance().vagrant_provider()) != providers.end()) {
provider = (VagrantProvider::PROVIDERS)CSettingsManager::Instance().vagrant_provider();
}

return provider;
}

QString VagrantProvider::CurrentStr() {
QString provider = VagrantProvider::ProviderToStr(VagrantProvider::VIRTUALBOX);

if (VagrantProvider::PROVIDER_LAST >= (int)CSettingsManager::Instance().vagrant_provider()) {
provider = VagrantProvider::ProviderToStr(
(VagrantProvider::PROVIDERS)CSettingsManager::Instance().vagrant_provider());
}
QString provider = VagrantProvider::ProviderToStr(VagrantProvider::CurrentProvider());

return provider;
}
Expand Down

0 comments on commit a1f4b3f

Please sign in to comment.