Пример #1
0
void QmlSelectGroup::on_listView_doubleClicked()
{
    if(downloader->getFileName()=="get_schem.json")
    {
    QString faculties = ui->listWidget->currentItem()->text();
    QString url("http://cist.nure.ua/ias/app/tt/get_groups?faculty_id=");
    text.clear();


    QJsonDocument d = QJsonDocument::fromJson(jSonText.toUtf8());
    QJsonObject facultiesSet = d.object();

    QJsonArray array = facultiesSet["faculties"].toArray();

    for(QJsonArray::value_type it:array)
    {
        QString _fac = it.toObject()["faculty_name"].toString();
        if(_fac==faculties)
        {
            int fac_id=it.toObject()["faculty_id"].toInt();
            url.append(QString::number(fac_id));
        }
    }
     loadFile("get_groups.json",url);
    }
    else if(downloader->getFileName()=="get_groups.json")
    {
        emit groupSelected(ui->listWidget->currentItem()->text(),getID("groups","group"));
    }
}
Пример #2
0
void UnityTestRunner(unityfunction * setup,
        unityTestfunction * body,
        unityTestfunction * teardown,
        const char * printableName,
        const char * group,
        const char * name,
        const char * file, int line, struct _Unity * const unity_p)
{
    if (testSelected(name, unity_p) && groupSelected(group, unity_p))
    {
        unity_p->CurrentTestFailed = 0;
        unity_p->TestFile = file;
        unity_p->CurrentTestName = printableName;
        unity_p->CurrentTestLineNumber = line;
        if (!unity_p->Verbose)
            UNITY_OUTPUT_CHAR('.');
        else
            UnityPrint(printableName, unity_p);

        unity_p->NumberOfTests++;
#if defined(UNITY_DYNAMIC_MEM_DEBUG)
        UnityMalloc_StartTest();
#endif
#if defined(UNITY_CPP_UNIT_COMPAT)
        UnityPointer_Init(unity_p);
#endif 
        runTestCase(unity_p);
        /* remember setup has failed - skip teardown if so*/
        bool hasSetupFailed = false;
        if (TEST_PROTECT())
        {
            setup(unity_p);
            /*DX_PATCH for jumpless version. If setup failed don't perform the test*/
            if (!unity_p->CurrentTestFailed) 
            {
                body(unity_p->testLocalStorage, unity_p);
            }
            else
            {
                hasSetupFailed  = true;
            }
        }
        if (TEST_PROTECT() && !hasSetupFailed )
        {
            teardown(unity_p->testLocalStorage, unity_p);
        }
        if (TEST_PROTECT())
        {
#if defined(UNITY_CPP_UNIT_COMPAT)
            UnityPointer_UndoAllSets(unity_p);
#endif
#if defined(UNITY_DYNAMIC_MEM_DEBUG)
            if (!unity_p->CurrentTestFailed)
                UnityMalloc_EndTest(unity_p);
#endif
        }
        UnityConcludeFixtureTest(unity_p);
    }
}
Пример #3
0
/****************************************************************************
**
** Copyright (C) 2015
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QHeaderView>
#include <QEvent>
#include <QImage>
#include <QPixmap>
#include <QTreeWidgetItem>
#include "tool_sceneviewwidget.h"

namespace Magus
{
//****************************************************************************/
QtSceneViewWidget::QtSceneViewWidget(const QString& iconDir, QWidget* parent) : QWidget(parent)
{
    setWindowTitle(QString("Scene view"));
    mIconDir = iconDir;
    QVBoxLayout* mainLayout = new QVBoxLayout;
    mSearchLayout = new QHBoxLayout;
    mTreeLayout = new QVBoxLayout;

    // Create edit
    mSearchLine = new QLineEdit();
    connect(mSearchLine, SIGNAL(textChanged(QString)), this, SLOT(searchLineTextChanged(QString)));

    // Create findbutton
    QImage imageSearch(mIconDir + TOOL_SCENEVIEW_ICON_SEARCH);
    QPixmap pixMapSearch = QPixmap::fromImage(imageSearch).scaled(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH);
    mSearchLabel = new QLabel();
    mSearchLabel->setPixmap(pixMapSearch);
    mSearchLabel->setContentsMargins(-8, -8, -8, -8);

    // Create clearbutton
    QImage imageClear(mIconDir + TOOL_SCENEVIEW_ICON_CLOSE);
    QPixmap pixMapClear = QPixmap::fromImage(imageClear).scaled(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH);
    mSearchClearButton = new QPushButton();
    mSearchClearButton->setStyleSheet(QString("QPushButton {border: none; background: transparent;} QPushButton:hover {background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #565656, stop:1 #464646);}"));
    mSearchClearButton->setIcon(QIcon(pixMapClear));
    mSearchClearButton->setIconSize(QSize(TOOL_SCENEVIEW_ICON_WIDTH, TOOL_SCENEVIEW_ICON_WIDTH));
    mSearchClearButton->setContentsMargins(-8, -8, -8, -8);
    connect(mSearchClearButton, SIGNAL(clicked()), this, SLOT(clearSearchLine()));


    // Misc
    mVisibilityIconVisibleForGroups = true;
    mVisibilityIconVisibleForAssets = true;
    mDeletionIconVisibleForGroups = true;
    mDeletionIconVisibleForAssets = true;

    // Layout
    mSearchLayout->addWidget(mSearchLabel, 1);
    mSearchLayout->addWidget(mSearchLine, 2000);
    mSearchLayout->addWidget(mSearchClearButton, 1);
    setVisibilitySearchWidgets(false);
    mainLayout->addLayout(mSearchLayout, 1);
    mainLayout->addLayout(mTreeLayout, 2000);
    setLayout(mainLayout);
}

//****************************************************************************/
QtSceneViewWidget::~QtSceneViewWidget(void)
{
    // Delete all QtAssetGroups in mAssetGroupMap
    foreach (QtAssetGroup* group, mAssetGroupMap)
        delete group;

    mAssetGroupMap.clear();

}

//****************************************************************************/
bool QtSceneViewWidget::eventFilter(QObject* object, QEvent* event)
{
    QMouseEvent* mouseEvent = (QMouseEvent*) event;
    switch ((int) event->type())
    {
    case QEvent::MouseButtonPress:
        mouseClickHandler(mouseEvent);
        break;
    }
    return QObject::eventFilter(object, event);
}

//****************************************************************************/
void QtSceneViewWidget::mouseClickHandler(QMouseEvent* event)
{
    switch ((int) event->button())
    {
    case Qt::LeftButton:
    {
        // Get the selected item of the visible sceneview
        QTreeWidget* sceneView = getCurrentVisibleScene();
        if (sceneView)
        {
            QTreeWidgetItem* item = sceneView->itemAt(event->pos());
            int col = sceneView->columnAt(event->pos().x());
            if (itemIsGroup(item))
            {
                if (col == TOOL_SCENEVIEW_COLUMN_GROUP_CLOSE)
                {
                    handleDeletionOfGroup(sceneView, item);
                    return;
                }
                else if (col == TOOL_SCENEVIEW_COLUMN_GROUP_VISIBILITY)
                {
                    // Toggle visibility
                    toggleVisibilityOfGroup(item);
                }

                int groupId = getGroupIdOfGroupItem(item);
                emit groupSelected(sceneView, groupId);
            }
            else if (itemIsAsset(item))
            {
                if (col == TOOL_SCENEVIEW_COLUMN_ASSET_CLOSE)
                {
                    handleDeletionOfAsset(sceneView, item);
                    return;
                }
                else if (col == TOOL_SCENEVIEW_COLUMN_ASSET_VISIBILITY)
                {
                    // Toggle visibility
                    toggleVisibilityOfAsset(item);
                }

                int groupId = getGroupIdOfAssetItem(item);
                int assetId = getAssetIdOfAssetItem(item);
                emit assetSelected(sceneView, groupId, assetId);
            }
        }
    }
    break;

    case Qt::RightButton:
    {
        // TODO
    }
    break;
    }
}
void QgsStyleV2GroupSelectionDialog::groupTreeSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
{
  QModelIndex index;
  QModelIndexList selectedItems = selected.indexes();
  QModelIndexList deselectedItems = deselected.indexes();

  Q_FOREACH ( index, deselectedItems )
  {
    if ( index.data( Qt::UserRole +  2 ).toString() == "groupsheader" )
    {
      // Ignore: it's the group header
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "all" )
    {
      emit allDeselected( );
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "smartgroupsheader" )
    {
      // Ignore: it's the smartgroups header
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "smartgroup" )
    {
      emit smartgroupDeselected( index.data( ).toString() );
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "group" )
    { // It's a group
      emit groupDeselected( index.data( ).toString() );
    }
  }
  Q_FOREACH ( index, selectedItems )
  {
    if ( index.data( Qt::UserRole +  2 ).toString( ) == "groupsheader" )
    {
      // Ignore: it's the group header
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "all" )
    {
      emit allSelected( );
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "smartgroupsheader" )
    {
      // Ignore: it's the smartgroups header
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "smartgroup" )
    {
      emit smartgroupSelected( index.data( ).toString() );
    }
    else if ( index.data( Qt::UserRole +  2 ).toString() == "group" )
    {  // It's a group
      emit groupSelected( index.data( ).toString() );
    }
  }
}
Пример #5
0
void UnityIgnoreTest(const char * printableName, const char * group, const char * name)
{
    if (testSelected(name) && groupSelected(group)) 
    {
        Unity.NumberOfTests++;
        Unity.CurrentTestIgnored = 1;
        if (!UnityFixture.Verbose)
            UNITY_OUTPUT_CHAR('!');
        else
            UnityPrint(printableName);
        UnityConcludeFixtureTest();
    }
}
Пример #6
0
void UnityIgnoreTest(const char* printableName, const char* group, const char* name)
{
    if (testSelected(name) && groupSelected(group))
    {
        Unity.NumberOfTests++;
        Unity.TestIgnores++;
        if (!UnityFixture.Verbose)
            UNITY_OUTPUT_CHAR('!');
        else
        {
            UnityPrint(printableName);
            UNITY_PRINT_EOL();
        }
    }
}
Пример #7
0
void UnityTestRunner(unityfunction* setup,
                     unityfunction* testBody,
                     unityfunction* teardown,
                     const char* printableName,
                     const char* group,
                     const char* name,
                     const char* file,
                     unsigned int line)
{
    if (testSelected(name) && groupSelected(group))
    {
        Unity.TestFile = file;
        Unity.CurrentTestName = printableName;
        Unity.CurrentTestLineNumber = line;
        if (!UnityFixture.Verbose)
            UNITY_OUTPUT_CHAR('.');
        else
        {
            UnityPrint(printableName);
        #ifndef UNITY_REPEAT_TEST_NAME
            Unity.CurrentTestName = NULL;
        #endif
        }

        Unity.NumberOfTests++;
        UnityMalloc_StartTest();
        UnityPointer_Init();

        UNITY_EXEC_TIME_START();

        if (TEST_PROTECT())
        {
            setup();
            testBody();
        }
        if (TEST_PROTECT())
        {
            teardown();
        }
        if (TEST_PROTECT())
        {
            UnityPointer_UndoAllSets();
            if (!Unity.CurrentTestFailed)
                UnityMalloc_EndTest();
        }
        UnityConcludeFixtureTest();
    }
}
Пример #8
0
void UnityTestRunner(unityfunction* setup,
        unityfunction* testBody,
        unityfunction* teardown,
        const char * printableName,
        const char * group,
        const char * name,
        const char * file, int line)
{
    if (testSelected(name) && groupSelected(group))
    {
        Unity.CurrentTestFailed = 0;
        Unity.TestFile = file;
        Unity.CurrentTestName = printableName;
        Unity.CurrentTestLineNumber = line;
        if (!UnityFixture.Verbose)
            UNITY_OUTPUT_CHAR('.');
        else
            UnityPrint(printableName);

        Unity.NumberOfTests++;
        UnityMalloc_StartTest();
        UnityPointer_Init();

        runTestCase();
        if (TEST_PROTECT())
        {
            setup();
            testBody();
        }
        if (TEST_PROTECT())
        {
            teardown();
        }
        if (TEST_PROTECT())
        {
            UnityPointer_UndoAllSets();
            if (!Unity.CurrentTestFailed)
                UnityMalloc_EndTest();
            UnityConcludeFixtureTest();
        }
        else
        {
            //aborting - jwg - di i need these for the other TEST_PROTECTS?
        }
    }
}
QAction* QgsLayerTreeViewDefaultActions::actionGroupSelected( QObject* parent )
{
  QAction* a = new QAction( tr( "&Group Selected" ), parent );
  connect( a, SIGNAL( triggered() ), this, SLOT( groupSelected() ) );
  return a;
}
Пример #10
0
void ThreadListWidget::groupDeleted(QObject*g) {
    ForumGroup *grp = dynamic_cast<ForumGroup*>(g);
    if(grp == currentGroup)
        groupSelected(0);
}