#include "ImageManager.h" #include "ConfigOptions.h" ImageManager* ImageManager::_instance = NULL; static const int NUM_IMAGES = 7; static const char* _images [] = { "exec.png", "info.png", "job.png", "people.png", "stop.png", "terminal.png", "user.png", "branch.png", "delta.png", "label.png" "penguin.png", "pending_changes.png", "file_c.png", "file_h.png", "file_cpp.png", "file_binary.png", "unknown.png", "file_txt.png", "file_project.png", "file_py.png", "file_html.png", "file_java.png", "file_ruby.png" }; ImageManager::ImageManager() { } ImageManager* ImageManager::getInstance() { if (_instance == NULL) { _instance = new ImageManager(); _instance->loadKnownImages(); } return _instance; } QPixmap ImageManager::getPixmap( const QString& imgName ) { QPixmap pm; if (!QPixmapCache::find(imgName, pm)) { QString path = ConfigOptions::getInstance()->getImageDir() + "/" + imgName; if (pm.load(path)) { QPixmapCache::insert( imgName, pm ); } else { if (!QPixmapCache::find("penguin.png",pm)) { // load default penguin QString path = ConfigOptions::getInstance()->getImageDir() + "/penguin.png"; pm.load( path ); QPixmapCache::insert( "penguin.png", pm ); } } } return pm; } void ImageManager::loadKnownImages() { QString path = ConfigOptions::getInstance()->getImageDir(); for (int i = 0; i < NUM_IMAGES; ++i) { QPixmap pm; pm.load( path + "/" + _images[i] ); QPixmapCache::insert( _images[i], pm ); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 2152 | Jacob Gladish | Added a couple more images, and non-blocking server communication | ||
#2 | 2145 | Jacob Gladish | Added PendingChanges listview | ||
#1 | 2141 | Jacob Gladish |
Begun adding toolbar buttons, and added connection info. Added some missing files from project. |