add minimal about dialogs

This commit is contained in:
Axel Kohlmeyer
2023-07-25 00:39:47 -04:00
parent a49a1b644e
commit 908e925b8f
3 changed files with 41 additions and 5 deletions

View File

@ -37,8 +37,10 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
&LammpsGui::run_buffer);
connect(ui->actionExecute_Line, &QAction::triggered, this,
&LammpsGui::run_line);
// connect(ui->actionAbout, &QAction::triggered, this,
// &LammpsGui::about);
connect(ui->actionAbout_LAMMPS_GUI, &QAction::triggered, this,
&LammpsGui::about);
connect(ui->actionLAMMPS_Info, &QAction::triggered, this,
&LammpsGui::about_lammps);
#if !QT_CONFIG(clipboard)
ui->actionCut->setEnabled(false);
@ -206,7 +208,21 @@ void LammpsGui::clear()
ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
}
void LammpsGui::about_lammps()
{
char *args[] = {(char *)"LAMMPS GUI", (char *)"-log", (char *)"none"};
int nargs = sizeof(args) / sizeof(char *);
if (!lammps_handle)
lammps_handle = lammps_open_no_mpi(nargs, args, nullptr);
std::string version = "LAMMPS Version " + std::to_string(lammps_version(lammps_handle));
QString lammps_info(version.c_str());
QMessageBox::information(this, "About LAMMPS", lammps_info);
}
void LammpsGui::about()
{
// dummy
QMessageBox::information(this, "About LAMMPS-GUI",
"This is LAMMPS-GUI version 0.1");
}

View File

@ -48,6 +48,7 @@ private slots:
void run_buffer();
void run_line();
void about();
void about_lammps();
private:
Ui::LammpsGui *ui;

View File

@ -25,7 +25,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="CodeEditor" name="textEdit"/>
<widget class="CodeEditor" name="textEdit" native="true"/>
</item>
</layout>
</widget>
@ -36,7 +36,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>23</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -74,6 +74,8 @@
<property name="title">
<string>About</string>
</property>
<addaction name="actionAbout_LAMMPS_GUI"/>
<addaction name="actionLAMMPS_Info"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
@ -146,7 +148,24 @@
<string>Execute Line</string>
</property>
</action>
<action name="actionAbout_LAMMPS_GUI">
<property name="text">
<string>About LAMMPS-GUI</string>
</property>
</action>
<action name="actionLAMMPS_Info">
<property name="text">
<string>LAMMPS Info</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>CodeEditor</class>
<extends>QWidget</extends>
<header>codeeditor.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>