12 #include <QGuiApplication>
15 #include <QPlainTextEdit>
17 #include <QWindowList>
23 mTimer(new
QTimer(this)), mPythonEditor(python_editor)
25 mScreenshotSubPath =
"/screenshots";
26 mPythonContentSubPath =
"/pythoneditors";
41 if(halFileName.
isEmpty() || qGuiApp->topLevelWindows().isEmpty())
46 QString screenshotPath = halFileDir.
path() + halFileNameSubPath + mScreenshotSubPath;
47 if(!halFileDir.
exists(screenshotPath))
49 if(!halFileDir.
mkpath(screenshotPath))
51 qDebug() <<
"Failed to create screenshots directory.";
62 for(
int i = 0; i < qGuiApp->topLevelWindows().size(); i++)
69 totalWidth += p.
width();
70 maxHeight = (maxHeight > p.
height()) ? maxHeight : p.
height();
78 for(
int i = 0; i < pixmapList.
size(); i++)
83 curr_x += currPixmap.
width();
86 if(!image.
save(screenshotPath +
"/" + fileName +
"." + fileType))
87 qDebug() <<
"Could not save image!";
99 QString pythonEditorDumpPath = halFileDir.
path() + halFileNameSubPath + mPythonContentSubPath;
100 if(!halFileDir.
exists(pythonEditorDumpPath))
102 if(!halFileDir.
mkpath(pythonEditorDumpPath))
104 qDebug() <<
"Failed to create python editor dumb directory.";
112 QFile file(pythonEditorDumpPath +
"/" + fileName +
"." + fileType);
116 qDebug() <<
"Could not open file with path: " <<
file.fileName() <<
". Abort.";
123 for(
int i = 0; i < pythonTabWidget->
count(); i++)
131 content =
"Could not get python code editor content.";
133 textStream <<
"---------------------Start of new tab------------------------\nTabnumber: " << i
134 <<
"\nName: "<< pythonTabWidget->
tabText(i) <<
"\nContent:\n" << content <<
"\n";
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
static FileManager * get_instance()
Main widget that combines all neccessary functionality to develop in python (for hal).
QTabWidget * getTabWidget()
void startLogging(int msec)
SpecialLogContentManager(QObject *parent=nullptr, PythonEditor *python_editor=nullptr)
~SpecialLogContentManager()
QDateTime currentDateTime()
bool exists() const const
bool mkpath(const QString &dirPath) const const
QString path() const const
QDir absoluteDir() const const
QString baseName() const const
bool save(const QString &fileName, const char *format, int quality) const const
void append(const T &value)
const T & at(int i) const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void fillRect(const QRectF &rectangle, const QBrush &brush)
QString toPlainText() const const
bool isEmpty() const const
QString number(int n, int base)
QString tabText(int index) const const