Added atomtypewindow

This commit is contained in:
arcan1s
2013-08-08 18:12:28 +04:00
parent 020d912704
commit f7bdd89940
13 changed files with 651 additions and 26 deletions

View File

@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: mathmech
# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 8 04:28:38 2013
# Generated by qmake (2.01a) (Qt 4.8.5) on: ?? ??? 8 17:13:39 2013
# Project: mathmech.pro
# Template: app
# Command: /usr/lib/qt4/bin/qmake -o Makefile mathmech.pro
@ -48,22 +48,26 @@ SOURCES = main.cpp \
errorwindow.cpp \
clear_items.cpp \
start_events.cpp \
update_fields.cpp moc_mainwindow.cpp \
update_fields.cpp \
atomtypeswindow.cpp moc_mainwindow.cpp \
moc_errorwindow.cpp \
moc_clear_items.cpp \
moc_start_events.cpp \
moc_update_fields.cpp
moc_update_fields.cpp \
moc_atomtypeswindow.cpp
OBJECTS = main.o \
mainwindow.o \
errorwindow.o \
clear_items.o \
start_events.o \
update_fields.o \
atomtypeswindow.o \
moc_mainwindow.o \
moc_errorwindow.o \
moc_clear_items.o \
moc_start_events.o \
moc_update_fields.o
moc_update_fields.o \
moc_atomtypeswindow.o
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/common/gcc-base.conf \
@ -119,7 +123,7 @@ first: all
all: Makefile $(TARGET)
$(TARGET): ui_mainwindow.h ui_errorwindow.h $(OBJECTS)
$(TARGET): ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: mathmech.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
@ -184,7 +188,7 @@ qmake: FORCE
dist:
@$(CHK_DIR_EXISTS) .tmp/mathmech1.0.0 || $(MKDIR) .tmp/mathmech1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.h errorwindow.h clear_items.h start_events.h update_fields.h .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp update_fields.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.ui .tmp/mathmech1.0.0/ && (cd `dirname .tmp/mathmech1.0.0` && $(TAR) mathmech1.0.0.tar mathmech1.0.0 && $(COMPRESS) mathmech1.0.0.tar) && $(MOVE) `dirname .tmp/mathmech1.0.0`/mathmech1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mathmech1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.h errorwindow.h clear_items.h start_events.h update_fields.h atomtypeswindow.h .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp errorwindow.cpp clear_items.cpp start_events.cpp update_fields.cpp atomtypeswindow.cpp .tmp/mathmech1.0.0/ && $(COPY_FILE) --parents mainwindow.ui errorwindow.ui atomtypeswindow.ui .tmp/mathmech1.0.0/ && (cd `dirname .tmp/mathmech1.0.0` && $(TAR) mathmech1.0.0.tar mathmech1.0.0 && $(COMPRESS) mathmech1.0.0.tar) && $(MOVE) `dirname .tmp/mathmech1.0.0`/mathmech1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/mathmech1.0.0
clean:compiler_clean
@ -205,9 +209,9 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp
compiler_moc_header_make_all: moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp
-$(DEL_FILE) moc_mainwindow.cpp moc_errorwindow.cpp moc_clear_items.cpp moc_start_events.cpp moc_update_fields.cpp moc_atomtypeswindow.cpp
moc_mainwindow.cpp: mainwindow.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
@ -223,6 +227,9 @@ moc_start_events.cpp: start_events.h
moc_update_fields.cpp: update_fields.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) update_fields.h -o moc_update_fields.cpp
moc_atomtypeswindow.cpp: atomtypeswindow.h
/usr/lib/qt4/bin/moc $(DEFINES) $(INCPATH) atomtypeswindow.h -o moc_atomtypeswindow.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
@ -230,15 +237,18 @@ compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h ui_errorwindow.h
compiler_uic_make_all: ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h ui_errorwindow.h
-$(DEL_FILE) ui_mainwindow.h ui_errorwindow.h ui_atomtypeswindow.h
ui_mainwindow.h: mainwindow.ui
/usr/lib/qt4/bin/uic mainwindow.ui -o ui_mainwindow.h
ui_errorwindow.h: errorwindow.ui
/usr/lib/qt4/bin/uic errorwindow.ui -o ui_errorwindow.h
ui_atomtypeswindow.h: atomtypeswindow.ui
/usr/lib/qt4/bin/uic atomtypeswindow.ui -o ui_atomtypeswindow.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
@ -254,8 +264,10 @@ main.o: main.cpp mainwindow.h
mainwindow.o: mainwindow.cpp mainwindow.h \
ui_mainwindow.h \
atomtypeswindow.h \
clear_items.h \
start_events.h
start_events.h \
update_fields.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
errorwindow.o: errorwindow.cpp errorwindow.h \
@ -279,6 +291,12 @@ update_fields.o: update_fields.cpp update_fields.h \
ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o update_fields.o update_fields.cpp
atomtypeswindow.o: atomtypeswindow.cpp atomtypeswindow.h \
ui_atomtypeswindow.h \
errorwindow.h \
ui_errorwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o atomtypeswindow.o atomtypeswindow.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
@ -294,6 +312,9 @@ moc_start_events.o: moc_start_events.cpp
moc_update_fields.o: moc_update_fields.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_update_fields.o moc_update_fields.cpp
moc_atomtypeswindow.o: moc_atomtypeswindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_atomtypeswindow.o moc_atomtypeswindow.cpp
####### Install
install: FORCE

View File

@ -0,0 +1,157 @@
#include <QDir>
#include <QFileDialog>
#include <QKeyEvent>
#include <QTextStream>
#include "atomtypeswindow.h"
#include "ui_atomtypeswindow.h"
#include "errorwindow.h"
#include "ui_errorwindow.h"
AtomTypesWindow::AtomTypesWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::AtomTypesWindow)
{
ui->setupUi(this);
num_of_mol = new int[100];
for (int i=0; i<100; i++)
{
num_of_mol[i] = 1;
atomTypes.append(QString(""));
}
}
AtomTypesWindow::~AtomTypesWindow()
{
delete ui;
delete num_of_mol;
}
// ESC press event
void AtomTypesWindow::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Escape)
close();
}
// events
void AtomTypesWindow::on_atomTypes_pushButton_output_clicked()
{
QString filename = QFileDialog::getSaveFileName(
this,
tr("Save file as..."),
QDir::currentPath(),
tr("Atom types files (*.types);;All files (*.*)"));
if (!filename.isEmpty())
ui->atomTypes_lineEdit_output->setText(filename);
}
void AtomTypesWindow::on_atomTypes_pushButton_add_clicked()
{
errorwin = new ErrorWindow(this);
QString charAtomType = ui->atomTypes_lineEdit_chType->text();
QString intAtomType= QString::number(ui->atomTypes_spinBox_intType->value());
if ((charAtomType.count() != 2) || (charAtomType.split(' ', QString::SkipEmptyParts)[0] != charAtomType))
{
errorwin->set_message(5);
errorwin->show();
return;
}
ui->atomTypes_listWidget->addItem(charAtomType + "=" + intAtomType);
atomTypes[ui->atomTypes_comboBox_mol->currentIndex()] = QString("");
for (int i=0; i<ui->atomTypes_listWidget->count(); i++)
atomTypes[ui->atomTypes_comboBox_mol->currentIndex()].append(ui->atomTypes_listWidget->item(i)->text() + ",");
delete errorwin;
}
void AtomTypesWindow::on_atomTypes_pushButton_typeRem_clicked()
{
int curIndex = ui->atomTypes_listWidget->currentRow();
if (curIndex > -1)
delete ui->atomTypes_listWidget->item(curIndex);
}
void AtomTypesWindow::on_atomTypes_pushButton_clear_clicked()
{
for (int i=0; i<100; i++)
{
num_of_mol[i] = 1;
atomTypes[i] = QString("");
}
ui->atomTypes_lineEdit_output->clear();
ui->atomTypes_comboBox_mol->clear();
ui->atomTypes_comboBox_mol->addItem(QString("1"));
ui->atomTypes_comboBox_mol->addItem(QApplication::translate("AtomTypesWindow", "Add new molecule"));
}
void AtomTypesWindow::on_atomTypes_spinBox_numOfMol_editingFinished()
{
num_of_mol[ui->atomTypes_comboBox_mol->currentIndex()] = ui->atomTypes_spinBox_numOfMol->value();
}
void AtomTypesWindow::on_atomTypes_comboBox_mol_currentIndexChanged(int index)
{
ui->atomTypes_lineEdit_chType->clear();
ui->atomTypes_spinBox_intType->setValue(1);
ui->atomTypes_listWidget->clear();
if (ui->atomTypes_comboBox_mol->itemText(index) == (QApplication::translate("AtomTypesWindow", "Add new molecule")))
{
ui->atomTypes_comboBox_mol->setItemText(index, QString::number(index+1));
ui->atomTypes_comboBox_mol->addItem(QApplication::translate("AtomTypesWindow", "Add new molecule"));
ui->atomTypes_spinBox_numOfMol->setValue(num_of_mol[index]);
}
else if (index == -1)
return;
else
{
ui->atomTypes_spinBox_numOfMol->setValue(num_of_mol[index]);
ui->atomTypes_listWidget->addItems(atomTypes[index].split(',', QString::SkipEmptyParts));
}
}
void AtomTypesWindow::on_atomTypes_pushButton_create_clicked()
{
errorwin = new ErrorWindow(this);
QString output = ui->atomTypes_lineEdit_output->text();
QString num_mol = QString::number(ui->atomTypes_comboBox_mol->count() - 1);
for (int i=0; i<num_mol.toInt(); i++)
if (atomTypes[i] == "")
{
errorwin->set_message(8);
errorwin->show();
return;
}
if (output == "")
{
errorwin->set_message(4);
errorwin->show();
return;
}
output = QFileInfo(output).absoluteFilePath();
QFile f_out(output);
if (!f_out.open(QIODevice::WriteOnly | QIODevice::Text))
{
errorwin->set_message(9);
errorwin->show();
return;
}
QTextStream out(&f_out);
out << "NUMTYPES=" << num_mol << "\n";
for (int i=0; i<num_mol.toInt(); i++)
{
out << "NUMMOL=" << num_of_mol[i] << "\n";
out << "NUMAT=" << atomTypes[i].split(',', QString::SkipEmptyParts).count() << "\n";
out << atomTypes[i].split(',', QString::SkipEmptyParts).join("\n") << "\n";
}
f_out.close();
on_atomTypes_pushButton_clear_clicked();
delete errorwin;
}

View File

@ -0,0 +1,40 @@
#ifndef ATOMTYPESWINDOW_H
#define ATOMTYPESWINDOW_H
#include <QMainWindow>
class ErrorWindow;
namespace Ui {
class AtomTypesWindow;
}
class AtomTypesWindow : public QMainWindow
{
Q_OBJECT
public:
explicit AtomTypesWindow(QWidget *parent = 0);
~AtomTypesWindow();
private slots:
// events
void on_atomTypes_pushButton_output_clicked();
void on_atomTypes_pushButton_add_clicked();
void on_atomTypes_pushButton_typeRem_clicked();
void on_atomTypes_pushButton_clear_clicked();
void on_atomTypes_spinBox_numOfMol_editingFinished();
void on_atomTypes_comboBox_mol_currentIndexChanged(int index);
void on_atomTypes_pushButton_create_clicked();
private:
Ui::AtomTypesWindow *ui;
ErrorWindow *errorwin;
int *num_of_mol;
QStringList atomTypes;
// ESC pressed event
void keyPressEvent(QKeyEvent *pressedKey);
};
#endif /* ATOMTYPESWINDOW_H */

361
mathmech/atomtypeswindow.ui Normal file
View File

@ -0,0 +1,361 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AtomTypesWindow</class>
<widget class="QMainWindow" name="AtomTypesWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
<string>Atom types</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="atomTypes_layout_output">
<item>
<widget class="QLabel" name="atomTypes_label_output">
<property name="minimumSize">
<size>
<width>110</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Output file</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="atomTypes_lineEdit_output">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="atomTypes_pushButton_output">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="atomTypes_layout_mol">
<item>
<widget class="QLabel" name="atomTypes_label_mol">
<property name="minimumSize">
<size>
<width>110</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Molecule</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="atomTypes_comboBox_mol">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>23</height>
</size>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>Add new molecule</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="atomTypes_label_numOfMol">
<property name="minimumSize">
<size>
<width>130</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Number of molecules</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="atomTypes_spinBox_numOfMol">
<property name="minimumSize">
<size>
<width>60</width>
<height>23</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="atomTypes_layout_atom">
<item>
<widget class="QLabel" name="atomTypes_label_chType">
<property name="minimumSize">
<size>
<width>110</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Char atom type</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="atomTypes_lineEdit_chType">
<property name="minimumSize">
<size>
<width>60</width>
<height>23</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="atomTypes_label_intType">
<property name="minimumSize">
<size>
<width>110</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Int atom type</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="atomTypes_spinBox_intType">
<property name="minimumSize">
<size>
<width>60</width>
<height>23</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="atomTypes_pushButton_add">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Add</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="atomTypes_listWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="atomTypes_layout_intRem">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="atomTypes_pushButton_typeRem">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Remove</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="atomTypes_layout_buttons">
<item>
<widget class="QPushButton" name="atomTypes_pushButton_clear">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="atomTypes_pushButton_create">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Create</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="atomTypes_pushButton_close">
<property name="minimumSize">
<size>
<width>80</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Close</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>atomTypes_lineEdit_output</tabstop>
<tabstop>atomTypes_pushButton_output</tabstop>
<tabstop>atomTypes_comboBox_mol</tabstop>
<tabstop>atomTypes_spinBox_numOfMol</tabstop>
<tabstop>atomTypes_lineEdit_chType</tabstop>
<tabstop>atomTypes_spinBox_intType</tabstop>
<tabstop>atomTypes_pushButton_add</tabstop>
<tabstop>atomTypes_listWidget</tabstop>
<tabstop>atomTypes_pushButton_typeRem</tabstop>
<tabstop>atomTypes_pushButton_clear</tabstop>
<tabstop>atomTypes_pushButton_create</tabstop>
<tabstop>atomTypes_pushButton_close</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>atomTypes_pushButton_close</sender>
<signal>clicked()</signal>
<receiver>AtomTypesWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>388</x>
<y>294</y>
</hint>
<hint type="destinationlabel">
<x>447</x>
<y>324</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -34,7 +34,7 @@ void ErrorWindow::set_message(int mess)
message = QApplication::translate("ErrorWindow", "Output file is not set");
break;
case 5:
message = QApplication::translate("ErrorWindow", "Atom type must contain 2 characters");
break;
case 6:
message = QApplication::translate("ErrorWindow", "Log file is not set");
@ -43,10 +43,10 @@ void ErrorWindow::set_message(int mess)
message = QApplication::translate("ErrorWindow", "Component is not found");
break;
case 8:
message = QApplication::translate("ErrorWindow", "Atom types is not set");
break;
case 9:
message = QApplication::translate("ErrorWindow", "Something wrong");
break;
case 10:
message = QApplication::translate("ErrorWindow", "Interactions are not set");
@ -59,6 +59,9 @@ void ErrorWindow::set_message(int mess)
break;
case 13:
break;
default:
message = QApplication::translate("ErrorWindow", "Unknown error");
break;
}

View File

@ -3,6 +3,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "atomtypeswindow.h"
#include "clear_items.h"
#include "start_events.h"
#include "update_fields.h"
@ -17,7 +18,9 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
statgen_crit = new float[10];
ui->statusBar->showMessage(QString("Ready"));
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
createActions();
// TODO: read config
// language = QString("eng");
@ -522,8 +525,9 @@ void MainWindow::on_statgen_pushButton_intAdd_clicked()
void MainWindow::on_stagen_pushButton_intRem_clicked()
{
if (int curIndex = ui->statgen_listWidget_int->currentRow() > -1)
delete ui->statgen_listWidget_int->item(curIndex-1);
int curIndex = ui->statgen_listWidget_int->currentRow();
if (curIndex > -1)
delete ui->statgen_listWidget_int->item(curIndex);
}
// start signals
@ -574,3 +578,16 @@ void MainWindow::on_tabWidget_currentChanged(int index)
break;
}
}
// window signals
void MainWindow::createActions()
{
connect(ui->actionAtom_types_file, SIGNAL(triggered()), this, SLOT(createAtomTypes()));
}
void MainWindow::createAtomTypes()
{
AtomTypesWindow *atomTypes;
atomTypes = new AtomTypesWindow(this);
atomTypes->show();
}

View File

@ -73,6 +73,8 @@ private slots:
void on_pdb_pushButton_start_clicked();
// completion
void on_tabWidget_currentChanged(int index);
// window signals
void createAtomTypes();
private:
Ui::MainWindow *ui;
@ -91,6 +93,9 @@ private:
friend class Start_events;
Update_fields *update_fields;
friend class Update_fields;
// window signals
void createActions();
};
#endif /* MAINWINDOW_H */

View File

@ -3272,6 +3272,14 @@
<property name="title">
<string>Menu</string>
</property>
<widget class="QMenu" name="menuFile_creator">
<property name="title">
<string>File creator</string>
</property>
<addaction name="actionAtom_types_file"/>
<addaction name="actionAgglomerate_file"/>
</widget>
<addaction name="menuFile_creator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuHelp">
@ -3295,7 +3303,10 @@
<widget class="QStatusBar" name="statusBar"/>
<action name="actionExit">
<property name="text">
<string>Exit</string>
<string>&amp;Quit</string>
</property>
<property name="toolTip">
<string>Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
@ -3303,7 +3314,7 @@
</action>
<action name="actionHelp">
<property name="text">
<string>Help</string>
<string>&amp;Help</string>
</property>
<property name="shortcut">
<string>F1</string>
@ -3314,6 +3325,16 @@
<string>About</string>
</property>
</action>
<action name="actionAtom_types_file">
<property name="text">
<string>Atom &amp;types file</string>
</property>
</action>
<action name="actionAgglomerate_file">
<property name="text">
<string>&amp;Agglomerate file</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>

Binary file not shown.

View File

@ -12,11 +12,14 @@ HEADERS += mainwindow.h \
errorwindow.h \
clear_items.h \
start_events.h \
update_fields.h
update_fields.h \
atomtypeswindow.h
FORMS += mainwindow.ui \
errorwindow.ui
errorwindow.ui \
atomtypeswindow.ui
SOURCES += main.cpp mainwindow.cpp \
errorwindow.cpp \
clear_items.cpp \
start_events.cpp \
update_fields.cpp
update_fields.cpp \
atomtypeswindow.cpp

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.8.0, 2013-08-08T06:17:50. -->
<!-- Written by QtCreator 2.8.0, 2013-08-08T18:10:35. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -6,8 +6,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <stdio.h>
Update_fields::Update_fields(MainWindow *wid) :
parent(wid)
{

View File

@ -21,7 +21,6 @@ public slots:
private:
MainWindow *parent;
};
#endif /* UPDATE_FIELDS_H */