clangformat

This commit is contained in:
Miodrag Milanovic 2018-08-02 19:25:20 +02:00
parent e40b61e87e
commit 23a7d96f4c
5 changed files with 23 additions and 28 deletions

View File

@ -25,13 +25,13 @@
#include <QIcon> #include <QIcon>
#include <QInputDialog> #include <QInputDialog>
#include <QSplitter> #include <QSplitter>
#include <fstream>
#include "designwidget.h" #include "designwidget.h"
#include "fpgaviewwidget.h" #include "fpgaviewwidget.h"
#include "jsonparse.h"
#include "log.h" #include "log.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "pythontab.h" #include "pythontab.h"
#include "jsonparse.h"
#include <fstream>
static void initBasenameResource() { Q_INIT_RESOURCE(base); } static void initBasenameResource() { Q_INIT_RESOURCE(base); }
@ -85,7 +85,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
splitter_v->addWidget(centralTabWidget); splitter_v->addWidget(centralTabWidget);
splitter_v->addWidget(tabWidget); splitter_v->addWidget(tabWidget);
// Connect Worker // Connect Worker
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string))); connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool))); connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool))); connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
@ -95,7 +95,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted())); connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused())); connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
// Events for context change // Events for context change
connect(this, SIGNAL(contextChanged(Context *)), task, SIGNAL(contextChanged(Context *))); connect(this, SIGNAL(contextChanged(Context *)), task, SIGNAL(contextChanged(Context *)));
connect(this, SIGNAL(contextChanged(Context *)), console, SLOT(newContext(Context *))); connect(this, SIGNAL(contextChanged(Context *)), console, SLOT(newContext(Context *)));
connect(this, SIGNAL(contextChanged(Context *)), fpgaView, SLOT(newContext(Context *))); connect(this, SIGNAL(contextChanged(Context *)), fpgaView, SLOT(newContext(Context *)));
@ -104,7 +104,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
// Catch close tab events // Catch close tab events
connect(centralTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(centralTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
// Propagate events from design view to device view // Propagate events from design view to device view
connect(designview, SIGNAL(selected(std::vector<DecalXY>, bool)), fpgaView, connect(designview, SIGNAL(selected(std::vector<DecalXY>, bool)), fpgaView,
SLOT(onSelectedArchItem(std::vector<DecalXY>, bool))); SLOT(onSelectedArchItem(std::vector<DecalXY>, bool)));
connect(designview, SIGNAL(zoomSelected()), fpgaView, SLOT(zoomSelected())); connect(designview, SIGNAL(zoomSelected()), fpgaView, SLOT(zoomSelected()));

View File

@ -50,15 +50,16 @@ class BaseMainWindow : public QMainWindow
Context *getContext() { return ctx.get(); } Context *getContext() { return ctx.get(); }
void load_json(std::string filename); void load_json(std::string filename);
protected: protected:
void createMenusAndBars(); void createMenusAndBars();
void disableActions(); void disableActions();
virtual void onDisableActions() {}; virtual void onDisableActions(){};
virtual void onJsonLoaded() {}; virtual void onJsonLoaded(){};
virtual void onPackFinished() {}; virtual void onPackFinished(){};
virtual void onBudgetFinished() {}; virtual void onBudgetFinished(){};
virtual void onPlaceFinished() {}; virtual void onPlaceFinished(){};
virtual void onRouteFinished() {}; virtual void onRouteFinished(){};
protected Q_SLOTS: protected Q_SLOTS:
void writeInfo(std::string text); void writeInfo(std::string text);
@ -105,7 +106,7 @@ class BaseMainWindow : public QMainWindow
QStatusBar *statusBar; QStatusBar *statusBar;
QToolBar *mainActionBar; QToolBar *mainActionBar;
QProgressBar *progressBar; QProgressBar *progressBar;
QAction *actionNew; QAction *actionNew;
QAction *actionOpen; QAction *actionOpen;
QAction *actionSave; QAction *actionSave;

View File

@ -317,7 +317,7 @@ QtProperty *DesignWidget::addSubGroup(QtProperty *topItem, const QString &name)
void DesignWidget::onClickedBel(BelId bel, bool keep) void DesignWidget::onClickedBel(BelId bel, bool keep)
{ {
boost::optional<TreeModel::Item*> item; boost::optional<TreeModel::Item *> item;
{ {
std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex); std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
std::lock_guard<std::mutex> lock(ctx->mutex); std::lock_guard<std::mutex> lock(ctx->mutex);
@ -334,7 +334,7 @@ void DesignWidget::onClickedBel(BelId bel, bool keep)
void DesignWidget::onClickedWire(WireId wire, bool keep) void DesignWidget::onClickedWire(WireId wire, bool keep)
{ {
boost::optional<TreeModel::Item*> item; boost::optional<TreeModel::Item *> item;
{ {
std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex); std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
std::lock_guard<std::mutex> lock(ctx->mutex); std::lock_guard<std::mutex> lock(ctx->mutex);
@ -351,7 +351,7 @@ void DesignWidget::onClickedWire(WireId wire, bool keep)
void DesignWidget::onClickedPip(PipId pip, bool keep) void DesignWidget::onClickedPip(PipId pip, bool keep)
{ {
boost::optional<TreeModel::Item*> item; boost::optional<TreeModel::Item *> item;
{ {
std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex); std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
std::lock_guard<std::mutex> lock(ctx->mutex); std::lock_guard<std::mutex> lock(ctx->mutex);

View File

@ -54,8 +54,8 @@ MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget
MainWindow::~MainWindow() {} MainWindow::~MainWindow() {}
void MainWindow::createMenu() void MainWindow::createMenu()
{ {
// Add arch specific actions // Add arch specific actions
actionLoadPCF = new QAction("Open PCF", this); actionLoadPCF = new QAction("Open PCF", this);
actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png")); actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png"));
actionLoadPCF->setStatusTip("Open PCF file"); actionLoadPCF->setStatusTip("Open PCF file");
@ -72,7 +72,7 @@ void MainWindow::createMenu()
mainActionBar->addSeparator(); mainActionBar->addSeparator();
mainActionBar->addAction(actionLoadPCF); mainActionBar->addAction(actionLoadPCF);
mainActionBar->addAction(actionSaveAsc); mainActionBar->addAction(actionSaveAsc);
menuDesign->addSeparator(); menuDesign->addSeparator();
menuDesign->addAction(actionLoadPCF); menuDesign->addAction(actionLoadPCF);
menuDesign->addAction(actionSaveAsc); menuDesign->addAction(actionSaveAsc);
@ -157,7 +157,7 @@ void MainWindow::load_pcf(std::string filename)
{ {
disableActions(); disableActions();
currentPCF = filename; currentPCF = filename;
std::ifstream f(filename); std::ifstream f(filename);
if (apply_pcf(ctx.get(), f)) { if (apply_pcf(ctx.get(), f)) {
log("Loading PCF successful.\n"); log("Loading PCF successful.\n");
actionPack->setEnabled(true); actionPack->setEnabled(true);
@ -309,14 +309,7 @@ void MainWindow::onDisableActions()
actionSaveAsc->setEnabled(false); actionSaveAsc->setEnabled(false);
} }
void MainWindow::onJsonLoaded() void MainWindow::onJsonLoaded() { actionLoadPCF->setEnabled(true); }
{ void MainWindow::onRouteFinished() { actionSaveAsc->setEnabled(true); }
actionLoadPCF->setEnabled(true);
}
void MainWindow::onRouteFinished()
{
actionSaveAsc->setEnabled(true);
}
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END

View File

@ -35,6 +35,7 @@ class MainWindow : public BaseMainWindow
public: public:
void createMenu(); void createMenu();
void load_pcf(std::string filename); void load_pcf(std::string filename);
protected: protected:
void onDisableActions() override; void onDisableActions() override;
void onJsonLoaded() override; void onJsonLoaded() override;