mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
improve edit chain
This commit is contained in:
@@ -44,13 +44,30 @@ void EditChain::on_select_profile_clicked() {
|
||||
});
|
||||
}
|
||||
|
||||
void EditChain::AddProfileToListIfExist(int id) {
|
||||
auto _ent = NekoRay::profileManager->GetProfile(id);
|
||||
void EditChain::AddProfileToListIfExist(int profileId) {
|
||||
auto _ent = NekoRay::profileManager->GetProfile(profileId);
|
||||
if (_ent != nullptr && _ent->type != "chain") {
|
||||
auto wI = new QListWidgetItem();
|
||||
wI->setData(114514, profileId);
|
||||
auto w = new ProxyItem(this, _ent, wI);
|
||||
wI->setData(114514, id);
|
||||
ui->listWidget->addItem(wI);
|
||||
ui->listWidget->setItemWidget(wI, w);
|
||||
// change button
|
||||
connect(w->get_change_button(), &QPushButton::clicked, w, [=] {
|
||||
get_edit_dialog()->hide();
|
||||
GetMainWindow()->start_select_mode(w, [=](int newId) {
|
||||
get_edit_dialog()->show();
|
||||
ReplaceProfile(w, newId);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void EditChain::ReplaceProfile(ProxyItem *w, int profileId) {
|
||||
auto _ent = NekoRay::profileManager->GetProfile(profileId);
|
||||
if (_ent != nullptr && _ent->type != "chain") {
|
||||
w->item->setData(114514, profileId);
|
||||
w->ent = _ent;
|
||||
w->refresh_data();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user