Unify interfaces for gui
This commit is contained in:
parent
80e6b17ec9
commit
e68ca65e9e
@ -384,7 +384,7 @@ struct PipRange
|
|||||||
|
|
||||||
struct ArchArgs
|
struct ArchArgs
|
||||||
{
|
{
|
||||||
enum
|
enum ArchArgsType
|
||||||
{
|
{
|
||||||
NONE,
|
NONE,
|
||||||
LFE5U_25F,
|
LFE5U_25F,
|
||||||
|
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifndef NO_GUI
|
#ifndef NO_GUI
|
||||||
if (vm.count("gui")) {
|
if (vm.count("gui")) {
|
||||||
Application a(argc, argv);
|
Application a(argc, argv);
|
||||||
MainWindow w(std::move(ctx));
|
MainWindow w(std::move(ctx),args);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -175,7 +175,7 @@ void Arch::setGroupDecal(GroupId group, DecalXY decalxy)
|
|||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
Arch::Arch(ArchArgs) {}
|
Arch::Arch(ArchArgs) : chipName("generic") {}
|
||||||
|
|
||||||
void IdString::initialize_arch(const BaseCtx *ctx) {}
|
void IdString::initialize_arch(const BaseCtx *ctx) {}
|
||||||
|
|
||||||
|
@ -90,7 +90,8 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> ctx = std::unique_ptr<Context>(new Context(ArchArgs{}));
|
ArchArgs chipArgs{};
|
||||||
|
std::unique_ptr<Context> ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
|
|
||||||
if (vm.count("verbose")) {
|
if (vm.count("verbose")) {
|
||||||
ctx->verbose = true;
|
ctx->verbose = true;
|
||||||
@ -107,7 +108,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifndef NO_GUI
|
#ifndef NO_GUI
|
||||||
if (vm.count("gui")) {
|
if (vm.count("gui")) {
|
||||||
Application a(argc, argv);
|
Application a(argc, argv);
|
||||||
MainWindow w(std::move(ctx));
|
MainWindow w(std::move(ctx), chipArgs);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -23,19 +23,27 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
MainWindow::MainWindow(std::unique_ptr<Context> context, QWidget *parent) : BaseMainWindow(std::move(context), parent)
|
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), parent), chipArgs(args)
|
||||||
{
|
{
|
||||||
initMainResource();
|
initMainResource();
|
||||||
|
|
||||||
std::string title = "nextpnr-ecp5 - [EMPTY]";
|
std::string title = "nextpnr-ecp5 - [EMPTY]";
|
||||||
setWindowTitle(title.c_str());
|
setWindowTitle(title.c_str());
|
||||||
|
|
||||||
|
connect(this, &BaseMainWindow::contextChanged, this, &MainWindow::newContext);
|
||||||
|
|
||||||
createMenu();
|
createMenu();
|
||||||
Q_EMIT contextChanged(ctx.get());
|
Q_EMIT contextChanged(ctx.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() {}
|
||||||
|
|
||||||
|
void MainWindow::newContext(Context *ctx)
|
||||||
|
{
|
||||||
|
std::string title = "nextpnr-generic - " + ctx->getChipName() + " ( " + chipArgs.package + " )";
|
||||||
|
setWindowTitle(title.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::createMenu() {}
|
void MainWindow::createMenu() {}
|
||||||
|
|
||||||
void MainWindow::new_proj() {}
|
void MainWindow::new_proj() {}
|
||||||
|
@ -29,7 +29,7 @@ class MainWindow : public BaseMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(std::unique_ptr<Context> context, QWidget *parent = 0);
|
explicit MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent = 0);
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -39,6 +39,10 @@ class MainWindow : public BaseMainWindow
|
|||||||
virtual void new_proj();
|
virtual void new_proj();
|
||||||
virtual void open_proj();
|
virtual void open_proj();
|
||||||
virtual bool save_proj();
|
virtual bool save_proj();
|
||||||
|
void newContext(Context *ctx);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ArchArgs chipArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -23,19 +23,27 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
MainWindow::MainWindow(std::unique_ptr<Context> context, QWidget *parent) : BaseMainWindow(std::move(context), parent)
|
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), parent), chipArgs(args)
|
||||||
{
|
{
|
||||||
initMainResource();
|
initMainResource();
|
||||||
|
|
||||||
std::string title = "nextpnr-generic - [EMPTY]";
|
std::string title = "nextpnr-generic - [EMPTY]";
|
||||||
setWindowTitle(title.c_str());
|
setWindowTitle(title.c_str());
|
||||||
|
|
||||||
|
connect(this, &BaseMainWindow::contextChanged, this, &MainWindow::newContext);
|
||||||
|
|
||||||
createMenu();
|
createMenu();
|
||||||
Q_EMIT contextChanged(ctx.get());
|
Q_EMIT contextChanged(ctx.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() {}
|
||||||
|
|
||||||
|
void MainWindow::newContext(Context *ctx)
|
||||||
|
{
|
||||||
|
std::string title = "nextpnr-generic - " + ctx->getChipName();
|
||||||
|
setWindowTitle(title.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::createMenu() {}
|
void MainWindow::createMenu() {}
|
||||||
|
|
||||||
void MainWindow::new_proj() {}
|
void MainWindow::new_proj() {}
|
||||||
|
@ -29,7 +29,7 @@ class MainWindow : public BaseMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(std::unique_ptr<Context> context, QWidget *parent = 0);
|
explicit MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent = 0);
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -39,6 +39,10 @@ class MainWindow : public BaseMainWindow
|
|||||||
virtual void new_proj();
|
virtual void new_proj();
|
||||||
virtual void open_proj();
|
virtual void open_proj();
|
||||||
virtual bool save_proj();
|
virtual bool save_proj();
|
||||||
|
void newContext(Context *ctx);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ArchArgs chipArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
Loading…
Reference in New Issue
Block a user