mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
try to fix migration
This commit is contained in:
parent
a56d6b084c
commit
05aa4e017b
1 changed files with 15 additions and 9 deletions
|
@ -121,15 +121,7 @@ void ImageUploader::initialize(Settings &settings, Paths &paths)
|
|||
this->uploadedImagesSetting_ = std::make_unique<
|
||||
pajlada::Settings::Setting<std::vector<UploadedImage>>>(
|
||||
"/uploadedImages", this->sm_);
|
||||
|
||||
for (const auto &item : this->uploadedImagesSetting_->getValue())
|
||||
{
|
||||
this->images_.append(item);
|
||||
}
|
||||
this->signals_.addConnection(
|
||||
this->images_.delayedItemsChanged.connect([this]() {
|
||||
this->uploadedImagesSetting_->setValue(this->images_.raw());
|
||||
}));
|
||||
this->sm_->load();
|
||||
|
||||
// try to read old log
|
||||
QFile oldLogFile(oldLogName);
|
||||
|
@ -164,6 +156,20 @@ void ImageUploader::initialize(Settings &settings, Paths &paths)
|
|||
}
|
||||
oldLogFile.close();
|
||||
oldLogFile.rename(combinePath(logPath, "ImageUploader.old.json"));
|
||||
}
|
||||
|
||||
for (const auto &item : this->uploadedImagesSetting_->getValue())
|
||||
{
|
||||
this->images_.append(item);
|
||||
}
|
||||
this->signals_.addConnection(
|
||||
this->images_.delayedItemsChanged.connect([this]() {
|
||||
this->uploadedImagesSetting_->setValue(this->images_.raw());
|
||||
}));
|
||||
|
||||
if (isOldLogFileOkay)
|
||||
{
|
||||
this->uploadedImagesSetting_->setValue(this->images_.raw());
|
||||
this->sm_->save();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue