Example #1
0
/*!
  \internal
  \brief Establishes all connections.
 */
void Ui::MainWindow::establishConnections()
{
    Ui::CommonBar *commonBar = qobject_cast<Ui::CommonBar *>(actionManager->toolBar(Core::ID::COMMON_BAR));
    connect(commonBar, SIGNAL(antialiasingChanged(bool)), this, SIGNAL(antialiasingChanged(bool)));

    connect(newAction, SIGNAL(triggered()), this, SLOT(showProjectCreateDialog()));
    connect(openAction, SIGNAL(triggered()), this, SLOT(showOpenDialog()));
    //connect(actionManager->action(Core::ID::Action::NEW), SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));

    // tool box actions
    connect(lineToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(lineToolAction, Core::ID::ACTION_DRAW_LINE);
    connect(textToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(textToolAction, Core::ID::ACTION_DRAW_TEXT);
    connect(curveToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(curveToolAction, Core::ID::ACTION_DRAW_CURVE);
    connect(ellipseToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(ellipseToolAction, Core::ID::ACTION_DRAW_ELLIPSE);
    connect(polygonToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(polygonToolAction, Core::ID::ACTION_DRAW_POLYGON);
    connect(rectangleToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(rectangleToolAction, Core::ID::ACTION_DRAW_RECT);
    connect(roundRectangleToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(roundRectangleToolAction, Core::ID::ACTION_DRAW_ROUND_RECT);
    connect(mapper, SIGNAL(mapped(QString)), appCtx, SLOT(setCurrentAction(QString)));
    connect(mapper, SIGNAL(mapped(QString)), commonBar, SLOT(resetCommonBar(QString)));

    connect(ci, SIGNAL(foregroundColorChanged(QColor)), appCtx, SLOT(setPenColor(const QColor &)));
}
eduMAppMenu::eduMAppMenu(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::eduMAppMenu)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(showTime()));
    timer->start(1000);

    showTime();

    //currentDirectory = QDir::current();
    currentDirectory = QDir(qApp->applicationDirPath());
    categoriesNames = currentDirectory.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
    categories_layout = new QHBoxLayout;
    apps_layout= new QGridLayout;
    categoryButtonToButtonName_signalMapper = new QSignalMapper(this);
    appsButtonToButtonName_signalMapper = new QSignalMapper(this);
    categoriesWidget = new QWidget;
    appsWidget = new QWidget;
    appProcess = new QProcess(this);

    QString categoryName;
    QPushButton* button;
    if(!categoriesNames.isEmpty())
        for(int i=0; i<categoriesNames.size(); i++)
        {
            categoryName = categoriesNames.value(i);

            if(categoryName.startsWith("."))
                continue;

            categoriesButtons[categoryName]= new QPushButton(categoryName);

            button = categoriesButtons.value(categoriesNames.value(i));
            button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
            categories_layout->addWidget(button);

            categoryButtonToButtonName_signalMapper->setMapping(button, QString(categoryName));
            QObject::connect(button, SIGNAL(clicked()), categoryButtonToButtonName_signalMapper, SLOT(map()));
        }

    //options_pushButton = new QPushButton("Options");
    //options_pushButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    //categories_layout->addWidget(options_pushButton);

    //QObject::connect(options_pushButton, SIGNAL(clicked()), this, SLOT(showOptions()));

    QObject::connect(categoryButtonToButtonName_signalMapper, SIGNAL(mapped(QString)), this, SLOT(categorySelected(QString)));
    QObject::connect(appsButtonToButtonName_signalMapper, SIGNAL(mapped(QString)), this, SLOT(appSelected(QString)));

    categoriesWidget->setLayout(categories_layout);
    ui->categories_scrollArea->setWidget(categoriesWidget);

}
XXPortManager::XXPortManager( QWidget *parent )
  : QObject( parent ), mSelectionModel( 0 ),
    mParentWidget( parent ), mImportProgressDialog( 0 )
{
  mImportMapper = new QSignalMapper( this );
  mExportMapper = new QSignalMapper( this );

  connect( mImportMapper, SIGNAL(mapped(QString)),
           this, SLOT(slotImport(QString)) );
  connect( mExportMapper, SIGNAL(mapped(QString)),
           this, SLOT(slotExport(QString)) );
}
void QgisAppInterface::preloadForm( QString uifile )
{
  QSignalMapper* signalMapper = new QSignalMapper( this );
  mTimer = new QTimer( this );

  connect( mTimer , SIGNAL( timeout() ), signalMapper, SLOT( map() ) );
  connect( signalMapper, SIGNAL( mapped( QString ) ), mTimer, SLOT( stop() ) );
  connect( signalMapper, SIGNAL( mapped( QString ) ), this, SLOT( cacheloadForm( QString ) ) );

  signalMapper->setMapping( mTimer, uifile );

  mTimer->start( 0 );
}
Example #5
0
static int
should_list(xcb_window_t w, int mask)
{
	if ((mask & LIST_ALL)
		|| (!mapped(conn, w) && mask & LIST_HIDDEN)
		|| (ignore(conn, w) && mask & LIST_IGNORE)
		|| (mapped(conn, w)
			&& !ignore(conn, w)
			&& mask == 0))
		return 1;

	return 0;
}
GamepadForm::GamepadForm()
	: QWidget()
	, ui(new Ui::GamepadForm())
{
	// Here all GUI widgets are created and initialized.
	ui->setupUi(this);

	// Disabling buttons since we are not connected to robot yet and can not send any commands.
	setButtonsEnabled(false);

	// Some script constants, matching protocol (extra buttons commands)
	const QString smileScript = "21:direct:brick.smile();";
	const QString sayHiScript = "24:direct:brick.say(\"Hi!\");";

	// Setting actions to extra buttons pressed.
	mButtonsMapper.setMapping(ui->buttonSmile, smileScript);
	mButtonsMapper.setMapping(ui->buttonSayHi, sayHiScript);

	// Connecting mapper to a slot which will process all extra button presses.
	connect(&mButtonsMapper, SIGNAL(mapped(QString)), this, SLOT(onButtonPressed(QString)));

	// Connecting buttons with mapper.
	connect(ui->buttonSmile, SIGNAL(clicked()), &mButtonsMapper, SLOT(map()));
	connect(ui->buttonSayHi, SIGNAL(clicked()), &mButtonsMapper, SLOT(map()));

	// Some script constants, matching protocol (up, down, left, right commands)
	const QString forwardScript = "67:direct:brick.motor(M3).setPower(100);brick.motor(M4).setPower(100);";
	const QString backScript = "73:direct:brick.motor(M3).setPower(-(100));brick.motor(M4).setPower(-(100));";
	const QString leftScript = "70:direct:brick.motor(M3).setPower(-(100));brick.motor(M4).setPower(100);";
	const QString rightScript = "70:direct:brick.motor(M3).setPower(100);brick.motor(M4).setPower(-(100));";
	const QString stopScript = "20:direct:brick.stop();";

	// Setting up mapper for pad buttons, "pressed" signal.
	// Here we provide a command to be sent to a robot instead of id.
	mPadsMapper.setMapping(ui->buttonPadUp, forwardScript);
	mPadsMapper.setMapping(ui->buttonPadDown, backScript);
	mPadsMapper.setMapping(ui->buttonPadLeft, leftScript);
	mPadsMapper.setMapping(ui->buttonPadRight, rightScript);
	mPadsMapper.setMapping(ui->buttonStop, stopScript);

	connect(&mPadsMapper, SIGNAL(mapped(QString)), this, SLOT(onButtonPressed(QString)));

	connect(ui->buttonPadUp, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadDown, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadLeft, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonPadRight, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
	connect(ui->buttonStop, SIGNAL(pressed()), &mPadsMapper, SLOT(map()));
}
void WallpaperInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut)
{
    QAction *action = m_actions->action(name);

    if (action) {
        action->setText(text);
    } else {
        Q_ASSERT(!m_actions->action(name));
        action = new QAction(text, this);
        m_actions->addAction(name, action);

        if (!m_actionSignals) {
            m_actionSignals = new QSignalMapper(this);
            connect(m_actionSignals, SIGNAL(mapped(QString)),
                    this, SLOT(executeAction(QString)));
        }

        connect(action, SIGNAL(triggered()), m_actionSignals, SLOT(map()));
        m_actionSignals->setMapping(action, name);
    }

    if (!icon.isEmpty()) {
        action->setIcon(QIcon::fromTheme(icon));
    }

    if (!shortcut.isEmpty()) {
        action->setShortcut(shortcut);
    }

    action->setObjectName(name);
    setProperty("contextualActions", QVariant::fromValue(contextualActions()));
}
Example #8
0
        void contact_list_dialog::update_contacts()
        {
            INVARIANT(_list);
            INVARIANT(_service);

            _list->clear();
            _ui.clear();

            for(auto u : _service->user().contacts().list())
            {
                auto rm = make_x_button();
                std::stringstream ss;
                ss << "Remove `" << u->name() << "'";
                rm->setToolTip(ss.str().c_str());

                auto mapper = new QSignalMapper{this};
                mapper->setMapping(rm, QString(u->id().c_str()));
                connect(rm, SIGNAL(clicked()), mapper, SLOT(map()));
                connect(mapper, SIGNAL(mapped(QString)), this, SLOT(remove(QString)));

                auto ui = new user_info{u, _service, rm, false};
                _list->add(ui);
                _ui.push_back(ui);
            }

            _prev_contacts = _service->user().contacts().size();
        }
Example #9
0
void MSOptionMenu::drawFieldValue(void)
{
  if (frozen()==MSFalse&&owner()->mapped()==MSTrue&&mapped()==MSTrue)
   {
     int sht=fieldValue()->shadowThickness();
     XFillRectangle(display(),window(),backgroundShadowGC(),
		    fieldValue()->x()+sht,fieldValue()->y()+sht,
		    fieldValue()->width()-(sht<<1),fieldValue()->height()-(sht<<1));

     MSString buffer;
     const char *pString=formatOutput(buffer);
     if (pString!=0&&buffer.length()>0)
      {   
	int len=buffer.length();
	if (len>0)
	 {
	   int xx=fieldValue()->x()+fieldValue()->offset();
	   int offset=fieldValue()->highlightThickness()+fieldValue()->shadowThickness();
	   int margin=(fieldValue()->height()-(2*offset+fieldValue()->textHeight()))>>1;
	   int yy=offset+((margin>0)?margin:0)+fieldValue()->textAscent();
	   
	   int vw=fieldValue()->width()-2*fieldValue()->offset()-
	          2*MSOptionMenuDefaultMargin-MSOptionMenuSymbolWidth;
           int tw=fieldValue()->textWidth(pString,len);
           int delta=(vw>tw)?((vw-tw)>>1):0;
	   
	   fieldValue()->foreground(itemForeground(selectedItem()));
	   XDrawString(display(),window(),fieldValue()->textGC(),fieldValue()->textFontStruct(),
		       xx+delta,fieldValue()->y()+yy,pString,len);
	 }
Example #10
0
	void Canvas::touchEvent(const DataTouch& touchPoint)
	{
		assert(touchPoint.getPolygon()->getId() == polygonId);
		ofVec3f pto = touchPoint.getTouchPoint();
		ofVec3f mapped(texMapper.map(pto));
		int id = touchPoint.getId();
		map<int, Trace*>::iterator t = traces.find(id);
		switch (touchPoint.getType())
		{
		case kTouchTypeStarted:
			touchPoints[id] = touchPoint;
			traces[id] = new Trace(mapped, foreColor);
			break;
		case kTouchTypeHolding:
			if(pto.distanceSquared(touchPoints[id].getTouchPoint()) > 0.0001)
			{
				touchPoints[id] = touchPoint;
				if (t != traces.end())
				{
					t->second->update(mapped);
					redraw();
				}
			}
			break;
		case kTouchTypeReleased:
			touchPoints.erase(id);
			break;
		}
		
	}
Example #11
0
SessionMgr::SessionMgr(QObject *parent) : QObject(parent)
{
    m_sig_map = new QSignalMapper(this);
    connect(m_sig_map, SIGNAL(mapped(QString)), SLOT(loadSession(QString)));

    updateSessions();
}
Example #12
0
/* Translate the URL into a 'filename' */
CStr qEnvApache::MapFullPath(const char *path)
{
	char *p;
	if (path && (*path != '/') && (p = strrchr(myReq->filename,DIRSEP))) {
		// relative path map should be easy
		int len = p - myReq->filename;
		CStr mapped(myReq->filename,len+1);
		mapped << path;
		return mapped;
	} else  {
		// root path map is complex, easier way in API?
	int was = IsAuth;

	IsAuth = 1;
 
 
#ifdef APACHE2
	request_rec *r = ap_sub_req_lookup_uri(path, myReq, NULL);
#else
	request_rec *r = ap_sub_req_lookup_uri(path, myReq);
#endif

	IsAuth = was;
	CStr mapped = r->filename;
	
	ap_destroy_sub_req(r);

	return mapped;
	}
}
Example #13
0
Server::Server(QWidget *parent) :
	QDialog(parent),
	mTcpServer(0),
	mNetworkSession(0) {
	QNetworkConfigurationManager manager;
	if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
		// Get saved network configuration
		QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
		settings.beginGroup(QLatin1String("QtNetwork"));
		const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
		settings.endGroup();

		// If the saved network configuration is not currently discovered use the system default
		QNetworkConfiguration config = manager.configurationFromIdentifier(id);
		if ((config.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) {
			config = manager.defaultConfiguration();
		}

		mNetworkSession = new QNetworkSession(config, this);
		connect(mNetworkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));

		mNetworkSession->open();
	} else {
		sessionOpened();
	}

	mIPAddressMapper = new QSignalMapper;
	connect(mTcpServer, SIGNAL(newConnection()), this, SLOT(acceptClientConnection()));
	connect(mIPAddressMapper, SIGNAL(mapped(QString)), this, SIGNAL(clientDisconnected(QString)));
}
DataSourceView::DataSourceView(const QString &rootPath, QWidget *parent) :
	QTreeView(parent),
	m_path(rootPath)
{
	// boss requirement - icons shoudl have be at least 32px sized
	setStyleSheet("icon-size: 32px;");

	m_proxy = new DataSourceProxyModel(this);

	m_model = new DataSourceModel(this);
	m_proxy->setSourceModel(m_model);

	setModel(m_proxy);
	refreshModel();

	header()->close();

	setContextMenuPolicy(Qt::CustomContextMenu);

	m_signalMapper = new QSignalMapper(this);

	connect(m_signalMapper, SIGNAL(mapped(QString)),
	        this, SLOT(spawnZimaUtilityOnDir(QString)));
	connect(this, SIGNAL(customContextMenuRequested(QPoint)),
	        this, SLOT(showContextMenu(QPoint)));
	connect(this, SIGNAL(clicked(QModelIndex)),
	        this, SLOT(modelClicked(QModelIndex)));
	connect(MetadataCache::get(), SIGNAL(cleared()),
	        this, SLOT(refreshModel()));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    m_mapper.setMapping(ui->pushButton_00, "0,0");
    m_mapper.setMapping(ui->pushButton_01, "0,1");
    m_mapper.setMapping(ui->pushButton_02, "0,2");
    m_mapper.setMapping(ui->pushButton_10, "1,0");
    m_mapper.setMapping(ui->pushButton_11, "1,1");
    m_mapper.setMapping(ui->pushButton_12, "1,2");
    m_mapper.setMapping(ui->pushButton_20, "2,0");
    m_mapper.setMapping(ui->pushButton_21, "2,1");
    m_mapper.setMapping(ui->pushButton_22, "2,2");

    QObject::connect(ui->pushButton_00, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_01, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_02, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_10, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_11, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_12, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_20, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_21, SIGNAL(clicked()), &m_mapper, SLOT(map()));
    QObject::connect(ui->pushButton_22, SIGNAL(clicked()), &m_mapper, SLOT(map()));

    QObject::connect(&m_mapper,SIGNAL(mapped(QString)),this,SLOT(clicked(QString)));
}
Example #16
0
void ThemeWidget::initData() {
//    list_widget = new NormalWidget(150, 150, 20, this);
    list_widget = new NormalWidget(119, 139, 20, this);
    list_widget->setGeometry(QRect(30, 55, 860, 330));
    list_widget->calculate_data();

    QString current_theme = sessionproxy->get_theme_qt();
    /*QStringList */syslist = sessionproxy->get_themes_qt();
    card_list.clear();
    QSignalMapper *signal_mapper = new QSignalMapper(this);
    for(int i = 0; i<syslist.length(); ++i)
    {
        NormalCard *card = new NormalCard(syslist[i], list_widget->cardPanel);
        card_list.append(card);
        if(current_theme == syslist[i]) {
            card->showUsingLogo(true);
        }
        list_widget->add_card(card);
        connect(card, SIGNAL(sendSelectThemeName(QString)), signal_mapper, SLOT(map()));
        signal_mapper->setMapping(card, QString::number(i, 10));
        connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(switchUsingLogo(QString)));
        connect(card, SIGNAL(sendSelectThemeName(QString)), this, SLOT(changeTheme(QString)));
    }
    dataOK = true;
    this->initConnect();
}
Example #17
0
void MSVGauge::drawGauge(void)
{
  if (mapped()==MSTrue)
   {
     int x=sliderAreaRect().x()+SliderAreaShadowThickness;
     int y=y_end();
     int curValue=valueToPixel(currentValue())+slider()->height();
     int startValue;
     if(_startValue.isSet()==MSTrue)
      {
        double sv=_startValue;
        if(sv<valueMin()) sv=valueMin();
	else if(sv>valueMax()) sv=valueMax();
	startValue=valueToPixel(sv)+slider()->height();
      }
     else startValue=y-SliderAreaShadowThickness;
     Direction direction=curValue<startValue?Up:Down;
     int thickness=slider()->shadowThickness();
     int h=abs(startValue-curValue); 
     int starty=(direction==Up)?startValue:curValue;
     
     if (h>=thickness&&slider()->width()>thickness*2)
      {
        int height=h-(h>thickness*2?thickness*2:thickness);
        XBFillRectangle(display(),window(),slider()->backgroundShadowGC(),
                        x+thickness,starty-h+thickness,slider()->width()-2*thickness,height);
      }
     if (h>thickness&&thickness>0)
      {
        drawGaugeShadow(x,starty,h,thickness,direction);
      }
     gaugeHeight(h);
     _direction=direction;
   }
}
nsresult
nsAttrAndChildArray::MakeMappedUnique(nsMappedAttributes* aAttributes)
{
  NS_ASSERTION(aAttributes, "missing attributes");

  if (!mImpl && !GrowBy(1)) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  if (!aAttributes->GetStyleSheet()) {
    // This doesn't currently happen, but it could if we do loading right

    nsRefPtr<nsMappedAttributes> mapped(aAttributes);
    mapped.swap(mImpl->mMappedAttrs);

    return NS_OK;
  }

  nsRefPtr<nsMappedAttributes> mapped =
    aAttributes->GetStyleSheet()->UniqueMappedAttributes(aAttributes);
  NS_ENSURE_TRUE(mapped, NS_ERROR_OUT_OF_MEMORY);

  if (mapped != aAttributes) {
    // Reset the stylesheet of aAttributes so that it doesn't spend time
    // trying to remove itself from the hash. There is no risk that aAttributes
    // is in the hash since it will always have come from GetModifiableMapped,
    // which never returns maps that are in the hash (such hashes are by
    // nature not modifiable).
    aAttributes->DropStyleSheetReference();
  }
  mapped.swap(mImpl->mMappedAttrs);

  return NS_OK;
}
Example #19
0
void MainWindow::inittbl() {
    tv = ui->tableView;
    tvm = new QStandardItemModel(4, 4);
    tv->setModel (tvm);
    QPushButton *btn;
    psigmap = new QSignalMapper();
    for(int i = 0; i < 4; i++) {
        tvm->setHeaderData (i, Qt::Horizontal, QString("col") + QString::number (i, 10));
        for(int j = 0; j < 4; j++) {
            QModelIndex pindx = tvm->index (i, j);
            if(j == 3) {
                tvm->setData (pindx, QString::number ((j * i), 10));
                btn = new QPushButton("open");
                tv->setIndexWidget (pindx, btn);
                connect (btn, SIGNAL(clicked()), psigmap, SLOT(map()));
                //psigmap->setMapping (btn, tvm->data(pindx).toInt());
                psigmap->setMapping (btn, tvm->data(pindx).toInt());
                psigmap->setMapping (btn, QString("sig deliver"));
            } else {
                tvm->setData (pindx, QString::number (j, 10));
            }

        }
    }
    connect (psigmap, SIGNAL(mapped(int)), this, SLOT(sigmapslot(int)));
    connect (psigmap ,SIGNAL(mapped(QString)), this, SLOT(sigmapslotString(QString)));
}
Example #20
0
OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget* parent)
    : QDialog(parent),
      ui_(new Ui_OrganiseDialog),
      task_manager_(task_manager),
      total_size_(0),
      resized_by_user_(false) {
  ui_->setupUi(this);
  connect(ui_->button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
          SLOT(Reset()));

  ui_->aftercopying->setItemIcon(1, IconLoader::Load("edit-delete"));

  // Valid tags
  QMap<QString, QString> tags;
  tags[tr("Title")] = "title";
  tags[tr("Album")] = "album";
  tags[tr("Artist")] = "artist";
  tags[tr("Artist's initial")] = "artistinitial";
  tags[tr("Album artist")] = "albumartist";
  tags[tr("Composer")] = "composer";
  tags[tr("Performer")] = "performer";
  tags[tr("Grouping")] = "grouping";
  tags[tr("Lyrics")] = "lyrics";
  tags[tr("Track")] = "track";
  tags[tr("Disc")] = "disc";
  tags[tr("BPM")] = "bpm";
  tags[tr("Year")] = "year";
  tags[tr("Genre")] = "genre";
  tags[tr("Comment")] = "comment";
  tags[tr("Length")] = "length";
  tags[tr("Bitrate", "Refers to bitrate in file organise dialog.")] = "bitrate";
  tags[tr("Samplerate")] = "samplerate";
  tags[tr("File extension")] = "extension";

  // Naming scheme input field
  new OrganiseFormat::SyntaxHighlighter(ui_->naming);

  connect(ui_->destination, SIGNAL(currentIndexChanged(int)),
          SLOT(UpdatePreviews()));
  connect(ui_->naming, SIGNAL(textChanged()), SLOT(UpdatePreviews()));
  connect(ui_->replace_ascii, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));
  connect(ui_->replace_the, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));
  connect(ui_->replace_spaces, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));

  // Get the titles of the tags to put in the insert menu
  QStringList tag_titles = tags.keys();
  qStableSort(tag_titles);

  // Build the insert menu
  QMenu* tag_menu = new QMenu(this);
  QSignalMapper* tag_mapper = new QSignalMapper(this);
  for (const QString& title : tag_titles) {
    QAction* action = tag_menu->addAction(title, tag_mapper, SLOT(map()));
    tag_mapper->setMapping(action, tags[title]);
  }

  connect(tag_mapper, SIGNAL(mapped(QString)), SLOT(InsertTag(QString)));
  ui_->insert->setMenu(tag_menu);
}
Example #21
0
void MSArrowButton::redraw(void)
{
  if (mapped()==MSTrue)
   {
     drawShadow();
     arrow()->draw();
   }
}
Example #22
0
void MSPrimitive::redraw(void)
{
  if (mapped()==MSTrue) 
   { 
     drawBackground(); 
     drawShadow();
   }
}
Example #23
0
void UberCalc::connectButtons()
{
    numberMapper->setMapping(ui->Num_0, QString::number(0));
    numberMapper->setMapping(ui->Num_1, QString::number(1));
    numberMapper->setMapping(ui->Num_2, QString::number(2));
    numberMapper->setMapping(ui->Num_3, QString::number(3));
    numberMapper->setMapping(ui->Num_4, QString::number(4));
    numberMapper->setMapping(ui->Num_5, QString::number(5));
    numberMapper->setMapping(ui->Num_6, QString::number(6));
    numberMapper->setMapping(ui->Num_7, QString::number(7));
    numberMapper->setMapping(ui->Num_8, QString::number(8));
    numberMapper->setMapping(ui->Num_9, QString::number(9));
    numberMapper->setMapping(ui->dot, QString("."));

    connect (ui->Num_0, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_1, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_2, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_3, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_4, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_5, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_6, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_7, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_8, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->Num_9, SIGNAL (clicked()), numberMapper, SLOT (map()));
    connect (ui->dot, SIGNAL (clicked()), numberMapper, SLOT(map()));


    operationMapper->setMapping(ui->Composition, QString("+"));
    operationMapper->setMapping(ui->Subtraction, QString("-"));
    operationMapper->setMapping(ui->Multiplication, QString("*"));
    operationMapper->setMapping(ui->Division, QString("/"));

    connect (ui->Composition, SIGNAL (clicked()), operationMapper, SLOT(map()));
    connect (ui->Subtraction, SIGNAL (clicked()), operationMapper, SLOT(map()));
    connect (ui->Multiplication, SIGNAL (clicked()), operationMapper, SLOT(map()));
    connect (ui->Division, SIGNAL (clicked()), operationMapper, SLOT(map()));

    connect (ui->Equal, SIGNAL (clicked()), this, SLOT (equalClicked()));
    connect (ui->clear, SIGNAL (clicked()), this, SLOT (clearClicked()));
    connect (ui->plus_minus, SIGNAL (clicked()), this, SLOT (plus_minusClicked()));
    connect (ui->MemSave, SIGNAL (clicked()), this, SLOT (MemSaveClicked()));
    connect (ui->MemRest, SIGNAL (clicked()), this, SLOT (MemRestClicked()));

    connect(numberMapper, SIGNAL(mapped(QString)), this, SLOT (addToResultLine(QString)));
    connect(operationMapper, SIGNAL(mapped(QString)), this, SLOT(operationClicked(QString)));
}
Example #24
0
void MSSash::redraw(void)
{
  if (mapped()==MSTrue)
   {
     drawBackground();
     drawSeparator();
     drawSash();
   }
}
void QGuiSignalMapper::emitMapped(QWidget *widget)
{
    // Make sure we emit mapped() exactly once for each emission of mappedQWidget()
    if (!emittingMapped) {
        emittingMapped = true;
        emit mapped(widget);
        emittingMapped = false;
    }
}
Example #26
0
auto permuted(RangeifiableValues&& values_obj, RangeifiableIndices&& indices_obj)
{
    as_range<RangeifiableValues> values_range(values_obj);
    return mapped(indices_obj,
    [values_range](const auto& index) -> decltype(auto)
    {
        return at(values_range, index);
    });
}
Example #27
0
PromotionTaskMenu::PromotionState  PromotionTaskMenu::createPromotionActions(QDesignerFormWindowInterface *formWindow)
{
    // clear out old
    if (!m_promotionActions.empty()) {
        qDeleteAll(m_promotionActions);
        m_promotionActions.clear();
    }
    // No promotion of main container
    if (formWindow->mainContainer() == m_widget)
        return NotApplicable;

    // Check for a homogenous selection
    const PromotionSelectionList promotionSelection = promotionSelectionList(formWindow);

    if (promotionSelection.empty())
        return NoHomogenousSelection;

    QDesignerFormEditorInterface *core = formWindow->core();
    // if it is promoted: demote only.
    if (isPromoted(formWindow->core(), m_widget)) {
        const QString label = m_demoteLabel.arg( promotedExtends(core , m_widget));
        QAction *demoteAction = new QAction(label, this);
        connect(demoteAction, SIGNAL(triggered()), this, SLOT(slotDemoteFromCustomWidget()));
        m_promotionActions.push_back(demoteAction);
        return CanDemote;
    }
    // figure out candidates
    const QString baseClassName = WidgetFactory::classNameOf(core,  m_widget);
    const WidgetDataBaseItemList candidates = promotionCandidates(core->widgetDataBase(), baseClassName );
    if (candidates.empty()) {
        // Is this thing promotable at all?
        return QDesignerPromotionDialog::baseClassNames(core->promotion()).contains(baseClassName) ?  CanPromote : NotApplicable;
    }
    // Set up a signal mapper to associate class names
    if (!m_promotionMapper) {
        m_promotionMapper = new QSignalMapper(this);
        connect(m_promotionMapper, SIGNAL(mapped(QString)), this, SLOT(slotPromoteToCustomWidget(QString)));
    }

    QMenu *candidatesMenu = new QMenu();
    // Create a sub menu
    const WidgetDataBaseItemList::const_iterator cend = candidates.constEnd();
    // Set up actions and map class names
    for (WidgetDataBaseItemList::const_iterator it = candidates.constBegin(); it != cend; ++it) {
        const QString customClassName = (*it)->name();
        QAction *action = new QAction((*it)->name(), this);
        connect(action, SIGNAL(triggered()), m_promotionMapper, SLOT(map()));
        m_promotionMapper->setMapping(action, customClassName);
        candidatesMenu->addAction(action);
    }
    // Sub menu action
    QAction *subMenuAction = new QAction(m_promoteLabel, this);
    subMenuAction->setMenu(candidatesMenu);
    m_promotionActions.push_back(subMenuAction);
    return CanPromote;
}
Example #28
0
void WSignalMapper::map(WObject *sender)
{
  {
    std::map<WObject *, int>::iterator i = intMappings_.find(sender);
    if (i != intMappings_.end())
      emit mapped(i->second);
  }
  {
    std::map<WObject *, std::string>::iterator i
      = stringMappings_.find(sender);
    if (i != stringMappings_.end())
      emit mapped(i->second);
  }
  {
    std::map<WObject *, WWidget *>::iterator i = widgetMappings_.find(sender);
    if (i != widgetMappings_.end())
      emit mapped(i->second);
  }  
}
Example #29
0
void SystemCompositor::surfaceCreated(QWaylandSurface *surface)
{
    // Connect surface signals
    connect(surface, SIGNAL(destroyed(QObject *)),
            this, SLOT(surfaceDestroyed(QObject *)));
    connect(surface, SIGNAL(mapped()),
            this, SLOT(surfaceMapped()));
    connect(surface, SIGNAL(unmapped()),
            this, SLOT(surfaceUnmapped()));
}
Example #30
0
void QWindowCompositor::surfaceCreated(QWaylandSurface *surface)
{
    connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *)));
    connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
    connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped()));
    connect(surface, SIGNAL(damaged(const QRect &)), this, SLOT(surfaceDamaged(const QRect &)));
    connect(surface, SIGNAL(extendedSurfaceReady()), this, SLOT(sendExpose()));
    connect(surface, SIGNAL(posChanged()), this, SLOT(surfacePosChanged()));
    m_renderScheduler.start(0);
}