MainWindow::MainWindow()
{
    textedit=new QTextEdit;
    c=new Contents;
    a=new About;
    setWindowTitle("NotePad");
    setWindowIcon(QIcon(":/images/file.png"));
    setupUi(this);
    MagicNumber=909012123;

    textedit->addAction(actionCopy);
    textedit->addAction(actionPaste);
    textedit->addAction(actionCut);
    textedit->setContextMenuPolicy(Qt::ActionsContextMenu);

    CreateAction();

    connect(actionCopy,SIGNAL(triggered()),this,SLOT(copy()));
    connect(actionPaste,SIGNAL(triggered()),this,SLOT(paste()));
    connect(actionSave,SIGNAL(triggered()),this,SLOT(Save()));
    connect(actionSave_As,SIGNAL(triggered()),this,SLOT(SaveAs()));
    connect(actionDelete,SIGNAL(triggered()),textedit,SLOT(clear()));
    connect(actionOpen,SIGNAL(triggered()),textedit,SLOT(clear()));
    connect(actionOpen_2,SIGNAL(triggered()),this,SLOT(Open()));
    connect(textedit,SIGNAL(textChanged()),this,SLOT(Modified()));
toolBar->addAction(actionOpen);
toolBar->addAction(actionOpen_2);
toolBar->addAction(actionSave);
toolBar_2->addAction(actionCopy);
toolBar_2->addAction(actionPaste);
toolBar_2->addAction(actionCut);
toolBar_2->addAction(actionDelete);


}
Example #2
0
Action* ActionParser::Parse(const std::string& cmd) {
	if (cmd.empty()) {
		return nullptr;
	}

	return CreateAction(cmd);
}
Example #3
0
/*----------------------------------------------------------------------
|   PLT_MediaController::Seek
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::Seek(PLT_DeviceDataReference& device, 
                          NPT_UInt32               instance_id,
                          NPT_String               unit,
                          NPT_String               target,
                          void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:AVTransport:1", 
        "Seek", 
        action));

    // Set the unit
    if (NPT_FAILED(action->SetArgumentValue("Unit", unit))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // Set the target
    if (NPT_FAILED(action->SetArgumentValue("Target", target))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return CallAVTransportAction(action, instance_id, userdata);
}
Example #4
0
/*----------------------------------------------------------------------
|   PLT_MediaController::SetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::SetAVTransportURI(PLT_DeviceDataReference& device, 
                                       NPT_UInt32               instance_id, 
                                       const char*              uri,
                                       const char*              metadata,
                                       void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:AVTransport:1", 
        "SetAVTransportURI", 
        action));

    // set the uri
    if (NPT_FAILED(action->SetArgumentValue("CurrentURI", uri))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the uri metadata
    if (NPT_FAILED(action->SetArgumentValue("CurrentURIMetaData", metadata))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return CallAVTransportAction(action, instance_id, userdata);
}
Example #5
0
/*----------------------------------------------------------------------
|   PLT_MediaController::Stop
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::Stop(PLT_DeviceDataReference& device, 
                          NPT_UInt32               instance_id,
                          void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:AVTransport:1", 
        "Stop", 
        action));
    return CallAVTransportAction(action, instance_id, userdata);
}
Example #6
0
/********************************
* Set up the dropping mechanism
********************************/
int InitActionDrop(){
	int ActionID;

	DEBUGPATH;

	ActionID=CreateAction("drop");
	if (ActionID==ACTION_NONE){
#ifdef DEBUG
		printf("Couldn't allocation action drop\n");
#endif	
		return FALSE;
	}
	
	Globals.ActionItems[ActionID].ActionFunc=DropAction;

	return TRUE;
}
Example #7
0
/*----------------------------------------------------------------------
|   PLT_MediaController::GetProtocolInfo
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::GetProtocolInfo(PLT_DeviceDataReference& device, 
                                     void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:ConnectionManager:1", 
        "GetProtocolInfo", 
        action));

    // set the arguments on the action, this will check the argument values
    if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return NPT_SUCCESS;
}
Example #8
0
/********************************
* Set up the alert Syslog stuff
********************************/
int InitActionAlertSyslog()
{
    int ActionID;

    DEBUGPATH;

    ActionID = CreateAction("alert syslog");
    if (ActionID == ACTION_NONE) {
	DBG((printf("Couldn't allocation action alert syslog\n")));
	return FALSE;
    }

    Globals.ActionItems[ActionID].ActionFunc = AlertSyslogAction;
    Globals.ActionItems[ActionID].MessageFunc = AlertSyslogMessage;
    Globals.ActionItems[ActionID].ParseArgs = AlertSyslogParseArgs;

    return TRUE;
}
Example #9
0
/********************************
* Set up the packet dump stuffg
********************************/
int InitActionDumpPacket() {
    int ActionID;

    DEBUGPATH;

    ActionID=CreateAction("dump packet");
    if (ActionID==ACTION_NONE) {
#ifdef DEBUG
        printf("Couldn't allocation action dump packet\n");
#endif
        return FALSE;
    }

    Globals.ActionItems[ActionID].ActionFunc=DumpPacketAction;
    Globals.ActionItems[ActionID].ParseArgs=DumpPacketParseArgs;

    return TRUE;
}
Example #10
0
/********************************
* Set up the alert socket stuff
********************************/
int InitActionAlertSocket(){
	int ActionID;

	DEBUGPATH;

	ActionID=CreateAction("alert socket");
	if (ActionID==ACTION_NONE){
#ifdef DEBUG
		printf("Couldn't allocation action alert socket\n");
#endif	
		return FALSE;
	}
	
	Globals.ActionItems[ActionID].ActionFunc=AlertSocketAction;
	Globals.ActionItems[ActionID].MessageFunc=AlertSocketMessage;
	Globals.ActionItems[ActionID].ParseArgs=AlertSocketParseArgs;

	return TRUE;
}
Example #11
0
/*----------------------------------------------------------------------
|   PLT_MediaController::SetPlayMode
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::SetPlayMode(PLT_DeviceDataReference& device, 
                                 NPT_UInt32               instance_id,
                                 NPT_String               new_play_mode,
                                 void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:AVTransport:1", 
        "SetPlayMode", 
        action));

    // set the New PlayMode
    if (NPT_FAILED(action->SetArgumentValue("NewPlayMode", new_play_mode))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return CallAVTransportAction(action, instance_id, userdata);
}
Example #12
0
/*----------------------------------------------------------------------
|   PLT_MediaController::Play
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::Play(PLT_DeviceDataReference& device, 
                          NPT_UInt32               instance_id,
                          NPT_String               speed,
                          void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:AVTransport:1", 
        "Play", 
        action));

    // Set the speed
    if (NPT_FAILED(action->SetArgumentValue("Speed", speed))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return CallAVTransportAction(action, instance_id, userdata);
}
Example #13
0
/*----------------------------------------------------------------------
|   PLT_MediaController::Mute
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::Mute(PLT_DeviceDataReference& device, 
                          NPT_UInt32               instance_id,
                          void*                    userdata)
{
    static int mute=0;
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:RenderingControl:1", 
        "SetMute", 
        action));
    mute = 1-mute;
    
    // Set the speed
    if (NPT_FAILED(action->SetArgumentValue("DesiredMute", mute==1?"1":"0"))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }
    
    return CallAVTransportAction(action, instance_id, userdata);
}
Example #14
0
/*----------------------------------------------------------------------
|   PLT_MediaController::Mute
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::Volume(PLT_DeviceDataReference& device, 
                          NPT_UInt32               instance_id,
                          int					   value,
                          void*                    userdata)
{
    PLT_ActionReference action;
    char tmp[10];
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:RenderingControl:1", 
        "SetVolume", 
        action));
    sprintf(tmp,"%d",value);
    
    // Set the speed
    if (NPT_FAILED(action->SetArgumentValue("DesiredVolume",tmp))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }
    
    return CallAVTransportAction(action, instance_id, userdata);
}
Example #15
0
/********************************
* Set up the bns routing stuff
********************************/
int InitActionBNS(){
	int ActionID;

	DEBUGPATH;

	ActionID=CreateAction("bns");
	if (ActionID==ACTION_NONE){
#ifdef DEBUG
		printf("Couldn't allocation action BNS\n");
#endif	
		return FALSE;
	}
	
	Globals.ActionItems[ActionID].ActionFunc=BNSAction;
	Globals.ActionItems[ActionID].MessageFunc=BNSMessage;
	Globals.ActionItems[ActionID].ParseArgs=BNSParseArgs;

	IPDecoderID=GetDecoderByName("IP");

	return TRUE;
}
Example #16
0
/********************************
* Set up the sip routing stuff
********************************/
int InitActionRouteSIP(){
	int ActionID;

	DEBUGPATH;

	ActionID=CreateAction("route sip");
	if (ActionID==ACTION_NONE){
#ifdef DEBUG
		printf("Couldn't allocation action route sip\n");
#endif	
		return FALSE;
	}
	
	Globals.ActionItems[ActionID].ActionFunc=RouteSIPAction;
	Globals.ActionItems[ActionID].MessageFunc=RouteSIPMessage;
	Globals.ActionItems[ActionID].ParseArgs=RouteSIPParseArgs;

	IPDecoderID=GetDecoderByName("IP");

	return TRUE;
}
Example #17
0
/*----------------------------------------------------------------------
|   PLT_MediaController::GetCurrentConnectionInfo
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::GetCurrentConnectionInfo(PLT_DeviceDataReference& device, 
                                              NPT_UInt32               connection_id,
                                              void*                    userdata)
{
    PLT_ActionReference action;
    NPT_CHECK_SEVERE(CreateAction(device, 
        "urn:schemas-upnp-org:service:ConnectionManager:1", 
        "GetCurrentConnectionInfo", 
        action));

    // set the New PlayMode
    if (NPT_FAILED(action->SetArgumentValue("ConnectionID", NPT_String::FromInteger(connection_id)))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the arguments on the action, this will check the argument values
    if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return NPT_SUCCESS;
}
Example #18
0
	Trigger* MainEventPool::CreateTrigger(XmlNode* trigNode)
	{
		const char* trigName = XmlUtility::XmlGetString(trigNode, "name");

		Trigger* trigger = xNew1(Trigger, trigName);

		XmlNode* evtNode = trigNode->first_node("Event");
		if(evtNode != 0) // Trigger may not have and event
		{
			trigger->SetEvent(FindEvent(evtNode));
		}

		XmlNode* actsNode = trigNode->first_node("Actions", 7);
		MultiAction* actions = xNew0(MultiAction);
		XmlNode* actNode = actsNode->first_node("Action", 6);
		while (actNode != 0)
		{
			actions->AddAction(CreateAction(actNode));
			actNode = actNode->next_sibling();
		}
		trigger->SetActions(actions);
		return trigger;
	}
Example #19
0
MainWindowView::MainWindowView(): QMainWindow(0)
{
    //Set the window title and version
    setWindowTitle(APPLICATION_NAME " v" VER_FILEVERSION_STR);

    //Set application
    QCoreApplication::setOrganizationName("Milestone S.r.l");
    QCoreApplication::setOrganizationDomain("milestone.it");
    QCoreApplication::setApplicationName(APPLICATION_NAME);

    //Create actions and fill the main menu bar
    CreateAction();
    CreateApplicationMenuBar();
    createStatusBar();

    //Resize the window
    this->resize(1024, 768);
    //Set the icon
    this->setWindowIcon(QIcon(":/icon/iconaexe.png"));

    //Set accept drop events
    this->setAcceptDrops(true);

    //Initialize and load from the system registry the previously value
    m_pAttributeNameTagCollapse = new AttributeNameTagCollapse;

    //Initialize the command invoker
    m_pXmlEditorCommandInvoker = new XmlEditCommandInvoker;

    //Connect the command invoker
    connect(m_pXmlEditorCommandInvoker, SIGNAL(UndoEnabled(bool)), this, SLOT(SetEnableUndo(bool)));
    connect(m_pXmlEditorCommandInvoker, SIGNAL(RedoEnabled(bool)), this, SLOT(SetEnableRedo(bool)));

    //Initialize in order to set the right state of the action undo and redo
    m_pXmlEditorCommandInvoker->Initialize();

    //Set a zero the error view
    m_pXmlErrorWidget = 0;

    //Initialize the associated file names
    m_pAssociatedFiles = new AssociatedFiles;
    m_pAssociatedFiles->AttachObserver(this);

    //Initialize layouts
    m_pHorizMainLayout = new QHBoxLayout;
    m_pLeftVertLayout = new QVBoxLayout;
    m_pRightVertLayout = new QVBoxLayout;

    //Initialize combo boxes
    m_pLeftComboBox = new QComboBox;
    m_pRightComboBox = new QComboBox;

    //Connect the combo box with the right actions
    connect(m_pLeftComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(ExchangeLeftXmlShown(int)));
    connect(m_pRightComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(ExchangeRightXmlShown(int)));

    //Initialize and load the relation collection from the standard configuration file
    m_pXmlRelationCollection = new XmlRelationCollection;
    FILE_XML_ERR_CODE errCode = m_pXmlRelationCollection->LoadSettedFileConf();
    //If an error has occurred show the box with the error
    if(errCode != FILE_XML_NO_ERR)
    {
        ShowOpenSaveXmlError("Impossible to load the standard configuration file. When the first new relation will be inserted a new one configuration file will be created.\n\n", errCode, m_pXmlRelationCollection->GetXmlDocument());
    }

    //Initialize the core
    m_pXmlRelationCheckerCore = new XmlRelationCheckerCoreImpl(&m_openedXmlDocuments, m_pXmlRelationCollection);

    //Initialize the view
    m_pLeftXmlViewBase = new XmlViewTree(m_pXmlRelationCheckerCore, m_pXmlEditorCommandInvoker);
    m_pRightXmlViewBase = new XmlViewTree(m_pXmlRelationCheckerCore, m_pXmlEditorCommandInvoker);

    //connect the view
    connect(m_pLeftXmlViewBase, SIGNAL(ShowAndSelectedItemRequested(QString,QString)), this, SLOT(ShowAndSelectedItemOnLeftTree(QString,QString)));
    connect(m_pRightXmlViewBase, SIGNAL(ShowAndSelectedItemRequested(QString,QString)), this, SLOT(ShowAndSelectedItemOnRightTree(QString,QString)));

    //Combine the widget and the layouts
    m_pLeftVertLayout->addWidget(m_pLeftComboBox);
    m_pLeftVertLayout->addWidget(m_pLeftXmlViewBase);
    m_pLeftVertLayout->setAlignment(Qt::AlignTop);
    m_pRightVertLayout->addWidget(m_pRightComboBox);
    m_pRightVertLayout->addWidget(m_pRightXmlViewBase);
    m_pRightVertLayout->setAlignment(Qt::AlignTop);
    m_pHorizMainLayout->addItem(m_pLeftVertLayout);
    m_pHorizMainLayout->addItem(m_pRightVertLayout);

    //Set the main layout
    m_pCentralWidget = new QWidget;
    m_pCentralWidget->setLayout(m_pHorizMainLayout);
    setCentralWidget(m_pCentralWidget);

    //Initialize the file watcher
    m_pFileSystemWatcher = new QFileSystemWatcher;
    connect(m_pFileSystemWatcher, SIGNAL(fileChanged(QString)), this, SLOT(OpenedFileChanged(QString)));

    //Disable the save action
    DisableSaveActions();
}