-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cpu stacked widget #197
base: cpu-profiling
Are you sure you want to change the base?
Cpu stacked widget #197
Changes from 7 commits
0012ace
9e485e5
fae9271
c5ea529
b98902d
86fe995
ddd74f2
e961905
0a8ea57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,36 @@ | |
|
||
AppMainwindow::AppMainwindow(QWidget *parent) : QMainWindow(parent) | ||
{ | ||
centralWidget = new CentralWidget(this); | ||
setCentralWidget(centralWidget); | ||
QWidget *mainWidget = new QWidget(this); | ||
|
||
mainLayout = new QVBoxLayout(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shared pointers! these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. centralwidget is only deleted once the rbkit-client itself closes this is also true for mainWidget and mainLayout |
||
|
||
stackedWidget = new StackedWidget(this); | ||
setCentralWidget(mainWidget); | ||
|
||
centralMemoryWidget = new CentralWidget(stackedWidget, this); | ||
int index = stackedWidget->addWidget(centralMemoryWidget); | ||
|
||
actionToolBar = QSharedPointer<ActionToolbar>::create(this, centralMemoryWidget); | ||
|
||
cpuTab = new QTabWidget(stackedWidget); | ||
cpuTab->setTabsClosable(true); | ||
connect(cpuTab, | ||
SIGNAL(tabCloseRequested(int)), | ||
this, | ||
SLOT(closeCpuTab(int))); | ||
|
||
stackedWidget->addWidget(cpuTab); | ||
|
||
stackedWidget->setCurrentIndex(index); | ||
|
||
actionToolBar.data()->connectTabChangedSignal(this); | ||
|
||
mainLayout->addWidget(actionToolBar.data()->getToolBar(), 0, Qt::AlignTop); | ||
mainLayout->addWidget(stackedWidget, 1); | ||
|
||
mainWidget->setLayout(mainLayout); | ||
mainWidget->show(); | ||
|
||
appStatusBar = new QStatusBar(this); | ||
setStatusBar(appStatusBar); | ||
|
@@ -26,13 +54,38 @@ AppMainwindow::AppMainwindow(QWidget *parent) : QMainWindow(parent) | |
qRegisterMetaType<RBKit::ObjectDetail>(); | ||
} | ||
|
||
/*CpuViewPtr AppMainwindow::getCpuView() | ||
void AppMainwindow::newCpuView() | ||
{ | ||
return centralWidget->getCpuViewPtr(); | ||
}*/ | ||
QSharedPointer<CpuView> cpuView(new CpuView()); | ||
cpuTab->addTab(cpuView.data(), "Cpu Tree"); | ||
cpuViewList.append(cpuView); | ||
|
||
connect(cpuView.data(), | ||
SIGNAL(fillCallGraph(QStandardItemModel*)), | ||
RBKit::CpuStorage::getStorage().data(), | ||
SLOT(fillCallGraphModel(QStandardItemModel*))); | ||
|
||
connect(cpuView.data(), | ||
SIGNAL(fillFlatProfile(QStandardItemModel*)), | ||
RBKit::CpuStorage::getStorage().data(), | ||
SLOT(fillFlatProfileModel(QStandardItemModel*))); | ||
|
||
emit cpuView.data()->fillCallGraph(cpuView->callGraphModel); | ||
emit cpuView.data()->fillFlatProfile(cpuView->flatGraphModel); | ||
} | ||
|
||
AppMainwindow::~AppMainwindow() | ||
{ | ||
delete centralWidget; | ||
delete centralMemoryWidget; | ||
} | ||
|
||
void AppMainwindow::tabChanged(int tab) | ||
{ | ||
stackedWidget->setCurrentIndex(tab); | ||
} | ||
|
||
void AppMainwindow::closeCpuTab(int index) | ||
{ | ||
cpuTab->removeTab(index); | ||
cpuViewList.removeAt(index); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use sharedpointer here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not instantiating AppMainwindow here
this variable will just hold a reference to mainwindow so that some of the function which need to call methods on mainwindow can call them