35 #include <QDesktopWidget>
36 #include <QApplication>
37 #include <QFileDialog>
55 CX_LOG_INFO() <<
"Log folder: " << mLog->getLoggingFolder();
59 this->updateWindowTitle();
62 this->setCentralWidget(consoles);
64 this->initializeGeometry();
67 void LogConsole::initializeGeometry()
69 if (!this->restoreGeometry(this->getGeometryOption().readVariant().toByteArray()))
70 this->setDefaultGeometry();
73 void LogConsole::setDefaultGeometry()
75 QDesktopWidget* desktop =
dynamic_cast<QApplication*
>(QApplication::instance())->desktop();
76 QRect screen = desktop->screenGeometry(desktop->primaryScreen());
77 screen.adjust(screen.width()*0.5, screen.height()*0.25, 0, 0);
78 this->setGeometry(screen);
81 XmlOptionItem LogConsole::getGeometryOption()
83 return XmlOptionItem(
"geometry", mOptions.
getElement());
88 this->getGeometryOption().
writeVariant(this->saveGeometry());
93 void LogConsole::createMenus()
96 QAction* selectFolderAction =
new QAction(QIcon(
":/icons/open_icon_library/document-import-2.png"), tr(
"&Select folder"),
this);
97 selectFolderAction->setShortcut(tr(
"Ctrl+L"));
98 selectFolderAction->setStatusTip(tr(
"Select folder"));
99 connect(selectFolderAction, &QAction::triggered,
this, &LogConsole::onSelectFolder);
101 QMenu* fileMenu =
new QMenu(tr(
"File"),
this);
102 fileMenu->addAction(selectFolderAction);
103 this->menuBar()->addMenu(fileMenu);
106 void LogConsole::updateWindowTitle()
108 QString title = QString(
"Log Console [%1]").arg(mLog->getLoggingFolder());
109 this->setWindowTitle(title);
112 void LogConsole::onSelectFolder()
114 QString folder = mLog->getLoggingFolder() +
"/..";
116 folder = QFileDialog::getExistingDirectory(
this,
"Open log folder", folder);
117 if (folder.isEmpty())
122 mLog->setLoggingFolder(folder);
123 this->updateWindowTitle();
void writeVariant(const QVariant &val)
QDomElement getElement()
return the current element
static QString getPersistentWritablePath()
Path to location usable for persistent and temporary storage of config. Do not use directly...
void save()
save entire document.
Helper class for xml files used to store ssc/cx data.
static LogFileWatcherPtr create()