mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 08:54:12 +08:00
improve process selection
This commit is contained in:
parent
6ba4f9c909
commit
c9240d9e68
@ -11,7 +11,6 @@ AttachProcessDialog::AttachProcessDialog(QWidget *parent, std::vector<std::pair<
|
||||
ui.setupUi(this);
|
||||
setWindowTitle(SELECT_PROCESS);
|
||||
ui.label->setText(ATTACH_INFO);
|
||||
ui.processIdEdit->setValidator(new QIntValidator(0, INT_MAX, this));
|
||||
ui.processList->setModel(&model);
|
||||
|
||||
QPixmap transparent(100, 100);
|
||||
@ -25,24 +24,16 @@ AttachProcessDialog::AttachProcessDialog(QWidget *parent, std::vector<std::pair<
|
||||
|
||||
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
connect(ui.processList, &QListView::clicked, [this](QModelIndex index)
|
||||
connect(ui.processList, &QListView::clicked, [this](QModelIndex index) { ui.processEdit->setText(model.item(index.row())->text()); });
|
||||
connect(ui.processList, &QListView::doubleClicked, this, &QDialog::accept);
|
||||
connect(ui.processEdit, &QLineEdit::textEdited, [this](QString process)
|
||||
{
|
||||
selectedProcess = model.item(index.row())->text();
|
||||
for (int i = 0; i < model.rowCount(); ++i) ui.processList->setRowHidden(i, !model.item(i)->text().contains(process, Qt::CaseInsensitive));
|
||||
});
|
||||
connect(ui.processList, &QListView::doubleClicked, [this](QModelIndex index)
|
||||
{
|
||||
selectedProcess = model.item(index.row())->text();
|
||||
accept();
|
||||
});
|
||||
connect(ui.processIdEdit, &QLineEdit::returnPressed, [this]
|
||||
{
|
||||
selectedProcess = ui.processIdEdit->text();
|
||||
accept();
|
||||
});
|
||||
|
||||
connect(ui.processEdit, &QLineEdit::returnPressed, this, &QDialog::accept);
|
||||
}
|
||||
|
||||
QString AttachProcessDialog::SelectedProcess()
|
||||
{
|
||||
return selectedProcess.isEmpty() ? ui.processIdEdit->text() : selectedProcess;
|
||||
return ui.processEdit->text();
|
||||
}
|
||||
|
@ -18,11 +18,7 @@
|
||||
<widget class="QLabel" name="label"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="processIdEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Process id</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="processEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="processList"/>
|
||||
|
2
text.cpp
2
text.cpp
@ -34,7 +34,7 @@ const char* EXTENSIONS = u8"Extensions";
|
||||
const char* SELECT_PROCESS = u8"Select process";
|
||||
const char* ATTACH_INFO = u8R"(If you don't see the process you want to attach, try running with admin rights
|
||||
You can also type in the process ID)";
|
||||
const char* SELECT_PROCESS_INFO = u8"If you manually type in the process file name, please use the absolute path";
|
||||
const char* SELECT_PROCESS_INFO = u8"If you manually type in the process file name, use the absolute path";
|
||||
const char* FROM_COMPUTER = u8"Select from computer";
|
||||
const char* PROCESSES = u8"Processes (*.exe)";
|
||||
const char* CODE_INFODUMP = u8R"(Enter read code
|
||||
|
Loading…
x
Reference in New Issue
Block a user