0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

refactoring

This commit is contained in:
Victor Zarubkin 2016-08-04 23:46:04 +03:00
parent aac410d9f8
commit 27ec6aee7e
3 changed files with 23 additions and 23 deletions

View File

@ -29,8 +29,7 @@
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QSignalBlocker> #include <QSignalBlocker>
#include <QSettings> #include <QSettings>
#include <qtextcodec.h> #include <QTextCodec>
#include "blocks_tree_widget.h" #include "blocks_tree_widget.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -238,23 +237,22 @@ ProfTreeWidget::ProfTreeWidget(QWidget* _parent) : Parent(_parent), m_beginTime(
header->setText(COL_NCALLS_TOTAL, "N Calls total"); header->setText(COL_NCALLS_TOTAL, "N Calls total");
setHeaderItem(header); setHeaderItem(header);
//hideColumn(COL_END);
connect(&::profiler_gui::EASY_GLOBALS.events, &::profiler_gui::ProfGlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange); connect(&::profiler_gui::EASY_GLOBALS.events, &::profiler_gui::ProfGlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange);
QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME);
settings.beginGroup("tree_widget");
auto color_rows_set = settings.value("color_rows"); QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME);
if (!color_rows_set.isNull()) settings.beginGroup("tree_widget");
m_bColorRows = color_rows_set.toBool();
for (int i = 0; i < columnCount(); i++) auto color_rows_set = settings.value("color_rows");
{ if (!color_rows_set.isNull())
if (settings.value(QString("Column") + QString::number(i)).toBool()) m_bColorRows = color_rows_set.toBool();
hideColumn(i);
}
settings.endGroup(); for (int i = 0; i < columnCount(); i++)
{
if (settings.value(QString("Column") + QString::number(i)).toBool())
hideColumn(i);
}
settings.endGroup();
} }
ProfTreeWidget::ProfTreeWidget(const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, QWidget* _parent) : This(_parent) ProfTreeWidget::ProfTreeWidget(const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, QWidget* _parent) : This(_parent)

View File

@ -28,9 +28,8 @@
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QCoreApplication> #include <QCoreApplication>
#include <qevent.h> #include <QCloseEvent>
#include <QSettings> #include <QSettings>
#include "main_window.h" #include "main_window.h"
#include "blocks_tree_widget.h" #include "blocks_tree_widget.h"
#include "blocks_graphics_view.h" #include "blocks_graphics_view.h"
@ -190,16 +189,14 @@ void ProfMainWindow::onTestViewportClicked(bool)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void ProfMainWindow::closeEvent(QCloseEvent *close_event) void ProfMainWindow::closeEvent(QCloseEvent* close_event)
{ {
saveSettings(); saveSettings();
close_event->setAccepted(true); QMainWindow::closeEvent(close_event);
QMainWindow::closeEvent(close_event);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void ProfMainWindow::saveSettings() void ProfMainWindow::saveSettings()
{ {
QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME); QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME);

View File

@ -44,6 +44,10 @@ public:
ProfMainWindow(); ProfMainWindow();
virtual ~ProfMainWindow(); virtual ~ProfMainWindow();
// Public virtual methods
void closeEvent(QCloseEvent* close_event) override;
protected slots: protected slots:
void onOpenFileClicked(bool); void onOpenFileClicked(bool);
@ -53,8 +57,9 @@ protected slots:
private: private:
// Private non-virtual methods
void loadFile(const std::string& filename); void loadFile(const std::string& filename);
void closeEvent(QCloseEvent *close_event);
void saveSettings(); void saveSettings();