Skip to content

Commit

Permalink
https://github.com/StephaneCouturier/Katalog/issues/482
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneCouturier committed Nov 26, 2023
1 parent 01a3851 commit 55b13bc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
2 changes: 1 addition & 1 deletion device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void Device::loadDevice(){
)");

query.prepare(querySQL);
query.bindValue(":device_id",ID);
query.bindValue(":device_id", ID);

if (query.exec()) {
if (query.next()) {
Expand Down
42 changes: 22 additions & 20 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
//Set current version, release date, and development mode
currentVersion = "2.0";
releaseDate = "2023-11-26";
developmentMode = true;
developmentMode = false;

//Prepare paths, user setting file, check version
//Get user home path and application dir path
Expand Down Expand Up @@ -77,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
hideDevelopmentUIItems();
}

//Settings screen
//Settings screen
ui->Settings_lineEdit_DatabaseFilePath->setText(databaseFilePath);
ui->Settings_comboBox_DatabaseMode->setItemData(0, "Memory", Qt::UserRole);
ui->Settings_comboBox_DatabaseMode->setItemData(1, "File", Qt::UserRole);
Expand Down Expand Up @@ -132,28 +132,30 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
else if ( ui->Settings_comboBox_Theme->currentText() == tr("Katalog Colors (dark)") ){
loadCustomThemeDark();
}

//Load Collection data

//Load Collection
loadCollection();
filterFromSelectedDevices();

//Restore last opened catalog to Explore tab
if(ui->Settings_checkBox_LoadLastCatalog->isChecked()==true){
selectedCatalog->name = settings.value("Explore/lastSelectedCatalogName").toString();
selectedCatalog->loadCatalog();
selectedDirectoryName = settings.value("Explore/lastSelectedDirectory").toString();
selectedDirectoryFullPath = selectedCatalog->sourcePath + "/" + selectedDirectoryName;
ui->Explore_label_CatalogDirectoryDisplay->setText(selectedDirectoryName);
if (selectedCatalog->filePath != ""){
openCatalogToExplore();
}
}
//Load Collection
loadCollection();
selectedDevice->loadDevice();
filterFromSelectedDevices();

//Preload last selected catalogs contents to memory
if(ui->Settings_checkBox_PreloadCatalogs->isChecked()==true){
preloadCatalogs();
//Restore last opened catalog to Explore tab
if(ui->Settings_checkBox_LoadLastCatalog->isChecked()==true){
selectedCatalog->name = settings.value("Explore/lastSelectedCatalogName").toString();
selectedCatalog->loadCatalog();
selectedDirectoryName = settings.value("Explore/lastSelectedDirectory").toString();
selectedDirectoryFullPath = selectedCatalog->sourcePath + "/" + selectedDirectoryName;
ui->Explore_label_CatalogDirectoryDisplay->setText(selectedDirectoryName);
if (selectedCatalog->filePath != ""){
openCatalogToExplore();
}
}

//Preload last selected catalogs contents to memory
if(ui->Settings_checkBox_PreloadCatalogs->isChecked()==true){
preloadCatalogs();
}

//Setup tabs

Expand Down
20 changes: 7 additions & 13 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6921,6 +6921,13 @@ background: url(:/images/link-h.png) repeat-x center;</string>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="TEST_pushButton_GenerateMissingIDs">
<property name="text">
<string>GenerateMissingIDs</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -8767,19 +8774,6 @@ background: url(:/images/link-h.png) repeat-x center;</string>
</rect>
</property>
</widget>
<widget class="QPushButton" name="TEST_pushButton_GenerateMissingIDs">
<property name="geometry">
<rect>
<x>270</x>
<y>10</y>
<width>231</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>generateMissingIDs</string>
</property>
</widget>
</widget>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions mainwindow_tab_catalogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,9 @@

//Execute query
loadCatalogQuery.prepare(loadCatalogQuerySQL);
loadCatalogQuery.bindValue(":catalog_storage", selectedDevice->name);
loadCatalogQuery.bindValue(":catalog_name", selectedDevice->name);
loadCatalogQuery.bindValue(":device_id", selectedDevice->ID);
loadCatalogQuery.bindValue(":catalog_storage", selectedDevice->name);
loadCatalogQuery.bindValue(":catalog_name", selectedDevice->name);
loadCatalogQuery.bindValue(":device_id", selectedDevice->ID);
loadCatalogQuery.bindValue(":device_parent_id", selectedDevice->ID);
loadCatalogQuery.exec();

Expand Down

0 comments on commit 55b13bc

Please sign in to comment.