Exemplo n.º 1
0
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::createIcons()
{
    createIcon("://icon/config.png", tr("Configuration"));
    createIcon("://icon/pattern_config.png", tr("Pattern"));
    createIcon("://icon/community_config.png", tr("Community"));
    createIcon("://icon/path_config.png", tr("Paths"));

    connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
}
Exemplo n.º 2
0
void ColourChooser::btnClicked()
{
    QString name = sender()->objectName();

    if(name == QString("mainMaxBtn"))
    {
        QColor c = QColorDialog().getColor(mainMax->toRgb(),0,tr("Set Main Colour Maximum Variation"));
        if(c != QColor::Invalid)
        {
            *mainMax = c;
            mainMaxBtn->setIcon(createIcon(mainMax));
            mainImage->setPixmap(createHPixmap(mainMin,mainMax));
        }
    }
    else if(name == QString("mainMinBtn"))
    {
        QColor c = QColorDialog().getColor(mainMin->toRgb(),0,tr("Set Main Colour Minimum Variation"));
        if(c != QColor::Invalid)
        {
            *mainMin = c;
            mainMinBtn->setIcon(createIcon(mainMin));
            mainImage->setPixmap(createHPixmap(mainMin,mainMax));
        }
    }
    else if(name == QString("altMaxBtn"))
    {
        QColor c = QColorDialog().getColor(altMax->toRgb(),0,tr("Set ")+ bottomBox->title()+QString(" Maximum Variation"));
        if(c != QColor::Invalid)
        {
            *altMax = c;
            altMaxBtn->setIcon(createIcon(altMax));
            altImage->setPixmap(createHPixmap(altMin,altMax));
        }
    }
    else if(name == QString("altMinBtn"))
    {
        QColor c = QColorDialog().getColor(altMin->toRgb(),0,tr("Set ")+ bottomBox->title()+QString(" Minimum Variation"));
        if(c != QColor::Invalid)
        {
            *altMin = c;
            altMinBtn->setIcon(createIcon(altMin));
            altImage->setPixmap(createHPixmap(altMin,altMax));
        }
    }

    sideImage->setPixmap(createVPixmap());

}
Exemplo n.º 3
0
const QIcon Flags::getIcon(const QString& layout)
{
    if( ! iconMap.contains(layout) ) {
        iconMap[ layout ] = createIcon(layout);
    }
    return iconMap[ layout ];
}
Exemplo n.º 4
0
void DMessageBox::showInformationWidget(QMessageBox::Icon icon,
                                        QWidget* const parent,
                                        const QString& caption,
                                        const QString& text,
                                        QWidget* const listWidget,
                                        const QString& dontShowAgainName)
{
    if (!readMsgBoxShouldBeShown(dontShowAgainName))
    {
        return;
    }

    QDialog* const dialog = new QDialog(parent, Qt::Dialog);
    dialog->setWindowTitle(caption);
    dialog->setObjectName(QLatin1String("showInformation"));
    dialog->setModal(true);

    QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok, dialog);
    buttons->button(QDialogButtonBox::Ok)->setDefault(true);
    buttons->button(QDialogButtonBox::Ok)->setShortcut(Qt::Key_Escape);

    QObject::connect(buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
                     dialog, SLOT(accept()));

    bool  checkboxResult = false;

    createMessageBox(dialog, buttons, createIcon(icon), text, listWidget,
                     dontShowAgainName.isEmpty() ? QString() : i18n("Do not show this message again"),
                     &checkboxResult);

    saveMsgBoxShouldBeShown(dontShowAgainName, checkboxResult);
}
Exemplo n.º 5
0
QPixmap CursorTheme::icon() const
{
    if (m_icon.isNull())
        m_icon = createIcon();

    return m_icon;
}
Exemplo n.º 6
0
InfoBar::InfoBar( QWidget *parent )
	: QWidget( parent )
{
	setBackgroundColor();
	createLayout();
	createIcon();
	createLabel();
	createCloseButton();
}
Exemplo n.º 7
0
void ColorDialog::setForeground()
{
    QColor color = QColorDialog::getColor(fg);
    if (color.isValid()) {
        QToolButton *button = static_cast<QToolButton *>(sender());
        button->setIcon(createIcon(button->iconSize(), color));
        fg = color;
    }
}
Exemplo n.º 8
0
	void refresh() override
	{
		clear();
		auto& universe = *m_editor.getUniverse();
		for (Entity entity = universe.getFirstEntity(); entity.isValid(); entity = universe.getNextEntity(entity))
		{
			createIcon(entity);
		}
	}
Exemplo n.º 9
0
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
                              const GLFWimage* image,
                              int xhot, int yhot)
{
    cursor->win32.handle = (HCURSOR) createIcon(image, xhot, yhot, GLFW_FALSE);
    if (!cursor->win32.handle)
        return GLFW_FALSE;

    return GLFW_TRUE;
}
Exemplo n.º 10
0
int DMessageBox::showYesNoWidget(QMessageBox::Icon icon,
                                 QWidget* const parent,
                                 const QString& caption,
                                 const QString& text,
                                 QWidget* const listWidget,
                                 const QString& dontAskAgainName)
{
    if (!readMsgBoxShouldBeShown(dontAskAgainName))
    {
        return QMessageBox::Yes;
    }

    QDialog* const dialog = new QDialog(parent, Qt::Dialog);
    dialog->setWindowTitle(caption);
    dialog->setObjectName(QLatin1String("showYesNo"));
    dialog->setModal(true);

    QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No, dialog);
    buttons->button(QDialogButtonBox::No)->setDefault(true);
    buttons->button(QDialogButtonBox::No)->setShortcut(Qt::Key_Escape);

    QSignalMapper* const signalMapper = new QSignalMapper(buttons);
    signalMapper->setMapping(buttons->button(QDialogButtonBox::Yes), QDialogButtonBox::Yes);
    signalMapper->setMapping(buttons->button(QDialogButtonBox::No),  QDialogButtonBox::No);

    QObject::connect(buttons->button(QDialogButtonBox::Yes), SIGNAL(clicked()),
                     signalMapper, SLOT(map()));

    QObject::connect(buttons->button(QDialogButtonBox::No), SIGNAL(clicked()),
                     signalMapper, SLOT(map()));

    QObject::connect(signalMapper, SIGNAL(mapped(int)),
                     dialog, SLOT(done(int)));

    bool checkboxResult = false;
    int result          = createMessageBox(dialog, buttons, createIcon(icon), text, listWidget,
                                           dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
                                           &checkboxResult);

    if (result == QDialogButtonBox::Yes)
    {
        saveMsgBoxShouldBeShown(dontAskAgainName, checkboxResult);
        return QMessageBox::Yes;
    }
    else if (result == QDialogButtonBox::No)
    {
        saveMsgBoxShouldBeShown(dontAskAgainName, checkboxResult);
        return QMessageBox::No;
    }

    return QMessageBox::Cancel;
}
Exemplo n.º 11
0
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
                                int count, const GLFWimage* images)
{
    HICON bigIcon = NULL, smallIcon = NULL;

    if (count)
    {
        const GLFWimage* bigImage = chooseImage(count, images,
                                                GetSystemMetrics(SM_CXICON),
                                                GetSystemMetrics(SM_CYICON));
        const GLFWimage* smallImage = chooseImage(count, images,
                                                  GetSystemMetrics(SM_CXSMICON),
                                                  GetSystemMetrics(SM_CYSMICON));

        bigIcon = createIcon(bigImage, 0, 0, GLFW_TRUE);
        smallIcon = createIcon(smallImage, 0, 0, GLFW_TRUE);
    }
    else
    {
        bigIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICON);
        smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
    }

    SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
    SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);

    if (window->win32.bigIcon)
        DestroyIcon(window->win32.bigIcon);

    if (window->win32.smallIcon)
        DestroyIcon(window->win32.smallIcon);

    if (count)
    {
        window->win32.bigIcon = bigIcon;
        window->win32.smallIcon = smallIcon;
    }
}
Exemplo n.º 12
0
void patternDockWidget::changeSymbol(QRgb color,
                                     const QPixmap& symbol) {

  const QColor qColor(color);
  QList<QListWidgetItem*> listItems =
    symbolList_->findItems("", Qt::MatchStartsWith); // get them all
  for (QList<QListWidgetItem*>::iterator it = listItems.begin(),
         end = listItems.end(); it != end; ++it) {
    if ((*it)->data(Qt::UserRole).value<QColor>() == qColor) {
      (*it)->setIcon(createIcon(color, symbol));
      symbolList_->setCurrentItem(*it);
      break;
    }
  }
}
Exemplo n.º 13
0
Tray::Tray(QObject *parent) :
    QObject(parent)
{
    m_blinkTimer = new QTimer(this);
    m_blinkTimer->setInterval(1000);

    createActions();
    createIcon();

    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(trayClicked(QSystemTrayIcon::ActivationReason)));
    connect(m_blinkTimer, SIGNAL(timeout()), SLOT(blink()));

    if(!Settings::instance()->getValue("window/hide_tray").toBool())
        trayIcon->show();

}
Exemplo n.º 14
0
void patternDockWidget::
setSymbolList(const QHash<QRgb, QPixmap>& colorSymbols) {

  symbolList_->clear();
  const QVector<symbolPair> sortedList = sortHashByIntensity(colorSymbols);
  for (QVector<symbolPair>::const_iterator it = sortedList.begin(),
          end = sortedList.end(); it != end; ++it) {
    const QRgb thisColor = (*it).first;
    const QPixmap thisSymbol = (*it).second;
    QListWidgetItem* listItem =
      new QListWidgetItem(createIcon(thisColor, thisSymbol), "",
                          symbolList_);
    // also store the color values for convenience
    listItem->setData(Qt::UserRole, QVariant(QColor(thisColor)));
  }
  setSymbolCountLabel(symbolList_->count());
}
Exemplo n.º 15
0
QPixmap CursorTheme::createIcon() const
{
    int iconSize = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
    int cursorSize = nominalCursorSize(iconSize);
    QSize size = QSize(iconSize, iconSize);

    QPixmap pixmap = createIcon(cursorSize);

    if (!pixmap.isNull())
    {
        // Scale the pixmap if it's larger than the preferred icon size
        if (pixmap.width() > size.width() || pixmap.height() > size.height())
            pixmap = pixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    }

    return pixmap;
}
QIcon IconDecorator::getIconByName(const QString &name)
{
    static QHash<QString, QIcon> icons;
    if (icons.isEmpty()) {
        icons.insert(QLatin1String("Dir.Headers"), createIcon(QStyle::SP_DirIcon, QIcon(QLatin1String(":/cov/icons/headers.png"))));
        icons.insert(QLatin1String("Dir.Sources"), createIcon(QStyle::SP_DirIcon, QIcon(QLatin1String(":/cov/icons/sources.png"))));
        icons.insert(QLatin1String("Dir.Project"), createIcon(QStyle::SP_DirIcon, QIcon(QLatin1String(":/cov/icons/qt_project.png"))));
        icons.insert(QLatin1String("Dir.Other"), createIcon(QStyle::SP_DirIcon, QIcon()));
        icons.insert(QLatin1String("File.Headers"), createIcon(QStyle::SP_FileIcon, QIcon(QLatin1String(":/cov/icons/headers.png"))));
        icons.insert(QLatin1String("File.Sources"), createIcon(QStyle::SP_FileIcon, QIcon(QLatin1String(":/cov/icons/sources.png"))));
    }

    return icons.value(name);
}
Exemplo n.º 17
0
int DMessageBox::showContinueCancelWidget(QMessageBox::Icon icon,
                                          QWidget* const parent,
                                          const QString& caption,
                                          const QString& text,
                                          QWidget* const listWidget,
                                          const QString& dontAskAgainName)
{
    if (!readMsgBoxShouldBeShown(dontAskAgainName))
    {
        return QMessageBox::Yes;
    }

    QDialog* const dialog = new QDialog(parent, Qt::Dialog);
    dialog->setWindowTitle(caption);
    dialog->setObjectName(QLatin1String("showContinueCancel"));
    dialog->setModal(true);

    QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::Cancel, dialog);
    buttons->button(QDialogButtonBox::Yes)->setDefault(true);
    buttons->button(QDialogButtonBox::Yes)->setText(i18n("Continue"));
    buttons->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);

    QObject::connect(buttons->button(QDialogButtonBox::Yes), SIGNAL(clicked()),
                     dialog, SLOT(accept()));

    QObject::connect(buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
                     dialog, SLOT(reject()));

    bool checkboxResult = false;
    const int result    = createMessageBox(dialog, buttons, createIcon(icon), text, listWidget,
                                           dontAskAgainName.isEmpty() ? QString() : i18n("Do not ask again"),
                                           &checkboxResult);

    if (result != QDialog::Accepted)
    {
        return QMessageBox::Cancel;
    }

    saveMsgBoxShouldBeShown(dontAskAgainName, checkboxResult);

    return QMessageBox::Yes;
}
Exemplo n.º 18
0
//--------------------------------------------------------------
void JiveScreen::getChoreoPosition(int step, char gender, bool displayPrevious, vector< vector<int> > choreo, bool bdisplayIcon, bool bisStart)
{
    // CURRENT POSITION ----------------------------------------
    char side;
    if(choreo[step][2] == 0)
    {
        positionCurr.x = choreo[step][0]-config.distanceFeet;
        side = 'l';
    }
    else
    {
        positionCurr.x = choreo[step][0]+config.distanceFeet;
        side = 'r';
    }
    positionCurr.y = choreo[step][1];
    
    // DISPLAY STEP --------------------------------------------
    // set color
    ofSetColor(255);
    if(displayPrevious) ofSetColor(255, 127);
    
    Foot(positionCurr.x, positionCurr.y, side, gender, config.iconSize);
    
    int nextStep = step+2;
    if(nextStep == 8) nextStep = 0;
    if(nextStep == 9) nextStep = 1;
    
    if(bdisplayIcon) createIcon(positionCurr, choreo, nextStep, gender);
    
    // PREVIOUS STEP -------------------------------------------
    if(displayPrevious)
    {
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        ofPushMatrix();
        if(bisStart) ofTranslate(-boxWidth*2/7, 0);
        getChoreoPosition(previousStep, gender, false, choreo, bdisplayIcon, bisStart);
        ofPopMatrix();
    }
}
Exemplo n.º 19
0
const QIcon Flags::getIconWithText(const LayoutUnit& layoutUnit, const KeyboardConfig& keyboardConfig)
{
    QString keySuffix(getPixmapKey(keyboardConfig));
    QString key(layoutUnit.toString() + keySuffix);
    if( iconOrTextMap.contains(key) ) {
        return iconOrTextMap[ key ];
    }

    if( keyboardConfig.indicatorType == KeyboardConfig::SHOW_FLAG ) {
        QIcon icon = getIcon(layoutUnit.layout);
        if( ! icon.isNull() ) {
            iconOrTextMap[ key ] = icon;
            return icon;
        }
    }

    QString layoutText = Flags::getShortText(layoutUnit, keyboardConfig);

    const QSize TRAY_ICON_SIZE(21, 14);
    QPixmap pixmap = QPixmap(TRAY_ICON_SIZE);
    pixmap.fill(Qt::transparent);

    QPainter painter(&pixmap);
//	p.setRenderHint(QPainter::SmoothPixmapTransform);
//	p.setRenderHint(QPainter::Antialiasing);

    if( keyboardConfig.indicatorType == KeyboardConfig::SHOW_LABEL_ON_FLAG ) {
        QIcon iconf = createIcon(layoutUnit.layout);
        iconf.paint(&painter, painter.window(), Qt::AlignCenter);
    }

    drawLabel(painter, layoutText, keyboardConfig.isFlagShown());

    painter.end();

    QIcon icon(pixmap);
    iconOrTextMap[ key ] = icon;

    return icon;
}
Exemplo n.º 20
0
//--------------------------------------------------------------
void SalsaScreen::getChoreoPosition(int step, char gender, bool displayPrevious, vector< vector<int> > choreo, bool bdisplayIcon)
{
    // CURRENT POSITION ----------------------------------------
    char side;
    if(choreo[step][2] == 0)
    {
        positionCurr.x = choreo[step][0]-config.distanceFeet;
        side = 'l';
    }
    else
    {
        positionCurr.x = choreo[step][0]+config.distanceFeet;
        side = 'r';
    }
    positionCurr.y = choreo[step][1];
    
    // DISPLAY STEP --------------------------------------------
    // set color
    ofSetColor(255);
    if(displayPrevious) ofSetColor(255, 127);
    
    Foot(positionCurr.x, positionCurr.y, side, gender, config.iconSize);
    
    int nextStep = step+2;
    if(nextStep == 6) nextStep = 0;
    if(nextStep == 7) nextStep = 1;
    
    if(bdisplayIcon) createIcon(positionCurr, choreo, nextStep, gender);
    
    // PREVIOUS STEP -------------------------------------------
    if(displayPrevious)
    {
        previousStep = step-1;
        if(previousStep == -1) previousStep = 5;
        getChoreoPosition(previousStep, gender, false, choreo, bdisplayIcon);
    }
}
Exemplo n.º 21
0
	void onEntityCreated(Entity entity)
	{
		createIcon(entity);
	}
Exemplo n.º 22
0
QPixmap XCursorImage::icon () const {
  if (mIcon.isNull()) mIcon = createIcon();
  return mIcon;
}
Exemplo n.º 23
0
	void refreshIcon(const ComponentUID& cmp)
	{
		destroyIcon(cmp.entity);
		createIcon(cmp.entity);
	}
Exemplo n.º 24
0
//--------------------------------------------------------------
void JiveScreen::tweenPositionSlave(vector<ofVec2f> fP, ofVec2f posUpdate, ofVec2f positionCurr, vector< vector<int> > choreo, int step, char side, char gender, bool bdisplayIcon, bool bdisplayPrevious, bool bmoveForward, bool bcloser)
{
    // if lift
    if(choreo[step][3] == 5 && !bmoveForward)
    {
        fP.at(fP.size()-1) = positionCurr;
        posUpdate          = positionCurr;
        positionPrev       = positionCurr;
    }
    //cout << step << " - prev: " << positionPrev << " - curr: " << positionCurr << " --> update: " << posUpdate << "     out: " << fP.at(fP.size()-1) << endl;
    
    if (posUpdate != positionCurr)
    {
        int last = fP.size()-1;
        
        ofSetColor(255, 255, 255, 255);
        
        /*int distTotal = ofDist(positionPrev.x, positionPrev.y, positionCurr.x, positionCurr.y);
         int distUpdate = ofDist(fP.at(last).x, fP.at(last).y, positionCurr.x, positionCurr.y);
         //int alpha = ofMap(distUpdate, 0, distTotal, 75, 255);
         //int alpha = 255-255*distUpdate/distTotal;
         //ofSetColor(255, 255, 255, alpha);*/
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }else if(step == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else{
            if(gender == 'm'){
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
        }
        
        //alpha = 255;
        //if(distUpdate < distTotal/4) alpha = 0;
        if(bdisplayIcon) createIcon(fP, choreo, step, gender);
        //ofSetColor(255, 255, 255, 255);
    }
    else
    {
        int last = fP.size()-1;
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }
        else
        {
            // if lift
            if(choreo[step][3] == 5 && !bmoveForward)
            {
                if(bdisplayIcon) createIcon(fP, choreo, step, gender);
                
                if(!biconWasBig && newIconSize  < config.iconSize+5) newIconSize += 1;
                if(                newIconSize == config.iconSize+5) biconWasBig = true;
                if( biconWasBig && newIconSize >= config.iconSize)   newIconSize -= 1;
            }else{
                // reset
                biconWasBig = false;
                newIconSize = config.iconSize;
            }
            
            if(step == 0)
            {
                ofPushMatrix();
                if(gender == 'm'){
                    ofRotateZ(360-rotateDegree);
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    ofRotateZ(rotateDegree);
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
                ofPopMatrix();
            }
            else
            {
                if(gender == 'm'){
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
            }
        }
        
        //if(bdisplayIcon) createIcon(fP, choreo, step, gender);
    }
    
    if(bdisplayPrevious)
    {
        // PREVIOUS STEP --------------------------------------------
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        
        // get position
        ofVec2f previousStepPos;
        if(choreo[previousStep][2] == 0)
        {
            previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
            side = 'l';
        }
        else
        {
            previousStepPos.x = choreo[previousStep][0]+config.distanceFeet;
            side = 'r';
        }
        //if(previousStep == 0) previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
        previousStepPos.y = choreo[previousStep][1];
        
        // display step
        ofSetColor(255, 127);
        if(previousStep == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else
        {
            if(gender == 'm'){
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
        }

        int futureStep = previousStep+2;
        if(futureStep == 8) futureStep = 0;
        if(futureStep == 9) futureStep = 1;
        if(bdisplayIcon) createIcon(previousStepPos, choreo, futureStep, gender);
        ofSetColor(255, 255);
    }
}
Exemplo n.º 25
0
HRESULT CSIM_ext::QueryContextMenu(HMENU hmenu,
                                   UINT indexMenu,
                                   UINT idCmdFirst,
                                   UINT idCmdLast,
                                   UINT uFlags)
{
    if ((lpData == NULL) || (uFlags & CMF_DEFAULTONLY))
        return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);

	CmdBase = idCmdFirst;

    if (((uFlags & 0x0000000F) == CMF_NORMAL) || (uFlags & CMF_EXPLORE)){
    STGMEDIUM stgmedium = { TYMED_HGLOBAL, NULL };
    FORMATETC formatetc = { CF_HDROP,
                            NULL,
                            DVASPECT_CONTENT,
                            -1,
                            TYMED_HGLOBAL
                          };
	    HRESULT hr = lpData->GetData(&formatetc, &stgmedium);
		if (!SUCCEEDED(hr))
	        return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
		char *drop_files = (char*)GlobalLock(stgmedium.hGlobal);
		DROPFILES *files = (DROPFILES*)drop_files;
        GlobalUnlock(stgmedium.hGlobal);

        CComBSTR in("CONTACTS 3");
        CComBSTR out;
        unsigned cmd_id = idCmdFirst;
        if (ProcessStr && ProcessStr(in, &out)){
            HMENU hMain = NULL;
            HMENU hSub  = NULL;
            size_t size = WideCharToMultiByte(CP_ACP, 0, out, wcslen(out), 0, 0, NULL, NULL);
            char *res = new char[size + 1];
            size = WideCharToMultiByte(CP_ACP, 0, out, wcslen(out), res, size, NULL, NULL);
            res[size] = 0;
            if (res[0] == '>'){
                string r = res + 1;
                string line = getToken(r, '\n');
                unsigned nContacts = atol(getToken(line, ' ').c_str());
                unsigned nGroups   = atol(line.c_str());
                bool bSubMenu = false;
                if ((nContacts > 20) && (nGroups > 1)){
                    hMain = CreatePopupMenu();
                    bSubMenu = true;
                }
                unsigned old_grp = (unsigned)(-1);
                while (!r.empty()){
                    line = getToken(r, '\n');
                    if (line.empty())
                        continue;
                    unsigned id  = atol(getToken(line, ' ').c_str());
                    unsigned grp = atol(getToken(line, ' ').c_str());
                    string icon  = getToken(line, ' ');
                    if (!line.empty()){
                        if (hMain){
                            if (grp != old_grp){
                                old_grp = grp;
                                if (bSubMenu){
                                    char *res = NULL;
                                    hSub = CreatePopupMenu();
                                    char *grp = "Group";
                                    char cmd[64];
                                    sprintf(cmd, "GROUP %u", old_grp);
                                    CComBSTR in(cmd);
                                    CComBSTR out;
                                    if (ProcessStr && ProcessStr(in, &out)){
                                        size_t size = WideCharToMultiByte(CP_ACP, 0, out, wcslen(out), 0, 0, NULL, NULL);
                                        char *res = new char[size + 1];
                                        size = WideCharToMultiByte(CP_ACP, 0, out, wcslen(out), res, size, NULL, NULL);
                                        res[size] = 0;
                                        if (res[0] == '>')
                                            grp = res + 1;
                                    }
                                    AppendMenu(hMain, MF_POPUP | MF_STRING, (unsigned)hSub, grp);
                                    if (res)
                                        delete[] res;
                                }else{
                                    AppendMenu(hSub, MF_SEPARATOR, 0, NULL);
                                }
                            }
                        }else{
                            hMain = CreatePopupMenu();
                            hSub  = hMain;
                        }
                        ItemInfo info;
                        info.text  = line.c_str();
                        info.icon  = createIcon(icon.c_str());
                        info.id	   = id;
                        m_items.insert(ITEM_MAP::value_type(cmd_id, info));
                        AppendMenu(hSub, MF_STRING | MF_OWNERDRAW, cmd_id, line.c_str());
                        cmd_id++;
                    }
                }
            }
            delete[] res;
            if (hMain != NULL)
                InsertMenu(hmenu, indexMenu++, MF_POPUP|MF_BYPOSITION,
                           (UINT)hMain, "Send to SIM contact");
        }
        return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, cmd_id - idCmdFirst);
    }
    return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
}
Exemplo n.º 26
0
TToolBox::TToolBox(QWidget *parent) : QToolBox(parent), m_lastIndex(0)
{
    setFrameStyle(QFrame::StyledPanel);
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(changeIcon(int)));
    createIcon();
}
Exemplo n.º 27
0
QPixmap XCursorThemeData::icon () const {
  if (mIcon.isNull()) mIcon = createIcon();
  return mIcon;
}
Exemplo n.º 28
0
studrating::studrating(QWidget *parent, Qt::WindowFlags flags): QMainWindow(parent, flags), ui(new Ui::MainWindow)
{
	ui->setupUi(this);
	
	manager = new StudRatingManager(this);
	dbFilePath = QString();
	disciplinModel = new QStringListModel(this);
	ui->disciplinsListView->setModel(disciplinModel);
	
	
	createDbDialog = new CreateDbDialog(this);
	studentListDialog = new StudentListDialog(this);
	addDateDialog = new AddDateDialog(this);
	
	htmlGenerator = new HtmlGenerator(this);
	
	settings = new QSettings( QSettings::NativeFormat, QSettings::UserScope, APP_NAME, QString(), this);
	readSettings();
	
	if(!dbFilePath.isEmpty())
	{
		if(manager->loadDB(dbFilePath))
		{
			ui->dbFilePathEdit->setText(dbFilePath);
			ui->aboutDbTextEdit->setPlainText(manager->getAboutDB());
			ui->label_14->setVisible(false);
			setWindowTitle(APP_NAME + "-" + VERSION + " - " + dbFilePath);
		}
		else
		{
			QMessageBox::warning(this, trUtf8("Загрузка базы данных"), trUtf8("Не возможно загрузить файл ") + dbFilePath);
			dbFilePath.clear();
		}
	}
	
	createIcon();
	if(!dbFilePath.isEmpty())
	{
		if(manager->groupsIsEmpty() || manager->disciplinsIsEmpty())
		{
			for(int i = 3; i <= 5; i++)
			{
				Qt::ItemFlags flags =  ui->contentsWidget->item(i)->flags();
				ui->contentsWidget->item(i)->setFlags(flags ^ Qt::ItemIsEnabled);
			}
		}
	}
	else
	{
		for(int i = 1; i <= 5; i++)
		{
			Qt::ItemFlags flags =  ui->contentsWidget->item(i)->flags();
			ui->contentsWidget->item(i)->setFlags(flags ^ Qt::ItemIsEnabled);
		}
	}
	
	ui->pagesWidget->setCurrentIndex(currentPageIndex);
	ui->contentsWidget->setCurrentRow(currentPageIndex);
	
	connect(ui->actionAboutQt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt()));
}
Exemplo n.º 29
0
ColourChooser::ColourChooser(QString title, QWidget *parent) :
    QWidget(parent)
{
    isConstant = false;

    mainMinBtn = new QPushButton(tr("From"));
    mainMin = new QColor(0,64,0);
    mainMinBtn->setIcon(createIcon(mainMin));
    mainMinBtn->setObjectName(QString("mainMinBtn"));

    mainMaxBtn = new QPushButton(tr("To"));
    mainMax = new QColor(0,128,0);
    mainMaxBtn->setIcon(createIcon(mainMax));
    mainMaxBtn->setObjectName(QString("mainMaxBtn"));

    altMinBtn = new QPushButton(tr("From"));
    altMin = new QColor(32,64,32);
    altMinBtn->setIcon(createIcon(altMin));
    altMinBtn->setObjectName(QString("altMinBtn"));

    altMaxBtn = new QPushButton(tr("To"));
    altMax = new QColor(32,128,32);
    altMaxBtn->setIcon(createIcon(altMax));
    altMaxBtn->setObjectName(QString("altMaxBtn"));

    intensity = new VariationChooser(QString("Colouring Spread Distance"), 2,1,0);
    intensity->setMinimumHeight(50);

    connect(mainMinBtn,SIGNAL(clicked()),this,SLOT(btnClicked()));
    connect(mainMaxBtn,SIGNAL(clicked()),this,SLOT(btnClicked()));
    connect(altMinBtn,SIGNAL(clicked()),this,SLOT(btnClicked()));
    connect(altMaxBtn,SIGNAL(clicked()),this,SLOT(btnClicked()));

    sideImage = new QLabel();
    sideImage->setPixmap(createVPixmap());
    mainImage = new QLabel();
    mainImage->setPixmap(createHPixmap(mainMin,mainMax));
    altImage = new QLabel();
    altImage->setPixmap(createHPixmap(altMin,altMax));

    QGroupBox *box = new QGroupBox(title);
    QVBoxLayout *leftLayout = new QVBoxLayout();

    //Main Colour Box
    QGroupBox *topBox = new QGroupBox(tr("Main Colour:"));
    QVBoxLayout *topBoxLayout = new QVBoxLayout();
    topBoxLayout->addWidget(new QLabel(tr("Variation")),0,Qt::AlignCenter);

    QHBoxLayout *topBoxHLayout = new QHBoxLayout();
    topBoxHLayout->addWidget(mainMinBtn);
    topBoxHLayout->addStretch();
    topBoxHLayout->addWidget(mainMaxBtn);
    topBoxLayout->addLayout(topBoxHLayout);

    topBoxLayout->addWidget(new QLabel(tr("Range")),0,Qt::AlignCenter);
    topBoxLayout->addWidget(mainImage,0,Qt::AlignCenter);

    topBox->setLayout(topBoxLayout);

    //Alt Colour Box
    bottomBox = new QGroupBox(tr("Alternate Colour:"));
    QVBoxLayout *bottomBoxLayout = new QVBoxLayout();
    bottomBoxLayout->addWidget(new QLabel(tr("Variation")),0,Qt::AlignCenter);

    QHBoxLayout *bottomBoxHLayout = new QHBoxLayout();
    bottomBoxHLayout->addWidget(altMinBtn);
    bottomBoxHLayout->addStretch();
    bottomBoxHLayout->addWidget(altMaxBtn);
    bottomBoxLayout->addLayout(bottomBoxHLayout);

    bottomBoxLayout->addWidget(new QLabel(tr("Range")),0,Qt::AlignCenter);
    bottomBoxLayout->addWidget(altImage,0,Qt::AlignCenter);
    bottomBoxLayout->addWidget(intensity,0,Qt::AlignCenter);
    bottomBoxLayout->addStretch();

    bottomBox->setLayout(bottomBoxLayout);

    //Now add to left layout
    leftLayout->addWidget(topBox);
    leftLayout->addWidget(bottomBox);


    QHBoxLayout *boxLayout = new QHBoxLayout();
    QHBoxLayout *mainLayout = new QHBoxLayout();
    boxLayout->addLayout(leftLayout);
    boxLayout->addWidget(sideImage,0,Qt::AlignBottom);
    box->setLayout(boxLayout);
    mainLayout->addWidget(box);

    this->setLayout(mainLayout);
}
Exemplo n.º 30
0
void Status::initIcon(const QString &protocol)
{
	d->icon = createIcon(d->type, protocol);
}