mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
Sync group after updating instance
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
@ -296,8 +296,18 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
view->setAttribute(Qt::WA_MacShowFocusRect, false);
|
view->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
connect(delegate, &ListViewDelegate::textChanged, this, [this](QString before, QString after) {
|
connect(delegate, &ListViewDelegate::textChanged, this, [this](QString before, QString after) {
|
||||||
if (auto newRoot = askToUpdateInstanceDirName(m_selectedInstance, before, after, this); !newRoot.isEmpty()) {
|
if (auto newRoot = askToUpdateInstanceDirName(m_selectedInstance, before, after, this); !newRoot.isEmpty()) {
|
||||||
|
auto oldID = m_selectedInstance->id();
|
||||||
|
auto newID = QFileInfo(newRoot).fileName();
|
||||||
|
QString origGroup(APPLICATION->instances()->getInstanceGroup(oldID));
|
||||||
|
bool syncGroup = origGroup != GroupId() && oldID != newID;
|
||||||
|
if (syncGroup)
|
||||||
|
APPLICATION->instances()->setInstanceGroup(oldID, GroupId());
|
||||||
|
|
||||||
refreshInstances();
|
refreshInstances();
|
||||||
setSelectedInstanceById(QFileInfo(newRoot).fileName());
|
setSelectedInstanceById(newID);
|
||||||
|
|
||||||
|
if (syncGroup)
|
||||||
|
APPLICATION->instances()->setInstanceGroup(newID, origGroup);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user