Skip to content
Snippets Groups Projects
Commit 66043735 authored by Olivier Langella's avatar Olivier Langella
Browse files

main window added

parent 08fd83a9
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#FIND_PACKAGE( Pappsomspp REQUIRED )
SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
#SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
#SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/build/src/libpappsomspp-qt4.so")
......@@ -52,10 +52,24 @@ SET(CPP_FILES
utils/readspectrum.cpp
)
set(QTLIBS ${Qt5Xml_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES})
# we need this to be able to include headers produced by uic in our code
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
SET(XTPCPP_SRCS
./gui/mainwindow.cpp
)
SET (GUI_UIS
./gui/main.ui
)
SET(XTPCPP_MOC_HDRS
./gui/mainwindow.h
)
......@@ -65,15 +79,10 @@ QT4_WRAP_UI( GUI_UI_HDRS ${GUI_UIS} )
QT4_WRAP_CPP( XTPCPP_MOC_SRCS ${XTPCPP_MOC_HDRS} )
MESSAGE("XTPCPP_SRCS: ${XTPCPP_SRCS}")
set(QTLIBS ${Qt5Xml_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES})
# we need this to be able to include headers produced by uic in our code
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
ADD_EXECUTABLE(xtpcpp ${CPP_FILES} ${GUI_UI_HDRS} ${XTPCPP_MOC_SRCS})
ADD_EXECUTABLE(xtpcpp main.cpp ${CPP_FILES} ${XTPCPP_SRCS} ${GUI_UI_HDRS} ${XTPCPP_MOC_SRCS})
target_include_directories (xtpcpp PUBLIC ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTSVG_INCLUDE_DIR})
SET_TARGET_PROPERTIES(xtpcpp
PROPERTIES OUTPUT_NAME xtpcpp
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Main</class>
<widget class="QMainWindow" name="Main">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>286</width>
<height>372</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>286</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionLoad"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionLoad">
<property name="text">
<string>Load</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation
******************************************************************************/
#include "mainwindow.h"
#include "ui_main.h"
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent),
ui(new Ui::Main)
{
ui->setupUi(this);
PwizLoaderThread *worker = new PwizLoaderThread;
worker->moveToThread(&workerThread);
#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
/*
connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(this, SIGNAL(operateMsDataFile(QString)), worker,SLOT(doMsDataFileLoad(QString)));
connect(worker, SIGNAL(msDataReady(pwiz::msdata::MSDataFile *)), this, SLOT(handleMsDataFile(pwiz::msdata::MSDataFile *)));
*/
#endif
/*
*/
workerThread.start();
}
MainWindow::~MainWindow()
{
workerThread.quit();
workerThread.wait();
//if (_p_ms_data_file != nullptr) delete _p_ms_data_file;
delete ui;
}
\ No newline at end of file
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.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@moulon.inra.fr> - initial API and implementation
******************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QThread>
#include <QFileInfo>
#include <pappsomspp/types.h>
#include <pappsomspp/peptide/peptide.h>
#include <pappsomspp/spectrum/spectrum.h>
#include <pwiz/data/msdata/MSDataFile.hpp>
#include "../utils/readspectrum.h"
namespace Ui {
class Main;
}
class PwizLoaderThread : public QObject
{
Q_OBJECT
public:
public slots:
void doMsDataFileLoad(const QString & parameter) {
pwiz::msdata::MSDataFile* p_ms_data_file = getPwizMSDataFile(parameter);
/* ... here is the expensive or blocking operation ... */
emit msDataReady(p_ms_data_file);
}
signals:
void msDataReady(pwiz::msdata::MSDataFile * p_ms_data_file);
};
class MainWindow: public QMainWindow {
Q_OBJECT
QThread workerThread;
public:
explicit MainWindow(QWidget * parent = 0);
~MainWindow();
public slots:
//void peptideEdited(QString peptideStr);
// void setColor(const QColor &color);
// void setShape(Shape shape);
signals:
//void peptideChanged(pappso::PeptideSp peptide);
private:
Ui::Main *ui;
};
#endif // MAINWINDOW_H
......@@ -23,8 +23,9 @@
#include <QApplication>
#include <iostream>
#include "ptspectrumviewer.h"
#include "qspectrumwidget.h"
#include <pappsomspp/pappsoexception.h>
#include "config.h"
#include "gui/mainwindow.h"
using namespace std;
......@@ -37,7 +38,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("PAPPSO");
QCoreApplication::setOrganizationDomain("pappso.inra.fr");
QCoreApplication::setApplicationName("xtpcpp");
PtSpectrumViewer window;
MainWindow window;
window.show();
return app.exec();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment