From 43c2a51331d3e91d86ef50c5262920bdaa260925 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 11 Feb 2019 10:52:30 +0100 Subject: Show/hide drumkit tab depending on if the current kit has a valid image attached or not. --- plugingui/image.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugingui/image.cc') diff --git a/plugingui/image.cc b/plugingui/image.cc index 4b5622e..70ee08e 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -76,15 +76,17 @@ Image& Image::operator=(Image&& other) image_data = std::move(other.image_data); _width = other._width; _height = other._height; + valid = other.valid; other._width = 0; other._height = 0; - + other.valid = false; return *this; } void Image::setError() { + valid = false; Resource rc(":resources/png_error"); const unsigned char* ptr = (const unsigned char*)rc.data(); @@ -155,6 +157,7 @@ void Image::load(const char* data, size_t size) assert(image_data.size() == (_width * _height)); std::free(char_image_data); + valid = true; } size_t Image::width() const @@ -177,4 +180,9 @@ const Colour& Image::getPixel(size_t x, size_t y) const return image_data[x + y * _width]; } +bool Image::isValid() const +{ + return valid; +} + } // GUI:: -- cgit v1.2.3