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 QScreen* screen__ = qApp->screens()[0];
77 QRect screen = desktop->screenGeometry(desktop->primaryScreen());
78 screen.adjust(screen.width()*0.5, screen.height()*0.25, 0, 0);
79 this->setGeometry(screen);
82 XmlOptionItem LogConsole::getGeometryOption()
84 return XmlOptionItem(
"geometry", mOptions.
getElement());
89 this->getGeometryOption().
writeVariant(this->saveGeometry());
94 void LogConsole::createMenus()
97 QAction* selectFolderAction =
new QAction(QIcon(
":/icons/open_icon_library/document-import-2.png"), tr(
"&Select folder"),
this);
98 selectFolderAction->setShortcut(tr(
"Ctrl+L"));
99 selectFolderAction->setStatusTip(tr(
"Select folder"));
100 connect(selectFolderAction, &QAction::triggered,
this, &LogConsole::onSelectFolder);
102 QMenu* fileMenu =
new QMenu(tr(
"File"),
this);
103 fileMenu->addAction(selectFolderAction);
104 this->menuBar()->addMenu(fileMenu);
107 void LogConsole::updateWindowTitle()
109 QString title = QString(
"Log Console [%1]").arg(mLog->getLoggingFolder());
110 this->setWindowTitle(title);
113 void LogConsole::onSelectFolder()
115 QString folder = mLog->getLoggingFolder() +
"/..";
117 folder = QFileDialog::getExistingDirectory(
this,
"Open log folder", folder);
118 if (folder.isEmpty())
123 mLog->setLoggingFolder(folder);
124 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()