"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/gui/widgetVisibilityHandler/WidgetVisibilityHandler.cpp" between
ksnip-1.8.1.tar.gz and ksnip-1.8.2.tar.gz

About: ksnip is a Qt based cross-platform screenshot tool that provides many annotation features for your screenshots.

WidgetVisibilityHandler.cpp  (ksnip-1.8.1):WidgetVisibilityHandler.cpp  (ksnip-1.8.2)
skipping to change at line 26 skipping to change at line 26
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "WidgetVisibilityHandler.h" #include "WidgetVisibilityHandler.h"
WidgetVisibilityHandler::WidgetVisibilityHandler(QWidget *widget) : WidgetVisibilityHandler::WidgetVisibilityHandler(QWidget *widget) :
mWidget(widget), mWidget(widget),
mSelectedWindowState(Qt::WindowActive), mSelectedWindowState(Qt::WindowActive),
mWindowStateChangeLock(false), mWindowStateChangeLock(false),
mWasMinimized(false) mIsMinimized(false),
mIsHidden(false)
{ {
} }
void WidgetVisibilityHandler::hide() void WidgetVisibilityHandler::hide()
{ {
mWidget->hide(); mWidget->hide();
if(!mWindowStateChangeLock) {
mIsHidden = true;
}
} }
void WidgetVisibilityHandler::makeInvisible() void WidgetVisibilityHandler::makeInvisible()
{ {
mWindowStateChangeLock = true; mWindowStateChangeLock = true;
setVisible(false); setVisible(false);
mWidget->showMinimized(); mWidget->showMinimized();
} }
void WidgetVisibilityHandler::minimize() void WidgetVisibilityHandler::show()
{ {
mWidget->showMinimized(); showWidget();
} }
void WidgetVisibilityHandler::restoreVisibility() void WidgetVisibilityHandler::restoreState()
{ {
setVisible(true); setVisible(true);
if(!mWasMinimized) { if(!mIsMinimized && !mIsHidden) {
showWidget(); showWidget();
mIsHidden = false;
} else if(!mIsMinimized && mIsHidden){
hide();
} else { } else {
mWidget->showMinimized(); mWidget->setWindowState(Qt::WindowMinimized);
mIsHidden = false;
} }
mWindowStateChangeLock = false; mWindowStateChangeLock = false;
} }
void WidgetVisibilityHandler::enforceVisible() void WidgetVisibilityHandler::enforceVisible()
{ {
setVisible(true); setVisible(true);
showWidget(); showWidget();
mIsHidden = false;
mWindowStateChangeLock = false; mWindowStateChangeLock = false;
} }
bool WidgetVisibilityHandler::isMaximized() bool WidgetVisibilityHandler::isMaximized()
{ {
return mSelectedWindowState == Qt::WindowMaximized; return mSelectedWindowState == Qt::WindowMaximized;
} }
void WidgetVisibilityHandler::updateState() void WidgetVisibilityHandler::updateState()
{ {
if(!mWindowStateChangeLock) { if(!mWindowStateChangeLock) {
if(mWidget->isMaximized()) { if(mWidget->isMaximized()) {
mSelectedWindowState = Qt::WindowMaximized; mSelectedWindowState = Qt::WindowMaximized;
} else if(mWidget->isActiveWindow()){ } else if(mWidget->isActiveWindow()){
mSelectedWindowState = Qt::WindowActive; mSelectedWindowState = Qt::WindowActive;
} }
mWasMinimized = mWidget->isMinimized(); mIsMinimized = mWidget->isMinimized();
} }
} }
void WidgetVisibilityHandler::setVisible(bool isVisible) void WidgetVisibilityHandler::setVisible(bool isVisible)
{ {
if(isVisible) { if(isVisible) {
mWidget->setWindowOpacity(1.0); mWidget->setWindowOpacity(1.0);
} else { } else {
mWidget->setWindowOpacity(0.0); mWidget->setWindowOpacity(0.0);
} }
 End of changes. 10 change blocks. 
7 lines changed or deleted 17 lines changed or added

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