2012-12-29 01:39:02 +00:00
|
|
|
/* profile_dialog.cpp
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <glib.h>
|
|
|
|
|
2013-11-17 02:55:14 +00:00
|
|
|
#include "wsutil/filesystem.h"
|
2012-12-29 01:39:02 +00:00
|
|
|
#include "epan/prefs.h"
|
|
|
|
|
2017-07-25 14:15:18 +00:00
|
|
|
#include <ui/qt/utils/qt_ui_utils.h>
|
2014-11-29 18:32:30 +00:00
|
|
|
|
2012-12-29 01:39:02 +00:00
|
|
|
#include "ui/profile.h"
|
|
|
|
|
2017-07-25 14:15:18 +00:00
|
|
|
#include <ui/qt/utils/variant_pointer.h>
|
2017-01-11 12:55:23 +00:00
|
|
|
|
2012-12-29 01:39:02 +00:00
|
|
|
#include "profile_dialog.h"
|
2015-06-25 16:17:03 +00:00
|
|
|
#include <ui_profile_dialog.h>
|
2012-12-29 01:39:02 +00:00
|
|
|
#include "wireshark_application.h"
|
2017-07-25 14:15:18 +00:00
|
|
|
#include <ui/qt/utils/color_utils.h>
|
2012-12-29 01:39:02 +00:00
|
|
|
|
|
|
|
#include <QBrush>
|
2013-07-25 23:49:47 +00:00
|
|
|
#include <QDir>
|
|
|
|
#include <QFont>
|
2012-12-29 01:39:02 +00:00
|
|
|
#include <QMessageBox>
|
2015-02-08 20:24:19 +00:00
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTreeWidgetItem>
|
2013-07-25 23:49:47 +00:00
|
|
|
#include <QUrl>
|
2012-12-29 01:39:02 +00:00
|
|
|
|
|
|
|
ProfileDialog::ProfileDialog(QWidget *parent) :
|
2016-02-28 18:23:20 +00:00
|
|
|
GeometryStateDialog(parent),
|
2012-12-29 01:39:02 +00:00
|
|
|
pd_ui_(new Ui::ProfileDialog),
|
|
|
|
ok_button_(NULL)
|
|
|
|
{
|
|
|
|
GList *fl_entry;
|
|
|
|
profile_def *profile;
|
|
|
|
const gchar *profile_name = get_profile_name();
|
|
|
|
|
|
|
|
pd_ui_->setupUi(this);
|
2016-02-28 18:23:20 +00:00
|
|
|
loadGeometry();
|
2014-12-29 23:15:59 +00:00
|
|
|
setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles")));
|
2012-12-29 01:39:02 +00:00
|
|
|
ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
|
|
|
|
// XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock
|
2017-04-05 19:15:27 +00:00
|
|
|
// icons on macOS.
|
2012-12-29 01:39:02 +00:00
|
|
|
// Are there equivalent stock icons on Windows?
|
2013-04-24 11:07:25 +00:00
|
|
|
#ifdef Q_OS_MAC
|
2012-12-29 01:39:02 +00:00
|
|
|
pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
|
|
|
pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
|
|
|
pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
|
2015-12-06 11:15:53 +00:00
|
|
|
pd_ui_->infoLabel->setAttribute(Qt::WA_MacSmallSize, true);
|
2012-12-29 01:39:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
init_profile_list();
|
|
|
|
fl_entry = edited_profile_list();
|
|
|
|
pd_ui_->profileTreeWidget->blockSignals(true);
|
|
|
|
while (fl_entry && fl_entry->data) {
|
|
|
|
profile = (profile_def *) fl_entry->data;
|
|
|
|
QTreeWidgetItem *item = new QTreeWidgetItem(pd_ui_->profileTreeWidget);
|
|
|
|
item->setText(0, profile->name);
|
2017-01-11 12:55:23 +00:00
|
|
|
item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry));
|
2012-12-29 01:39:02 +00:00
|
|
|
|
|
|
|
if (profile->is_global || profile->status == PROF_STAT_DEFAULT) {
|
|
|
|
QFont ti_font = item->font(0);
|
|
|
|
ti_font.setItalic(true);
|
|
|
|
item->setFont(0, ti_font);
|
|
|
|
} else {
|
|
|
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
|
|
|
}
|
|
|
|
|
2015-11-22 14:25:27 +00:00
|
|
|
if (!profile->is_global && strcmp(profile_name, profile->name) == 0) {
|
|
|
|
pd_ui_->profileTreeWidget->setCurrentItem(item);
|
|
|
|
}
|
|
|
|
|
2012-12-29 01:39:02 +00:00
|
|
|
fl_entry = g_list_next(fl_entry);
|
|
|
|
}
|
|
|
|
pd_ui_->profileTreeWidget->blockSignals(false);
|
|
|
|
|
|
|
|
connect(pd_ui_->profileTreeWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
|
|
|
|
this, SLOT(editingFinished()));
|
|
|
|
updateWidgets();
|
|
|
|
}
|
|
|
|
|
|
|
|
ProfileDialog::~ProfileDialog()
|
|
|
|
{
|
|
|
|
delete pd_ui_;
|
|
|
|
empty_profile_list (TRUE);
|
|
|
|
}
|
|
|
|
|
2012-12-30 19:33:05 +00:00
|
|
|
int ProfileDialog::execAction(ProfileDialog::ProfileAction profile_action)
|
|
|
|
{
|
|
|
|
int ret = QDialog::Accepted;
|
|
|
|
QTreeWidgetItem *item;
|
|
|
|
|
|
|
|
switch (profile_action) {
|
|
|
|
case ShowProfiles:
|
|
|
|
ret = exec();
|
|
|
|
break;
|
|
|
|
case NewProfile:
|
|
|
|
on_newToolButton_clicked();
|
|
|
|
ret = exec();
|
|
|
|
break;
|
|
|
|
case EditCurrentProfile:
|
|
|
|
item = pd_ui_->profileTreeWidget->currentItem();
|
|
|
|
if (item) {
|
|
|
|
pd_ui_->profileTreeWidget->editItem(item, 0);
|
|
|
|
}
|
|
|
|
ret = exec();
|
|
|
|
break;
|
|
|
|
case DeleteCurrentProfile:
|
|
|
|
if (delete_current_profile()) {
|
|
|
|
wsApp->setConfigurationProfile (NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-12-29 01:39:02 +00:00
|
|
|
void ProfileDialog::updateWidgets()
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = pd_ui_->profileTreeWidget->currentItem();
|
|
|
|
bool enable_new = false;
|
|
|
|
bool enable_del = false;
|
|
|
|
bool enable_copy = false;
|
|
|
|
bool enable_ok = true;
|
|
|
|
profile_def *current_profile = NULL;
|
|
|
|
|
|
|
|
if (item) {
|
2017-01-11 12:55:23 +00:00
|
|
|
current_profile = (profile_def *) VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole))->data;
|
2012-12-29 01:39:02 +00:00
|
|
|
enable_new = true;
|
|
|
|
enable_copy = true;
|
2017-02-13 22:00:00 +00:00
|
|
|
if (!current_profile->is_global && !(item->font(0).strikeOut())) {
|
2012-12-29 01:39:02 +00:00
|
|
|
enable_del = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-25 23:49:47 +00:00
|
|
|
if (current_profile) {
|
2015-12-06 11:15:53 +00:00
|
|
|
QString profile_path;
|
|
|
|
QString profile_info;
|
|
|
|
switch (current_profile->status) {
|
|
|
|
case PROF_STAT_DEFAULT:
|
2017-02-13 22:00:00 +00:00
|
|
|
if (item->font(0).strikeOut()) {
|
|
|
|
profile_info = tr("Will be reset to default values");
|
|
|
|
} else {
|
|
|
|
profile_path = get_persconffile_path("", FALSE);
|
|
|
|
}
|
2015-12-06 11:15:53 +00:00
|
|
|
break;
|
|
|
|
case PROF_STAT_EXISTS:
|
2017-02-18 15:46:24 +00:00
|
|
|
{
|
|
|
|
char* profile_dir = current_profile->is_global ? get_global_profiles_dir() : get_profiles_dir();
|
|
|
|
profile_path = profile_dir;
|
|
|
|
g_free(profile_dir);
|
|
|
|
|
2013-07-25 23:49:47 +00:00
|
|
|
profile_path.append(QDir::separator()).append(current_profile->name);
|
2017-02-18 15:46:24 +00:00
|
|
|
}
|
2015-12-06 11:15:53 +00:00
|
|
|
break;
|
|
|
|
case PROF_STAT_COPY:
|
|
|
|
if (current_profile->reference) {
|
|
|
|
profile_info = tr("Created from %1").arg(current_profile->reference);
|
2017-02-14 21:36:52 +00:00
|
|
|
if (current_profile->from_global) {
|
|
|
|
profile_info.append(QString(" %1").arg(tr("(system provided)")));
|
|
|
|
}
|
2015-12-06 11:15:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Fall Through */
|
|
|
|
case PROF_STAT_NEW:
|
|
|
|
profile_info = tr("Created from default settings");
|
|
|
|
break;
|
|
|
|
case PROF_STAT_CHANGED:
|
|
|
|
profile_info = tr("Renamed from %1").arg(current_profile->reference);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!profile_path.isEmpty()) {
|
|
|
|
pd_ui_->infoLabel->setUrl(QUrl::fromLocalFile(profile_path).toString());
|
|
|
|
pd_ui_->infoLabel->setText(profile_path);
|
|
|
|
pd_ui_->infoLabel->setToolTip(tr("Go to %1").arg(profile_path));
|
|
|
|
} else {
|
|
|
|
pd_ui_->infoLabel->clear();
|
|
|
|
pd_ui_->infoLabel->setText(profile_info);
|
2013-07-25 23:49:47 +00:00
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
} else {
|
2015-12-06 11:15:53 +00:00
|
|
|
pd_ui_->infoLabel->clear();
|
2012-12-29 01:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pd_ui_->profileTreeWidget->topLevelItemCount() > 0) {
|
|
|
|
profile_def *profile;
|
|
|
|
for (int i = 0; i < pd_ui_->profileTreeWidget->topLevelItemCount(); i++) {
|
|
|
|
item = pd_ui_->profileTreeWidget->topLevelItem(i);
|
2017-01-11 12:55:23 +00:00
|
|
|
profile = (profile_def *) VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole))->data;
|
2017-02-07 20:35:16 +00:00
|
|
|
if (gchar *err_msg = profile_name_is_valid(profile->name)) {
|
|
|
|
item->setToolTip(0, err_msg);
|
|
|
|
item->setBackground(0, ColorUtils::fromColorT(&prefs.gui_text_invalid));
|
|
|
|
if (profile == current_profile) {
|
|
|
|
pd_ui_->infoLabel->setText(err_msg);
|
|
|
|
}
|
|
|
|
g_free(err_msg);
|
|
|
|
enable_ok = false;
|
|
|
|
continue;
|
|
|
|
}
|
2015-12-06 11:15:53 +00:00
|
|
|
if (profile->is_global) {
|
|
|
|
item->setToolTip(0, tr("This is a system provided profile."));
|
|
|
|
continue;
|
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
if (current_profile && !current_profile->is_global && profile != current_profile && strcmp(profile->name, current_profile->name) == 0) {
|
2015-12-06 11:15:53 +00:00
|
|
|
item->setToolTip(0, tr("A profile already exists with this name."));
|
2013-07-17 21:55:38 +00:00
|
|
|
item->setBackground(0, ColorUtils::fromColorT(&prefs.gui_text_invalid));
|
2015-12-06 11:15:53 +00:00
|
|
|
if (current_profile->status != PROF_STAT_DEFAULT &&
|
|
|
|
current_profile->status != PROF_STAT_EXISTS)
|
|
|
|
{
|
|
|
|
pd_ui_->infoLabel->setText(tr("A profile already exists with this name"));
|
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
enable_ok = false;
|
2017-02-13 22:00:00 +00:00
|
|
|
} else if (item->font(0).strikeOut()) {
|
|
|
|
item->setToolTip(0, tr("The profile will be reset to default values."));
|
|
|
|
item->setBackground(0, ColorUtils::fromColorT(&prefs.gui_text_deprecated));
|
2012-12-29 01:39:02 +00:00
|
|
|
} else {
|
|
|
|
item->setBackground(0, QBrush());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pd_ui_->profileTreeWidget->resizeColumnToContents(0);
|
|
|
|
pd_ui_->newToolButton->setEnabled(enable_new);
|
|
|
|
pd_ui_->deleteToolButton->setEnabled(enable_del);
|
|
|
|
pd_ui_->copyToolButton->setEnabled(enable_copy);
|
|
|
|
ok_button_->setEnabled(enable_ok);
|
|
|
|
}
|
|
|
|
|
2015-07-07 06:24:50 +00:00
|
|
|
void ProfileDialog::on_profileTreeWidget_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)
|
2012-12-29 01:39:02 +00:00
|
|
|
{
|
|
|
|
if (pd_ui_->profileTreeWidget->updatesEnabled()) updateWidgets();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::on_newToolButton_clicked()
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
|
|
|
profile_def *profile;
|
|
|
|
const gchar *name = "New profile";
|
|
|
|
GList *fl_entry = add_to_profile_list(name, "", PROF_STAT_NEW, FALSE, FALSE);
|
|
|
|
|
|
|
|
profile = (profile_def *) fl_entry->data;
|
|
|
|
item->setText(0, profile->name);
|
2017-01-11 12:55:23 +00:00
|
|
|
item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry));
|
2012-12-29 01:39:02 +00:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
|
|
|
pd_ui_->profileTreeWidget->addTopLevelItem(item);
|
|
|
|
pd_ui_->profileTreeWidget->setCurrentItem(item);
|
|
|
|
pd_ui_->profileTreeWidget->editItem(item, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::on_deleteToolButton_clicked()
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = pd_ui_->profileTreeWidget->currentItem();
|
|
|
|
|
|
|
|
if (item) {
|
2017-01-11 12:55:23 +00:00
|
|
|
GList *fl_entry = VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole));
|
2013-07-17 23:19:19 +00:00
|
|
|
profile_def *profile = (profile_def *) fl_entry->data;
|
2017-02-13 22:00:00 +00:00
|
|
|
if (profile->is_global || item->font(0).strikeOut()) {
|
2013-07-17 23:19:19 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-02-13 22:00:00 +00:00
|
|
|
if (profile->status == PROF_STAT_DEFAULT) {
|
|
|
|
QFont ti_font = item->font(0);
|
|
|
|
ti_font.setStrikeOut(true);
|
|
|
|
item->setFont(0, ti_font);
|
|
|
|
updateWidgets();
|
|
|
|
} else {
|
|
|
|
delete item;
|
2013-07-17 23:19:19 +00:00
|
|
|
|
2017-02-13 22:00:00 +00:00
|
|
|
// Select the default
|
|
|
|
pd_ui_->profileTreeWidget->setCurrentItem(pd_ui_->profileTreeWidget->topLevelItem(0));
|
2015-11-14 18:03:03 +00:00
|
|
|
|
2017-02-13 22:00:00 +00:00
|
|
|
remove_from_profile_list(fl_entry);
|
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::on_copyToolButton_clicked()
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *cur_item = pd_ui_->profileTreeWidget->currentItem();
|
2015-06-09 20:02:29 +00:00
|
|
|
if (!cur_item) return;
|
2012-12-29 01:39:02 +00:00
|
|
|
|
2017-01-11 12:55:23 +00:00
|
|
|
profile_def *cur_profile = (profile_def *) VariantPointer<GList>::asPtr(cur_item->data(0, Qt::UserRole))->data;
|
2015-06-09 20:02:29 +00:00
|
|
|
if (!cur_profile) return;
|
2012-12-29 01:39:02 +00:00
|
|
|
|
|
|
|
QTreeWidgetItem *new_item = new QTreeWidgetItem();
|
|
|
|
GList *fl_entry;
|
|
|
|
const gchar *parent;
|
|
|
|
gchar *new_name;
|
|
|
|
profile_def *new_profile;
|
|
|
|
|
|
|
|
if (cur_profile->is_global) {
|
|
|
|
parent = cur_profile->name;
|
|
|
|
} else {
|
|
|
|
parent = get_profile_parent (cur_profile->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cur_profile->is_global && !profile_exists (parent, FALSE)) {
|
|
|
|
new_name = g_strdup (cur_profile->name);
|
|
|
|
} else {
|
|
|
|
new_name = g_strdup_printf ("%s (copy)", cur_profile->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add a new entry to the profile list. */
|
|
|
|
fl_entry = add_to_profile_list(new_name, parent, PROF_STAT_COPY, FALSE, cur_profile->from_global);
|
|
|
|
new_profile = (profile_def *) fl_entry->data;
|
|
|
|
new_item->setText(0, new_profile->name);
|
2017-01-11 12:55:23 +00:00
|
|
|
new_item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry));
|
2012-12-29 01:39:02 +00:00
|
|
|
new_item->setFlags(new_item->flags() | Qt::ItemIsEditable);
|
|
|
|
pd_ui_->profileTreeWidget->addTopLevelItem(new_item);
|
|
|
|
pd_ui_->profileTreeWidget->setCurrentItem(new_item);
|
|
|
|
pd_ui_->profileTreeWidget->editItem(new_item, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::on_buttonBox_accepted()
|
|
|
|
{
|
|
|
|
const gchar *err_msg;
|
2017-02-13 22:00:00 +00:00
|
|
|
QTreeWidgetItem *default_item = pd_ui_->profileTreeWidget->topLevelItem(0);
|
2012-12-29 01:42:01 +00:00
|
|
|
QTreeWidgetItem *item = pd_ui_->profileTreeWidget->currentItem();
|
2017-02-13 22:00:00 +00:00
|
|
|
gchar *profile_name = NULL;
|
|
|
|
bool write_recent = true;
|
|
|
|
bool item_data_removed = false;
|
|
|
|
|
|
|
|
if (default_item && default_item->font(0).strikeOut()) {
|
|
|
|
// Reset Default profile.
|
|
|
|
GList *fl_entry = VariantPointer<GList>::asPtr(default_item->data(0, Qt::UserRole));
|
|
|
|
remove_from_profile_list(fl_entry);
|
|
|
|
|
|
|
|
// Don't write recent file if leaving the Default profile after this has been reset.
|
|
|
|
write_recent = !is_default_profile();
|
|
|
|
|
|
|
|
// Don't fetch profile data if removed.
|
|
|
|
item_data_removed = (item == default_item);
|
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
|
|
|
|
if ((err_msg = apply_profile_changes()) != NULL) {
|
|
|
|
QMessageBox::critical(this, tr("Profile Error"),
|
|
|
|
err_msg,
|
|
|
|
QMessageBox::Ok);
|
2015-01-10 04:04:47 +00:00
|
|
|
g_free((gchar*)err_msg);
|
2012-12-29 01:39:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-13 22:00:00 +00:00
|
|
|
if (item && !item_data_removed) {
|
2017-01-11 12:55:23 +00:00
|
|
|
profile_def *profile = (profile_def *) VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole))->data;
|
2017-02-13 22:00:00 +00:00
|
|
|
profile_name = profile->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (profile_exists (profile_name, FALSE) || profile_exists (profile_name, TRUE)) {
|
|
|
|
// The new profile exists, change.
|
|
|
|
wsApp->setConfigurationProfile (profile_name, write_recent);
|
|
|
|
} else if (!profile_exists (get_profile_name(), FALSE)) {
|
|
|
|
// The new profile does not exist, and the previous profile has
|
|
|
|
// been deleted. Change to the default profile.
|
|
|
|
wsApp->setConfigurationProfile (NULL, write_recent);
|
2012-12-29 01:42:01 +00:00
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::on_buttonBox_helpRequested()
|
|
|
|
{
|
|
|
|
wsApp->helpTopicAction(HELP_CONFIG_PROFILES_DIALOG);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileDialog::editingFinished()
|
|
|
|
{
|
|
|
|
QTreeWidgetItem *item = pd_ui_->profileTreeWidget->currentItem();
|
|
|
|
|
|
|
|
if (item) {
|
2017-01-11 12:55:23 +00:00
|
|
|
profile_def *profile = (profile_def *) VariantPointer<GList>::asPtr(item->data(0, Qt::UserRole))->data;
|
2012-12-29 01:39:02 +00:00
|
|
|
if (item->text(0).compare(profile->name) != 0) {
|
|
|
|
g_free(profile->name);
|
2014-11-29 18:32:30 +00:00
|
|
|
profile->name = qstring_strdup(item->text(0));
|
2015-11-12 20:41:10 +00:00
|
|
|
if (profile->status == PROF_STAT_EXISTS) {
|
|
|
|
profile->status = PROF_STAT_CHANGED;
|
|
|
|
}
|
2012-12-29 01:39:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
updateWidgets();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|