nextpnr/gui/basewindow.h

144 lines
3.5 KiB
C
Raw Normal View History

2018-06-22 22:21:20 +08:00
/*
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
2018-06-21 19:41:16 +08:00
#ifndef BASEMAINWINDOW_H
#define BASEMAINWINDOW_H
2019-06-26 00:19:25 +08:00
#include "command.h"
2018-06-21 19:41:16 +08:00
#include "nextpnr.h"
2018-08-03 00:50:08 +08:00
#include "worker.h"
2018-06-21 19:41:16 +08:00
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QProgressBar>
2018-06-21 19:41:16 +08:00
#include <QStatusBar>
2018-06-21 19:55:36 +08:00
#include <QTabWidget>
#include <QToolBar>
2018-06-21 19:41:16 +08:00
Q_DECLARE_METATYPE(std::string)
2018-07-15 01:44:37 +08:00
Q_DECLARE_METATYPE(NEXTPNR_NAMESPACE_PREFIX DecalXY)
2018-06-22 19:10:27 +08:00
NEXTPNR_NAMESPACE_BEGIN
2018-07-14 20:06:05 +08:00
class PythonTab;
2018-07-16 02:31:42 +08:00
class DesignWidget;
2018-07-26 19:21:46 +08:00
class FPGAViewWidget;
2018-07-14 20:06:05 +08:00
2018-06-21 19:41:16 +08:00
class BaseMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit BaseMainWindow(std::unique_ptr<Context> context, CommandHandler *handler, QWidget *parent = 0);
virtual ~BaseMainWindow();
Context *getContext() { return ctx.get(); }
2019-06-14 17:14:18 +08:00
void updateActions();
void notifyChangeContext();
2018-08-09 00:17:34 +08:00
2018-06-21 19:41:16 +08:00
protected:
void createMenusAndBars();
2018-08-03 00:50:08 +08:00
void disableActions();
void enableDisableDecals();
2018-08-06 00:02:33 +08:00
2018-08-03 01:25:20 +08:00
virtual void onDisableActions(){};
2019-06-14 17:14:18 +08:00
virtual void onUpdateActions(){};
2018-06-21 19:41:16 +08:00
protected Q_SLOTS:
void writeInfo(std::string text);
void closeTab(int index);
2018-06-26 20:17:17 +08:00
virtual void new_proj() = 0;
2018-08-09 00:14:22 +08:00
2018-08-03 00:50:08 +08:00
void open_json();
2019-06-14 17:14:18 +08:00
void save_json();
2018-08-03 00:50:08 +08:00
void budget();
void place();
2018-12-15 00:20:25 +08:00
void execute_python();
2018-08-03 00:50:08 +08:00
void pack_finished(bool status);
void budget_finish(bool status);
void place_finished(bool status);
void route_finished(bool status);
void taskCanceled();
void taskStarted();
void taskPaused();
void screenshot();
void saveMovie();
2020-02-27 16:37:09 +08:00
void saveSVG();
2018-06-26 21:47:22 +08:00
Q_SIGNALS:
void contextChanged(Context *ctx);
2018-07-06 02:06:12 +08:00
void updateTreeView();
2018-06-26 21:47:22 +08:00
2018-06-21 19:41:16 +08:00
protected:
2018-08-03 01:21:25 +08:00
// state variables
CommandHandler *handler;
std::unique_ptr<Context> ctx;
2018-08-03 00:50:08 +08:00
TaskManager *task;
2018-08-03 01:21:25 +08:00
bool timing_driven;
2018-08-09 00:14:22 +08:00
std::string currentProj;
2018-08-03 01:21:25 +08:00
// main widgets
2018-06-21 19:41:16 +08:00
QTabWidget *tabWidget;
2018-06-21 20:12:02 +08:00
QTabWidget *centralTabWidget;
2018-07-14 20:06:05 +08:00
PythonTab *console;
2018-08-03 01:21:25 +08:00
DesignWidget *designview;
FPGAViewWidget *fpgaView;
2018-06-21 19:55:36 +08:00
2018-08-03 01:21:25 +08:00
// Menus, bars and actions
2018-06-21 19:41:16 +08:00
QMenuBar *menuBar;
2018-08-03 01:21:25 +08:00
QMenu *menuDesign;
2018-06-21 19:41:16 +08:00
QStatusBar *statusBar;
2018-08-03 01:21:25 +08:00
QToolBar *mainActionBar;
QProgressBar *progressBar;
2018-08-03 01:25:20 +08:00
2019-06-14 17:14:18 +08:00
QAction *actionNew;
2018-08-03 00:50:08 +08:00
QAction *actionLoadJSON;
2019-06-14 17:14:18 +08:00
QAction *actionSaveJSON;
2018-08-03 00:50:08 +08:00
QAction *actionPack;
QAction *actionAssignBudget;
QAction *actionPlace;
QAction *actionRoute;
2018-12-15 00:20:25 +08:00
QAction *actionExecutePy;
2018-08-03 00:50:08 +08:00
QAction *actionPlay;
QAction *actionPause;
QAction *actionStop;
QAction *actionDisplayBel;
QAction *actionDisplayWire;
QAction *actionDisplayPip;
QAction *actionDisplayGroups;
QAction *actionScreenshot;
QAction *actionMovie;
2020-02-27 16:37:09 +08:00
QAction *actionSaveSVG;
2018-06-21 19:41:16 +08:00
};
2018-06-22 19:10:27 +08:00
NEXTPNR_NAMESPACE_END
2018-06-21 19:41:16 +08:00
#endif // BASEMAINWINDOW_H