-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jordan Bieder
committed
Sep 25, 2019
1 parent
1805fca
commit b29f7cf
Showing
14 changed files
with
1,308 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ SUBDIRS = \ | |
qAgate.pro \ | ||
qConducti.pro \ | ||
qDispersion.pro \ | ||
qTdep.pro | ||
qTdep.pro \ | ||
qDOS.pro |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,76 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2019-09-20T10:30:07 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport | ||
|
||
TARGET = qDOS | ||
TEMPLATE = app | ||
CONFIG += c++11 | ||
isEmpty(PREFIX) { | ||
PREFIX = /usr/ | ||
} | ||
isEmpty(PREFIX_AGATE) { | ||
PREFIX_AGATE = /usr/ | ||
} | ||
target.path = $$PREFIX/bin | ||
INSTALLS += target | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which has been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
DEFINES += HAVE_CONFIG_H | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
|
||
SOURCES += \ | ||
qdos/main_qdos.cpp \ | ||
qdos/qdos.cpp \ | ||
tools/energyunitcombo.cpp \ | ||
tools/qcustomplot.cpp \ | ||
tools/qplot.cpp \ | ||
tools/unitcombo.cpp \ | ||
qdos/adddos.cpp | ||
|
||
HEADERS += \ | ||
qdos/qdos.h \ | ||
tools/energyunitcombo.h \ | ||
tools/qcustomplot.h \ | ||
tools/qplot.h \ | ||
tools/unitcombo.h \ | ||
qdos/adddos.h | ||
|
||
FORMS += \ | ||
qdos/qdos.ui \ | ||
qdos/adddos.ui | ||
|
||
INCLUDEPATH += $$PREFIX_AGATE/include/agate | ||
|
||
RESOURCES += \ | ||
qdos/qdos.qrc | ||
|
||
unix|win32: LIBS += -L$$PREFIX_AGATE/lib/ -lagate | ||
|
||
DISTFILES += \ | ||
qdos/qdos.svg \ | ||
qdos/qdos.desktop | ||
|
||
logo.files = qdos/qdos.svg | ||
logo.path = /usr/share/qAgate/images/ | ||
|
||
desktop.files= qdos/qdos.desktop | ||
desktop.path = /usr/share/applications/ | ||
|
||
ICON = qdos/qdos.svg | ||
|
||
unix:INSTALLS += logo desktop |
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,176 @@ | ||
#include "adddos.h" | ||
#include "ui_adddos.h" | ||
#include <QColorDialog> | ||
|
||
AddDos::AddDos(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::AddDos), | ||
_db(nullptr), | ||
_hasColor(false) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
AddDos::~AddDos() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void AddDos::on_atom_currentIndexChanged(int index) | ||
{ | ||
(void) index; | ||
unsigned atom = static_cast<int>(ui->atom->currentData(Qt::UserRole).toInt()); | ||
ElectronDos dos = _db->atom(atom); | ||
ui->colorLabel->setEnabled(true); | ||
ui->color->setEnabled(true); | ||
ui->labelLabel->setEnabled(true); | ||
ui->label->setEnabled(true); | ||
if (atom == 0) | ||
{ | ||
ui->magnetic->setDisabled(true); | ||
ui->magneticLabel->setDisabled(true); | ||
ui->magnetic->setVisible(false); | ||
ui->magneticLabel->setVisible(false); | ||
if (dos.prtdos() == 5) | ||
{ | ||
ui->projection->clear(); | ||
ui->projection->addItem("Up-Up","uu"); | ||
ui->projection->addItem("Down-Down","dd"); | ||
ui->projection->addItem("Up-Down","ud"); | ||
ui->projection->addItem("Down-Up","du"); | ||
ui->projection->addItem("X","x"); | ||
ui->projection->addItem("Y","y"); | ||
ui->projection->addItem("Z","z"); | ||
ui->projectionLabel->setText(tr("Projection")); | ||
ui->projection->setEnabled(true); | ||
ui->projectionLabel->setEnabled(true); | ||
} | ||
else | ||
{ | ||
ui->projection->clear(); | ||
ui->projection->setDisabled(true); | ||
ui->projectionLabel->setDisabled(true); | ||
ui->colorLabel->setDisabled(true); | ||
ui->color->setDisabled(true); | ||
ui->labelLabel->setDisabled(true); | ||
ui->label->setDisabled(true); | ||
} | ||
} | ||
else | ||
{ | ||
if (dos.isProjected()) | ||
{ | ||
ui->projection->setEnabled(true); | ||
ui->projectionLabel->setEnabled(true); | ||
ui->projectionLabel->setText(tr("Angular moment")); | ||
ui->projection->clear(); | ||
ui->projection->addItem("s","s"); | ||
ui->projection->addItem("p","p"); | ||
ui->projection->addItem("d","d"); | ||
ui->projection->addItem("f","f"); | ||
ui->projection->addItem("g","g"); | ||
if (dos.isMResolved()) | ||
{ | ||
//ui->magnetic->setEnabled(true); | ||
ui->magneticLabel->setEnabled(true); | ||
ui->magnetic->setVisible(true); | ||
ui->magneticLabel->setVisible(true); | ||
this->on_projection_currentIndexChanged(ui->projection->currentText()); | ||
} | ||
else | ||
{ | ||
ui->magnetic->setDisabled(true); | ||
ui->magneticLabel->setDisabled(true); | ||
ui->magnetic->setVisible(false); | ||
ui->magneticLabel->setVisible(false); | ||
} | ||
} | ||
} | ||
} | ||
|
||
void AddDos::setDb(DosDB *db) | ||
{ | ||
if (db==nullptr) this->close(); | ||
_db = db; | ||
auto list = db->list(); | ||
std::sort(list.begin(),list.end()); | ||
for (auto l : list) | ||
if (l!=0||_db->atom(l).prtdos()==5) ui->atom->addItem(l==0?tr("Total"):tr("Atom %0").arg(l),l); | ||
ui->atom->setCurrentIndex(0); | ||
} | ||
|
||
void AddDos::on_projection_currentIndexChanged(const QString &arg1) | ||
{ | ||
if (arg1.size() == 1) // angular projection | ||
{ | ||
int l = static_cast<int>(ui->projection->currentIndex()); | ||
ui->magnetic->clear(); | ||
for ( int m = -l; m <= l; ++m) | ||
{ | ||
ui->magnetic->addItem(QString::number(m),m); | ||
} | ||
} | ||
} | ||
|
||
void AddDos::on_color_clicked() | ||
{ | ||
QColor newColor = QColorDialog::getColor(Qt::black,this,tr("Pick a color"),QColorDialog::DontUseNativeDialog); | ||
if (!newColor.isValid()) return; | ||
QPalette pal = ui->color->palette(); | ||
pal.setColor(QPalette::Button,newColor); | ||
ui->color->setPalette(pal); | ||
_hasColor = true; | ||
} | ||
|
||
bool AddDos::hasColor() const | ||
{ | ||
return _hasColor; | ||
} | ||
|
||
QList<QStandardItem*> AddDos::item() | ||
{ | ||
QStandardItem *selection = new QStandardItem; | ||
QStandardItem *projection = new QStandardItem; | ||
QStandardItem *magnetic = new QStandardItem; | ||
QStandardItem *color = new QStandardItem; | ||
QStandardItem *label = new QStandardItem; | ||
|
||
selection->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsSelectable); | ||
projection->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); | ||
magnetic->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); | ||
color->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); | ||
|
||
selection->setData(ui->atom->currentText(),Qt::DisplayRole); | ||
selection->setData(ui->atom->currentData(Qt::UserRole),Qt::UserRole); | ||
selection->setData(Qt::Checked,Qt::CheckStateRole); | ||
if (ui->projection->isEnabled()) | ||
{ | ||
projection->setData(ui->projection->currentText(),Qt::DisplayRole); | ||
projection->setData(ui->projection->currentData(Qt::UserRole),Qt::UserRole); | ||
if (ui->magnetic->isEnabled()) | ||
{ | ||
magnetic->setData(ui->magnetic->currentText(),Qt::DisplayRole); | ||
magnetic->setData(ui->magnetic->currentData(Qt::UserRole),Qt::UserRole); | ||
} | ||
} | ||
if (this->hasColor()) | ||
{ | ||
QColor colorInput = ui->color->palette().color(QPalette::Button); | ||
color->setData(colorInput.name(QColor::HexRgb),Qt::DisplayRole); | ||
color->setData(colorInput.name(QColor::HexRgb),Qt::UserRole); | ||
color->setData(colorInput,Qt::BackgroundRole); | ||
} | ||
if (!ui->label->text().isEmpty()) | ||
{ | ||
label->setData(ui->label->text(),Qt::DisplayRole); | ||
} | ||
QList<QStandardItem*> list; | ||
list << selection << projection << magnetic << color | ||
<< label; | ||
return list; | ||
} | ||
|
||
void AddDos::on_magneticLabel_clicked(bool checked) | ||
{ | ||
ui->magnetic->setEnabled(checked); | ||
} |
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,42 @@ | ||
#ifndef ADDDOS_H | ||
#define ADDDOS_H | ||
|
||
#include <QDialog> | ||
#include "plot/dosdb.hpp" | ||
#include <QStandardItem> | ||
|
||
namespace Ui { | ||
class AddDos; | ||
} | ||
|
||
class AddDos : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit AddDos(QWidget *parent = 0); | ||
~AddDos(); | ||
|
||
void setDb(DosDB *db); | ||
|
||
bool hasColor() const; | ||
|
||
QList<QStandardItem*> item(); | ||
|
||
private slots: | ||
void on_atom_currentIndexChanged(int index); | ||
|
||
void on_projection_currentIndexChanged(const QString &arg1); | ||
|
||
void on_color_clicked(); | ||
|
||
void on_magneticLabel_clicked(bool checked); | ||
|
||
private: | ||
Ui::AddDos *ui; | ||
DosDB *_db; | ||
bool _hasColor; | ||
|
||
}; | ||
|
||
#endif // ADDDOS_H |
Oops, something went wrong.