Basic GUI part selection
This commit is contained in:
parent
26798038fe
commit
1f115ddd32
@ -21,6 +21,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "embed.h"
|
||||||
|
#include "chipdb/available.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
@ -78,31 +80,42 @@ void MainWindow::createMenu()
|
|||||||
|
|
||||||
void MainWindow::new_proj()
|
void MainWindow::new_proj()
|
||||||
{
|
{
|
||||||
/* QMap<QString, int> arch;
|
QList<QString> arch;
|
||||||
|
|
||||||
|
std::stringstream ss(available_devices);
|
||||||
|
std::string name;
|
||||||
|
while(getline(ss, name, ';')){
|
||||||
|
std::string chipdb = stringf("machxo2/chipdb-%s.bin", name.c_str());
|
||||||
|
auto db_ptr = reinterpret_cast<const RelPtr<ChipInfoPOD> *>(get_chipdb(chipdb));
|
||||||
|
if (!db_ptr)
|
||||||
|
continue; // chipdb not available
|
||||||
|
for (auto &chip : db_ptr->get()->variants) {
|
||||||
|
for (auto &pkg : chip.packages) {
|
||||||
|
for (auto &speedgrade : chip.speed_grades) {
|
||||||
|
for (auto &rating : chip.suffixes) {
|
||||||
|
std::string devname = stringf("%s-%d%s%s", chip.name.get(), speedgrade.speed, pkg.short_name.get(), rating.suffix.get());
|
||||||
|
arch.append(QString::fromLocal8Bit(devname.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString item = QInputDialog::getItem(this, "Select new context", "Chip:", arch.keys(), 0, false, &ok);
|
QString item = QInputDialog::getItem(this, "Select new context", "Part:", arch, 0, false, &ok);
|
||||||
if (ok && !item.isEmpty()) {
|
if (ok && !item.isEmpty()) {
|
||||||
ArchArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
chipArgs.type = (ArchArgs::ArchArgsTypes)arch.value(item);
|
chipArgs.device = item.toUtf8().constData();;
|
||||||
|
|
||||||
QStringList packages;
|
|
||||||
for (auto package : Arch::get_supported_packages(chipArgs.type))
|
|
||||||
packages.append(QLatin1String(package.data(), package.size()));
|
|
||||||
QString package = QInputDialog::getItem(this, "Select package", "Package:", packages, 0, false, &ok);
|
|
||||||
|
|
||||||
if (ok && !item.isEmpty()) {
|
|
||||||
handler->clear();
|
handler->clear();
|
||||||
currentProj = "";
|
currentProj = "";
|
||||||
disableActions();
|
disableActions();
|
||||||
chipArgs.package = package.toStdString().c_str();
|
|
||||||
ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
actionLoadJSON->setEnabled(true);
|
actionLoadJSON->setEnabled(true);
|
||||||
|
|
||||||
Q_EMIT contextChanged(ctx.get());
|
Q_EMIT contextChanged(ctx.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::open_lpf()
|
void MainWindow::open_lpf()
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,8 @@ static void get_chip_info(std::string device, const ChipInfoPOD **chip_info, con
|
|||||||
for (auto &pkg : chip.packages) {
|
for (auto &pkg : chip.packages) {
|
||||||
for (auto &speedgrade : chip.speed_grades) {
|
for (auto &speedgrade : chip.speed_grades) {
|
||||||
for (auto &rating : chip.suffixes) {
|
for (auto &rating : chip.suffixes) {
|
||||||
std::string name = stringf("%s-%d%s%s", chip.name.get(), speedgrade.speed, pkg.short_name.get(), rating.suffix.get());
|
std::string devname = stringf("%s-%d%s%s", chip.name.get(), speedgrade.speed, pkg.short_name.get(), rating.suffix.get());
|
||||||
if (device == name) {
|
if (device == devname) {
|
||||||
*chip_info = db_ptr->get();
|
*chip_info = db_ptr->get();
|
||||||
*package_info = nullptr;
|
*package_info = nullptr;
|
||||||
*package_name = pkg.name.get();
|
*package_name = pkg.name.get();
|
||||||
|
@ -72,7 +72,7 @@ std::unique_ptr<Context> MachXO2CommandHandler::createContext(dict<std::string,
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (!vm.count("device")) {
|
if (!vm.count("device")) {
|
||||||
log_error("device must be specified on the command line (e.g. --device LCMXO2-7000HC-4TG144I)\n");
|
log_error("device must be specified on the command line (e.g. --device LCMXO2-1200HC-4SG32C)\n");
|
||||||
}
|
}
|
||||||
chipArgs.device = vm["device"].as<std::string>();
|
chipArgs.device = vm["device"].as<std::string>();
|
||||||
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
|
Loading…
Reference in New Issue
Block a user