SequenceBinaryExpression(LHS const& lhs,
                          RHS const& rhs,
                          OperationType const& operation=OperationType()) :
     lhs_(lhs),
     rhs_(rhs),
     operation_(operation)
 {
 }
Beispiel #2
0
void PanelMenu::showMenu(int x, int y)
{
    if (m_menuManager && m_menuManager->isValid()){
        QDBusPendingReply<QDBusObjectPath> pr = m_menuManager->RegisterMenu();
        if (pr.count() == 1)
        {
            QDBusObjectPath op = pr.argumentAt(0).value<QDBusObjectPath>();
            m_menuInterfacePath = op.path();
            DBusMenu *m_menu = new DBusMenu(m_menuInterfacePath,this);
            connect(m_menu,&DBusMenu::MenuUnregistered,m_menu,&DBusMenu::deleteLater);
            connect(m_menu,&DBusMenu::ItemInvoked,this,&PanelMenu::onItemInvoked);

            QJsonObject targetObj;
            targetObj.insert("x",QJsonValue(x));
            targetObj.insert("y",QJsonValue(y));
            targetObj.insert("isDockMenu",QJsonValue(false));

            QJsonArray contentArry;
            contentArry.append(createRadioItemObj(tr("Fashion mode"),ToFashionMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::FashionMode));
            contentArry.append(createRadioItemObj(tr("Efficient mode"),ToEfficientMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::EfficientMode));
            contentArry.append(createRadioItemObj(tr("Classic mode"),ToClassicMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::ClassicMode));
            contentArry.append(createItemObj("",OperationType(-1)));
            contentArry.append(createRadioItemObj(tr("Keep showing"),ToKeepShowing,HideModeGroup,m_dockModeData->getHideMode() == Dock::KeepShowing));
            contentArry.append(createRadioItemObj(tr("Keep hidden"),ToKeepHidden,HideModeGroup,m_dockModeData->getHideMode() == Dock::KeepHidden));
            contentArry.append(createRadioItemObj(tr("Smart hide"),ToSmartHide,HideModeGroup,m_dockModeData->getHideMode() == Dock::SmartHide));
            contentArry.append(createItemObj("",OperationType(-1)));
            contentArry.append(createItemObj(tr("Notification area settings"),ToPluginSetting));

            QJsonObject contentObj;
            contentObj.insert("items",contentArry);
            targetObj.insert("menuJsonContent",QString(QJsonDocument(contentObj).toJson()));

            m_menu->ShowMenu(QString(QJsonDocument(targetObj).toJson()));
        }
    }
}
Beispiel #3
0
void PanelMenu::onItemInvoked(const QString &itemId, bool)
{
    emit menuItemInvoked();

    if (itemId.split(":").length() < 1)
        return;

    OperationType tt = OperationType(itemId.split(":").at(0).toInt());
    switch (tt)
    {
    case ToFashionMode:
        changeToFashionMode();
        break;
    case ToEfficientMode:
        changeToEfficientMode();
        break;
    case ToClassicMode:
        changeToClassicMode();
        break;
    case ToKeepShowing:
        changeToKeepShowing();
        break;
    case ToKeepHidden:
        changeToKeepHidden();
        break;
    case ToSmartHide:
        changeToSmartHide();
        break;
    case ToPluginSetting:
        emit settingPlugin();
        break;
    default:
        break;
    }

}
Beispiel #4
0
string Eval  (const string& o_operation)
{

    string operation = OperatorsToFunctionCalls (o_operation); //really redundant
    operation = StripWhitespaceBE (operation);
    operation = StripParens (operation);
    //auto operands = SeparateOperands (operation); operand count has to be one at this point

	list <string> operands = SeparateOperands (operation);
	
	
	
	if (operands.size() == 1)
	{		

        // literal value
        if (IsNumericValue (operation))
		    return tostr (NumEval (operation)); //maybe return operation  directly
		
	    function_t fcode;
        string function_name = GetFunctionName(operation);
        
         //function
        if (IsFunctionCall (operation))
        { 
            SeparateArguments (StripB (function_name, operation));
    		return run_function (function_name, SeparateArguments (StripB (function_name, operation)));
     	} // if 
     	
	 	
        // only one operand at this point, which is a variable
        if (IsVariable (operation))
			return GetVariable (operands.front())-> Value ();

		// check for Literals
		// TODO: OperationType does so many unncessasry checks (for variables, waveforms, etc) 
		//       its better to figure out some way to skip those checks
		type_t optype = OperationType (operation);
		if (optype == TYPE_TEXT or optype == TYPE_NUM)
			return operation;
			
		// NaV: Not a value
		if (operation == "NaV")
			error ("operation did not return a valid value");
			
		// Unknown object
		error ("object `" + operation + "' is unsupported.");        	
		
	} // if 
	
	else
	{
		
		string result = "";
		
		for (list<string>::iterator o = operands.begin(); o != operands.end(); o++)
		{
			
			if (IsOperator (*o))
			{
				result += *o;	
				
			} /* if */
			
			else
			{
				result += Eval (*o);	
			
			} /* else */
			
			
		} /* for */
		
		
		return StripE (" ", result);
	} /* else */	 
				
} /* eval */
Beispiel #5
0
void AssertArgtype (const string& argument, const type_t type)
{
	if (OperationType (argument) != type)
		error ("argument " + argument + " is of the wrong type");
		
} // AssertArgtype