# HG changeset patch # User Chris Cannam # Date 1184256899 0 # Node ID 9a13687c078b864f025c728295550b016a74ffb2 # Parent 3b8008d0954179b0f6c29cc3cbb2a169636ff544 * Add SingleColourLayer to manage colours for layers that have a single predominant colour (i.e. most of them). diff -r 3b8008d09541 -r 9a13687c078b base/ColourDatabase.cpp --- a/base/ColourDatabase.cpp Wed Jul 11 17:21:37 2007 +0000 +++ b/base/ColourDatabase.cpp Thu Jul 12 16:14:59 2007 +0000 @@ -16,6 +16,8 @@ #include "ColourDatabase.h" #include "XmlExportable.h" +#include + ColourDatabase ColourDatabase::m_instance; @@ -97,7 +99,10 @@ ColourDatabase::setUseDarkBackground(int c, bool dark) { if (c < 0 || size_t(c) >= m_colours.size()) return; - m_colours[c].darkbg = dark; + if (m_colours[c].darkbg != dark) { + m_colours[c].darkbg = dark; + emit colourDatabaseChanged(); + } } int @@ -182,3 +187,20 @@ } } +QPixmap +ColourDatabase::getExamplePixmap(int index, QSize size) const +{ + QPixmap pmap(size); + pmap.fill(useDarkBackground(index) ? Qt::black : Qt::white); + QPainter paint(&pmap); + QColor colour(getColour(index)); + paint.setPen(colour); + paint.setBrush(colour); + int margin = 2; + if (size.width() < 4 || size.height() < 4) margin = 0; + else if (size.width() < 8 || size.height() < 8) margin = 1; + paint.drawRect(margin, margin, + size.width() - margin*2 - 1, size.height() - margin*2 - 1); + return pmap; +} + diff -r 3b8008d09541 -r 9a13687c078b base/ColourDatabase.h --- a/base/ColourDatabase.h Wed Jul 11 17:21:37 2007 +0000 +++ b/base/ColourDatabase.h Thu Jul 12 16:14:59 2007 +0000 @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include class ColourDatabase : public QObject @@ -58,6 +60,8 @@ // for use by PropertyContainer getPropertyRangeAndValue methods void getColourPropertyRange(int *min, int *max) const; + + QPixmap getExamplePixmap(int index, QSize size) const; signals: void colourDatabaseChanged(); diff -r 3b8008d09541 -r 9a13687c078b data/fileio/RemoteFile.cpp --- a/data/fileio/RemoteFile.cpp Wed Jul 11 17:21:37 2007 +0000 +++ b/data/fileio/RemoteFile.cpp Thu Jul 12 16:14:59 2007 +0000 @@ -64,7 +64,9 @@ this, SLOT(dataReadProgress(int, int))); connect(m_http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(httpResponseHeaderReceived(const QHttpResponseHeader &))); - m_http->get(url.path(), m_localFile); + QString path = url.path(); + std::cerr << "RemoteFile: path is \"" << path.toStdString() << "\"" << std::endl; + m_http->get(path, m_localFile); } else if (scheme == "ftp") {