Skip to content

Commit

Permalink
https://github.com/StephaneCouturier/Katalog/issues/340
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneCouturier committed Dec 2, 2024
1 parent 19fcc7d commit 9fffdce
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 75 deletions.
1 change: 0 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ MainWindow::MainWindow(QWidget *parent) :

//Load mapping to backup tab
loadBackUpMapping();
loadBackUpDeviceLists();

//Restore last opened catalog to Explore tab
if(ui->Settings_checkBox_LoadLastCatalog->isChecked()==true){
Expand Down
5 changes: 3 additions & 2 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class MainWindow : public QMainWindow
//TAB: BackUp
bool optionDisplayFullMappingTable;
void loadBackUpMapping();
void loadBackUpDeviceLists();
void loadBackUpDeviceLists(QString list);
void saveNewMapping();

//TAB: Settings
Expand Down Expand Up @@ -540,7 +540,8 @@ class MainWindow : public QMainWindow
//BackUp
void on_BackUp_pushButton_SaveMapping_clicked();
void on_BackUp_pushButton_ReloadDeviceMappings_clicked();
void on_BackUp_pushButton_ReloadLists_clicked();
void on_BackUp_pushButton_ReloadSourceList_clicked();
void on_BackUp_pushButton_ReloadTargetList_clicked();
void on_BackUp_pushButton_DeleteSelectedMapping_clicked();
void on_BackUp_checkBox_DisplayFullTable_checkStateChanged(const Qt::CheckState &arg1);

Expand Down
138 changes: 77 additions & 61 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7317,6 +7317,46 @@ background: url(:/images/link-h.png) repeat-x center;</string>
<string>BackUp</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="BackUp_pushButton_ReloadDeviceMappings">
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reload device mappings</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="BackUp_checkBox_DisplayFullTable">
<property name="text">
<string>Full Table</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="BackUp_label_CurrentMappings">
<property name="text">
Expand All @@ -7331,7 +7371,7 @@ background: url(:/images/link-h.png) repeat-x center;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<layout class="QHBoxLayout" name="BackUp_horizontalLayout_Save">
<item>
<widget class="QLabel" name="BackUp_label_Name">
Expand Down Expand Up @@ -7365,7 +7405,30 @@ background: url(:/images/link-h.png) repeat-x center;</string>
</item>
</layout>
</item>
<item row="7" column="0">
<item row="4" column="0">
<widget class="QPushButton" name="BackUp_pushButton_DeleteSelectedMapping">
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Delete selected mapping</string>
</property>
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditDelete"/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="Line" name="BackUp_line_Separate1">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QGridLayout" name="BackUp_gridLayout_CreateMapping">
<item row="2" column="1">
<widget class="QLabel" name="BackUp_label_TargetDevice">
Expand All @@ -7388,93 +7451,46 @@ background: url(:/images/link-h.png) repeat-x center;</string>
<widget class="QTreeView" name="BackUp_treeView_List2"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="BackUp_pushButton_ReloadLists">
<widget class="QPushButton" name="BackUp_pushButton_ReloadSourceList">
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reload device lists</string>
<string>Load Source Catalogs</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="Line" name="BackUp_line_Separate1">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="BackUp_pushButton_DeleteSelectedMapping">
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Delete selected mapping</string>
</property>
<property name="icon">
<iconset theme="QIcon::ThemeIcon::EditDelete"/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="BackUp_label_CreateMapping">
<property name="text">
<string>Create New mapping</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="BackUp_pushButton_ReloadDeviceMappings">
<item row="1" column="1">
<widget class="QPushButton" name="BackUp_pushButton_ReloadTargetList">
<property name="maximumSize">
<size>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reload device mappings</string>
<string>Load Target Catalogs</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="BackUp_checkBox_DisplayFullTable">
<property name="text">
<string>Full Table</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="BackUp_label_CreateMapping">
<property name="text">
<string>Create New mapping</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_Settings">
Expand Down
32 changes: 21 additions & 11 deletions src/mainwindow_tab_backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ void MainWindow::on_BackUp_pushButton_SaveMapping_clicked()
saveNewMapping();
collection->saveMappingTableToFile();
}
void MainWindow::on_BackUp_pushButton_ReloadLists_clicked()
void MainWindow::on_BackUp_pushButton_ReloadSourceList_clicked()
{
loadBackUpDeviceLists();
loadBackUpDeviceLists("Source");
}

void MainWindow::on_BackUp_pushButton_ReloadTargetList_clicked()
{
loadBackUpDeviceLists("Target");
}

void MainWindow::on_BackUp_pushButton_ReloadDeviceMappings_clicked()
Expand Down Expand Up @@ -217,7 +222,7 @@ void MainWindow::loadBackUpMapping()
ui->BackUp_tableView_CurrentMappings->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
}

void MainWindow::loadBackUpDeviceLists()
void MainWindow::loadBackUpDeviceLists(QString list)
{
//Create a model for the table
QStandardItemModel *model = new QStandardItemModel();
Expand All @@ -244,14 +249,19 @@ void MainWindow::loadBackUpDeviceLists()
}
}

//Load model to the view
ui->BackUp_treeView_List1->setModel(model);
ui->BackUp_treeView_List1->resizeColumnToContents(1);
ui->BackUp_treeView_List1->setEditTriggers(QAbstractItemView::NoEditTriggers);
//Load model to the view
ui->BackUp_treeView_List2->setModel(model);
ui->BackUp_treeView_List2->resizeColumnToContents(1);
ui->BackUp_treeView_List2->setEditTriggers(QAbstractItemView::NoEditTriggers);
//Load model to the Source view
if (list =="Source"){
ui->BackUp_treeView_List1->setModel(model);
ui->BackUp_treeView_List1->resizeColumnToContents(1);
ui->BackUp_treeView_List1->setEditTriggers(QAbstractItemView::NoEditTriggers);
}

//Load model to the Target view
if (list =="Target"){
ui->BackUp_treeView_List2->setModel(model);
ui->BackUp_treeView_List2->resizeColumnToContents(1);
ui->BackUp_treeView_List2->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
}

void MainWindow::saveNewMapping()
Expand Down

0 comments on commit 9fffdce

Please sign in to comment.