mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 13:55:26 +00:00
Added IO list to NewFileDialog
This commit is contained in:
parent
b222aaa094
commit
ecb5fc75cf
@ -63,12 +63,10 @@ NewFileDialog::NewFileDialog(QWidget *parent) :
|
|||||||
ui->logoSvgWidget->load(Config()->getLogoFile());
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
||||||
|
|
||||||
fillRecentFilesList();
|
fillRecentFilesList();
|
||||||
|
fillIOPluginsList();
|
||||||
|
|
||||||
if (Config()->getNewFileLastClicked() == TAB_PROJECTS) {
|
// Set last clicked tab
|
||||||
ui->tabWidget->setCurrentWidget(ui->projectsTab);
|
ui->tabWidget->setCurrentIndex(Config()->getNewFileLastClicked());
|
||||||
} else {
|
|
||||||
ui->tabWidget->setCurrentWidget(ui->filesTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->loadProjectButton->setEnabled(ui->projectsListWidget->currentItem() != nullptr);
|
ui->loadProjectButton->setEnabled(ui->projectsListWidget->currentItem() != nullptr);
|
||||||
|
|
||||||
@ -306,9 +304,24 @@ bool NewFileDialog::fillProjectsList()
|
|||||||
return !projects.isEmpty();
|
return !projects.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewFileDialog::fillIOPluginsList()
|
||||||
|
{
|
||||||
|
ui->ioPlugin->clear();
|
||||||
|
ui->ioPlugin->addItem("");
|
||||||
|
ui->ioPlugin->setItemData(0, tr("Open a file with no extra treatment."), Qt::ToolTipRole);
|
||||||
|
|
||||||
|
int index = 1;
|
||||||
|
QList<RIOPluginDescription> ioPlugins = Core()->getRIOPluginDescriptions();
|
||||||
|
for (RIOPluginDescription plugin : ioPlugins) {
|
||||||
|
ui->ioPlugin->addItem(plugin.name);
|
||||||
|
ui->ioPlugin->setItemData(index, plugin.description, Qt::ToolTipRole);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NewFileDialog::loadFile(const QString &filename)
|
void NewFileDialog::loadFile(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!ui->checkBox_FilelessOpen->isChecked() && !Core()->tryFile(filename, false)) {
|
if (ui->ioPlugin->currentIndex() == 0 && !Core()->tryFile(filename, false) && !ui->checkBox_FilelessOpen->isChecked()) {
|
||||||
QMessageBox msgBox(this);
|
QMessageBox msgBox(this);
|
||||||
msgBox.setText(tr("Select a new program or a previous one before continuing."));
|
msgBox.setText(tr("Select a new program or a previous one before continuing."));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
@ -327,7 +340,8 @@ void NewFileDialog::loadFile(const QString &filename)
|
|||||||
|
|
||||||
// Close dialog and open MainWindow/OptionsDialog
|
// Close dialog and open MainWindow/OptionsDialog
|
||||||
MainWindow *main = new MainWindow();
|
MainWindow *main = new MainWindow();
|
||||||
main->openNewFile(filename);
|
QString ioFile = ui->ioPlugin->currentText() + "://" + filename;
|
||||||
|
main->openNewFile(ioFile);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ class NewFileDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit NewFileDialog(QWidget *parent = nullptr);
|
explicit NewFileDialog(QWidget *parent = nullptr);
|
||||||
~NewFileDialog();
|
~NewFileDialog();
|
||||||
enum newFileTabs { TAB_FILES = 0, TAB_PROJECTS };
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_loadFileButton_clicked();
|
void on_loadFileButton_clicked();
|
||||||
@ -55,6 +54,7 @@ private:
|
|||||||
* @return true if list is not empty
|
* @return true if list is not empty
|
||||||
*/
|
*/
|
||||||
bool fillProjectsList();
|
bool fillProjectsList();
|
||||||
|
void fillIOPluginsList();
|
||||||
|
|
||||||
void loadFile(const QString &filename);
|
void loadFile(const QString &filename);
|
||||||
void loadProject(const QString &project);
|
void loadProject(const QString &project);
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="1">
|
<item row="1" column="3">
|
||||||
<widget class="QPushButton" name="selectFileButton">
|
<widget class="QPushButton" name="selectFileButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -164,7 +164,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="2">
|
||||||
<widget class="QLineEdit" name="newFileEdit">
|
<widget class="QLineEdit" name="newFileEdit">
|
||||||
<property name="frame">
|
<property name="frame">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -174,7 +174,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="newFileLabel">
|
<widget class="QLabel" name="newFileLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -183,7 +183,24 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Select new file</span></p></body></html></string>
|
<string><b>Select new file<b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QComboBox" name="ioPlugin"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="ioLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>IO</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>://</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user