diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6e25e3e..4554ef7 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -48,7 +48,7 @@ MainWindow::MainWindow(QWidget *parent) : //Set current version, release date, and development mode currentVersion = "2.3"; collection->appVersion = currentVersion; - releaseDate = "2024-11-30"; + releaseDate = "2024-12-02"; developmentMode = false; themeID = 1; //default value for the theme = Katalog Colors (light). selectedTab = 3; //default value for the first launch = Create screen. @@ -85,10 +85,14 @@ MainWindow::MainWindow(QWidget *parent) : hideDevelopmentUIItems(); } - QButtonGroup buttonGroup; - buttonGroup.addButton(ui->Devices_radioButton_DeviceTree); - buttonGroup.addButton(ui->Devices_radioButton_StorageList); - buttonGroup.addButton(ui->Devices_radioButton_CatalogList); + QButtonGroup buttonGroupDevices; + buttonGroupDevices.addButton(ui->Devices_radioButton_DeviceTree); + buttonGroupDevices.addButton(ui->Devices_radioButton_StorageList); + buttonGroupDevices.addButton(ui->Devices_radioButton_CatalogList); + + QButtonGroup buttonGroupBackUp; + buttonGroupBackUp.addButton(ui->BackUp_radioButton_Source); + buttonGroupBackUp.addButton(ui->BackUp_radioButton_Target); //Settings screen ui->Settings_lineEdit_DatabaseFilePath->setText(collection->databaseFilePath); diff --git a/src/mainwindow.h b/src/mainwindow.h index 4649396..ab29b85 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -544,6 +544,8 @@ class MainWindow : public QMainWindow void on_BackUp_pushButton_ReloadTargetList_clicked(); void on_BackUp_pushButton_DeleteSelectedMapping_clicked(); void on_BackUp_checkBox_DisplayFullTable_checkStateChanged(const Qt::CheckState &arg1); + void on_BackUp_radioButton_Source_clicked(); + void on_BackUp_radioButton_Target_clicked(); //Statistics void on_Statistics_pushButton_EditDeviceStatisticsFile_clicked(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 7beb51e..6f13936 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -7466,6 +7466,23 @@ background: url(:/images/link-h.png) repeat-x center; + + + + based on Sources + + + true + + + + + + + based on Targets + + + diff --git a/src/mainwindow_setup.cpp b/src/mainwindow_setup.cpp index 0cedccd..6e3e0ae 100755 --- a/src/mainwindow_setup.cpp +++ b/src/mainwindow_setup.cpp @@ -472,6 +472,12 @@ fileSortCaseSensitive = settings.value("Settings/FileCaseSensitiveSort").toBool(); ui->Settings_checkBox_SettingsFileCaseSensitiveSort->setChecked(fileSortCaseSensitive); + //BackUp Tab + QString filterMappingTable = settings.value("BackUp/FilterMappingTable", "Source").toString(); + if(filterMappingTable=="Target"){ + ui->BackUp_radioButton_Target->setChecked(true); + } + //Restore DEV Settings if(developmentMode==true){ ui->Settings_comboBox_DatabaseMode->setCurrentText(tr(collection->databaseMode.toStdString().c_str())); diff --git a/src/mainwindow_tab_backup.cpp b/src/mainwindow_tab_backup.cpp index 5ad9ccc..fb79733 100644 --- a/src/mainwindow_tab_backup.cpp +++ b/src/mainwindow_tab_backup.cpp @@ -89,6 +89,17 @@ void MainWindow::on_BackUp_checkBox_DisplayFullTable_checkStateChanged(const Qt: loadBackUpMapping(); } +void MainWindow::on_BackUp_radioButton_Source_clicked() +{ + QSettings settings(collection->settingsFilePath, QSettings:: IniFormat); + settings.setValue("BackUp/FilterMappingTable", "Source"); +} + +void MainWindow::on_BackUp_radioButton_Target_clicked() +{ + QSettings settings(collection->settingsFilePath, QSettings:: IniFormat); + settings.setValue("BackUp/FilterMappingTable", "Target"); +} //Methods----------------------------------------------------------------------- @@ -149,28 +160,55 @@ void MainWindow::loadBackUpMapping() AND dm.mapping_device_target_id = d2.device_id )"); - if ( selectedDevice->type == "Storage" ){ - querySQL += " AND d1.device_parent_id =:device_parent_id "; - } - else if ( selectedDevice->type == "Catalog" ){ - querySQL += " AND d1.device_id =:device_id "; + if(ui->BackUp_radioButton_Target->isChecked()==true){ + if ( selectedDevice->type == "Storage" ){ + querySQL += " AND d2.device_parent_id =:device_parent_id "; + } + else if ( selectedDevice->type == "Catalog" ){ + querySQL += " AND d2.device_id =:device_id "; + } + else if ( selectedDevice->type == "Virtual" ){ + QString prepareSQL = QLatin1String(R"( + AND d2.device_id IN ( + WITH RECURSIVE hierarchy AS ( + SELECT device_id, device_parent_id, device_name + FROM device + WHERE device_id = :device_id + UNION ALL + SELECT t.device_id, t.device_parent_id, t.device_name + FROM device t + JOIN hierarchy h ON t.device_parent_id = h.device_id + ) + SELECT device_id + FROM hierarchy) + )"); + querySQL += prepareSQL; + } } - else if ( selectedDevice->type == "Virtual" ){ - QString prepareSQL = QLatin1String(R"( - AND d1.device_id IN ( - WITH RECURSIVE hierarchy AS ( - SELECT device_id, device_parent_id, device_name - FROM device - WHERE device_id = :device_id - UNION ALL - SELECT t.device_id, t.device_parent_id, t.device_name - FROM device t - JOIN hierarchy h ON t.device_parent_id = h.device_id - ) - SELECT device_id - FROM hierarchy) - )"); - querySQL += prepareSQL; + else{ + if ( selectedDevice->type == "Storage" ){ + querySQL += " AND d1.device_parent_id =:device_parent_id "; + } + else if ( selectedDevice->type == "Catalog" ){ + querySQL += " AND d1.device_id =:device_id "; + } + else if ( selectedDevice->type == "Virtual" ){ + QString prepareSQL = QLatin1String(R"( + AND d1.device_id IN ( + WITH RECURSIVE hierarchy AS ( + SELECT device_id, device_parent_id, device_name + FROM device + WHERE device_id = :device_id + UNION ALL + SELECT t.device_id, t.device_parent_id, t.device_name + FROM device t + JOIN hierarchy h ON t.device_parent_id = h.device_id + ) + SELECT device_id + FROM hierarchy) + )"); + querySQL += prepareSQL; + } } querySQL +=" ORDER BY dm.mapping_name ASC ";