libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::HttpButton Class Reference

#include <httpbutton.h>

Inheritance diagram for pappso::HttpButton:

Public Member Functions

 HttpButton (QWidget *parent=nullptr)
 ~HttpButton ()
void setText (const QString &text)

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override
const QUrl getOlsUrl (QString psimod_accession)
const QUrl getPubMedUrl (QString accession)
const QUrl getRESIDUrl (QString accession)
const QUrl getChEBIUrl (QString accession)
const QUrl getUnimodUrl (QString accession)

Detailed Description

Definition at line 40 of file httpbutton.h.

Constructor & Destructor Documentation

◆ HttpButton()

HttpButton::HttpButton ( QWidget * parent = nullptr)
explicit

Default constructor

Definition at line 38 of file httpbutton.cpp.

38 : QPushButton(parent)
39{
40 qDebug();
41}

◆ ~HttpButton()

pappso::HttpButton::~HttpButton ( )

Destructor

Definition at line 43 of file httpbutton.cpp.

44{
45}

Member Function Documentation

◆ getChEBIUrl()

const QUrl HttpButton::getChEBIUrl ( QString accession)
protected

Definition at line 121 of file httpbutton.cpp.

122{
123 // ChEBI:37629
124 // https://www.ebi.ac.uk/chebi/searchId.do?chebiId=37628
125 QUrl url(QString("https://www.ebi.ac.uk/chebi/searchId.do?chebiId=%1")
126 .arg(accession.replace("ChEBI:", "")));
127 return url;
128}

Referenced by mousePressEvent().

◆ getOlsUrl()

const QUrl HttpButton::getOlsUrl ( QString psimod_accession)
protected

Definition at line 93 of file httpbutton.cpp.

94{
95
96 QString iri(QString("http://purl.obolibrary.org/obo/%1").arg(psimod_accession.replace(":", "_")));
97 QUrl url(QString("http://www.ebi.ac.uk/ols/ontologies/mod/terms?iri=%1").arg(iri));
98 return url;
99}

Referenced by mousePressEvent().

◆ getPubMedUrl()

const QUrl HttpButton::getPubMedUrl ( QString accession)
protected

Definition at line 102 of file httpbutton.cpp.

103{
104 // https://pubmed.ncbi.nlm.nih.gov/18688235/
105 QUrl url(QString("https://pubmed.ncbi.nlm.nih.gov/%1/").arg(accession.replace("PubMed:", "")));
106 return url;
107}

Referenced by mousePressEvent().

◆ getRESIDUrl()

const QUrl HttpButton::getRESIDUrl ( QString accession)
protected

Definition at line 111 of file httpbutton.cpp.

112{
113 // https://annotation.dbi.udel.edu/cgi-bin/resid?id=AA0470
114 QUrl url(QString("https://annotation.dbi.udel.edu/cgi-bin/resid?id=%1")
115 .arg(accession.replace("RESID:", "")));
116 return url;
117}

Referenced by mousePressEvent().

◆ getUnimodUrl()

const QUrl HttpButton::getUnimodUrl ( QString accession)
protected

Definition at line 132 of file httpbutton.cpp.

133{
134 // Unimod:23
135 // http://www.unimod.org/modifications_view.php?editid1=23
136 QUrl url(QString("http://www.unimod.org/modifications_view.php?editid1=%1")
137 .arg(accession.replace("Unimod:", "")));
138 return url;
139}

Referenced by mousePressEvent().

◆ mousePressEvent()

void pappso::HttpButton::mousePressEvent ( QMouseEvent * e)
overrideprotected

Definition at line 48 of file httpbutton.cpp.

49{
50 if(!text().isEmpty())
51 {
52 if(text().startsWith("MOD:"))
53 {
54 QDesktopServices::openUrl(getOlsUrl(this->text()));
55 // qDebug() << getOlsUrl(this->text());
56 }
57 else if(text().startsWith("PubMed:"))
58 {
59 QDesktopServices::openUrl(getPubMedUrl(this->text()));
60 // qDebug() << getPubMedUrl(this->text());
61 }
62 else if(text().startsWith("RESID:"))
63 {
64 QDesktopServices::openUrl(getRESIDUrl(this->text()));
65 // qDebug() << getPubMedUrl(this->text());
66 }
67 else if(text().startsWith("ChEBI:"))
68 {
69 QDesktopServices::openUrl(getChEBIUrl(this->text()));
70 // qDebug() << getPubMedUrl(this->text());
71 }
72 else if(text().startsWith("Unimod:"))
73 {
74 QDesktopServices::openUrl(getUnimodUrl(this->text()));
75 // qDebug() << getPubMedUrl(this->text());
76 }
77 else
78 {
79 qDebug() << "unknown" << this->text();
80 }
81 }
82 QPushButton::mousePressEvent(e);
83}
const QUrl getUnimodUrl(QString accession)
const QUrl getRESIDUrl(QString accession)
const QUrl getChEBIUrl(QString accession)
const QUrl getOlsUrl(QString psimod_accession)
const QUrl getPubMedUrl(QString accession)

References getChEBIUrl(), getOlsUrl(), getPubMedUrl(), getRESIDUrl(), and getUnimodUrl().

◆ setText()

void pappso::HttpButton::setText ( const QString & text)

Definition at line 86 of file httpbutton.cpp.

87{
88 QPushButton::setText(text);
89}

Referenced by pappso::OboTermForm::parseDefinitionLabel().


The documentation for this class was generated from the following files: