"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/GUI/WidgetRack.cpp" between
ssr-0.4.1.tar.gz and ssr-0.4.2.tar.gz

About: SimpleScreenRecorder is a screen (video-audio) recorder for Linux.

WidgetRack.cpp  (ssr-0.4.1):WidgetRack.cpp  (ssr-0.4.2)
skipping to change at line 73 skipping to change at line 73
QWidget* WidgetRack::GetWidget(unsigned int index) { QWidget* WidgetRack::GetWidget(unsigned int index) {
assert(index < m_widgets.size()); assert(index < m_widgets.size());
return m_widgets[index]; return m_widgets[index];
} }
unsigned int WidgetRack::GetSelected() { unsigned int WidgetRack::GetSelected() {
return m_selected_widget; return m_selected_widget;
} }
void WidgetRack::SetSelected(unsigned int index) { void WidgetRack::SetSelected(unsigned int index) {
assert(index == NO_SELECTION || index < m_widgets.size());
m_selected_widget = index; m_selected_widget = index;
UpdateSelection(); UpdateSelection();
} }
void WidgetRack::AddWidget(unsigned int index, QWidget* widget) { void WidgetRack::AddWidget(unsigned int index, QWidget* widget) {
assert(index <= m_widgets.size()); assert(index <= m_widgets.size());
assert(widget->parent() == viewport()); assert(widget->parent() == viewport());
widget->setAutoFillBackground(true); widget->setAutoFillBackground(true);
widget->setBackgroundRole(QPalette::Base); widget->setBackgroundRole(QPalette::Base);
if(widget->focusPolicy() == Qt::NoFocus) if(widget->focusPolicy() == Qt::NoFocus)
widget->setFocusPolicy(Qt::ClickFocus); widget->setFocusPolicy(Qt::ClickFocus);
widget->show(); widget->show();
m_widgets.insert(m_widgets.begin() + index, widget); m_widgets.insert(m_widgets.begin() + index, widget);
UpdateFocusChain(); UpdateFocusChain();
UpdateRange(); UpdateRange();
UpdateLayout(); UpdateLayout();
if(m_selected_widget != NO_SELECTION && index <= m_selected_widget) if(m_selected_widget != NO_SELECTION && m_selected_widget >= index)
++m_selected_widget; ++m_selected_widget;
} }
void WidgetRack::RemoveWidget(unsigned int index) { void WidgetRack::RemoveWidget(unsigned int index) {
assert(index < m_widgets.size()); assert(index < m_widgets.size());
delete m_widgets[index]; delete m_widgets[index];
m_widgets.erase(m_widgets.begin() + index); m_widgets.erase(m_widgets.begin() + index);
UpdateFocusChain(); UpdateFocusChain();
UpdateRange(); UpdateRange();
UpdateLayout(); UpdateLayout();
if(m_selected_widget != NO_SELECTION) { if(m_selected_widget != NO_SELECTION) {
if(m_selected_widget > index) { if(m_selected_widget == index) {
m_selected_widget = NO_SELECTION;
} else if(m_selected_widget > index) {
--m_selected_widget; --m_selected_widget;
} else if(m_selected_widget >= m_widgets.size()) {
m_selected_widget = (m_widgets.size() == 0)? NO_SELECTION
: m_widgets.size() - 1;
UpdateSelection();
} }
} }
} }
void WidgetRack::MoveWidget(unsigned int from, unsigned int to) { void WidgetRack::MoveWidget(unsigned int from, unsigned int to) {
assert(from < m_widgets.size()); assert(from < m_widgets.size());
assert(to < m_widgets.size()); assert(to < m_widgets.size());
QWidget *widget = m_widgets[from]; QWidget *widget = m_widgets[from];
 End of changes. 4 change blocks. 
6 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)