0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 00:31: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 <QSignalBlocker>
#include <QSettings>
#include <qtextcodec.h>
#include <QTextCodec>
#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");
setHeaderItem(header);
//hideColumn(COL_END);
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");
if (!color_rows_set.isNull())
m_bColorRows = color_rows_set.toBool();
QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME);
settings.beginGroup("tree_widget");
for (int i = 0; i < columnCount(); i++)
{
if (settings.value(QString("Column") + QString::number(i)).toBool())
hideColumn(i);
}
auto color_rows_set = settings.value("color_rows");
if (!color_rows_set.isNull())
m_bColorRows = color_rows_set.toBool();
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)

View File

@ -28,9 +28,8 @@
#include <QMenu>
#include <QMenuBar>
#include <QCoreApplication>
#include <qevent.h>
#include <QCloseEvent>
#include <QSettings>
#include "main_window.h"
#include "blocks_tree_widget.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();
close_event->setAccepted(true);
QMainWindow::closeEvent(close_event);
saveSettings();
QMainWindow::closeEvent(close_event);
}
//////////////////////////////////////////////////////////////////////////
void ProfMainWindow::saveSettings()
{
QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME);

View File

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