void MyWindow::setWindowIcon(QUrl icon) { if( icon!=m_windowIcon ){ QString str = icon.toString (); if( str.mid (0, 3) == "qrc") str = str.mid (3, str.count ()-3); setIcon (QIcon(str)); m_windowIcon = icon; emit windowIconChanged (); } }
void SystemTrayIcon::setWindowIcon(QUrl icon) { if( icon!=m_windowIcon ){ QString str = icon.toLocalFile(); if(str == ""){ str = icon.toString(); } if( str.mid (0, 3) == "qrc") str = str.mid (3, str.count ()-3); systempTray->setIcon (QIcon(str)); m_windowIcon = icon; emit windowIconChanged (); } }
WindowsModel::WindowsModel (QObject *parent) : QAbstractItemModel (parent) , CurrentDesktop_ (Util::XWrapper::Instance ().GetCurrentDesktop ()) , ImageProvider_ (new TaskbarImageProvider (QIcon::fromTheme ("xorg"))) { auto& w = Util::XWrapper::Instance (); auto windows = w.GetWindows (); for (auto wid : windows) AddWindow (wid, w); connect (&w, SIGNAL (windowListChanged ()), this, SLOT (updateWinList ())); connect (&w, SIGNAL (activeWindowChanged ()), this, SLOT (updateActiveWindow ())); connect (&w, SIGNAL (windowNameChanged (ulong)), this, SLOT (updateWindowName (ulong))); connect (&w, SIGNAL (windowIconChanged (ulong)), this, SLOT (updateWindowIcon (ulong))); connect (&w, SIGNAL (windowStateChanged (ulong)), this, SLOT (updateWindowState (ulong))); connect (&w, SIGNAL (windowActionsChanged (ulong)), this, SLOT (updateWindowActions (ulong))); connect (&w, SIGNAL (windowDesktopChanged (ulong)), this, SLOT (updateWindowDesktop (ulong))); connect (&w, SIGNAL (desktopChanged ()), this, SLOT (updateCurrentDesktop ())); QHash<int, QByteArray> roleNames; roleNames [Role::WindowName] = "windowName"; roleNames [Role::WindowID] = "windowID"; roleNames [Role::IconGenID] = "iconGenID"; roleNames [Role::IsCurrentDesktop] = "isCurrentDesktop"; roleNames [Role::IsActiveWindow] = "isActiveWindow"; roleNames [Role::IsMinimizedWindow] = "isMinimizedWindow"; setRoleNames (roleNames); int eventBase, errorBase; if (XCompositeQueryExtension (w.GetDisplay (), &eventBase, &errorBase)) { int major = 0, minor = 2; XCompositeQueryVersion (w.GetDisplay (), &major, &minor); if (major > 0 || minor >= 2) qDebug () << "all good, has NamePixmap"; } }