fixed load/save of new group ids and backward compatibility with FriendList

This commit is contained in:
csoler 2016-07-06 22:02:56 -04:00
parent 01c0d2f0f1
commit 269f9457be
7 changed files with 124 additions and 40 deletions

View file

@ -217,7 +217,17 @@ void FriendList::processSettings(bool load)
int arrayIndex = Settings->beginReadArray("Groups");
for (int index = 0; index < arrayIndex; ++index) {
Settings->setArrayIndex(index);
addGroupToExpand(RsNodeGroupId(Settings->value("open").toString().toStdString()));
std::string gids = Settings->value("open").toString().toStdString();
RsGroupInfo ginfo ;
if(rsPeers->getGroupInfoByName(gids,ginfo)) // backward compatibility
addGroupToExpand(ginfo.id) ;
else if(rsPeers->getGroupInfo(RsNodeGroupId(gids),ginfo)) // backward compatibility
addGroupToExpand(ginfo.id) ;
else
std::cerr << "(EE) Cannot find group info for openned group \"" << gids << "\"" << std::endl;
}
Settings->endArray();
} else {

View file

@ -51,7 +51,7 @@ const QString GroupDefs::name(const RsGroupInfo &groupInfo)
return qApp->translate("GroupDefs", "Favorites");
}
std::cerr << "GroupDefs::name: Unknown group id requested " << groupInfo.id;
std::cerr << "GroupDefs::name: Unknown group id requested " << groupInfo.id << std::endl;
return "";
}

View file

@ -45,6 +45,11 @@ CreateGroup::CreateGroup(const RsNodeGroupId &groupId, QWidget *parent)
mGroupId = groupId;
if(!mGroupId.isNull())
ui.groupId_LE->setText(QString::fromStdString(mGroupId.toStdString())) ;
else
ui.groupId_LE->setText(tr("To be defined")) ;
/* Initialize friends list */
ui.friendList->setHeaderText(tr("Friends"));
ui.friendList->setModus(FriendSelectionWidget::MODUS_CHECK);
@ -104,9 +109,9 @@ CreateGroup::~CreateGroup()
void CreateGroup::groupNameChanged(QString text)
{
if (text.isEmpty() || mUsedGroupNames.contains(misc::removeNewLine(text))) {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<height>298</height>
<width>575</width>
<height>485</height>
</rect>
</property>
<property name="windowTitle">
@ -23,9 +23,6 @@
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
@ -36,27 +33,35 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="groupLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="groupLabel">
<property name="text">
<string>Group Name</string>
<string>Group Name:</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QLineEdit" name="groupName">
<property name="toolTip">
<string>Enter a name for your group</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="groupId_LB">
<property name="text">
<string>Group ID:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="groupId_LE">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -79,6 +84,9 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
</layout>
</widget>
<customwidgets>