aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-07-29 12:44:42 +0200
committerRoland Knall <rknall@gmail.com>2019-07-29 11:07:15 +0000
commitc37cabe900b9b11e12c8626ca46adc080e465fdb (patch)
tree742b3ee549c9007d69aadf6e4f1c13f0d6a1cfc9 /ui/qt
parenta5d2c5e44cc5abdffaa27b97b92858b7f5f23542 (diff)
Qt: Rename profile global to system
It's called system profiles in UI so update function names and variables to use the same name. This will increase code readability. Change-Id: I048e9ea85bd6ebab4a2c3ed1c685487ac8f7e40e Reviewed-on: https://code.wireshark.org/review/34116 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/main_status_bar.cpp6
-rw-r--r--ui/qt/models/profile_model.cpp64
-rw-r--r--ui/qt/models/profile_model.h4
-rw-r--r--ui/qt/profile_dialog.cpp8
-rw-r--r--ui/qt/widgets/copy_from_profile_menu.cpp4
5 files changed, 43 insertions, 43 deletions
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index 0933ce44b5..4c2f9cfe42 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -553,7 +553,7 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
{
pa = profile_menu_.addAction(name);
}
- else if ( idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ else if ( idx.data(ProfileModel::DATA_IS_SYSTEM).toBool() )
{
/* Check if this profile does not exist as user */
if ( cnt == model.findByName(name) )
@@ -571,7 +571,7 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
pa->setFont(idx.data(Qt::FontRole).value<QFont>());
pa->setProperty("profile_name", idx.data());
- pa->setProperty("profile_is_global", idx.data(ProfileModel::DATA_IS_GLOBAL));
+ pa->setProperty("profile_is_system", idx.data(ProfileModel::DATA_IS_SYSTEM));
connect(pa, &QAction::triggered, this, &MainStatusBar::switchToProfile);
}
@@ -587,7 +587,7 @@ void MainStatusBar::showProfileMenu(const QPoint &global_pos, Qt::MouseButton bu
bool enable_edit = false;
QModelIndex idx = model.activeProfile();
- if ( ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() && ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ if ( ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() && ! idx.data(ProfileModel::DATA_IS_SYSTEM).toBool() )
enable_edit = true;
profile_menu_.setTitle(tr("Switch to"));
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp
index d06cabbfb1..6e9d525389 100644
--- a/ui/qt/models/profile_model.cpp
+++ b/ui/qt/models/profile_model.cpp
@@ -44,19 +44,19 @@ bool ProfileSortModel::lessThan(const QModelIndex &source_left, const QModelInde
if ( source_right.column() != ProfileModel::COL_NAME )
right = source_right.sibling(source_right.row(), ProfileModel::COL_NAME);
- bool igL = left.data(ProfileModel::DATA_IS_GLOBAL).toBool();
- bool igR = right.data(ProfileModel::DATA_IS_GLOBAL).toBool();
+ bool isL = left.data(ProfileModel::DATA_IS_SYSTEM).toBool();
+ bool isR = right.data(ProfileModel::DATA_IS_SYSTEM).toBool();
if (left.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_DEFAULT)
- igL = true;
+ isL = true;
if (right.data(ProfileModel::DATA_STATUS).toInt() == PROF_STAT_DEFAULT)
- igR = true;
+ isR = true;
- if ( igL && ! igR )
+ if ( isL && ! isR )
return true;
- else if ( ! igL && igR )
+ else if ( ! isL && isR )
return false;
- else if ( igL && igR )
+ else if ( isL && isR )
{
if (left.data(ProfileModel::DATA_STATUS) == PROF_STAT_DEFAULT)
return true;
@@ -87,10 +87,10 @@ bool ProfileSortModel::filterAcceptsRow(int source_row, const QModelIndex &) con
if ( ft_ != ProfileSortModel::AllProfiles )
{
- bool gl = idx.data(ProfileModel::DATA_IS_GLOBAL).toBool();
+ bool gl = idx.data(ProfileModel::DATA_IS_SYSTEM).toBool();
if ( ft_ == ProfileSortModel::UserProfiles && gl )
accept = false;
- else if ( ft_ == ProfileSortModel::GlobalProfiles && ! gl )
+ else if ( ft_ == ProfileSortModel::SystemProfiles && ! gl )
accept = false;
}
@@ -141,7 +141,7 @@ GList * ProfileModel::entry(profile_def *ref) const
GList *fl_entry = edited_profile_list();
while (fl_entry && fl_entry->data) {
profile_def *profile = reinterpret_cast<profile_def *>(fl_entry->data);
- if (strcmp(ref->name, profile->name) == 0 && ref->is_global == profile->is_global)
+ if (strcmp(ref->name, profile->name) == 0 && ref->is_system == profile->is_system)
{
if ( ( ref->reference == Q_NULLPTR && profile->reference == Q_NULLPTR )
|| ( ( ref->reference != Q_NULLPTR && profile->reference != Q_NULLPTR )
@@ -223,7 +223,7 @@ QVariant ProfileModel::dataDisplay(const QModelIndex &index) const
case COL_TYPE:
if ( prof->status == PROF_STAT_DEFAULT )
return tr("Default");
- else if ( prof->is_global )
+ else if ( prof->is_system )
return tr("System");
else
return tr("User");
@@ -245,10 +245,10 @@ QVariant ProfileModel::dataFontRole(const QModelIndex &index) const
QFont font;
- if ( prof->is_global )
+ if ( prof->is_system )
font.setItalic(true);
- if ( set_profile_.compare(prof->name) == 0 && ! prof->is_global )
+ if ( set_profile_.compare(prof->name) == 0 && ! prof->is_system )
font.setBold(true);
if ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
@@ -272,7 +272,7 @@ QVariant ProfileModel::dataBackgroundRole(const QModelIndex &index) const
if ( prof->status == PROF_STAT_DEFAULT && reset_default_ )
return ColorUtils::fromColorT(&prefs.gui_text_deprecated);
- QList<int> rows = const_cast<ProfileModel *>(this)->findAllByNameAndVisibility(QString(prof->name), prof->is_global);
+ QList<int> rows = const_cast<ProfileModel *>(this)->findAllByNameAndVisibility(QString(prof->name), prof->is_system);
if ( rows.count() > 1 )
return ColorUtils::fromColorT(&prefs.gui_text_invalid);
@@ -290,7 +290,7 @@ QVariant ProfileModel::dataToolTipRole(const QModelIndex &idx) const
QString msg;
- if (prof->is_global)
+ if (prof->is_system)
return tr("This is a system provided profile.");
else
return dataPath(idx);
@@ -314,7 +314,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
return tr("Resetting to default");
case PROF_STAT_EXISTS:
{
- QString profile_path = prof->is_global ? get_global_profiles_dir() : get_profiles_dir();
+ QString profile_path = prof->is_system ? get_system_profiles_dir() : get_profiles_dir();
profile_path.append(QDir::separator()).append(prof->name);
return profile_path;
}
@@ -339,7 +339,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const
{
QString msg = QString("%1 %2").arg(tr("Copied from: ")).arg(prof->reference);
- if ( profile_exists(prof->reference, TRUE) && prof->from_global )
+ if ( profile_exists(prof->reference, TRUE) && prof->from_system )
msg.append(QString(" (%1)").arg(tr("system provided")));
else
{
@@ -386,15 +386,15 @@ QVariant ProfileModel::data(const QModelIndex &index, int role) const
return qVariantFromValue(prof->status);
case ProfileModel::DATA_IS_DEFAULT:
return qVariantFromValue(prof->status == PROF_STAT_DEFAULT);
- case ProfileModel::DATA_IS_GLOBAL:
- return qVariantFromValue(prof->is_global);
+ case ProfileModel::DATA_IS_SYSTEM:
+ return qVariantFromValue(prof->is_system);
case ProfileModel::DATA_IS_SELECTED:
{
QModelIndex selected = activeProfile();
if ( selected.isValid() && selected.row() < profiles_.count() )
{
profile_def * selprof = guard(selected.row());
- if ( selprof && selprof->is_global != prof->is_global )
+ if ( selprof && selprof->is_system != prof->is_system )
return qVariantFromValue(false);
if ( selprof && strcmp(selprof->name, prof->name) == 0 )
@@ -451,7 +451,7 @@ Qt::ItemFlags ProfileModel::flags(const QModelIndex &index) const
if ( ! prof )
return fl;
- if ( index.column() == ProfileModel::COL_NAME && prof->status != PROF_STAT_DEFAULT && ! prof->is_global )
+ if ( index.column() == ProfileModel::COL_NAME && prof->status != PROF_STAT_DEFAULT && ! prof->is_system )
fl |= Qt::ItemIsEditable;
return fl;
@@ -466,20 +466,20 @@ int ProfileModel::findByName(QString name)
return row;
}
-int ProfileModel::findByNameAndVisibility(QString name, bool isGlobal)
+int ProfileModel::findByNameAndVisibility(QString name, bool isSystem)
{
- QList<int> result = findAllByNameAndVisibility(name, isGlobal);
+ QList<int> result = findAllByNameAndVisibility(name, isSystem);
return result.count() == 0 ? -1 : result.at(0);
}
-QList<int> ProfileModel::findAllByNameAndVisibility(QString name, bool isGlobal)
+QList<int> ProfileModel::findAllByNameAndVisibility(QString name, bool isSystem)
{
QList<int> result;
for ( int cnt = 0; cnt < profiles_.count(); cnt++ )
{
profile_def * prof = guard(cnt);
- if ( prof && static_cast<bool>(prof->is_global) == isGlobal && name.compare(prof->name) == 0 )
+ if ( prof && static_cast<bool>(prof->is_system) == isSystem && name.compare(prof->name) == 0 )
result << cnt;
}
@@ -513,11 +513,11 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx)
return QModelIndex();
QString parent = prof->name;
- if ( ! prof->is_global && prof->status != PROF_STAT_CHANGED && prof->status != PROF_STAT_NEW )
+ if ( ! prof->is_system && prof->status != PROF_STAT_CHANGED && prof->status != PROF_STAT_NEW )
parent = get_profile_parent (prof->name);
QString new_name;
- if (prof->is_global && ! profile_exists (parent.toUtf8().constData(), FALSE))
+ if (prof->is_system && ! profile_exists (parent.toUtf8().constData(), FALSE))
new_name = QString(prof->name);
else
new_name = QString("%1 (%2)").arg(parent).arg(tr("copy", "noun"));
@@ -535,10 +535,10 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx)
new_name = copyName;
}
- if ( new_name.compare(QString(new_name.toUtf8().constData())) != 0 && !prof->is_global )
+ if ( new_name.compare(QString(new_name.toUtf8().constData())) != 0 && !prof->is_system )
return QModelIndex();
- add_to_profile_list(new_name.toUtf8().constData(), parent.toUtf8().constData(), PROF_STAT_COPY, FALSE, prof->from_global);
+ add_to_profile_list(new_name.toUtf8().constData(), parent.toUtf8().constData(), PROF_STAT_COPY, FALSE, prof->from_system);
loadProfiles();
int row = findByNameAndVisibility(new_name, false);
@@ -557,7 +557,7 @@ void ProfileModel::deleteEntry(QModelIndex idx)
if ( ! prof )
return;
- if ( prof->is_global )
+ if ( prof->is_system )
return;
if ( prof->status == PROF_STAT_DEFAULT )
@@ -597,7 +597,7 @@ QModelIndex ProfileModel::activeProfile() const
if ( row >= 0 )
{
profile_def * prof = profiles_.at(row);
- if ( prof->is_global )
+ if ( prof->is_system )
return QModelIndex();
return index(row, ProfileModel::COL_NAME);
@@ -707,7 +707,7 @@ QStringList ProfileModel::exportFileList(QModelIndexList items)
foreach(QModelIndex idx, items)
{
profile_def * prof = guard(idx.row());
- if ( prof->is_global || QString(prof->name).compare(DEFAULT_PROFILE) == 0 )
+ if ( prof->is_system || QString(prof->name).compare(DEFAULT_PROFILE) == 0 )
continue;
if ( ! idx.data(ProfileModel::DATA_PATH_IS_NOT_DESCRIPTION).toBool() )
diff --git a/ui/qt/models/profile_model.h b/ui/qt/models/profile_model.h
index a095211292..266eff84d2 100644
--- a/ui/qt/models/profile_model.h
+++ b/ui/qt/models/profile_model.h
@@ -30,7 +30,7 @@ public:
enum FilterType {
AllProfiles = 0,
- GlobalProfiles,
+ SystemProfiles,
UserProfiles
};
@@ -63,7 +63,7 @@ public:
enum {
DATA_STATUS = Qt::UserRole,
DATA_IS_DEFAULT,
- DATA_IS_GLOBAL,
+ DATA_IS_SYSTEM,
DATA_IS_SELECTED,
DATA_PATH,
DATA_PATH_IS_NOT_DESCRIPTION
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index cab42bb3be..f7355e283e 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -210,7 +210,7 @@ void ProfileDialog::updateWidgets()
index = index.sibling(index.row(), ProfileModel::COL_NAME);
if (index.isValid()) {
- if ( !index.data(ProfileModel::DATA_IS_GLOBAL).toBool() || ! model_->resetDefault())
+ if ( !index.data(ProfileModel::DATA_IS_SYSTEM).toBool() || ! model_->resetDefault())
enable_del = true;
}
@@ -229,11 +229,11 @@ void ProfileDialog::updateWidgets()
if ( idx != index && idx.data().toString().compare(index.data().toString()) == 0 )
{
- if (idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() == index.data(ProfileModel::DATA_IS_GLOBAL).toBool())
+ if (idx.data(ProfileModel::DATA_IS_SYSTEM).toBool() == index.data(ProfileModel::DATA_IS_SYSTEM).toBool())
enable_ok = false;
}
- QList<int> rows = model_->findAllByNameAndVisibility(name, idx.data(ProfileModel::DATA_IS_GLOBAL).toBool());
+ QList<int> rows = model_->findAllByNameAndVisibility(name, idx.data(ProfileModel::DATA_IS_SYSTEM).toBool());
if ( rows.count() > 1 )
enable_ok = false;
}
@@ -419,7 +419,7 @@ void ProfileDialog::exportProfiles(bool exportAll)
for ( int cnt = 0; cnt < sort_model_->rowCount(); cnt++ )
{
QModelIndex idx = sort_model_->index(cnt, ProfileModel::COL_NAME);
- if ( ! idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
+ if ( ! idx.data(ProfileModel::DATA_IS_SYSTEM).toBool() && ! idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
{
items << sort_model_->mapToSource(idx);
}
diff --git a/ui/qt/widgets/copy_from_profile_menu.cpp b/ui/qt/widgets/copy_from_profile_menu.cpp
index c97002cdbb..5bfebc72f6 100644
--- a/ui/qt/widgets/copy_from_profile_menu.cpp
+++ b/ui/qt/widgets/copy_from_profile_menu.cpp
@@ -52,14 +52,14 @@ CopyFromProfileMenu::CopyFromProfileMenu(QString filename, QWidget *parent) :
pa = new QAction(name, this);
if ( idx.data(ProfileModel::DATA_IS_DEFAULT).toBool() )
addAction(pa);
- else if ( idx.data(ProfileModel::DATA_IS_GLOBAL).toBool() )
+ else if ( idx.data(ProfileModel::DATA_IS_SYSTEM).toBool() )
global << pa;
else
user << pa;
pa->setFont(idx.data(Qt::FontRole).value<QFont>());
pa->setProperty("profile_name", name);
- pa->setProperty("profile_is_global", idx.data(ProfileModel::DATA_IS_GLOBAL));
+ pa->setProperty("profile_is_system", idx.data(ProfileModel::DATA_IS_SYSTEM));
pa->setProperty("filename", fi.absoluteFilePath());
pa->setData(fi.absoluteFilePath().toUtf8().constData());