29 #include <QApplication> 
   32 #include <QFontDatabase> 
   47         const char *
file = context.file ? context.file : 
"";
 
   48         const char *
function = context.function ? context.function : 
"";
 
   51             fprintf(stderr, 
"Debug: %s (%s:%u, %s)\n", localMsg.
constData(), 
file, context.line, 
function);
 
   54             fprintf(stderr, 
"Info: %s (%s:%u, %s)\n", localMsg.
constData(), 
file, context.line, 
function);
 
   57             fprintf(stderr, 
"Warning: %s (%s:%u, %s)\n", localMsg.
constData(), 
file, context.line, 
function);
 
   60             fprintf(stderr, 
"Critical: %s (%s:%u, %s)\n", localMsg.
constData(), 
file, context.line, 
function);
 
   63             fprintf(stderr, 
"Fatal: %s (%s:%u, %s)\n", localMsg.
constData(), 
file, context.line, 
function);
 
   67         if (localMsg.
startsWith(
"QFSFileEngine::open"))
 
   68             fprintf(stderr, 
"***break***\n");
 
   73         return std::make_unique<PluginGui>();
 
   92         enum OpenArgs { None = 0, OpenProject = 1, DefaultImport = 2, ImportToProject = 3 } openArgs = None;
 
   94         std::filesystem::path fileName;
 
   97         if (
args.is_option_set(
"--project-dir"))
 
   99             openArgs = (OpenArgs) (openArgs|OpenProject);
 
  101             log_info(
"gui", 
"GUI started with project {}.", projDir.string());
 
  103         if (
args.is_option_set(
"--import-netlist"))
 
  105             openArgs = (OpenArgs) (openArgs|DefaultImport);
 
  106             fileName = std::filesystem::path(
args.get_parameter(
"--import-netlist"));
 
  107             log_info(
"gui", 
"GUI started with file {}.", fileName.string());
 
  108             if (
args.is_option_set(
"--gate-library"))
 
  122         case ImportToProject:
 
  125                 log_error(
"gui", 
"Cannot create project directory {}.", projDir.string());
 
  133                     log_error(
"gui", 
"Failed to open netlist '{}'.", fileName.string());
 
  139     static void cleanup()
 
  150     static void mCleanup(
int sig)
 
  154             log_info(
"gui", 
"Detected Ctrl+C in terminal");
 
  159     static void mCrashHandler(
int sig)
 
  161         log_info(
"gui", 
"Emergency dump of executed actions on signal {}", sig);
 
  167     bool PluginGui::exec(ProgramArguments& 
args)
 
  171         args.get_original_arguments(&argc, &argv);
 
  223             MainWindow::StyleSheetOption::Dark,
 
  225             "Specifies which theme should be used. Light style is designed to print screenshots and not recommended for regular use." 
  232             case MainWindow::StyleSheetOption::Dark : styleSheetToOpen = 
":/style/dark"; 
break;
 
  233             case MainWindow::StyleSheetOption::Light : styleSheetToOpen = 
":/style/light"; 
break;
 
  235             default: styleSheetToOpen = 
":/style/dark";
 
  238         QFile stylesheet(styleSheetToOpen);
 
  240         a.setStyleSheet(
QString(stylesheet.readAll()));
 
  246         qRegisterMetaType<u32>(
"u32");
 
  247         qRegisterMetaType<spdlog::level::level_enum>(
"spdlog::level::level_enum");
 
  259         const int handleSignals[] = { SIGTERM, SIGSEGV, SIGILL, SIGABRT, SIGFPE, 0 };
 
  260         for (
int isignal=0; handleSignals[isignal]; isignal++)
 
  261             signal(handleSignals[isignal], mCrashHandler);
 
  262         signal(SIGINT, mCleanup);
 
  265         handleProgramArguments(
args);
 
  271     std::string PluginGui::get_name()
 const 
  273         return std::string(
"hal_gui");
 
  276     std::string PluginGui::get_version()
 const 
  278         return std::string(
"2.0");
 
  281     std::string PluginGui::get_description()
 const 
  283         return std::string(
"GUI control for HAL app (can't be unloaded)");
 
  286     void PluginGui::initialize_logging()
 
  288         const char* gui_info_channel[] = {
"user", 
"gui", 
"python", 
"UserStudy", 
nullptr };
 
  289         for (
int i=0; gui_info_channel[i]; i++)
 
  295         ProgramOptions mDescription;
 
  297         mDescription.
add({
"--gui", 
"-g"}, 
"start graphical user interface");
 
  302     void PluginGui::set_layout_locker(
bool enable)
 
  305             mLayoutLockerList.append(
new LayoutLocker);
 
  308             if (mLayoutLockerList.isEmpty()) 
return;
 
  309             LayoutLocker* ll = mLayoutLockerList.takeLast();
 
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
 
Manages all ContentWidgets.
 
void openProject(QString projPath)
 
static FileManager * get_instance()
 
Holds information about the state (e.g. saved/unsaved) of all laded files (i.e. .hal/....
 
User interface to manage all GraphContexts.
 
Interface to interact with the gui itself.
 
std::shared_ptr< spdlog::logger > add_channel(const std::string &channel_name, const std::vector< std::shared_ptr< log_sink >> &sinks, const std::string &level="info")
 
static std::shared_ptr< log_sink > create_gui_sink()
 
static std::shared_ptr< log_sink > create_file_sink(const std::filesystem::path &file_name="", const bool truncate=false)
 
static std::shared_ptr< log_sink > create_stdout_sink(const bool colored=true)
 
static LogManager * get_instance(const std::filesystem::path &file_name="")
 
void set_file_name(const std::filesystem::path &file_name)
 
static SettingsItemDropdown * sSettingStyle
 
Connects the hal-core events to the gui.
 
Forwards plugin related events from the core to the gui.
 
bool add(const std::string &flag, const std::string &description, const std::initializer_list< std::string > ¶meters={})
 
std::filesystem::path get_default_filename(const std::string &extension=std::string()) const
 
static ProjectManager * instance()
 
bool create_project_directory(const std::string &path)
 
const ProjectDirectory & get_project_directory() const
 
Stores and manages the gui's selection state.
 
virtual QVariant value() const override
 
static UserActionManager * instance()
 
#define log_error(channel,...)
 
#define log_info(channel,...)
 
ProgramOptions get_cli_options()
 
std::filesystem::path get_user_config_directory()
 
PythonContext * gPythonContext
 
ContentManager * gContentManager
 
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
 
PluginRelay * gPluginRelay
 
FileStatusManager * gFileStatusManager
 
GraphContextManager * gGraphContextManager
 
SelectionRelay * gSelectionRelay
 
CommentManager * gCommentManager
 
std::unique_ptr< BasePluginInterface > create_plugin_instance()
 
NetlistRelay * gNetlistRelay
 
std::shared_ptr< Netlist > gNetlistOwner
 
const char * constData() const const
 
bool startsWith(const QByteArray &ba) const const
 
void setApplicationName(const QString &application)
 
void exit(int returnCode)
 
void setOrganizationDomain(const QString &orgDomain)
 
void setOrganizationName(const QString &orgName)
 
int addApplicationFont(const QString &fileName)
 
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool registerResource(const QString &rccFileName, const QString &mapRoot)
 
QString fromStdString(const std::string &str)
 
QByteArray toLocal8Bit() const const
 
int toInt(bool *ok) const const