first pieces of preferences dialog
This commit is contained in:
@ -69,7 +69,6 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setCentralWidget(ui->textEdit);
|
this->setCentralWidget(ui->textEdit);
|
||||||
highlighter = new Highlighter(ui->textEdit->document());
|
highlighter = new Highlighter(ui->textEdit->document());
|
||||||
prefdialog = new Preferences(this);
|
|
||||||
capturer = new StdCapture;
|
capturer = new StdCapture;
|
||||||
current_file.clear();
|
current_file.clear();
|
||||||
current_dir = QDir(".").absolutePath();
|
current_dir = QDir(".").absolutePath();
|
||||||
@ -619,8 +618,8 @@ void LammpsGui::manual()
|
|||||||
|
|
||||||
void LammpsGui::preferences()
|
void LammpsGui::preferences()
|
||||||
{
|
{
|
||||||
QString helpmsg = "This is LAMMPS-GUI version " LAMMPS_GUI_VERSION;
|
Preferences prefs(&lammps);
|
||||||
QMessageBox::information(this, "LAMMPS-GUI Help", helpmsg);
|
prefs.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LammpsGui::start_lammps()
|
void LammpsGui::start_lammps()
|
||||||
|
|||||||
@ -19,10 +19,7 @@
|
|||||||
#include "library.h"
|
#include "library.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LammpsWrapper::LammpsWrapper() :
|
LammpsWrapper::LammpsWrapper() : lammps_handle(nullptr), plugin_handle(nullptr) {}
|
||||||
lammps_handle(nullptr), plugin_handle(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LammpsWrapper::open(int narg, char **args)
|
void LammpsWrapper::open(int narg, char **args)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,6 +14,82 @@
|
|||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QSettings>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
Preferences::Preferences(QWidget *parent) : QDialog(parent) {}
|
#include "lammpswrapper.h"
|
||||||
|
|
||||||
|
Preferences::Preferences(LammpsWrapper *_lammps, QWidget *parent) :
|
||||||
|
QDialog(parent), tabWidget(new QTabWidget),
|
||||||
|
buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok)), settings(new QSettings), lammps(_lammps)
|
||||||
|
{
|
||||||
|
tabWidget->addTab(new AcceleratorTab(settings, lammps), "Accelerators");
|
||||||
|
tabWidget->addTab(new SnapshotTab(settings), "Snapshot Image");
|
||||||
|
|
||||||
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
|
||||||
|
auto *layout = new QVBoxLayout;
|
||||||
|
layout->addWidget(tabWidget);
|
||||||
|
layout->addWidget(buttonBox);
|
||||||
|
setLayout(layout);
|
||||||
|
setWindowTitle("LAMMPS-GUI - Preferences");
|
||||||
|
resize(400, 320);
|
||||||
|
}
|
||||||
|
|
||||||
|
Preferences::~Preferences()
|
||||||
|
{
|
||||||
|
delete buttonBox;
|
||||||
|
delete tabWidget;
|
||||||
|
delete settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceleratorTab::AcceleratorTab(QSettings *_settings, LammpsWrapper *_lammps, QWidget *parent) :
|
||||||
|
QWidget(parent), settings(_settings), lammps(_lammps)
|
||||||
|
{
|
||||||
|
QGroupBox *accelerator = new QGroupBox("Choose Accelerator");
|
||||||
|
QRadioButton *none = new QRadioButton("&None");
|
||||||
|
QRadioButton *kokkos = new QRadioButton("&Kokkos");
|
||||||
|
QRadioButton *intel = new QRadioButton("&Intel");
|
||||||
|
QRadioButton *openmp = new QRadioButton("&OpenMP");
|
||||||
|
QRadioButton *opt = new QRadioButton("O&pt");
|
||||||
|
|
||||||
|
none->setChecked(true);
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
layout->addWidget(none);
|
||||||
|
layout->addWidget(kokkos);
|
||||||
|
layout->addWidget(intel);
|
||||||
|
layout->addWidget(openmp);
|
||||||
|
layout->addWidget(opt);
|
||||||
|
layout->addStretch(1);
|
||||||
|
setLayout(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
SnapshotTab::SnapshotTab(QSettings *_settings, QWidget *parent) :
|
||||||
|
QWidget(parent), settings(_settings)
|
||||||
|
{
|
||||||
|
QGridLayout *grid = new QGridLayout;
|
||||||
|
|
||||||
|
QLabel *xsize = new QLabel("Image width:");
|
||||||
|
QLabel *ysize = new QLabel("Image height:");
|
||||||
|
QLabel *zoom = new QLabel("Zoom factor:");
|
||||||
|
QLineEdit *xval = new QLineEdit(settings->value("xsize", "800").toString());
|
||||||
|
QLineEdit *yval = new QLineEdit(settings->value("ysize", "600").toString());
|
||||||
|
QLineEdit *zval = new QLineEdit(settings->value("zoom", "1.0").toString());
|
||||||
|
|
||||||
|
grid->addWidget(xsize, 0, 0);
|
||||||
|
grid->addWidget(ysize, 1, 0);
|
||||||
|
grid->addWidget(zoom, 2, 0);
|
||||||
|
grid->addWidget(xval, 0, 1);
|
||||||
|
grid->addWidget(yval, 1, 1);
|
||||||
|
grid->addWidget(zval, 2, 1);
|
||||||
|
setLayout(grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// c-basic-offset: 4
|
||||||
|
// End:
|
||||||
|
|||||||
@ -16,17 +16,51 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
class QTabWidget;
|
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
|
class QSettings;
|
||||||
|
class QTabWidget;
|
||||||
|
class LammpsWrapper;
|
||||||
|
|
||||||
class Preferences : public QDialog {
|
class Preferences : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Preferences(QWidget *parent = nullptr);
|
explicit Preferences(LammpsWrapper *lammps, QWidget *parent = nullptr);
|
||||||
|
~Preferences() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTabWidget *tabWidget;
|
QTabWidget *tabWidget;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
|
QSettings *settings;
|
||||||
|
LammpsWrapper *lammps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// individual tabs
|
||||||
|
|
||||||
|
class AcceleratorTab : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AcceleratorTab(QSettings *settings, LammpsWrapper *lammps, QWidget *parent = nullptr);
|
||||||
|
enum { None, Intel, Kokkos, OpenMP, Opt };
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSettings *settings;
|
||||||
|
LammpsWrapper *lammps;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SnapshotTab : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SnapshotTab(QSettings *settings, QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSettings *settings;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// c-basic-offset: 4
|
||||||
|
// End:
|
||||||
|
|||||||
Reference in New Issue
Block a user