diff --git a/src/imageselector.cpp b/src/imageselector.cpp index e84b9a5..c2f7306 100644 --- a/src/imageselector.cpp +++ b/src/imageselector.cpp @@ -12,8 +12,8 @@ #include // std::shuffle #include // std::default_random_engine -ImageSelector::ImageSelector(std::unique_ptr& pathTraverser, char aspect): - pathTraverser(pathTraverser), _aspect(aspect) +ImageSelector::ImageSelector(std::unique_ptr& pathTraverser, char aspectIn): + pathTraverser(pathTraverser), aspect(aspectIn) { } @@ -61,7 +61,7 @@ bool ImageSelector::imageValidForAspect(const std::string &fileName) std::swap(imageWidth,imageHeight); } - switch(_aspect) + switch(aspect) { case 'a': // allow all @@ -118,7 +118,7 @@ std::string RandomImageSelector::getNextImage() unsigned int RandomImageSelector::selectRandom(const QStringList& images) const { - if(_debugMode) + if(debugMode) { std::cout << "images: " << images.size() << std::endl; } diff --git a/src/imageselector.h b/src/imageselector.h index a11c8c9..645f5af 100644 --- a/src/imageselector.h +++ b/src/imageselector.h @@ -11,17 +11,17 @@ class PathTraverser; class ImageSelector { public: - ImageSelector(std::unique_ptr& pathTraverser, char aspect); + ImageSelector(std::unique_ptr& pathTraverser, char aspectIn); virtual ~ImageSelector(); virtual std::string getNextImage() = 0; - void setDebugMode(bool debugMode) { _debugMode = debugMode;} + void setDebugMode(bool debugModeIn) { debugMode = debugModeIn;} protected: int getImageRotation(const std::string &fileName); bool imageValidForAspect(const std::string &fileName); std::unique_ptr& pathTraverser; - char _aspect; - bool _debugMode = false; + char aspect; + bool debugMode = false; }; class RandomImageSelector : public ImageSelector diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f283ffb..804a212 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -109,7 +109,7 @@ void MainWindow::updateImage(bool immediately) } QPixmap p( currentImage.c_str() ); - if(_debugMode) + if(debugMode) { std::cout << "size:" << p.width() << "x" << p.height() << std::endl; } @@ -125,7 +125,7 @@ void MainWindow::updateImage(bool immediately) drawText(background, overlay->getMarginTopRight(), overlay->getFontsizeTopRight(), overlay->getRenderedTopRight(currentImage).c_str(), Qt::AlignTop|Qt::AlignRight); drawText(background, overlay->getMarginBottomLeft(), overlay->getFontsizeBottomLeft(), overlay->getRenderedBottomLeft(currentImage).c_str(), Qt::AlignBottom|Qt::AlignLeft); drawText(background, overlay->getMarginBottomRight(), overlay->getFontsizeBottomRight(), overlay->getRenderedBottomRight(currentImage).c_str(), Qt::AlignBottom|Qt::AlignRight); - if (_debugMode) + if (debugMode) { // draw a thumbnail version of the source image in the bottom left, to check for cropping issues QPainter pt(&background); @@ -184,14 +184,14 @@ void MainWindow::setOverlay(Overlay* o) overlay = o; } -void MainWindow::setAspect(char aspect) +void MainWindow::setAspect(char aspectIn) { - _aspect = aspect; + aspect = aspectIn; } QPixmap MainWindow::getBlurredBackground(const QPixmap& originalSize, const QPixmap& scaled) { - if (scaled.width() < width() || _aspect == 'l') { + if (scaled.width() < width()) { QPixmap background = blur(originalSize.scaledToWidth(width(), Qt::SmoothTransformation)); QRect rect(0, (background.height() - height())/2, width(), height()); return background.copy(rect); @@ -212,15 +212,15 @@ QPixmap MainWindow::getRotatedPixmap(const QPixmap& p) QPixmap MainWindow::getScaledPixmap(const QPixmap& p) { - if (_fitAspectAxisToWindow) + if (fitAspectAxisToWindow) { - if ( _aspect == 'p') + if ( aspect == 'p') { // potrait mode, make height of image fit screen and crop top/bottom QPixmap pTemp = p.scaledToHeight(height(), Qt::SmoothTransformation); return pTemp.copy(0,0,width(),height()); } - else if ( _aspect == 'l') + else if ( aspect == 'l') { // landscape mode, make width of image fit screen and crop top/bottom QPixmap pTemp = p.scaledToWidth(width(), Qt::SmoothTransformation); diff --git a/src/mainwindow.h b/src/mainwindow.h index 9de5e9c..d83f436 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -25,18 +25,18 @@ public: void setBackgroundOpacity(unsigned int opacity); void warn(std::string text); void setOverlay(Overlay* overlay); - void setAspect(char aspect); - void setDebugMode(bool debugMode) {_debugMode = debugMode;} - void setFitAspectAxisToWindow(bool fitAspectAxisToWindow) { _fitAspectAxisToWindow = fitAspectAxisToWindow; } + void setAspect(char aspectIn); + void setDebugMode(bool debugModeIn) {debugMode = debugModeIn;} + void setFitAspectAxisToWindow(bool fitAspectAxisToWindowIn) { fitAspectAxisToWindow = fitAspectAxisToWindowIn; } private: Ui::MainWindow *ui; std::string currentImage; unsigned int blurRadius = 20; unsigned int backgroundOpacity = 150; - char _aspect = 'a'; - bool _debugMode = false; - bool _fitAspectAxisToWindow = false; + char aspect = 'a'; + bool debugMode = false; + bool fitAspectAxisToWindow = false; Overlay* overlay; diff --git a/src/overlay.cpp b/src/overlay.cpp index 94a2a68..9d43572 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -50,7 +50,7 @@ void Overlay::parseInput() { QString Overlay::getTemplate(QStringList components){ if (components.size()>3) { - if(_debugMode) + if(debugMode) { std::cout << "template: " << components[3].toStdString() << std::endl; } @@ -61,7 +61,7 @@ QString Overlay::getTemplate(QStringList components){ int Overlay::getMargin(QStringList components){ if (components.size()>1) { - if(_debugMode) + if(debugMode) { std::cout << "margin: " << components[1].toStdString() << std::endl; } @@ -76,7 +76,7 @@ int Overlay::getMargin(QStringList components){ int Overlay::getFontsize(QStringList components){ if (components.size()>2) { - if(_debugMode) + if(debugMode) { std::cout << "fontsize: " << components[2].toStdString() << std::endl; } diff --git a/src/overlay.h b/src/overlay.h index 90800f2..b1cef0a 100644 --- a/src/overlay.h +++ b/src/overlay.h @@ -27,13 +27,13 @@ class Overlay int getMarginBottomRight(); int getFontsizeBottomRight(); - void setDebugMode(const bool debugMode) { _debugMode = debugMode; } + void setDebugMode(const bool debugModeIn) { debugMode = debugModeIn; } private: const std::string overlayInput; int margin; int fontsize; - bool _debugMode = false; + bool debugMode = false; QString topLeftTemplate; QString topRightTemplate;