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