2014-09-26 08:46:48 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 by Amaury Pouly
|
|
|
|
*
|
|
|
|
* This program 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2013-08-21 18:16:26 +00:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QSettings>
|
|
|
|
#include "backend.h"
|
|
|
|
#include "settings.h"
|
2016-02-06 15:08:43 +00:00
|
|
|
#include "utils.h"
|
2013-08-21 18:16:26 +00:00
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
class DocumentTabWidget;
|
2014-09-18 19:36:17 +00:00
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
class DocumentTab
|
|
|
|
{
|
|
|
|
public:
|
2014-09-18 19:36:17 +00:00
|
|
|
DocumentTab() { m_tab = 0; }
|
2014-04-07 09:28:04 +00:00
|
|
|
virtual bool Quit() = 0;
|
2014-09-18 19:36:17 +00:00
|
|
|
virtual QWidget *GetWidget() = 0;
|
2016-02-06 15:08:43 +00:00
|
|
|
void SetTabWidget(DocumentTabWidget *tab);
|
2014-09-18 19:36:17 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void OnModified(bool modified);
|
|
|
|
void SetTabName(const QString& name);
|
2016-02-06 15:08:43 +00:00
|
|
|
DocumentTabWidget *m_tab;
|
2014-09-27 11:28:44 +00:00
|
|
|
QString m_tabname;
|
2014-04-07 09:28:04 +00:00
|
|
|
};
|
|
|
|
|
2016-02-06 15:08:43 +00:00
|
|
|
class DocumentTabWidget : public YTabWidget
|
2013-08-21 18:16:26 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2016-02-06 15:08:43 +00:00
|
|
|
DocumentTabWidget();
|
2014-04-07 09:28:04 +00:00
|
|
|
bool CloseTab(int index);
|
2014-09-18 19:36:17 +00:00
|
|
|
void SetTabModified(DocumentTab *tab, bool mod);
|
|
|
|
void SetTabName(DocumentTab *tab, const QString& name);
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnCloseTab(int index);
|
|
|
|
};
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow(Backend *backend);
|
|
|
|
void center();
|
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
2014-04-07 09:28:04 +00:00
|
|
|
protected:
|
2014-09-27 11:28:44 +00:00
|
|
|
void AddTab(DocumentTab *tab);
|
2014-04-07 09:28:04 +00:00
|
|
|
bool Quit();
|
|
|
|
|
2013-08-21 18:16:26 +00:00
|
|
|
private slots:
|
|
|
|
void OnQuit();
|
|
|
|
void OnAbout();
|
2014-02-09 01:17:14 +00:00
|
|
|
void OnAboutQt();
|
2013-08-21 18:16:26 +00:00
|
|
|
void OnLoadDesc();
|
|
|
|
void OnNewRegTab();
|
2014-04-07 09:28:04 +00:00
|
|
|
void OnNewRegEdit();
|
2013-08-21 18:16:26 +00:00
|
|
|
|
|
|
|
private:
|
2016-02-06 15:08:43 +00:00
|
|
|
DocumentTabWidget *m_tab;
|
2013-08-21 18:16:26 +00:00
|
|
|
Backend *m_backend;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|