Commit 59b4988e authored by Tobias WEBER's avatar Tobias WEBER
Browse files

starting with empty main window

parent bcaf4b14
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.moc
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# External libraries
ext/**
!ext/.dir
# Temporary files
tmp/**
!tmp/.dir
build/**
Tobias Weber <tweber@ill.fr>
#
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-2018
# @license see 'LICENSE' file
#
project(in20tools)
cmake_minimum_required(VERSION 3.0)
message("Build type: ${CMAKE_BUILD_TYPE}")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_VERBOSE_MAKEFILE TRUE)
endif()
set(CMAKE_CXX_STANDARD 17)
add_definitions(-std=c++17)
include_directories(
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/ext"
)
# -----------------------------------------------------------------------------
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# -----------------------------------------------------------------------------
add_executable(in20
tools/in20/main.cpp tools/in20/mainwnd.cpp tools/in20/mainwnd.h
ext/qcp/qcustomplot.cpp ext/qcp/qcustomplot.h
)
target_link_libraries(in20
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport
)
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
Directory containing external dependencies.
#!/bin/bash
#
# downloads external libraries
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-18
# @license see 'LICENSE' file
#
# -----------------------------------------------------------------------------
# tools
WGET=wget
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# URLs for external libs
TLIBS=https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tlibs.git/snapshot/tlibs-master.tar.bz2
QCP=http://www.qcustomplot.com/release/2.0.0/QCustomPlot-source.tar.gz
# local file names
TLIBS_LOCAL=${TLIBS##*[/\\]}
QCP_LOCAL=${QCP##*[/\\]}
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# cleans externals
function clean_dirs()
{
rm -rf tlibs
rm -rf qcp
}
function clean_files()
{
rm -f ${TLIBS_LOCAL}
rm -f ${QCP_LOCAL}
}
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
function dl_tlibs()
{
if ! ${WGET} ${TLIBS}
then
echo -e "Error downloading tlibs.";
exit -1;
fi
if ! tar xjvf ${TLIBS_LOCAL}
then
echo -e "Error extracting tlibs.";
exit -1;
fi
mv tlibs-master tlibs
}
function dl_qcp()
{
if ! ${WGET} ${QCP}
then
echo -e "Error downloading qcp.";
exit -1;
fi
if ! tar xzvf ${QCP_LOCAL}
then
echo -e "Error extracting qcp.";
exit -1;
fi
mv qcustomplot-source qcp
}
# -----------------------------------------------------------------------------
cd ext
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing old libs...\n"
clean_dirs
clean_files
echo -e "--------------------------------------------------------------------------------\n"
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external tlibs library...\n"
dl_tlibs
echo -e "--------------------------------------------------------------------------------\n"
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Installing external qcustomplot library...\n"
dl_qcp
echo -e "--------------------------------------------------------------------------------\n"
echo -e "\n--------------------------------------------------------------------------------"
echo -e "Removing temporary files...\n"
clean_files
echo -e "--------------------------------------------------------------------------------\n"
Directory containing individual sub-programs.
/**
* in20 data analysis tool
* @author Tobias Weber
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
#include <locale>
#include <iostream>
#include <QApplication>
#include "mainwnd.h"
int main(int argc, char** argv)
{
std::ios_base::sync_with_stdio(false);
setlocale(LC_ALL, "C");
std::locale::global(std::locale("C"));
QLocale::setDefault(QLocale::C);
QApplication app(argc, argv);
QSettings sett("tobis_stuff", "in20tool");
MainWnd wnd(&sett);
wnd.show();
return app.exec();
}
/**
* in20 data analysis tool
* @author Tobias Weber
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
#include "mainwnd.h"
MainWnd::MainWnd(QSettings* pSettings)
: QMainWindow(), m_pSettings(pSettings),
m_pMenu(new QMenuBar(this)), m_pStatus(new QStatusBar(this))
{
this->setWindowTitle("IN20 Tool");
this->resize(800, 600);
this->setMenuBar(m_pMenu);
this->setStatusBar(m_pStatus);
if(m_pSettings)
{
// restore window state
if(m_pSettings->contains("mainwnd/geo"))
this->restoreGeometry(m_pSettings->value("mainwnd/geo").toByteArray());
if(m_pSettings->contains("mainwnd/state"))
this->restoreState(m_pSettings->value("mainwnd/state").toByteArray());
}
}
MainWnd::~MainWnd()
{
}
void MainWnd::closeEvent(QCloseEvent *pEvt)
{
if(m_pSettings)
{
// save window state
m_pSettings->setValue("mainwnd/geo", this->saveGeometry());
m_pSettings->setValue("mainwnd/state", this->saveState());
}
QMainWindow::closeEvent(pEvt);
}
/**
* in20 data analysis tool
* @author Tobias Weber
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
#ifndef __IN20MAINWND_H__
#define __IN20MAINWND_H__
#include <QMainWindow>
#include <QSettings>
#include <QMenuBar>
#include <QStatusBar>
class MainWnd : public QMainWindow
{
private:
QSettings *m_pSettings = nullptr;
QMenuBar *m_pMenu = nullptr;
QStatusBar *m_pStatus = nullptr;
private:
virtual void closeEvent(QCloseEvent *pEvt) override;
public:
MainWnd(QSettings* pSettings = nullptr);
virtual ~MainWnd();
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment