Skip to content
Snippets Groups Projects
choosemodificationdialog.cpp 3.11 KiB
Newer Older

/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
*     XTPcpp 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.
*
*     XTPcpp 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 XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/

#include "choosemodificationdialog.h"

#include "ui_choose_modification_dialog.h"
#include <QDebug>
#include <QDesktopServices>
#include "../../utils/utils.h"

ChooseModificationDialog::ChooseModificationDialog(QWidget * parent):
    QDialog(parent),
    ui(new Ui::ChooseModificationDialog)
{
    qDebug() << "ChooseModificationDialog::ChooseModificationDialog begin";
    ui->setupUi(this);
    this->setModal(true);

    _p_modification_str_li = new QStandardItemModel();
    ui->modification_listview->setModel(_p_modification_str_li);
    //param.setFilterCrossSamplePeptideNumber(settings.value("automatic_filter/cross_sample", "true").toBool());
    
#if QT_VERSION >= 0x050000
    // Qt5 code
    /*
    connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
    connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad);
    connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile);
    */
#else
// Qt4 code

#endif

}

ChooseModificationDialog::~ChooseModificationDialog()
{
    delete ui;
}

void ChooseModificationDialog::setMassRange(const pappso::MassRange & massrange) {
}


void ChooseModificationDialog::ItemDoubleClicked (QModelIndex index )
{
    qDebug() << "ChooseModificationDialog::ItemClicked data=" << index.data().toString();
    qDebug() << "ChooseModificationDialog::ItemClicked acc=" << _p_modification_str_li->data(index,Qt::UserRole).toString();
    QDesktopServices::openUrl (Utils::getOlsUrl(_p_modification_str_li->data(index,Qt::UserRole).toString())) ;
}

void ChooseModificationDialog::ItemClicked (QModelIndex index )
{
    qDebug() << "ChooseModificationDialog::ItemClicked data=" << index.data().toString();
    qDebug() << "ChooseModificationDialog::ItemClicked acc=" << _p_modification_str_li->data(index,Qt::UserRole).toString();
    qDebug() << "ChooseModificationDialog::ItemClicked str=" << _p_modification_str_li->data(index,Qt::DisplayRole).toString();
    pappso::AaModificationP modification = pappso::AaModification::getInstance(index.data(Qt::UserRole).toString());
    _selected_modification = modification;
}