From fbfb98019598b52d9c12d5bff0ed19c2a660607a Mon Sep 17 00:00:00 2001 From: CSMathematics Date: Thu, 10 Oct 2024 10:10:34 +0300 Subject: [PATCH] New DTX Classes New classes for FilesDB: DTXField, DTXChapter, DTXSection and DTXSubSection --- DataTex.pro.user | 2 +- datatex.cpp | 48 ++-------- datatex.ui | 12 +-- datatex/clonedatabasefile.cpp | 8 +- datatex/clonedatabasefile.h | 2 +- datatex/databasecreator.cpp | 7 +- datatex/filecommands.cpp | 122 +++++++++++++++++++++---- datatex/filecommands.h | 86 ++++++++++++++++- datatex/newdatabasefile.cpp | 21 ++--- datatex/newdatabasefile.h | 1 - datatex/newfiletype.cpp | 22 +++-- images/Dark_Theme/ConnectDB.svg | 55 +++++------ images/Dark_Theme/DatabaseAdd.svg | 16 ++-- images/Dark_Theme/Delimiters.svg | 40 +++++--- images/Dark_Theme/DisconnectDB.svg | 24 ++--- images/Dark_Theme/FileDependencies.svg | 102 ++++++++++----------- images/Dark_Theme/Locked.svg | 18 ++-- images/Dark_Theme/Tex.svg | 14 +-- themes/darkstyle/darkstyle.qss | 34 ++++--- 19 files changed, 397 insertions(+), 237 deletions(-) diff --git a/DataTex.pro.user b/DataTex.pro.user index 47cca34c..17e47d19 100755 --- a/DataTex.pro.user +++ b/DataTex.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/datatex.cpp b/datatex.cpp index da408573..9ba7f3a0 100755 --- a/datatex.cpp +++ b/datatex.cpp @@ -594,33 +594,7 @@ DataTex::DataTex(QWidget *parent) } }); - // qDebug()<OpenDatabasesGridLayout->addWidget(ui->SideBarViewOptions,0,0); } void DataTex::setDefaultAction(QAction* action) @@ -663,23 +637,21 @@ void DataTex::CreateMenus_Actions() AreAllDBConnected(); },"",QIcon::fromTheme("DisconnectDB"),tr("Disconnect selected database")); ConnectAllDatabase = CreateNewAction(FileMenu,ConnectAllDatabase,[=](){ - for(DTXDatabase DTXDB : GlobalDatabaseList.values()){ - if(!DTXDB.IsConnected){ - QTreeWidgetItem * item = ui->OpenDatabasesTreeWidget->findItems(DTXDB.BaseName,Qt::MatchExactly | Qt::MatchRecursive,2).at(0); + for (auto DTXDB = GlobalDatabaseList.cbegin(), end = GlobalDatabaseList.cend(); DTXDB != end; DTXDB++){ + if(!DTXDB->IsConnected){ + QTreeWidgetItem * item = ui->OpenDatabasesTreeWidget->findItems(DTXDB->BaseName,Qt::MatchExactly | Qt::MatchRecursive,2).at(0); SetDatabaseConnected(item); } -// ConnectAllDatabase->setEnabled(false); -// DisconnectAllDatabase->setEnabled(true); } },"",QIcon::fromTheme("ConnectAllDB"),tr("Connect all databases")); DisconnectAllDatabase = CreateNewAction(FileMenu,DisconnectAllDatabase,[=](){ - for(DTXDatabase DTXDB : GlobalDatabaseList.values()){ - if(DTXDB.IsConnected){ - QTreeWidgetItem * item = ui->OpenDatabasesTreeWidget->findItems(DTXDB.BaseName,Qt::MatchExactly | Qt::MatchRecursive,2).at(0); + for (auto DTXDB = GlobalDatabaseList.cbegin(), end = GlobalDatabaseList.cend(); DTXDB != end; DTXDB++){ + if(DTXDB->IsConnected){ + QTreeWidgetItem * item = ui->OpenDatabasesTreeWidget->findItems(DTXDB->BaseName,Qt::MatchExactly | Qt::MatchRecursive,2).at(0); SetDatabaseDisconnected(item); } DisconnectAllDatabase->setEnabled(false); - ConnectAllDatabase->setEnabled(true);//If all are unencrypted + ConnectAllDatabase->setEnabled(true);//If all are not encrypted } },"",QIcon::fromTheme("DisconnectAllDB"),tr("Disconnect all databases")); FileMenu->addSeparator(); @@ -3997,7 +3969,7 @@ void DataTex::SetDatabaseConnected(QTreeWidgetItem * item) file.open(QFile::ReadWrite | QFile::Text); QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); QJsonObject dbObject(doc.object()); - dbObject["IsConnected"] = 1; + dbObject["IsConnected"] = true; file.resize(0); QJsonDocument newDoc(dbObject); file.write(newDoc.toJson()); @@ -4019,7 +3991,7 @@ void DataTex::SetDatabaseDisconnected(QTreeWidgetItem *item) file.open(QFile::ReadWrite | QFile::Text); QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); QJsonObject dbObject(doc.object()); - dbObject["IsConnected"] = 0; + dbObject["IsConnected"] = false; file.resize(0); QJsonDocument newDoc(dbObject); file.write(newDoc.toJson()); diff --git a/datatex.ui b/datatex.ui index c62595aa..dc2eee8e 100755 --- a/datatex.ui +++ b/datatex.ui @@ -1773,8 +1773,8 @@ 0 0 - 176 - 25 + 185 + 28 @@ -2215,7 +2215,7 @@ - 1 + 0 @@ -2249,8 +2249,8 @@ 0 0 - 96 - 26 + 567 + 611 @@ -3362,8 +3362,8 @@ - + diff --git a/datatex/clonedatabasefile.cpp b/datatex/clonedatabasefile.cpp index c74e1494..15a92edf 100755 --- a/datatex/clonedatabasefile.cpp +++ b/datatex/clonedatabasefile.cpp @@ -241,7 +241,7 @@ void CloneDatabaseFile::AddFiles(int row) DTXFile *FileData = new DTXFile; FileData->Id = Id; // FileData->FileType<Field<Field<Chapters<setRecordList(SqlFunctions::GetChapterInfo.arg(Id),SourceDatabase.Database); FileData->Sections<setRecordList(SqlFunctions::GetSectionInfo.arg(Id),SourceDatabase.Database); FileData->SubSections<setRecordList(SqlFunctions::GetSubsectionInfo.arg(Id),SourceDatabase.Database); @@ -404,7 +404,7 @@ void CloneDatabaseFile::on_Okbutton_accepted() if(info->misc.value()==NewFileMode::CloneModeContentAndMetadata){ //Sql queries to clone metadata to destination database QSqlQuery WriteData(DataTex::CurrentFilesDataBase.Database); - WriteData.exec(QString("INSERT OR IGNORE INTO Fields (Id,Name) VALUES(\"%1\",\"%2\")").arg(info->Field[0],info->Field[1])); + WriteData.exec(QString("INSERT OR IGNORE INTO Fields (Id,Name) VALUES(\"%1\",\"%2\")").arg(info->Field.Id,info->Field.Name)); for (QStringList chapter:info->Chapters) { WriteData.exec(QString("INSERT OR IGNORE INTO Chapters (Id,Name,Field) VALUES(\"%1\",\"%2\",\"%3\")") .arg(chapter[0],chapter[1],chapter[2])); @@ -556,7 +556,7 @@ void CloneDatabaseFile::on_SelectedFiles_itemClicked(QTreeWidgetItem *item, int ui->BibliographyBrowser->setText(info->Bibliography); ui->removeButton->setEnabled(true); ui->MetadataTable->item(0,0)->setText(info->Id); - ui->MetadataTable->item(1,0)->setText(info->Field[1]); + ui->MetadataTable->item(1,0)->setText(info->Field.Name); ui->MetadataTable->item(2,0)->setText(chapters.join("|")); ui->MetadataTable->item(3,0)->setText(sections.join("|")); ui->MetadataTable->item(4,0)->setText(subsections.join("|")); @@ -582,7 +582,7 @@ void CloneDatabaseFile::disableItems(QComboBox * combo,int excludeItems,bool che bool CloneDatabaseFile::CheckMetadataResemblances(DTXFile * fileInfo, QSqlDatabase destinationDatabase) { DTXFile resemblenceInfo; - QStringList check = SqlFunctions::Get_Record_From_Query(QString("SELECT Id='%1',Name='%2' FROM Fields WHERE (Id = '%1' OR Name = '%2')").arg(fileInfo->Field[0],fileInfo->Field[1]),destinationDatabase); + QStringList check = SqlFunctions::Get_Record_From_Query(QString("SELECT Id='%1',Name='%2' FROM Fields WHERE (Id = '%1' OR Name = '%2')").arg(fileInfo->Field.Id,fileInfo->Field.Name),destinationDatabase); QStringList chapters; QStringList sections; diff --git a/datatex/clonedatabasefile.h b/datatex/clonedatabasefile.h index 8ba4fbaf..ef588b65 100755 --- a/datatex/clonedatabasefile.h +++ b/datatex/clonedatabasefile.h @@ -18,7 +18,7 @@ #include "style.h" #include "databasecreator.h" -class DTXFile; +struct DTXFile; enum NewFileMode { BasicMode,ImportMode,EditMode,CloneModeOnlyContent,CloneModeContentAndMetadata }; diff --git a/datatex/databasecreator.cpp b/datatex/databasecreator.cpp index fd37a00c..f181dc2a 100755 --- a/datatex/databasecreator.cpp +++ b/datatex/databasecreator.cpp @@ -405,7 +405,10 @@ void DatabaseCreator::on_DatabaseCreator_accepted() basicObject["Metadata"] = metaArray; newDatabaseInfo.setObject(basicObject); - QFile file(DataTex::datatexpath+"Databases/"+NewDatabase.BaseName+".json"); + QString path = DataTex::datatexpath+"Databases/"; + QDir dir(path); + if (!dir.exists())dir.mkpath(path); + QFile file(path+NewDatabase.BaseName+".json"); file.open(QIODevice::WriteOnly); file.write(newDatabaseInfo.toJson()); file.close(); @@ -503,7 +506,6 @@ void DatabaseCreator::on_DatabaseCreator_accepted() newdatabaseFile.close(); emit newbase(NewDatabase); -// QDialog::accept(); } QString DatabaseCreator::getDatabaseTypeName(int type) @@ -528,6 +530,7 @@ QString DatabaseCreator::getDatabaseTypeName(int type) case DTXDatabaseType::ClassesDB: return tr("Classes database"); } + // default } DTXFileType::DTXFileType(){} diff --git a/datatex/filecommands.cpp b/datatex/filecommands.cpp index 870239b8..d68578c4 100755 --- a/datatex/filecommands.cpp +++ b/datatex/filecommands.cpp @@ -6,18 +6,87 @@ FileCommands::FileCommands() } -DTXFile::DTXFile() +DTXField::DTXField(){} + +DTXField::DTXField(QString id, QSqlDatabase database) { + QStringList list = SqlFunctions::Get_Record_From_Query(SqlFunctions::GetFieldInfo.arg(id),database); + Id = list.at(0); + Name = list.at(1); +} + +DTXChapter::DTXChapter(QStringList list) +{ + id = list.at(0); + name = list.at(1); + fieldId = list.at(2); +} +DTXChapters::DTXChapters(){} + +DTXChapters::DTXChapters(QString id, QSqlDatabase database) +{ + QSqlQuery query(database); + query.exec(SqlFunctions::GetChapterInfo.arg(id)); + while(query.next()){ + DTXChapter chapter; + chapter.id = query.record().value(0).toString(); + chapter.name = query.record().value(1).toString(); + chapter.fieldId = query.record().value(2).toString(); + insert(chapter.id,chapter); + } } +DTXSection::DTXSection(){} + +DTXSection::DTXSection(QStringList list) +{ + id = list.at(0); + name = list.at(1); + chapterId = list.at(2); +} + +DTXSections::DTXSections(){} + +DTXSections::DTXSections(QString id, QSqlDatabase database) +{ + QSqlQuery query(database); + query.exec(SqlFunctions::GetSectionInfo.arg(id)); + while(query.next()){ + DTXSection section; + section.id = query.record().value(0).toString(); + section.name = query.record().value(1).toString(); + section.chapter = query.record().value(2).toString(); + insert(section.id,section); + } +} + + + +DTXSubSections::DTXSubSections(){} + +DTXSubSections::DTXSubSections(QString id, QSqlDatabase database) +{ + QSqlQuery query(database); + query.exec(SqlFunctions::GetSubsectionInfo.arg(id)); + while(query.next()){ + DTXSubSection subSection; + subSection.id = query.record().value(0).toString(); + subSection.name = query.record().value(1).toString(); + subSection.section = query.record().value(2).toString(); + insert(subSection.id,subSection); + } +} + +DTXFile::DTXFile(){} + DTXFile::DTXFile(QString fileId,QSqlDatabase database){ Id=fileId; FileType = DTXFileType(SqlFunctions::Get_Record_From_Query(SqlFunctions::GetFileTypeInfo.arg(fileId),database)); - Field<> FileCommands::GetFileIdsFromContent(QString Conten QString FileCommands::NewFilePathAndId(DTXFile *info,bool needsSubSection) { - QString FieldId = info->Field[0]; - QString Fields = info->Field[1]; QString Chapters = info->getChaptersNames().join("|"); QString Sections = info->getSectionsNames().join("|"); QString ChapterId = info->getChaptersIds().join(""); QString SectionId = info->getSectionsIds().join(""); QString ExTypeId = info->getSubSectionsIds().join(""); - QString Path = QFileInfo(DataTex::CurrentFilesDataBase.Path).absolutePath()+QDir::separator()+Fields+QDir::separator()+Chapters+QDir::separator()+Sections+QDir::separator()+info->FileType.FolderName+QDir::separator(); + QString Path = QFileInfo(DataTex::CurrentFilesDataBase.Path).absolutePath()+QDir::separator()+info->Field.Name+QDir::separator()+Chapters+QDir::separator()+Sections+QDir::separator()+info->FileType.FolderName+QDir::separator(); QString prefix;// = SqlFunctions::Get_String_From_Query(QString("SELECT Prefix FROM DataBases WHERE FileName = '%1'").arg(QFileInfo(DataTex::CurrentFilesDataBase.Path).baseName()),DataTex::DataTeX_Settings); prefix = (!prefix.isEmpty() && !prefix.isNull()) ? prefix+"-" : QString() ; - QString fileId = (needsSubSection) ? prefix+FieldId+"-"+ChapterId+"-"+SectionId+"-"+ExTypeId+"-"+info->FileType.Id - : prefix+FieldId+"-"+ChapterId+"-"+SectionId+"-"+info->FileType.Id; + QString fileId = (needsSubSection) ? prefix+info->Field.Id+"-"+ChapterId+"-"+SectionId+"-"+ExTypeId+"-"+info->FileType.Id + : prefix+info->Field.Id+"-"+ChapterId+"-"+SectionId+"-"+info->FileType.Id; QStringList ExistingFiles = SqlFunctions::Get_StringList_From_Query( QString("SELECT Id FROM Database_Files WHERE Id LIKE \"%%1%\"").arg(fileId),DataTex::CurrentFilesDataBase.Database); int fileNumber = 1; @@ -779,7 +861,7 @@ void FileCommands::AddNewFileToDatabase(DTXFile * fileInfo,QSqlDatabase database QSqlQuery writeExercise(database); writeExercise.exec("INSERT INTO Database_Files (Id,FileType,Field,Difficulty,Path,Date,Solved_Prooved," "FileContent,Preamble,BuildCommand,FileDescription) " - "VALUES (\""+fileInfo->Id+"\",\""+fileInfo->FileType.Id+"\",\""+fileInfo->Field[0]+ + "VALUES (\""+fileInfo->Id+"\",\""+fileInfo->FileType.Id+"\",\""+fileInfo->Field.Id+ "\",\""+QString::number(fileInfo->Difficulty)+"\",\""+fileInfo->Path+ "\",\""+fileInfo->Date.toString("dd/M/yyyy hh:mm")+ "\",\""+QString::number((int)fileInfo->Solved)+"\",\""+fileInfo->Content+"\",\""+fileInfo->Preamble.Id+ @@ -787,9 +869,11 @@ void FileCommands::AddNewFileToDatabase(DTXFile * fileInfo,QSqlDatabase database QString fileName = fileInfo->Id; for(QString Chapter:fileInfo->getChaptersIds()){ writeExercise.exec("INSERT INTO Chapters_per_File (File_Id,Chapter_Id) VALUES (\""+fileName+"\",\""+Chapter+"\")"); + qDebug()<<"INSERT INTO Chapters_per_File (File_Id,Chapter_Id) VALUES (\""+fileName+"\",\""+Chapter+"\")"; } for(QString Section:fileInfo->getSectionsIds()){ writeExercise.exec("INSERT INTO Sections_per_File (File_Id,Section_Id) VALUES (\""+fileName+"\",\""+Section+"\")"); + qDebug()<<"INSERT INTO Sections_per_File (File_Id,Section_Id) VALUES (\""+fileName+"\",\""+Section+"\")"; } for(QString SubSection:fileInfo->getSubSectionsIds()){ writeExercise.exec("INSERT INTO ExerciseTypes_per_File (File_Id,ExerciseType_Id) VALUES (\""+fileName+"\",\""+SubSection+"\")"); @@ -826,7 +910,7 @@ void FileCommands::UpdateFileInfo(DTXFile * fileInfo,QSqlDatabase database) if (!dir.exists()) dir.mkpath("."); QString query ="UPDATE Database_Files SET " "Path=\""+fileInfo->Path+"\"," - "Field='"+fileInfo->Field[0]+"'," + "Field='"+fileInfo->Field.Id+"'," "FileDescription=\""+fileInfo->Description+"\"," "Preamble='"+fileInfo->Preamble.Id+"'," "BuildCommand='"+fileInfo->BuildCommand+"'," @@ -842,7 +926,7 @@ void FileCommands::UpdateFileInfo(DTXFile * fileInfo,QSqlDatabase database) DTXFile * FileCommands::CreateSolutionData(DTXFile * fileInfo,QSqlDatabase database) { - QStringList info =/*= fileInfo->FileType.getListFromDTXFileType();*/ + QStringList info = fileInfo->FileType.getListFromDTXFileType(); SqlFunctions::Get_Record_From_Query(QString("SELECT * FROM FileTypes WHERE BelongsTo = '%1'").arg(fileInfo->FileType.Id),database); QString Path = fileInfo->Path; // qDebug()< +{ + DTXChapters(); + DTXChapters(QString id,QSqlDatabase database); +}; + +struct DTXSection +{ + QString id; + QString name; + QString chapterId; + inline bool operator==(const DTXChapter &file2) const + { + bool isEqual; + isEqual = id == file2.id && name == file2.name && fieldId == file2.fieldId; + return isEqual; + } + + DTXSection(); + DTXSection(QStringList list); +}; + +struct DTXSections : QHash +{ + DTXSections(); + DTXSections(QString id,QSqlDatabase database); + +}; + +struct DTXSubSection +{ + QString id; + QString name; + QString section; +}; + +struct DTXSubSections : QHash +{ + DTXSubSections(); + DTXSubSections(QString id,QSqlDatabase database); +}; + struct DTXFile { QString Id = QString(); DTXFileType FileType; - QStringList Field = QStringList();//DTXField;{Id,Name,;} - QList Chapters;//DTXField; - QList Sections;//DTXField; - QList SubSections;//DTXField; + DTXField Field; + DTXChapters Chapters; + DTXSections Sections; + DTXSubSections SubSections; int Difficulty = 0; QString Path = QString(); QDateTime Date = QDateTime(); @@ -108,6 +184,8 @@ struct DTXFile { } void WriteDTexFile(); + + void setChapters(QString id, QSqlDatabase database); }; //Q_DECLARE_METATYPE(DTXFile) Q_DECLARE_METATYPE(DTXFile*) diff --git a/datatex/newdatabasefile.cpp b/datatex/newdatabasefile.cpp index a0b24bfd..762828f2 100755 --- a/datatex/newdatabasefile.cpp +++ b/datatex/newdatabasefile.cpp @@ -23,7 +23,6 @@ NewDatabaseFile::NewDatabaseFile(QWidget *parent, DTXFile *fileinfo, int mode) : ImportedFileContent = ""; } CurrentFileContent = ImportedFileContent; - // qDebug()<NewFileContentText->setEnabled(false); ui->addChapter->setProperty("Info",tr("Add new chapter for field : ")); @@ -32,7 +31,7 @@ NewDatabaseFile::NewDatabaseFile(QWidget *parent, DTXFile *fileinfo, int mode) : QSettings settings; settings.beginGroup("NewDatabaseFile"); - saveSelections = settings.value("SaveNewFileSelections").toInt();//SqlFunctions::Get_String_From_Query("SELECT Value FROM Initial_Settings WHERE Setting = 'SaveNewFileSelections'",DataTex::DataTeX_Settings).toInt(); + saveSelections = settings.value("SaveNewFileSelections").toInt(); settings.endGroup(); ui->FieldTable->setEnabled(false); @@ -187,8 +186,8 @@ void NewDatabaseFile::EditModeIsEnabled() // qDebug()<FieldTable->setCurrentItem(ui->FieldTable->findItems(metadata->Field[1],Qt::MatchExactly).at(0)); - FieldsClicked(ui->FieldTable->findItems(metadata->Field[1],Qt::MatchExactly).at(0)); + ui->FieldTable->setCurrentItem(ui->FieldTable->findItems(metadata->Field.Name,Qt::MatchExactly).at(0)); + FieldsClicked(ui->FieldTable->findItems(metadata->Field.Name,Qt::MatchExactly).at(0)); for(int i=0;iChapters->findItems(ImportedChaptersList[i],Qt::MatchExactly)){ item->setSelected(true); @@ -232,9 +231,9 @@ void NewDatabaseFile::CloneModeIsEnabled(int cloneMode) FileTypeGroup->buttons().at(i)->setChecked(true); } } - ui->FieldTable->setCurrentItem(ui->FieldTable->findItems(metadata->Field[1],Qt::MatchExactly).at(0)); - metadata->Field[0] = ui->FieldTable->currentItem()->data(Qt::UserRole).toString(); - FieldsClicked(ui->FieldTable->findItems(metadata->Field[1],Qt::MatchExactly).at(0)); + ui->FieldTable->setCurrentItem(ui->FieldTable->findItems(metadata->Field.Name,Qt::MatchExactly).at(0)); + metadata->Field.Id = ui->FieldTable->currentItem()->data(Qt::UserRole).toString(); + FieldsClicked(ui->FieldTable->findItems(metadata->Field.Name,Qt::MatchExactly).at(0)); for(int i=0;iChapters->findItems(ImportedChaptersList[i],Qt::MatchExactly)){ if(metadata->Chapters[i][1]==item->text()){ @@ -600,8 +599,8 @@ void NewDatabaseFile::FieldsClicked(QListWidgetItem * item) // Selected_Field_ids.clear(); ui->FilterChapters->setEnabled(true); // for(QListWidgetItem * item:ui->FieldTable->selectedItems()) { - // Selected_Field_ids.append(item->data(Qt::UserRole).toStringList()[0]); - // Selected_Field_names.append(item->text()); + // Selected_Field_ids.insert(item->data(Qt::UserRole).toStringList()[0]); + // Selected_Field_names.insert(item->text()); // } QString FieldId = item->data(Qt::UserRole).toStringList()[0]; @@ -617,7 +616,7 @@ void NewDatabaseFile::FieldsClicked(QListWidgetItem * item) QStringList Chapter_Names; QList ChapterList = SqlFunctions::GetRecordList(QString("SELECT * FROM Chapters WHERE Field IN (\"%1\")").arg(Selected_Field_ids.values().join("\",\"")),currentbase); - // qDebug()<Chapters->clear(); ui->Sections->clear(); ui->SubSections->clear(); @@ -641,7 +640,7 @@ void NewDatabaseFile::FieldsClicked(QListWidgetItem * item) updateTableView(ui->ExerciseFileList,SqlFunctions::UpdateTableFiles.arg(Selected_Field_ids.values().join("|"),"","","",FileType.Id)); connect(ui->ExerciseFileList->selectionModel(), &QItemSelectionModel::selectionChanged,this, &NewDatabaseFile::ExerciseFileList_selection_changed); ui->NewFileContentText->setEnabled(false); - metadata->Field = GetDataFromSelectionList(ui->FieldTable).at(0); + // metadata->Field = GetDataFromSelectionList(ui->FieldTable).at(0); // qDebug()<<"Field clicked"; } diff --git a/datatex/newdatabasefile.h b/datatex/newdatabasefile.h index 8dd82f48..b1c8d3ce 100755 --- a/datatex/newdatabasefile.h +++ b/datatex/newdatabasefile.h @@ -16,7 +16,6 @@ #include "clonedatabasefile.h" #include "datatex.h" #include "newfiletype.h" -#include "csvfunctions.h" struct DTXFile; namespace Ui { diff --git a/datatex/newfiletype.cpp b/datatex/newfiletype.cpp index 02e35765..ef039443 100755 --- a/datatex/newfiletype.cpp +++ b/datatex/newfiletype.cpp @@ -84,8 +84,9 @@ bool NewFileType::CreateNewDatabaseFileType(QSqlDatabase database,int DBType, DT "VALUES (\"%2\",\"%3\",\"%4\",\"%5\",\"%6\")").arg(tables[DBType],filetype.Id,filetype.Name, filetype.FolderName,QString::number((int)filetype.Solvable),filetype.Description); qDebug()<<(filetype.Solvable == DTXSolutionState::Solvable); - if(NewFileType.exec()){ + NewFileType.exec(); if(filetype.Solvable == DTXSolutionState::Solvable){ + QSqlQuery newSolutionFileType(database); DTXFileType filetypeSol; filetypeSol.Id = filetype.Id+"-Sol"; filetypeSol.Name = filetype.Name+tr(" - Solution"); @@ -96,18 +97,23 @@ bool NewFileType::CreateNewDatabaseFileType(QSqlDatabase database,int DBType, DT filetypeSol.BuiltIn = false; filetypeSol.DBType = (DTXDatabaseType)DBType; - NewFileType.prepare(QString("INSERT OR IGNORE INTO %1 (Id,Name,FolderName,Solvable,BelongsTo,Description) " + newSolutionFileType.prepare(QString("INSERT OR IGNORE INTO %1 (Id,Name,FolderName,Solvable,BelongsTo,Description) " "VALUES(\"%2\",\"%3\",\"%4\",\"%5\",\"%6\",\"%7\")") .arg(tables[DBType],filetypeSol.Id,filetypeSol.Name, filetypeSol.FolderName,QString::number((int)filetypeSol.Solvable) ,filetypeSol.BelongsTo,filetypeSol.Description)); - NewFileType.exec(); + qDebug()< - - - - - - - - - + style="fill:#71c837;stroke-width:27.4835;stroke-dasharray:none" + d="M 432.85742,225.7168 A 143.142,143.142 0 0 0 289.71679,368.85938 143.142,143.142 0 0 0 432.85742,512 143.142,143.142 0 0 0 576,368.85938 143.142,143.142 0 0 0 432.85742,225.7168 Z m 65.94726,62.76758 32.25391,32.60742 -98.72461,99.92578 0.0176,0.0449 -27.82227,28.12891 -0.0859,-0.0879 -0.1289,0.13086 -27.86524,-28.17188 0.0195,-0.0449 -41.8125,-42.32422 32.25196,-32.60937 37.49414,37.95117 81.33203,-82.32227 z" /> diff --git a/images/Dark_Theme/DatabaseAdd.svg b/images/Dark_Theme/DatabaseAdd.svg index 9ce48363..57b6cf7f 100755 --- a/images/Dark_Theme/DatabaseAdd.svg +++ b/images/Dark_Theme/DatabaseAdd.svg @@ -8,7 +8,7 @@ style="enable-background:new 0 0 122.88 120.54" xml:space="preserve" sodipodi:docname="DatabaseAdd.svg" - inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -34,8 +34,8 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="694" + inkscape:window-width="1920" + inkscape:window-height="1012" id="namedview9" showgrid="false" inkscape:zoom="2.1901443" @@ -60,15 +60,15 @@ style="fill:#f2f2f2;fill-opacity:1;stroke-width:0.187408" d="M 53.6875 8.2988281 C 30.851363 8.2988281 12.324219 14.548658 12.324219 22.210938 L 12.324219 30.90625 C 12.324219 38.56853 30.851363 44.816406 53.6875 44.816406 C 76.523637 44.816406 95.050781 38.56853 95.050781 30.90625 L 95.050781 22.210938 C 95.050781 14.548658 76.523637 8.2988281 53.6875 8.2988281 z M 12.324219 41.773438 L 12.324219 61.335938 C 12.324219 68.998219 30.851363 75.248047 53.6875 75.248047 C 57.882036 75.248047 61.926508 75.034288 65.742188 74.642578 L 65.742188 59.611328 C 65.74223 54.416474 70.078542 50.081233 75.273438 50.082031 L 79.017578 50.082031 C 81.614806 50.082429 83.997525 51.167181 85.730469 52.900391 C 87.463412 54.633599 88.546874 57.016055 88.546875 59.613281 L 88.546875 68.810547 C 92.65763 66.649021 95.050781 64.084148 95.050781 61.335938 L 95.050781 41.773438 C 86.16392 48.077139 69.899024 51.011719 53.6875 51.011719 C 37.475976 51.011719 21.2109 48.077139 12.324219 41.773438 z M 12.324219 72.205078 L 12.324219 91.767578 C 12.324219 99.429857 30.851363 105.67969 53.6875 105.67969 C 57.882036 105.67969 61.926508 105.46593 65.742188 105.07422 L 65.742188 99.175781 L 48.982422 99.175781 C 43.787973 99.175782 39.453933 94.840931 39.453125 89.646484 L 39.453125 85.904297 C 39.452823 84.04281 40.015502 82.295766 40.96875 80.814453 C 29.400966 79.651216 18.863124 76.843402 12.324219 72.205078 z M 95.050781 72.205078 C 93.189013 73.525683 90.987954 74.689886 88.546875 75.71875 L 88.546875 76.371094 L 95.050781 76.371094 L 95.050781 72.205078 z M 88.546875 99.175781 L 88.546875 99.242188 C 88.589102 99.219984 88.631967 99.19807 88.673828 99.175781 L 88.546875 99.175781 z " /> diff --git a/images/Dark_Theme/Delimiters.svg b/images/Dark_Theme/Delimiters.svg index 59d5bf76..559f0847 100755 --- a/images/Dark_Theme/Delimiters.svg +++ b/images/Dark_Theme/Delimiters.svg @@ -6,15 +6,18 @@ + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + id="cmsy10" + horiz-origin-x="0" + horiz-origin-y="0" + vert-origin-x="512" + vert-origin-y="768" + vert-adv-y="1024"> + style="fill:#f2f2f2" + transform="translate(5.244,-1.164)"> { + + + + \{ + + + diff --git a/images/Dark_Theme/DisconnectDB.svg b/images/Dark_Theme/DisconnectDB.svg index ea1074ba..21026749 100755 --- a/images/Dark_Theme/DisconnectDB.svg +++ b/images/Dark_Theme/DisconnectDB.svg @@ -3,8 +3,8 @@ viewBox="0 0 576 512" version="1.1" id="svg1" - sodipodi:docname="plug-circle-minus.svg" - inkscape:version="1.3 (0e150ed6c4, 2023-07-21)" + sodipodi:docname="DisconnectDB.svg" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -20,22 +20,24 @@ inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" - inkscape:zoom="0.77951389" - inkscape:cx="288" - inkscape:cy="255.92873" - inkscape:window-width="1366" - inkscape:window-height="694" + inkscape:zoom="1.5590278" + inkscape:cx="484.59688" + inkscape:cy="301.46993" + inkscape:window-width="1920" + inkscape:window-height="1012" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg1" /> + style="fill:#f2f2f2" + sodipodi:nodetypes="ssccssssccsssscscsssccscsss" /> + d="m 436.66797,224.9668 c -29.36292,-0.98642 -58.93101,6.98527 -84.12109,24.07226 -73.35216,49.75639 -85.4635,151.91799 -25.5586,215.58594 5.92062,6.29253 14.00166,13.91502 17.95899,16.9375 20.76018,15.85603 46.11352,26.08655 71.80859,28.97852 20.32467,2.28751 46.72811,-1.20632 66.23828,-8.76758 42.75092,-16.56834 75.02706,-52.2472 87.32422,-96.5293 4.53215,-16.32032 5.74759,-46.23609 2.56641,-63.12305 -6.40934,-34.02324 -26.32324,-66.6865 -53.33008,-87.4707 -24.36592,-18.75177 -53.52381,-28.69718 -82.88672,-29.68359 z m -95.4043,116.73437 h 180.93945 v 52.71485 H 341.26367 Z" + sodipodi:nodetypes="ssssssssssccccc" /> diff --git a/images/Dark_Theme/FileDependencies.svg b/images/Dark_Theme/FileDependencies.svg index 99eee326..ead97977 100755 --- a/images/Dark_Theme/FileDependencies.svg +++ b/images/Dark_Theme/FileDependencies.svg @@ -7,7 +7,7 @@ viewBox="0 0 33.866667 33.866667" version="1.1" id="svg5" - inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" sodipodi:docname="FileDependencies.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" @@ -24,36 +24,17 @@ inkscape:deskcolor="#505050" inkscape:document-units="mm" showgrid="false" - inkscape:zoom="2.3786088" - inkscape:cx="53.182348" - inkscape:cy="58.017106" - inkscape:window-width="1366" - inkscape:window-height="694" + inkscape:zoom="3.3638608" + inkscape:cx="93.345123" + inkscape:cy="112.96544" + inkscape:window-width="1920" + inkscape:window-height="1012" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="layer1" /> - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/images/Dark_Theme/Locked.svg b/images/Dark_Theme/Locked.svg index fe71163f..b0db68f4 100755 --- a/images/Dark_Theme/Locked.svg +++ b/images/Dark_Theme/Locked.svg @@ -1,10 +1,12 @@ + style="fill:#e6e6e6;fill-opacity:1" /> diff --git a/images/Dark_Theme/Tex.svg b/images/Dark_Theme/Tex.svg index 316562e3..0fefd677 100755 --- a/images/Dark_Theme/Tex.svg +++ b/images/Dark_Theme/Tex.svg @@ -7,7 +7,7 @@ version="1.1" xml:space="preserve" sodipodi:docname="Tex.svg" - inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -24,11 +24,11 @@ inkscape:pagecheckerboard="1" inkscape:deskcolor="#505050" showgrid="false" - inkscape:zoom="1.84375" - inkscape:cx="12.474576" - inkscape:cy="64.271186" - inkscape:window-width="1366" - inkscape:window-height="694" + inkscape:zoom="7.375" + inkscape:cx="79.254237" + inkscape:cy="87.457627" + inkscape:window-width="1920" + inkscape:window-height="1012" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" @@ -86,7 +86,7 @@ id="g550" transform="matrix(0.94755211,0,0,0.94755211,104.23689,12.038628)" />