make more use of auto and thus avoid having to specify the same type twice
This commit is contained in:
@ -253,7 +253,7 @@ void ChartWindow::closeEvent(QCloseEvent *event)
|
|||||||
bool ChartWindow::eventFilter(QObject *watched, QEvent *event)
|
bool ChartWindow::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||||
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
||||||
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
||||||
stop_run();
|
stop_run();
|
||||||
|
|||||||
@ -620,7 +620,7 @@ void CodeEditor::dropEvent(QDropEvent *event)
|
|||||||
if (event->mimeData()->hasUrls()) {
|
if (event->mimeData()->hasUrls()) {
|
||||||
event->accept();
|
event->accept();
|
||||||
auto file = event->mimeData()->urls()[0].toLocalFile();
|
auto file = event->mimeData()->urls()[0].toLocalFile();
|
||||||
auto gui = dynamic_cast<LammpsGui *>(parent());
|
auto *gui = dynamic_cast<LammpsGui *>(parent());
|
||||||
if (gui) {
|
if (gui) {
|
||||||
moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||||
gui->open_file(file);
|
gui->open_file(file);
|
||||||
@ -687,17 +687,17 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
auto *menu = createStandardContextMenu();
|
auto *menu = createStandardContextMenu();
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
if (textCursor().hasSelection()) {
|
if (textCursor().hasSelection()) {
|
||||||
auto action1 = menu->addAction("Comment out selection");
|
auto *action1 = menu->addAction("Comment out selection");
|
||||||
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action1, &QAction::triggered, this, &CodeEditor::comment_selection);
|
connect(action1, &QAction::triggered, this, &CodeEditor::comment_selection);
|
||||||
auto action2 = menu->addAction("Uncomment selection");
|
auto *action2 = menu->addAction("Uncomment selection");
|
||||||
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_selection);
|
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_selection);
|
||||||
} else {
|
} else {
|
||||||
auto action1 = menu->addAction("Comment out line");
|
auto *action1 = menu->addAction("Comment out line");
|
||||||
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action1, &QAction::triggered, this, &CodeEditor::comment_line);
|
connect(action1, &QAction::triggered, this, &CodeEditor::comment_line);
|
||||||
auto action2 = menu->addAction("Uncomment line");
|
auto *action2 = menu->addAction("Uncomment line");
|
||||||
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_line);
|
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_line);
|
||||||
}
|
}
|
||||||
@ -705,14 +705,14 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
// print augmented context menu if an entry was found
|
// print augmented context menu if an entry was found
|
||||||
if (!help.isEmpty()) {
|
if (!help.isEmpty()) {
|
||||||
auto action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
auto *action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
||||||
action->setIcon(QIcon(":/icons/expand-text.png"));
|
action->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
|
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!page.isEmpty()) {
|
if (!page.isEmpty()) {
|
||||||
auto action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
auto *action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
||||||
action->setIcon(QIcon(":/icons/format-indent-less-3.png"));
|
action->setIcon(QIcon(":/icons/format-indent-less-3.png"));
|
||||||
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);
|
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);
|
||||||
|
|
||||||
@ -728,13 +728,13 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
help = words.at(0);
|
help = words.at(0);
|
||||||
page = words.at(0);
|
page = words.at(0);
|
||||||
page += ".html";
|
page += ".html";
|
||||||
auto action2 = menu->addAction(QString("View Documentation for '%1'").arg(help));
|
auto *action2 = menu->addAction(QString("View Documentation for '%1'").arg(help));
|
||||||
action2->setIcon(QIcon(":/icons/system-help.png"));
|
action2->setIcon(QIcon(":/icons/system-help.png"));
|
||||||
action2->setData(page);
|
action2->setData(page);
|
||||||
connect(action2, &QAction::triggered, this, &CodeEditor::open_help);
|
connect(action2, &QAction::triggered, this, &CodeEditor::open_help);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto action = menu->addAction(QString("LAMMPS Manual"));
|
auto *action = menu->addAction(QString("LAMMPS Manual"));
|
||||||
action->setIcon(QIcon(":/icons/help-browser.png"));
|
action->setIcon(QIcon(":/icons/help-browser.png"));
|
||||||
action->setData(QString());
|
action->setData(QString());
|
||||||
connect(action, &QAction::triggered, this, &CodeEditor::open_help);
|
connect(action, &QAction::triggered, this, &CodeEditor::open_help);
|
||||||
@ -1166,7 +1166,7 @@ void CodeEditor::find_help(QString &page, QString &help)
|
|||||||
|
|
||||||
void CodeEditor::open_help()
|
void CodeEditor::open_help()
|
||||||
{
|
{
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
auto *act = qobject_cast<QAction *>(sender());
|
||||||
QDesktopServices::openUrl(
|
QDesktopServices::openUrl(
|
||||||
QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString())));
|
QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString())));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
// duplicate string, STL version
|
// duplicate string, STL version
|
||||||
char *mystrdup(const std::string &text)
|
char *mystrdup(const std::string &text)
|
||||||
{
|
{
|
||||||
auto tmp = new char[text.size() + 1];
|
auto *tmp = new char[text.size() + 1];
|
||||||
memcpy(tmp, text.c_str(), text.size() + 1);
|
memcpy(tmp, text.c_str(), text.size() + 1);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
|
|||||||
scrollArea->setWidget(imageLabel);
|
scrollArea->setWidget(imageLabel);
|
||||||
scrollArea->setVisible(false);
|
scrollArea->setVisible(false);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
auto *mainLayout = new QVBoxLayout;
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
|
|||||||
combo->addItem(gname);
|
combo->addItem(gname);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHBoxLayout *menuLayout = new QHBoxLayout;
|
auto *menuLayout = new QHBoxLayout;
|
||||||
menuLayout->addWidget(menuBar);
|
menuLayout->addWidget(menuBar);
|
||||||
menuLayout->addWidget(renderstatus);
|
menuLayout->addWidget(renderstatus);
|
||||||
menuLayout->addWidget(new QLabel(" Width: "));
|
menuLayout->addWidget(new QLabel(" Width: "));
|
||||||
@ -324,7 +324,7 @@ void ImageViewer::reset_view()
|
|||||||
|
|
||||||
void ImageViewer::edit_size()
|
void ImageViewer::edit_size()
|
||||||
{
|
{
|
||||||
QSpinBox *field = qobject_cast<QSpinBox *>(sender());
|
auto *field = qobject_cast<QSpinBox *>(sender());
|
||||||
if (field->objectName() == "xsize") {
|
if (field->objectName() == "xsize") {
|
||||||
xsize = field->value();
|
xsize = field->value();
|
||||||
} else if (field->objectName() == "ysize") {
|
} else if (field->objectName() == "ysize") {
|
||||||
@ -335,7 +335,7 @@ void ImageViewer::edit_size()
|
|||||||
|
|
||||||
void ImageViewer::toggle_ssao()
|
void ImageViewer::toggle_ssao()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
usessao = !usessao;
|
usessao = !usessao;
|
||||||
button->setChecked(usessao);
|
button->setChecked(usessao);
|
||||||
createImage();
|
createImage();
|
||||||
@ -343,7 +343,7 @@ void ImageViewer::toggle_ssao()
|
|||||||
|
|
||||||
void ImageViewer::toggle_anti()
|
void ImageViewer::toggle_anti()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
antialias = !antialias;
|
antialias = !antialias;
|
||||||
button->setChecked(antialias);
|
button->setChecked(antialias);
|
||||||
createImage();
|
createImage();
|
||||||
@ -351,7 +351,7 @@ void ImageViewer::toggle_anti()
|
|||||||
|
|
||||||
void ImageViewer::toggle_vdw()
|
void ImageViewer::toggle_vdw()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
if (vdwfactor > 1.0)
|
if (vdwfactor > 1.0)
|
||||||
vdwfactor = 0.5;
|
vdwfactor = 0.5;
|
||||||
else
|
else
|
||||||
@ -362,7 +362,7 @@ void ImageViewer::toggle_vdw()
|
|||||||
|
|
||||||
void ImageViewer::toggle_box()
|
void ImageViewer::toggle_box()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
showbox = !showbox;
|
showbox = !showbox;
|
||||||
button->setChecked(showbox);
|
button->setChecked(showbox);
|
||||||
createImage();
|
createImage();
|
||||||
@ -370,7 +370,7 @@ void ImageViewer::toggle_box()
|
|||||||
|
|
||||||
void ImageViewer::toggle_axes()
|
void ImageViewer::toggle_axes()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
showaxes = !showaxes;
|
showaxes = !showaxes;
|
||||||
button->setChecked(showaxes);
|
button->setChecked(showaxes);
|
||||||
createImage();
|
createImage();
|
||||||
@ -420,14 +420,14 @@ void ImageViewer::do_rot_up()
|
|||||||
|
|
||||||
void ImageViewer::change_group(int)
|
void ImageViewer::change_group(int)
|
||||||
{
|
{
|
||||||
QComboBox *box = findChild<QComboBox *>("group");
|
auto *box = findChild<QComboBox *>("group");
|
||||||
if (box) group = box->currentText();
|
if (box) group = box->currentText();
|
||||||
createImage();
|
createImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageViewer::createImage()
|
void ImageViewer::createImage()
|
||||||
{
|
{
|
||||||
QLabel *renderstatus = findChild<QLabel *>("renderstatus");
|
auto *renderstatus = findChild<QLabel *>("renderstatus");
|
||||||
if (renderstatus) renderstatus->setEnabled(true);
|
if (renderstatus) renderstatus->setEnabled(true);
|
||||||
repaint();
|
repaint();
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ void ImageViewer::createImage()
|
|||||||
// determine elements from masses and set their covalent radii
|
// determine elements from masses and set their covalent radii
|
||||||
int ntypes = lammps->extract_setting("ntypes");
|
int ntypes = lammps->extract_setting("ntypes");
|
||||||
int nbondtypes = lammps->extract_setting("nbondtypes");
|
int nbondtypes = lammps->extract_setting("nbondtypes");
|
||||||
double *masses = (double *)lammps->extract_atom("mass");
|
auto *masses = (double *)lammps->extract_atom("mass");
|
||||||
QString units = (const char *)lammps->extract_global("units");
|
QString units = (const char *)lammps->extract_global("units");
|
||||||
QString elements = "element ";
|
QString elements = "element ";
|
||||||
QString adiams;
|
QString adiams;
|
||||||
|
|||||||
@ -300,14 +300,14 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
const char *varstyles[] = {"delete", "atomfile", "file", "format", "getenv", "index",
|
const char *varstyles[] = {"delete", "atomfile", "file", "format", "getenv", "index",
|
||||||
"internal", "loop", "python", "string", "timer", "uloop",
|
"internal", "loop", "python", "string", "timer", "uloop",
|
||||||
"universe", "world", "equal", "vector", "atom"};
|
"universe", "world", "equal", "vector", "atom"};
|
||||||
for (const auto var : varstyles)
|
for (const auto *const var : varstyles)
|
||||||
style_list << var;
|
style_list << var;
|
||||||
style_list.sort();
|
style_list.sort();
|
||||||
ui->textEdit->setVariableList(style_list);
|
ui->textEdit->setVariableList(style_list);
|
||||||
|
|
||||||
style_list.clear();
|
style_list.clear();
|
||||||
const char *unitstyles[] = {"lj", "real", "metal", "si", "cgs", "electron", "micro", "nano"};
|
const char *unitstyles[] = {"lj", "real", "metal", "si", "cgs", "electron", "micro", "nano"};
|
||||||
for (const auto unit : unitstyles)
|
for (const auto *const unit : unitstyles)
|
||||||
style_list << unit;
|
style_list << unit;
|
||||||
style_list.sort();
|
style_list.sort();
|
||||||
ui->textEdit->setUnitsList(style_list);
|
ui->textEdit->setUnitsList(style_list);
|
||||||
@ -392,14 +392,14 @@ void LammpsGui::open()
|
|||||||
|
|
||||||
void LammpsGui::open_recent()
|
void LammpsGui::open_recent()
|
||||||
{
|
{
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
auto *act = qobject_cast<QAction *>(sender());
|
||||||
if (act) open_file(act->data().toString());
|
if (act) open_file(act->data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LammpsGui::start_exe()
|
void LammpsGui::start_exe()
|
||||||
{
|
{
|
||||||
if (!lammps.extract_setting("box_exists")) return;
|
if (!lammps.extract_setting("box_exists")) return;
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
auto *act = qobject_cast<QAction *>(sender());
|
||||||
if (act) {
|
if (act) {
|
||||||
auto exe = act->data().toString();
|
auto exe = act->data().toString();
|
||||||
QString datacmd = "write_data '";
|
QString datacmd = "write_data '";
|
||||||
@ -1052,7 +1052,7 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
logwindow->document()->setDefaultFont(text_font);
|
logwindow->document()->setDefaultFont(text_font);
|
||||||
logwindow->setLineWrapMode(LogWindow::NoWrap);
|
logwindow->setLineWrapMode(LogWindow::NoWrap);
|
||||||
logwindow->setMinimumSize(400, 300);
|
logwindow->setMinimumSize(400, 300);
|
||||||
QShortcut *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow);
|
auto *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow);
|
||||||
QObject::connect(shortcut, &QShortcut::activated, logwindow, &LogWindow::close);
|
QObject::connect(shortcut, &QShortcut::activated, logwindow, &LogWindow::close);
|
||||||
shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash), logwindow);
|
shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash), logwindow);
|
||||||
QObject::connect(shortcut, &QShortcut::activated, this, &LammpsGui::stop_run);
|
QObject::connect(shortcut, &QShortcut::activated, this, &LammpsGui::stop_run);
|
||||||
@ -1244,7 +1244,7 @@ void LammpsGui::about()
|
|||||||
msg.setFont(font);
|
msg.setFont(font);
|
||||||
|
|
||||||
auto *minwidth = new QSpacerItem(700, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
auto *minwidth = new QSpacerItem(700, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
QGridLayout *layout = (QGridLayout *)msg.layout();
|
auto *layout = (QGridLayout *)msg.layout();
|
||||||
layout->addItem(minwidth, layout->rowCount(), 0, 1, layout->columnCount());
|
layout->addItem(minwidth, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
|
|
||||||
msg.exec();
|
msg.exec();
|
||||||
|
|||||||
@ -35,7 +35,7 @@ LogWindow::LogWindow(const QString &_filename, QWidget *parent) :
|
|||||||
QSettings settings;
|
QSettings settings;
|
||||||
resize(settings.value("logx", 500).toInt(), settings.value("logy", 320).toInt());
|
resize(settings.value("logx", 500).toInt(), settings.value("logy", 320).toInt());
|
||||||
|
|
||||||
auto action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
|
auto *action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
|
||||||
connect(action, &QShortcut::activated, this, &LogWindow::save_as);
|
connect(action, &QShortcut::activated, this, &LogWindow::save_as);
|
||||||
action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
||||||
connect(action, &QShortcut::activated, this, &LogWindow::quit);
|
connect(action, &QShortcut::activated, this, &LogWindow::quit);
|
||||||
@ -99,7 +99,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
// show augmented context menu
|
// show augmented context menu
|
||||||
auto *menu = createStandardContextMenu();
|
auto *menu = createStandardContextMenu();
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
auto action = menu->addAction(QString("Save Log to File ..."));
|
auto *action = menu->addAction(QString("Save Log to File ..."));
|
||||||
action->setIcon(QIcon(":/icons/document-save-as.png"));
|
action->setIcon(QIcon(":/icons/document-save-as.png"));
|
||||||
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
|
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
|
||||||
connect(action, &QAction::triggered, this, &LogWindow::save_as);
|
connect(action, &QAction::triggered, this, &LogWindow::save_as);
|
||||||
@ -114,7 +114,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
bool LogWindow::eventFilter(QObject *watched, QEvent *event)
|
bool LogWindow::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||||
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
||||||
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
||||||
stop_run();
|
stop_run();
|
||||||
|
|||||||
@ -93,25 +93,25 @@ void Preferences::accept()
|
|||||||
|
|
||||||
// store selected accelerator
|
// store selected accelerator
|
||||||
QList<QRadioButton *> allButtons = tabWidget->findChildren<QRadioButton *>();
|
QList<QRadioButton *> allButtons = tabWidget->findChildren<QRadioButton *>();
|
||||||
for (int i = 0; i < allButtons.size(); ++i) {
|
for (auto & allButton : allButtons) {
|
||||||
if (allButtons[i]->isChecked()) {
|
if (allButton->isChecked()) {
|
||||||
if (allButtons[i]->objectName() == "none")
|
if (allButton->objectName() == "none")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::None));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::None));
|
||||||
if (allButtons[i]->objectName() == "opt")
|
if (allButton->objectName() == "opt")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Opt));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::Opt));
|
||||||
if (allButtons[i]->objectName() == "openmp")
|
if (allButton->objectName() == "openmp")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::OpenMP));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::OpenMP));
|
||||||
if (allButtons[i]->objectName() == "intel")
|
if (allButton->objectName() == "intel")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Intel));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::Intel));
|
||||||
if (allButtons[i]->objectName() == "kokkos")
|
if (allButton->objectName() == "kokkos")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Kokkos));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::Kokkos));
|
||||||
if (allButtons[i]->objectName() == "gpu")
|
if (allButton->objectName() == "gpu")
|
||||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Gpu));
|
settings->setValue("accelerator", QString::number(AcceleratorTab::Gpu));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// store number of threads, reset to 1 for "None" and "Opt" settings
|
// store number of threads, reset to 1 for "None" and "Opt" settings
|
||||||
QLineEdit *field = tabWidget->findChild<QLineEdit *>("nthreads");
|
auto *field = tabWidget->findChild<QLineEdit *>("nthreads");
|
||||||
if (field) {
|
if (field) {
|
||||||
int accel = settings->value("accelerator", AcceleratorTab::None).toInt();
|
int accel = settings->value("accelerator", AcceleratorTab::None).toInt();
|
||||||
if ((accel == AcceleratorTab::None) || (accel == AcceleratorTab::Opt))
|
if ((accel == AcceleratorTab::None) || (accel == AcceleratorTab::Opt))
|
||||||
@ -132,7 +132,7 @@ void Preferences::accept()
|
|||||||
field = tabWidget->findChild<QLineEdit *>("zoom");
|
field = tabWidget->findChild<QLineEdit *>("zoom");
|
||||||
if (field)
|
if (field)
|
||||||
if (field->hasAcceptableInput()) settings->setValue("zoom", field->text());
|
if (field->hasAcceptableInput()) settings->setValue("zoom", field->text());
|
||||||
QCheckBox *box = tabWidget->findChild<QCheckBox *>("anti");
|
auto *box = tabWidget->findChild<QCheckBox *>("anti");
|
||||||
if (box) settings->setValue("antialias", box->isChecked());
|
if (box) settings->setValue("antialias", box->isChecked());
|
||||||
box = tabWidget->findChild<QCheckBox *>("ssao");
|
box = tabWidget->findChild<QCheckBox *>("ssao");
|
||||||
if (box) settings->setValue("ssao", box->isChecked());
|
if (box) settings->setValue("ssao", box->isChecked());
|
||||||
@ -142,7 +142,7 @@ void Preferences::accept()
|
|||||||
if (box) settings->setValue("axes", box->isChecked());
|
if (box) settings->setValue("axes", box->isChecked());
|
||||||
box = tabWidget->findChild<QCheckBox *>("vdwstyle");
|
box = tabWidget->findChild<QCheckBox *>("vdwstyle");
|
||||||
if (box) settings->setValue("vdwstyle", box->isChecked());
|
if (box) settings->setValue("vdwstyle", box->isChecked());
|
||||||
QComboBox *combo = tabWidget->findChild<QComboBox *>("background");
|
auto *combo = tabWidget->findChild<QComboBox *>("background");
|
||||||
if (combo) settings->setValue("background", combo->currentText());
|
if (combo) settings->setValue("background", combo->currentText());
|
||||||
combo = tabWidget->findChild<QComboBox *>("boxcolor");
|
combo = tabWidget->findChild<QComboBox *>("boxcolor");
|
||||||
if (combo) settings->setValue("boxcolor", combo->currentText());
|
if (combo) settings->setValue("boxcolor", combo->currentText());
|
||||||
@ -166,7 +166,7 @@ void Preferences::accept()
|
|||||||
box = tabWidget->findChild<QCheckBox *>("viewslide");
|
box = tabWidget->findChild<QCheckBox *>("viewslide");
|
||||||
if (box) settings->setValue("viewslide", box->isChecked());
|
if (box) settings->setValue("viewslide", box->isChecked());
|
||||||
|
|
||||||
auto spin = tabWidget->findChild<QSpinBox *>("updfreq");
|
auto *spin = tabWidget->findChild<QSpinBox *>("updfreq");
|
||||||
if (spin) settings->setValue("updfreq", spin->value());
|
if (spin) settings->setValue("updfreq", spin->value());
|
||||||
|
|
||||||
if (need_relaunch) {
|
if (need_relaunch) {
|
||||||
@ -324,7 +324,7 @@ void GeneralTab::newtextfont()
|
|||||||
|
|
||||||
void GeneralTab::pluginpath()
|
void GeneralTab::pluginpath()
|
||||||
{
|
{
|
||||||
QLineEdit *field = findChild<QLineEdit *>("pluginedit");
|
auto *field = findChild<QLineEdit *>("pluginedit");
|
||||||
QString pluginfile =
|
QString pluginfile =
|
||||||
QFileDialog::getOpenFileName(this, "Select Shared LAMMPS Library to Load", field->text(),
|
QFileDialog::getOpenFileName(this, "Select Shared LAMMPS Library to Load", field->text(),
|
||||||
"Shared Objects (*.so *.dll *.dylib)");
|
"Shared Objects (*.so *.dll *.dylib)");
|
||||||
|
|||||||
@ -281,7 +281,7 @@ void SlideShow::play()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset push button state. use findChild() if not triggered from button.
|
// reset push button state. use findChild() if not triggered from button.
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
if (!button) button = findChild<QPushButton *>("play");
|
if (!button) button = findChild<QPushButton *>("play");
|
||||||
if (button) button->setChecked(playtimer);
|
if (button) button->setChecked(playtimer);
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ void SlideShow::prev()
|
|||||||
|
|
||||||
void SlideShow::loop()
|
void SlideShow::loop()
|
||||||
{
|
{
|
||||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
auto *button = qobject_cast<QPushButton *>(sender());
|
||||||
do_loop = !do_loop;
|
do_loop = !do_loop;
|
||||||
button->setChecked(do_loop);
|
button->setChecked(do_loop);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user