Commit a26e889f authored by Tobias WEBER's avatar Tobias WEBER
Browse files

started with file browser

parent 77a5dcc6
......@@ -39,6 +39,7 @@ set(CMAKE_AUTOUIC ON)
add_executable(in20
tools/in20/main.cpp tools/in20/mainwnd.cpp tools/in20/mainwnd.h
tools/in20/filebrowser.cpp tools/in20/filebrowser.h
ext/qcp/qcustomplot.cpp ext/qcp/qcustomplot.h
)
......
#!/bin/bash
export CC=clang
export CXX=clang++
/**
* data file browser
* @author Tobias Weber <tweber@ill.fr>
* @date 9-Apr-2018
* @license see 'LICENSE' file
*/
#include "filebrowser.h"
FileBrowserWidget::FileBrowserWidget(QWidget *pParent)
: QWidget(pParent)
{
}
FileBrowserWidget::~FileBrowserWidget()
{
}
FileBrowser::FileBrowser(QWidget* pParent)
: QDockWidget(pParent), m_pBrowser(std::make_unique<FileBrowserWidget>(this))
{
this->setObjectName("fileBrowser");
this->setWindowTitle("File Browser");
}
FileBrowser::~FileBrowser()
{
}
/**
* data file browser
* @author Tobias Weber <tweber@ill.fr>
* @date 9-Apr-2018
* @license see 'LICENSE' file
*/
#ifndef __FILEBROWSER_H__
#define __FILEBROWSER_H__
#include <QtWidgets/QWidget>
#include <QtWidgets/QDockWidget>
#include <memory>
/**
* file browser widget
*/
class FileBrowserWidget : public QWidget
{
private:
public:
FileBrowserWidget(QWidget *pParent = nullptr);
virtual ~FileBrowserWidget();
};
/**
* the dock which contains the file browser widget
*/
class FileBrowser : public QDockWidget
{
private:
std::unique_ptr<FileBrowserWidget> m_pBrowser;
public:
FileBrowser(QWidget* pParent = nullptr);
virtual ~FileBrowser();
};
#endif
/**
* in20 data analysis tool
* @author Tobias Weber
* @author Tobias Weber <tweber@ill.fr>
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
#include <locale>
#include <iostream>
#include <QApplication>
#include <QtWidgets/QApplication>
#include "mainwnd.h"
......
/**
* in20 data analysis tool
* @author Tobias Weber
* @author Tobias Weber <tweber@ill.fr>
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
#include "mainwnd.h"
//#include <iostream>
MainWnd::MainWnd(QSettings* pSettings)
: QMainWindow(), m_pSettings(pSettings),
m_pMenu(new QMenuBar(this)), m_pStatus(new QStatusBar(this))
m_pMenu(new QMenuBar(this)), m_pStatus(new QStatusBar(this)),
m_pMDI(new QMdiArea(this)), m_pBrowser(new FileBrowser(this))
{
this->setObjectName("in20");
this->setWindowTitle("IN20 Tool");
this->resize(800, 600);
// ------------------------------------------------------------------------
// Menu Bar
QMenu *pMenuView = new QMenu("View", m_pMenu);
QAction *pShowFileBrowser = new QAction("Show File Browser", pMenuView);
pShowFileBrowser->setCheckable(true);
pShowFileBrowser->setChecked(m_pBrowser->isVisible());
connect(pShowFileBrowser, &QAction::toggled, m_pBrowser, &FileBrowser::setVisible);
pMenuView->addAction(pShowFileBrowser);
m_pMenu->addMenu(pMenuView);
this->setMenuBar(m_pMenu);
// ------------------------------------------------------------------------
this->setStatusBar(m_pStatus);
this->setCentralWidget(m_pMDI);
this->addDockWidget(Qt::LeftDockWidgetArea, m_pBrowser);
// ------------------------------------------------------------------------
// restore settings
if(m_pSettings)
{
// restore window state
......@@ -26,11 +49,17 @@ MainWnd::MainWnd(QSettings* pSettings)
if(m_pSettings->contains("mainwnd/state"))
this->restoreState(m_pSettings->value("mainwnd/state").toByteArray());
}
// ------------------------------------------------------------------------
}
MainWnd::~MainWnd()
{}
void MainWnd::showEvent(QShowEvent *pEvt)
{
QMainWindow::showEvent(pEvt);
}
......
/**
* in20 data analysis tool
* @author Tobias Weber
* @author Tobias Weber <tweber@ill.fr>
* @date 6-Apr-2018
* @license see 'LICENSE' file
*/
......@@ -8,10 +8,13 @@
#ifndef __IN20MAINWND_H__
#define __IN20MAINWND_H__
#include <QMainWindow>
#include <QSettings>
#include <QMenuBar>
#include <QStatusBar>
#include <QtCore/QSettings>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QStatusBar>
#include "filebrowser.h"
class MainWnd : public QMainWindow
......@@ -20,8 +23,11 @@ private:
QSettings *m_pSettings = nullptr;
QMenuBar *m_pMenu = nullptr;
QStatusBar *m_pStatus = nullptr;
QMdiArea *m_pMDI = nullptr;
FileBrowser *m_pBrowser = nullptr;
private:
virtual void showEvent(QShowEvent *pEvt) override;
virtual void closeEvent(QCloseEvent *pEvt) override;
public:
......
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