-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added export options dialog to PDB, allowing use of atom type names.
- Loading branch information
1 parent
002764a
commit 59836dc
Showing
7 changed files
with
279 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
*** PDB Export Options Dialog | ||
*** src/plugins/io_pdb/pdbexportoptions.h | ||
Copyright T. Youngs 2007-2017 | ||
This file is part of Aten. | ||
Aten is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Aten is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Aten. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef ATEN_PDBEXPORTOPTIONS_H | ||
#define ATEN_PDBEXPORTOPTIONS_H | ||
|
||
#include "base/kvmap.h" | ||
#include "plugins/io_pdb/ui_pdbexportoptions.h" | ||
|
||
ATEN_USING_NAMESPACE | ||
|
||
// Forward Declarations (Aten) | ||
/* none */ | ||
|
||
// PDB Export Options Dialog | ||
class PDBExportOptionsDialog : public QDialog | ||
{ | ||
// All Qt declarations derived from QObject must include this macro | ||
Q_OBJECT | ||
|
||
public: | ||
// Constructor | ||
PDBExportOptionsDialog(KVMap& pluginOptions); | ||
|
||
private: | ||
// Main form declaration | ||
Ui::PDBExportOptionsDialog ui; | ||
// Reference to KVMap of plugin options stored in plugin | ||
KVMap& pluginOptions_; | ||
|
||
|
||
/* | ||
* Widget Functions | ||
*/ | ||
private slots: | ||
// Cancel / OK buttons | ||
void on_CancelButton_clicked(bool checked); | ||
void on_OKButton_clicked(bool checked); | ||
|
||
|
||
/* | ||
* Show Function | ||
*/ | ||
public: | ||
// Update and show dialog (setting controls from pluginOptions_ if necessary) | ||
int updateAndExecute(); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>PDBExportOptionsDialog</class> | ||
<widget class="QDialog" name="PDBExportOptionsDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>370</width> | ||
<height>123</height> | ||
</rect> | ||
</property> | ||
<property name="font"> | ||
<font> | ||
<pointsize>8</pointsize> | ||
</font> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>PDB Export Options</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="spacing"> | ||
<number>4</number> | ||
</property> | ||
<property name="leftMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>4</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>4</number> | ||
</property> | ||
<item> | ||
<widget class="QCheckBox" name="UseTypeNamesCheck"> | ||
<property name="toolTip"> | ||
<string>Write atom type names instead of element names in the atom records</string> | ||
</property> | ||
<property name="text"> | ||
<string>Use type names if available</string> | ||
</property> | ||
<property name="checked"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>362</width> | ||
<height>48</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="Line" name="line"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<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="CancelButton"> | ||
<property name="text"> | ||
<string>&Cancel</string> | ||
</property> | ||
<property name="autoDefault"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="default"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="OKButton"> | ||
<property name="font"> | ||
<font> | ||
<weight>75</weight> | ||
<bold>true</bold> | ||
</font> | ||
</property> | ||
<property name="text"> | ||
<string>&OK</string> | ||
</property> | ||
<property name="autoDefault"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="default"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
*** PDB Export Options Functions | ||
*** src/gui/io_pdb/pdbexportoptions_funcs.cpp | ||
Copyright T. Youngs 2007-2017 | ||
This file is part of Aten. | ||
Aten is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Aten is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Aten. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "plugins/io_pdb/pdbexportoptions.h" | ||
|
||
// Constructor | ||
PDBExportOptionsDialog::PDBExportOptionsDialog(KVMap& pluginOptions) : QDialog(NULL), pluginOptions_(pluginOptions) | ||
{ | ||
ui.setupUi(this); | ||
} | ||
|
||
/* | ||
* Widget Functions | ||
*/ | ||
|
||
void PDBExportOptionsDialog::on_CancelButton_clicked(bool checked) | ||
{ | ||
// Don't modify the stored pluginOptions_, just reject() the dialog | ||
reject(); | ||
} | ||
|
||
void PDBExportOptionsDialog::on_OKButton_clicked(bool checked) | ||
{ | ||
// Set options before we accept() the dialog. | ||
pluginOptions_.add("useTypeNames", ui.UseTypeNamesCheck->isChecked() ? "true" : "false"); | ||
|
||
accept(); | ||
} | ||
|
||
/* | ||
* Show Function | ||
*/ | ||
|
||
// Update and show dialog, setting controls from pluginOptions | ||
int PDBExportOptionsDialog::updateAndExecute() | ||
{ | ||
// Set controls to reflect current pluginOptions_ | ||
ui.UseTypeNamesCheck->setChecked(pluginOptions_.value("useTypeNames") == "true"); | ||
|
||
// Execute the dialog - option setting will be handled in the OK button slot | ||
return exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,4 +100,4 @@ bool XYZFilePluginCommon::writeXYZModel(FilePluginInterface* plugin, FileParser& | |
} | ||
|
||
return true; | ||
} | ||
} |