RedPanda-CPP/RedPandaIDE/settingsdialog/projectdllhostwidget.cpp

48 lines
1.2 KiB
C++

#include "projectdllhostwidget.h"
#include "ui_projectdllhostwidget.h"
#include "../project.h"
#include "../mainwindow.h"
#include "../iconsmanager.h"
#include <QFileDialog>
ProjectDLLHostWidget::ProjectDLLHostWidget(const QString &name, const QString &group, QWidget *parent) :
SettingsWidget(name,group,parent),
ui(new Ui::ProjectDLLHostWidget)
{
ui->setupUi(this);
}
ProjectDLLHostWidget::~ProjectDLLHostWidget()
{
delete ui;
}
void ProjectDLLHostWidget::doLoad()
{
ui->txtHost->setText(pMainWindow->project()->options().hostApplication);
}
void ProjectDLLHostWidget::doSave()
{
pMainWindow->project()->options().hostApplication = ui->txtHost->text();
}
void ProjectDLLHostWidget::on_btnBrowse_clicked()
{
QString filename = QFileDialog::getOpenFileName(
this,
tr("Choose host application"),
pMainWindow->project()->directory(),
tr("All files (*.*)"));
if (!filename.isEmpty() && fileExists(filename)) {
ui->txtHost->setText(filename);
}
}
void ProjectDLLHostWidget::updateIcons(const QSize &size)
{
pIconsManager->setIcon(ui->btnBrowse, IconsManager::ACTION_FILE_OPEN_FOLDER);
}