Skip to content

Commit

Permalink
descriptions and info URL edit for contact items in place
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Oct 24, 2023
1 parent 5547c97 commit 68eb9ed
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 224 deletions.
20 changes: 10 additions & 10 deletions src/cdlgmdfcontact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ CDlgMdfContact::initDialogData(const CMDF_Object* pitemobj, mdf_dlg_contact_type
void
CDlgMdfContact::fillDescription(void)
{
std::map<std::string, std::string>* pmapDescription = m_pitemobj->getDescriptionMap();
std::map<std::string, std::string>* pmapDescription = m_pitemobj->getMapDescription();
std::map<std::string, std::string>::iterator itDesc = pmapDescription->begin();
while (itDesc != pmapDescription->end()) {
std::string lang = itDesc->first; // key
Expand All @@ -140,7 +140,7 @@ CDlgMdfContact::fillDescription(void)
void
CDlgMdfContact::fillInfoUrl(void)
{
std::map<std::string, std::string>* pmapHelpUrl = m_pitemobj->getInfoUrlMap();
std::map<std::string, std::string>* pmapHelpUrl = m_pitemobj->getMapInfoUrl();
std::map<std::string, std::string>::iterator itInfo = pmapHelpUrl->begin();
while (itInfo != pmapHelpUrl->end()) {
std::string lang = itInfo->first; // key
Expand Down Expand Up @@ -195,7 +195,7 @@ CDlgMdfContact::addDesc(void)
QString selstr = "en"; // Default language

CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pitemobj->getDescriptionMap() /*, &selstr*/);
dlg.initDialogData(m_pitemobj->getMapDescription() /*, &selstr*/);
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -218,7 +218,7 @@ CDlgMdfContact::editDesc(void)
QString selstr = pitem->text().split('_').first().left(2);

CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pitemobj->getDescriptionMap(), &selstr);
dlg.initDialogData(m_pitemobj->getMapDescription(), &selstr);
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -239,7 +239,7 @@ CDlgMdfContact::dupDesc(void)
{
if (-1 != ui->listDescription->currentRow()) {
CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pitemobj->getDescriptionMap());
dlg.initDialogData(m_pitemobj->getMapDescription());
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -265,7 +265,7 @@ CDlgMdfContact::deleteDesc(void)
QListWidgetItem* pitem = ui->listDescription->currentItem();
QString selstr = pitem->text().split('_').first().left(2);

m_pitemobj->getDescriptionMap()->erase(selstr.toStdString());
m_pitemobj->getMapDescription()->erase(selstr.toStdString());
ui->listDescription->clear();
fillDescription();
}
Expand All @@ -281,7 +281,7 @@ CDlgMdfContact::addInfo(void)
QString selstr = "en"; // Default language

CDlgMdfInfoUrl dlg(this);
dlg.initDialogData(m_pitemobj->getInfoUrlMap() /*, &selstr*/);
dlg.initDialogData(m_pitemobj->getMapInfoUrl() /*, &selstr*/);
if (QDialog::Accepted == dlg.exec()) {
ui->listInfo->clear();
fillInfoUrl();
Expand All @@ -304,7 +304,7 @@ CDlgMdfContact::editInfo(void)
QString selstr = pitem->text().split('_').first().left(2);

CDlgMdfInfoUrl dlg(this);
dlg.initDialogData(m_pitemobj->getInfoUrlMap(), &selstr);
dlg.initDialogData(m_pitemobj->getMapInfoUrl(), &selstr);
if (QDialog::Accepted == dlg.exec()) {
ui->listInfo->clear();
fillInfoUrl();
Expand All @@ -325,7 +325,7 @@ CDlgMdfContact::dupInfo(void)
{
if (-1 != ui->listInfo->currentRow()) {
CDlgMdfInfoUrl dlg(this);
dlg.initDialogData(m_pitemobj->getInfoUrlMap());
dlg.initDialogData(m_pitemobj->getMapInfoUrl());
if (QDialog::Accepted == dlg.exec()) {
ui->listInfo->clear();
fillInfoUrl();
Expand All @@ -351,7 +351,7 @@ CDlgMdfContact::deleteInfo(void)
QListWidgetItem* pitem = ui->listInfo->currentItem();
QString selstr = pitem->text().split('_').first().left(2);

m_pitemobj->getInfoUrlMap()->erase(selstr.toStdString());
m_pitemobj->getMapInfoUrl()->erase(selstr.toStdString());
ui->listInfo->clear();
fillInfoUrl();
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdlgmdfcontact.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Contact</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
Expand Down
2 changes: 1 addition & 1 deletion src/cdlgmdfcontactlist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Contacts</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
Expand Down
116 changes: 8 additions & 108 deletions src/cdlgmdfmanufacturer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>591</height>
<width>423</width>
<height>309</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Contact</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>10</x>
<y>550</y>
<width>631</width>
<y>270</y>
<width>401</width>
<height>32</height>
</rect>
</property>
Expand All @@ -37,8 +37,8 @@
<rect>
<x>9</x>
<y>9</y>
<width>641</width>
<height>531</height>
<width>401</width>
<height>252</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
Expand Down Expand Up @@ -122,108 +122,8 @@
<item row="7" column="1">
<widget class="QLineEdit" name="editCountry"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Contact</string>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QListWidget" name="listContact"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="btnAddDesc">
<property name="toolTip">
<string>Add description item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/add.png</normaloff>:/add.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnEditDesc">
<property name="toolTip">
<string>Edit description item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/pencil.svg</normaloff>:/pencil.svg</iconset>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnDupDesc">
<property name="toolTip">
<string>Duplicate description item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/images/svg/copy.svg</normaloff>:/images/svg/copy.svg</iconset>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnDelDesc">
<property name="toolTip">
<string>Delete Description item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/remove.png</normaloff>:/remove.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
</layout>
</widget>
Expand Down
10 changes: 5 additions & 5 deletions src/cdlgmdfmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ CDlgMdfModule::fillDescription()
QString str;

// Fill in descriptions
std::map<std::string, std::string>* pmapDescription = m_pmdf->getDescriptionMap();
std::map<std::string, std::string>* pmapDescription = m_pmdf->getMapDescription();
std::map<std::string, std::string>::iterator itDesc = pmapDescription->begin();
while (itDesc != pmapDescription->end()) {
std::string lang = itDesc->first; // key
Expand Down Expand Up @@ -306,7 +306,7 @@ CDlgMdfModule::addDesc(void)
QString selstr = "en"; // Default language

CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pmdf->getDescriptionMap()/*, &selstr*/);
dlg.initDialogData(m_pmdf->getMapDescription()/*, &selstr*/);
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -329,7 +329,7 @@ CDlgMdfModule::editDesc(void)
QString selstr = pitem->text().split('_').first().left(2);

CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pmdf->getDescriptionMap(), &selstr);
dlg.initDialogData(m_pmdf->getMapDescription(), &selstr);
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -350,7 +350,7 @@ CDlgMdfModule::dupDesc(void)
{
if (-1 != ui->listDescription->currentRow()) {
CDlgMdfDescription dlg(this);
dlg.initDialogData(m_pmdf->getDescriptionMap());
dlg.initDialogData(m_pmdf->getMapDescription());
if (QDialog::Accepted == dlg.exec()) {
ui->listDescription->clear();
fillDescription();
Expand All @@ -376,7 +376,7 @@ CDlgMdfModule::deleteDesc(void)
QListWidgetItem* pitem = ui->listDescription->currentItem();
QString selstr = pitem->text().split('_').first().left(2);

m_pmdf->getDescriptionMap()->erase(selstr.toStdString());
m_pmdf->getMapDescription()->erase(selstr.toStdString());
ui->listDescription->clear();
fillDescription();

Expand Down
Loading

0 comments on commit 68eb9ed

Please sign in to comment.