diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-15 20:31:42 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-15 20:31:42 +0200 |
commit | 8e12ae2cfed728ee1ecab4e5f60f0435bf2d58b8 (patch) | |
tree | 3fe3251b2217747bcad8967cdb551ed1fa18a1a3 | |
parent | ecc4c3fa7bdf1726377cd5cf2199b3cabd233427 (diff) | |
download | nextpnr-8e12ae2cfed728ee1ecab4e5f60f0435bf2d58b8.tar.gz nextpnr-8e12ae2cfed728ee1ecab4e5f60f0435bf2d58b8.tar.bz2 nextpnr-8e12ae2cfed728ee1ecab4e5f60f0435bf2d58b8.zip |
Added splash screen info while loading
-rw-r--r-- | gui/base.qrc | 1 | ||||
-rw-r--r-- | gui/basewindow.cc | 30 | ||||
-rw-r--r-- | gui/basewindow.h | 6 | ||||
-rw-r--r-- | gui/designwidget.cc | 5 | ||||
-rw-r--r-- | gui/designwidget.h | 2 | ||||
-rw-r--r-- | gui/ice40/mainwindow.cc | 1 | ||||
-rw-r--r-- | gui/resources/splash.png | bin | 0 -> 4651 bytes |
7 files changed, 39 insertions, 6 deletions
diff --git a/gui/base.qrc b/gui/base.qrc index 8f07aabe..bf21986b 100644 --- a/gui/base.qrc +++ b/gui/base.qrc @@ -9,5 +9,6 @@ <file>resources/resultset_previous.png</file> <file>resources/resultset_next.png</file> <file>resources/resultset_last.png</file> + <file>resources/splash.png</file> </qresource> </RCC> diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 22e47295..07b71105 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -18,6 +18,7 @@ */
#include <QAction>
+#include <QCoreApplication>
#include <QFileDialog>
#include <QGridLayout>
#include <QIcon>
@@ -61,15 +62,10 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent setCentralWidget(centralWidget);
- DesignWidget *designview = new DesignWidget();
+ designview = new DesignWidget();
designview->setMinimumWidth(300);
splitter_h->addWidget(designview);
- connect(this, SIGNAL(contextChanged(Context *)), designview, SLOT(newContext(Context *)));
- connect(this, SIGNAL(updateTreeView()), designview, SLOT(updateTree()));
-
- connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
-
tabWidget = new QTabWidget();
console = new PythonTab();
@@ -87,12 +83,34 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent connect(designview, SIGNAL(highlight(std::vector<DecalXY>, int)), fpgaView,
SLOT(onHighlightGroupChanged(std::vector<DecalXY>, int)));
+ connect(this, SIGNAL(contextChanged(Context *)), designview, SLOT(newContext(Context *)));
+ connect(this, SIGNAL(updateTreeView()), designview, SLOT(updateTree()));
+
+ connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
+
splitter_v->addWidget(centralTabWidget);
splitter_v->addWidget(tabWidget);
+ displaySplash();
}
BaseMainWindow::~BaseMainWindow() {}
+void BaseMainWindow::displaySplash()
+{
+ splash = new QSplashScreen();
+ splash->setPixmap(QPixmap(":/icons/resources/splash.png"));
+ splash->show();
+ connect(designview, SIGNAL(finishContextLoad()), splash, SLOT(close()));
+ connect(designview, SIGNAL(contextLoadStatus(std::string)), this, SLOT(displaySplashMessage(std::string)));
+ QCoreApplication::instance()->processEvents();
+}
+
+void BaseMainWindow::displaySplashMessage(std::string msg)
+{
+ splash->showMessage(msg.c_str(), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
+ QCoreApplication::instance()->processEvents();
+}
+
void BaseMainWindow::writeInfo(std::string text) { console->info(text); }
void BaseMainWindow::createMenusAndBars()
diff --git a/gui/basewindow.h b/gui/basewindow.h index 4d3d80a1..18b5339e 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -26,6 +26,7 @@ #include <QMenu>
#include <QMenuBar>
#include <QProgressBar>
+#include <QSplashScreen>
#include <QStatusBar>
#include <QTabWidget>
#include <QToolBar>
@@ -36,6 +37,7 @@ Q_DECLARE_METATYPE(NEXTPNR_NAMESPACE_PREFIX DecalXY) NEXTPNR_NAMESPACE_BEGIN
class PythonTab;
+class DesignWidget;
class BaseMainWindow : public QMainWindow
{
@@ -48,9 +50,11 @@ class BaseMainWindow : public QMainWindow protected:
void createMenusAndBars();
+ void displaySplash();
protected Q_SLOTS:
void writeInfo(std::string text);
+ void displaySplashMessage(std::string msg);
virtual void new_proj() = 0;
virtual void open_proj() = 0;
@@ -72,6 +76,8 @@ class BaseMainWindow : public QMainWindow QAction *actionNew;
QAction *actionOpen;
QProgressBar *progressBar;
+ QSplashScreen *splash;
+ DesignWidget *designview;
};
NEXTPNR_NAMESPACE_END
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 1f039c60..8b9e9d22 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -230,6 +230,7 @@ void DesignWidget::newContext(Context *ctx) bel_root->setText(0, "Bels");
treeWidget->insertTopLevelItem(0, bel_root);
if (ctx) {
+ Q_EMIT contextLoadStatus("Configuring bels...");
for (auto bel : ctx->getBels()) {
auto id = ctx->getBelName(bel);
QStringList items = QString(id.c_str(ctx)).split("/");
@@ -262,6 +263,7 @@ void DesignWidget::newContext(Context *ctx) wire_root->setText(0, "Wires");
treeWidget->insertTopLevelItem(0, wire_root);
if (ctx) {
+ Q_EMIT contextLoadStatus("Configuring wires...");
for (auto wire : ctx->getWires()) {
auto id = ctx->getWireName(wire);
QStringList items = QString(id.c_str(ctx)).split("/");
@@ -293,6 +295,7 @@ void DesignWidget::newContext(Context *ctx) pip_root->setText(0, "Pips");
treeWidget->insertTopLevelItem(0, pip_root);
if (ctx) {
+ Q_EMIT contextLoadStatus("Configuring pips...");
for (auto pip : ctx->getPips()) {
auto id = ctx->getPipName(pip);
QStringList items = QString(id.c_str(ctx)).split("/");
@@ -328,6 +331,8 @@ void DesignWidget::newContext(Context *ctx) cells_root = new QTreeWidgetItem(treeWidget);
cells_root->setText(0, "Cells");
treeWidget->insertTopLevelItem(0, cells_root);
+
+ Q_EMIT finishContextLoad();
}
void DesignWidget::updateTree()
diff --git a/gui/designwidget.h b/gui/designwidget.h index 269e32fa..1afe817d 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -65,6 +65,8 @@ class DesignWidget : public QWidget void info(std::string text);
void selected(std::vector<DecalXY> decal);
void highlight(std::vector<DecalXY> decal, int group);
+ void finishContextLoad();
+ void contextLoadStatus(std::string text);
private Q_SLOTS:
void prepareMenuProperty(const QPoint &pos);
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 28792ed3..4b1f2c57 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -226,6 +226,7 @@ void MainWindow::new_proj() ctx = std::unique_ptr<Context>(new Context(chipArgs));
actionLoadJSON->setEnabled(true);
+ Q_EMIT displaySplash();
Q_EMIT contextChanged(ctx.get());
}
}
diff --git a/gui/resources/splash.png b/gui/resources/splash.png Binary files differnew file mode 100644 index 00000000..14d2842b --- /dev/null +++ b/gui/resources/splash.png |