![]() |
HAL
|
Stores information about the currently opened netlist. More...
#include <file_manager.h>
Public Types | |
enum | DirectoryStatus { ProjectDirectory =2 , OtherDirectory =1 , IsFile =0 , NotExisting =-1 , InvalidExtension =-2 , ParseError =-3 , NetlistError =-4 , GatelibError =-5 , UnknownDirectoryEntry =-6 } |
Public Slots | |
bool | deprecatedOpenFile (QString filename, QString gatelibraryPath) |
void | importFile (QString filename) |
void | newProject () |
void | openProject (QString projPath) |
void | closeFile () |
void | autosave () |
Signals | |
void | fileOpened (const QString &fileName) |
void | projectOpened (QString projectDir, QString fileName) |
void | projectSaved (QString projectDir, QString fileName) |
void | fileChanged (const QString &path) |
void | fileDirectoryChanged (const QString &path) |
void | fileClosed () |
void | fileAboutToClose (const QString &fileName) |
Public Member Functions | |
QString | fileName () const |
bool | fileOpen () const |
void | watchFile (const QString &fileName) |
void | emitProjectSaved (QString &projectDir, QString &file) |
![]() | |
virtual const QMetaObject * | metaObject () const const |
QObject (QObject *parent) | |
virtual | ~QObject () |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
Q_CLASSINFO (Name, Value) | |
Q_INTERFACES (...) | |
Q_PROPERTY (...) | |
Q_ENUMS (...) | |
Q_FLAGS (...) | |
Q_ENUM (...) | |
Q_FLAG (...) | |
Q_ENUM_NS (...) | |
Q_FLAG_NS (...) | |
Q_OBJECT Q_OBJECT | |
Q_GADGET Q_GADGET | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_SIGNALS Q_SIGNALS | |
Q_SIGNAL Q_SIGNAL | |
Q_SLOTS Q_SLOTS | |
Q_SLOT Q_SLOT | |
Q_EMIT Q_EMIT | |
Q_INVOKABLE Q_INVOKABLE | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
Static Public Member Functions | |
static FileManager * | get_instance () |
static DirectoryStatus | directoryStatus (const QString &pathname) |
static QString | directoryStatusText (DirectoryStatus stat) |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
![]() | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
![]() | |
objectName | |
Stores information about the currently opened netlist.
The FileManager handles the status and information of the currently opened netlist file including whether a file is opened or not. This class is implemented with a singleton pattern.
Definition at line 47 of file file_manager.h.
Return values for static method directoryStatus
Enumerator | |
---|---|
ProjectDirectory | |
OtherDirectory | |
IsFile | |
NotExisting | |
InvalidExtension | |
ParseError | |
NetlistError | |
GatelibError | |
UnknownDirectoryEntry |
Definition at line 93 of file file_manager.h.
|
slot |
Serializes the project to the shadowfile. Called in regular intervals that can be set via the settings.
Definition at line 91 of file file_manager.cpp.
References hal::ProjectManager::get_project_directory(), hal::ProjectManager::get_project_status(), hal::ProjectDirectory::get_shadow_dir(), hal::gNetlist, hal::gPythonContext, log_info, and log_warning.
|
slot |
Closes the file and resets all information regarding the closed file.
Definition at line 668 of file file_manager.cpp.
References hal::NetlistRelay::debugHandleFileClosed(), hal::gNetlist, hal::gNetlistOwner, hal::gNetlistRelay, and hal::NetlistRelay::unregisterNetlistCallbacks().
Opens the given filename. It handles the initialization and deserialization process of the netlists as well as the shadowfile logic in an automated fashion.
fileName | - The file to be opened. |
gatelibraryPath | - Path to gate library, auto detection if empty |
Definition at line 493 of file file_manager.cpp.
References QList::append(), QDialog::exec(), QFileInfo::exists(), file, QString::fromStdString(), hal::gNetlist, hal::gNetlistOwner, hal::gNetlistRelay, hal::gPluginRelay, QString::isEmpty(), QString::lastIndexOf(), QString::left(), hal::netlist_factory::load_netlist(), hal::netlist_factory::load_netlists(), hal::GuiPluginTable::loadFeature(), log_error, log_info, hal::PluginRelay::mGuiPluginTable, test::n, test_multiple::netlist, configuration::netlists, QIODevice::ReadOnly, hal::NetlistRelay::registerNetlistCallbacks(), QInputDialog::setComboBoxItems(), QInputDialog::setLabelText(), QWidget::setWindowTitle(), QFileInfo::suffix(), QInputDialog::textValue, and QString::toStdString().
|
static |
This function checks whether a given path name is a hal directory (contains .project.json)
pathname | - the path name to be tested |
Definition at line 162 of file file_manager.cpp.
References hal::netlist_parser_manager::can_parse(), QJsonObject::contains(), QFileInfo::exists(), hal::ff, QJsonDocument::fromJson(), QString::fromStdString(), QFileInfo::isDir(), QString::isEmpty(), QFileInfo::isFile(), QJsonDocument::isObject(), QJsonParseError::NoError, QJsonDocument::object(), QIODevice::ReadOnly, QFileInfo::suffix(), and QString::toStdString().
Referenced by hal::OpenFileWidget::dropEvent(), and hal::ImportProjectDialog::importProject().
|
static |
This function returns a text explaining the DirectoryStatus value when searchin for HAL project directories
stat | DirectoryStatus value as returned by directoryStatus() |
Definition at line 224 of file file_manager.cpp.
Referenced by hal::ProjectDirDialog::accept(), and hal::ProjectDirDialogStatus::setMessage().
This function is called by openDirectory when the hal was saved.
projectDir | - the project directory |
file | - the file name |
Definition at line 147 of file file_manager.cpp.
References file.
|
signal |
Q_SIGNAL that is emitted when the file is about to be closed.
fileName | - The name of the file that will be closed. |
Referenced by hal::PythonEditor::PythonEditor().
|
signal |
Q_SIGNAL that is emitted when the file changed.
path | - The new file. |
|
signal |
Q_SIGNAL that is emitted when the file was successfully closed.
|
signal |
Q_SIGNAL that is emitted when the file directory changed.
path | - The new directory. |
QString hal::FileManager::fileName | ( | ) | const |
Get the filename of the currently opened file. When no file is open an empty string is returned.
Definition at line 107 of file file_manager.cpp.
Referenced by hal::SpecialLogContentManager::safePythonEditor(), and hal::SpecialLogContentManager::safeScreenshot().
bool hal::FileManager::fileOpen | ( | ) | const |
Get the status if a file is currently open or not.
Definition at line 86 of file file_manager.cpp.
|
signal |
Q_SIGNAL that is emitted when a file is successfully opened.
fileName | - The filename. |
Referenced by hal::ContentManager::ContentManager(), hal::NetlistRelay::NetlistRelay(), and hal::PythonEditor::PythonEditor().
|
static |
Get the singleton instance of the filemanager.
Definition at line 80 of file file_manager.cpp.
Referenced by hal::ContentManager::ContentManager(), hal::OpenFileWidget::dropEvent(), hal::ActionOpenNetlistFile::exec(), hal::FileStatusManager::modifiedFilesExisting(), hal::NetlistRelay::NetlistRelay(), hal::PythonEditor::PythonEditor(), hal::RecentFilesWidget::RecentFilesWidget(), hal::SpecialLogContentManager::safePythonEditor(), and hal::SpecialLogContentManager::safeScreenshot().
|
slot |
Imports the netlist file into a new hal project. User will be queried for project directory.
filename | - The netlist file to be imported. |
Definition at line 328 of file file_manager.cpp.
References QDir::absoluteFilePath(), QDir::absolutePath(), QDialog::Accepted, QMessageBox::ActionRole, QMessageBox::addButton(), QGridLayout::addItem(), QMessageBox::clickedButton(), QGridLayout::columnCount(), QFile::copy(), hal::ProjectManager::create_project_directory(), QDialog::exec(), QMessageBox::exec(), QSizePolicy::Expanding, QFileInfo::fileName(), QString::fromStdString(), hal::ImportNetlistDialog::gateLibraryPath(), hal::ProjectDirectory::get_default_filename(), hal::ProjectManager::get_netlist_filename(), hal::ProjectManager::get_project_directory(), hal::gFileStatusManager, hal::gNetlist, hal::ImportNetlistDialog::isCopyGatelibChecked(), QString::isEmpty(), hal::ImportNetlistDialog::isMoveNetlistChecked(), QWidget::layout(), log_info, log_warning, QSizePolicy::Minimum, hal::FileStatusManager::netlistChanged(), hal::FileStatusManager::netlistSaved(), hal::ImportNetlistDialog::projectDirectory(), QMessageBox::Question, QMessageBox::RejectRole, QString::remove(), hal::ProjectManager::remove_project_directory(), QDir::rename(), QGridLayout::rowCount(), hal::ProjectManager::serialize_project(), QMessageBox::setIcon(), QMessageBox::setText(), QMessageBox::setWindowTitle(), QString::toStdString(), and QMessageBox::warning().
Referenced by hal::OpenFileWidget::dropEvent(), and hal::ActionOpenNetlistFile::exec().
|
slot |
Creates a new empty hal project
Definition at line 271 of file file_manager.cpp.
References QDir::absoluteFilePath(), QDialog::Accepted, QFile::copy(), hal::netlist_factory::create_netlist(), hal::ProjectManager::create_project_directory(), QDialog::exec(), QFileInfo::fileName(), QString::fromStdString(), hal::NewProjectDialog::gateLibraryPath(), hal::ProjectDirectory::get_default_filename(), hal::ProjectManager::get_netlist_filename(), hal::ProjectManager::get_project_directory(), hal::gFileStatusManager, hal::gNetlist, hal::gNetlistOwner, hal::gNetlistRelay, hal::NewProjectDialog::isCopyGatelibChecked(), QString::isEmpty(), hal::gate_library_manager::load(), log_info, hal::FileStatusManager::netlistChanged(), hal::FileStatusManager::netlistSaved(), hal::NewProjectDialog::projectDirectory(), hal::NetlistRelay::registerNetlistCallbacks(), hal::ProjectManager::serialize_project(), QString::toStdString(), and QMessageBox::warning().
Referenced by hal::ActionOpenNetlistFile::exec().
|
slot |
Opens the given project.
projPath | - The directory path of the project to be opened |
Definition at line 450 of file file_manager.cpp.
References QDir::absoluteFilePath(), QString::arg(), QFileInfo::exists(), QString::fromStdString(), hal::ProjectJson::gateLibraryFilename(), hal::ProjectDirectory::get_default_filename(), hal::ProjectManager::get_netlist(), hal::ProjectManager::get_netlist_filename(), hal::ProjectManager::get_project_directory(), hal::ProjectDirectory::get_shadow_dir(), hal::gNetlist, hal::gNetlistOwner, hal::gNetlistRelay, hal::gPluginRelay, QString::isEmpty(), QFileInfo::isFile(), QFileInfo::lastModified(), hal::GuiPluginTable::loadFeature(), log_error, message(), hal::PluginRelay::mGuiPluginTable, QMessageBox::No, hal::ProjectManager::open_project(), QMessageBox::question(), hal::NetlistRelay::registerNetlistCallbacks(), hal::ProjectManager::restore_project_file_from_autosave(), hal::ProjectManager::set_project_directory(), QFileInfo::suffix(), QString::toStdString(), QDateTime::toString(), and QMessageBox::Yes.
Referenced by hal::OpenFileWidget::dropEvent(), and hal::ActionOpenNetlistFile::exec().
Q_SIGNAL that is emitted when a project is successfully opened.
projectDir | - The project directory |
fileName | - The filename. |
Referenced by hal::RecentFilesWidget::RecentFilesWidget().
Q_SIGNAL that is emitted when a project gets saved.
projectDir | - The project directory |
fileName | - The filename. |
Referenced by hal::RecentFilesWidget::RecentFilesWidget().
void hal::FileManager::watchFile | ( | const QString & | fileName | ) |
Watches the given file so that it is possible to notice modifications if changes were made outside of hal. This function call also sets all important information about the file as well as starts the timer to save the project in regular intervals.
fileName | - The file to be watched. |
Definition at line 115 of file file_manager.cpp.
References QString::isEmpty(), log_info, and QString::toStdString().