Example #1
0
void MainWindow::setupGUIConnections()
{
    connect(ui->chooseSourceSSLVisionRB, SIGNAL(released()), this, SLOT(handleChoosingVisionSource()));
    connect(ui->chooseSourceCyrusRB, SIGNAL(released()), this, SLOT(handleChoosingVisionSource()));
    connect(ui->chooseSourceGRSimRB, SIGNAL(released()), this, SLOT(handleChoosingVisionSource()));
    connect(ui->chooseSourceLogFileRB, SIGNAL(released()), this, SLOT(handleChoosingVisionSource()));

    connect(ui->actionWatch, SIGNAL(triggered()), this, SLOT(handleChangingMainTab()));
    connect(ui->actionCommnad, SIGNAL(triggered()), this, SLOT(handleChangingMainTab()));
    connect(ui->actionDesign, SIGNAL(triggered()), this, SLOT(handleChangingMainTab()));
    connect(ui->actionAI, SIGNAL(triggered()), this, SLOT(handleChangingMainTab()));
    connect(ui->actionHardware, SIGNAL(triggered()), this, SLOT(handleChangingMainTab()));

    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quitProgram()));
    connect(ui->actionMaximize, SIGNAL(triggered(bool)), this, SLOT(showMaximized()));
    connect(ui->actionMinimize, SIGNAL(triggered(bool)), this, SLOT(showMinimized()));

    connect(ui->pinMainToolsTB, SIGNAL(released()), this, SLOT(handlePinMainToolBarBtn()));
}
Example #2
0
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
    setWindowTitle(QCoreApplication::applicationName());
    ui.setupUi(this);

    // setup preferences dialog
    connect(&preferences,   SIGNAL(accepted()),                     this,   SLOT(getApplicationSettings()));

    connect(&builder,   SIGNAL(highlightLine(const QString &,
                                             int,
                                             int,
                                             const QString &)),

            this,       SLOT(highlightFileLine(const QString &,
                                               int,
                                               int)));

    connect(&builder,   SIGNAL(finished()),     this,           SLOT(setBuildAvailable()));
    connect(&builder,   SIGNAL(buildError()),   &preferences,   SLOT(showPreferences()));

    parser = language.parser();

    connect(&preferences, SIGNAL(updateColors()),               this,   SLOT(recolorProjectView()));
    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   this,   SLOT(recolorProjectView()));

    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   this,   SLOT(recolorBuildManager()));

    connect(&preferences, SIGNAL(accepted()),                   ui.editorTabs,   SIGNAL(accepted()));
    connect(&preferences, SIGNAL(updateColors()),               ui.editorTabs,   SIGNAL(updateColors()));
    connect(&preferences, SIGNAL(updateFonts(const QFont &)),   ui.editorTabs,   SIGNAL(updateFonts(const QFont &)));

    recolorProjectView();
    recolorBuildManager();

    // project editor tabs
    ui.finder->connectFileManager(ui.editorTabs);
    QSplitterHandle *hndl = ui.splitter->handle(1);
    hndl->setEnabled(false);

    connect(ui.editorTabs, SIGNAL(fileUpdated(int)),    this,   SLOT(setProject()));

    // File Menu
    connect(ui.action_New,              SIGNAL(triggered()),    ui.editorTabs,  SLOT(newFile()));
    connect(ui.actionNew_From_File,     SIGNAL(triggered()),    ui.editorTabs,  SLOT(newFromFile()));
    connect(ui.actionNew_From_Template, SIGNAL(triggered()),    this,           SLOT(newFromTemplate()));
    connect(ui.action_Open,             SIGNAL(triggered()),    ui.editorTabs,  SLOT(open()));

    connect(ui.action_Save,SIGNAL(triggered()),ui.editorTabs,SLOT(save()));
    connect(ui.actionSave_As,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAs()));
    connect(ui.actionSave_All,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAll()));

    ui.actionPrint->setEnabled(true);
    connect(ui.actionPrint,SIGNAL(triggered()),this,SLOT(printFile()));

    ui.action_Zip->setEnabled(true);
    connect(ui.action_Zip,SIGNAL(triggered()),this,SLOT(zipFiles()));

    recentFiles = findChildren<QAction *>(QRegExp("action_[0-9]+_File"));
    for (int i = 0; i < recentFiles.size(); i++)
        connect(recentFiles.at(i), SIGNAL(triggered()),this, SLOT(openRecentFile()));
    
    connect(ui.action_Close,       SIGNAL(triggered()),    ui.editorTabs, SLOT(closeFile()));
    connect(ui.actionClose_All,    SIGNAL(triggered()),    ui.editorTabs, SLOT(closeAll()));
    connect(ui.action_Quit,        SIGNAL(triggered()),    this,          SLOT(quitProgram()));

    connect(ui.editorTabs, SIGNAL(saveAvailable(bool)),    this,          SLOT(setSaveAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(saveAvailable(bool)),    this,          SLOT(setSaveAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setCloseAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setCloseAvailable(bool)));
    connect(ui.editorTabs, SIGNAL(closeAvailable(bool)),   this,          SLOT(setBuildAvailable(bool)));

    // Edit Menu
    connect(ui.action_Undo,        SIGNAL(triggered()), ui.editorTabs, SLOT(undo()));
    connect(ui.action_Redo,        SIGNAL(triggered()), ui.editorTabs, SLOT(redo()));

    connect(ui.action_Cut,         SIGNAL(triggered()), ui.editorTabs, SLOT(cut()));
    connect(ui.action_Copy,        SIGNAL(triggered()), ui.editorTabs, SLOT(copy()));
    connect(ui.action_Paste,       SIGNAL(triggered()), ui.editorTabs, SLOT(paste()));
    connect(ui.actionSelect_All,   SIGNAL(triggered()), ui.editorTabs, SLOT(selectAll()));

    connect(ui.action_Find,        SIGNAL(triggered()), ui.finder, SLOT(showFinder()));
    connect(ui.actionFind_Next,    SIGNAL(triggered()), ui.finder, SLOT(findNext()));
    connect(ui.actionFind_Previous,SIGNAL(triggered()), ui.finder, SLOT(findPrevious()));

    connect(ui.actionPreferences,  SIGNAL(triggered()), &preferences, SLOT(showPreferences()));

    connect(ui.editorTabs, SIGNAL(undoAvailable(bool)), ui.action_Undo,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(redoAvailable(bool)), ui.action_Redo,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Cut,SLOT(setEnabled(bool)));
    connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Copy,SLOT(setEnabled(bool)));

    // View Menu
    connect(ui.actionShow_Browser, SIGNAL(triggered()), this, SLOT(showBrowser()));
    connect(ui.actionBigger_Font,  SIGNAL(triggered()), this, SLOT(fontBigger()));
    connect(ui.actionSmaller_Font, SIGNAL(triggered()), this, SLOT(fontSmaller()));

    ui.actionBigger_Font->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomIn
                                                             << Qt::CTRL+Qt::Key_Equal);

    // Project Menu
    connect(ui.actionMemory_Map,SIGNAL(triggered()), this, SLOT(spawnMemoryMap()));
    connect(ui.actionBuild,     SIGNAL(triggered()), this, SLOT(programBuild()));
    connect(ui.actionRun,       SIGNAL(triggered()), this, SLOT(programRun()));
    connect(ui.actionWrite,     SIGNAL(triggered()), this, SLOT(programWrite()));
    connect(ui.actionTerminal,  SIGNAL(triggered()), this, SLOT(spawnTerminal()));

    // Help Menu
    connect(ui.actionPropeller_Quick_Reference, SIGNAL(triggered()), this, SLOT(propellerQuickReference()));
    connect(ui.actionPropeller_Datasheet,       SIGNAL(triggered()), this, SLOT(propellerDatasheet()));
    connect(ui.actionPropeller_Manual,          SIGNAL(triggered()), this, SLOT(propellerManual()));
    connect(ui.actionPropBASIC_Manual,          SIGNAL(triggered()), this, SLOT(propBasicManual()));
    connect(ui.action_About,                    SIGNAL(triggered()), this, SLOT(about()));

    // Toolbar Extras
    cbPort = new QComboBox(this);
    cbPort->setLayoutDirection(Qt::LeftToRight);
    cbPort->setToolTip(tr("Select Serial Port"));
    cbPort->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    ui.toolBar->addWidget(cbPort);

    connect(ui.projectview, SIGNAL(showFileLine(QString, int)),
            this,           SLOT(highlightFileLine(QString, int)));

    updateRecentFileActions();

    connect(ui.editorTabs, SIGNAL(sendMessage(const QString &)),   this,SLOT(showMessage(const QString &)));
    connect(ui.finder,     SIGNAL(sendMessage(const QString &)),   this,SLOT(showMessage(const QString &)));

    restoreGeometry(QSettings().value("windowSize").toByteArray());

    getApplicationSettings();

    connect(&manager, SIGNAL(portListChanged()), this, SLOT(updatePorts()));
    manager.enablePortMonitor(true);
    updatePorts();

    
    QSettings settings;
    QString lastport = settings.value("lastPort", QString()).toString();
    if (!lastport.isEmpty())
    {
        int index = cbPort->findText(lastport);
        if (index != -1)
            cbPort->setCurrentIndex(index);
    }

    ui.editorTabs->newFile();
    loadSession();

    installEventFilter(this);
    statusBar();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    readSettings();
    ui->actionSound->setChecked(settings.soundsenabled);

    irc = new QIrc();
    if (!irc->createSession())
    {
        QMessageBox::critical(this, tr("Error"), tr("Can't create session"));
        close();
        return;
    }
    connect(irc, SIGNAL(sigConnected()), this, SLOT(sltConnected()));
    connect(irc, SIGNAL(sigMessage(QString,QString)), this, SLOT(sltMessage(QString,QString)));
    connect(irc, SIGNAL(sigChannelJoined(QString,QString)), this, SLOT(sltChannelJoined(QString,QString)));
    connect(irc, SIGNAL(sigChannelParted(QString,QString,QString)), this, SLOT(sltChannelParted(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelNames(QString,QString,QStringList)), this, SLOT(sltChannelNames(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigChannelMessage(QString,QString,QString)), this, SLOT(sltChannelMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigPrivateMessage(QString,QString,QString)), this, SLOT(sltPrivateMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigNick(QString,QString)), this, SLOT(sltNick(QString,QString)));
    connect(irc, SIGNAL(sigNotice(QString,QString,QString)), this, SLOT(sltNotice(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopic(QString,QString,QString)), this, SLOT(sltTopic(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopicSet(QString,QString,QString,QString)), this, SLOT(sltTopicSet(QString,QString,QString,QString)));
    connect(irc, SIGNAL(sigKick(QString,QString,QString)), this, SLOT(sltKick(QString,QString,QString)));
    connect(irc, SIGNAL(sigQuit(QString,QString)), this, SLOT(sltQuit(QString,QString)));
    connect(irc, SIGNAL(sigChannelModeChanged(QString,QString,QStringList)), this, SLOT(sltChannelModeChanged(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigUmode(QString,QString)), this, SLOT(sltUmode(QString,QString)));
    connect(irc, SIGNAL(sigInvite(QString,QString,QString)), this, SLOT(sltInvite(QString,QString,QString)));
    connect(irc, SIGNAL(sigCtcpAction(QString,QString,QString)), this, SLOT(sltCtcpAction(QString,QString,QString)));
    connect(irc, SIGNAL(sigErrorOccured(QString)), this, SLOT(sltErrorOccured(QString)));

    consolebrowser = new QTextEdit();
    consolebrowser->setReadOnly(true);
    QFont consolefont;
    if (consolefont.fromString(settings.consolefont))
        consolebrowser->setFont(consolefont);

    if (!settings.hideconsole)
        consoleindex =ui->tabWidget->insertTab(0, consolebrowser, tr("Console"));

    setsdlg = 0;

    usercontextmenu = new QMenu(this);
    usercontextmenu->addAction(ui->actionPrivateChat);
    usercontextmenu->addAction(ui->actionInsert_to_editor);
    QMenu *managementmenu = usercontextmenu->addMenu(tr("Management"));
    managementmenu->addAction(ui->actionKick);
    managementmenu->addAction(ui->actionBan);
    managementmenu->addAction(ui->actionKickBan);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionOp);
    managementmenu->addAction(ui->actionDeOp);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionVoice);
    managementmenu->addAction(ui->actiondeVoice);
    connect(ui->treeWidget, SIGNAL(userContextMenu(QPoint)), this, SLOT(userContextMenuRequested(QPoint)));

    channelcontextmenu = new QMenu(this);
    channelcontextmenu->addAction(ui->actionLeave_channel);
    channelcontextmenu->addAction(ui->actionChannel_settings);
    connect(ui->treeWidget, SIGNAL(channelContextMenu(QPoint)), this, SLOT(channelContextMenuRequested(QPoint)));

    channelsettingsdialog = 0;
    trayicon = 0;
    traymenu = 0;
    setTrayIcon(settings.trayicon);
    connect(ui->actionChannel_settings, SIGNAL(triggered()), this, SLOT(channelSettingsPressed()));

    //smile menu
    smilemenu = new QMenu(this);
    smilewidgetaction = new QWidgetAction(smilemenu);
    smilebar = new SmileBar();
    smilewidgetaction->setDefaultWidget(smilebar);
    smilemenu->addAction(smilewidgetaction);
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(insertPlainText(QString)));
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(setFocus()));
    ui->actionEmoticons->setMenu(smilemenu);
    smilebutton = new QToolButton();
    smilebutton->setDefaultAction(ui->actionEmoticons);
    smilebutton->setPopupMode(QToolButton::InstantPopup);
    ui->mainToolBar->addWidget(smilebutton);

    channellistdialog = new ChannelListDialog();
    connect(irc, SIGNAL(sigChannelListStart()), channellistdialog, SLOT(showAndClear()));
    connect(irc, SIGNAL(sigChannelListAddItem(QString,QString,QString)), channellistdialog,
            SLOT(addListItem(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelListEnd()), channellistdialog, SLOT(endOfList()));
    connect(channellistdialog, SIGNAL(channelDoubleClicked(QString)), irc, SLOT(joinChannel(QString)));

    connect(ui->pushButtonSend, SIGNAL(clicked()), ui->plainTextEditMessage, SIGNAL(sendKeyPressed()));
    connect(ui->plainTextEditMessage, SIGNAL(sendKeyPressed()), this, SLOT(sendPressed()));
    connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(connectPressed()));
    connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(disconnectPressed()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settingsPressed()));
    connect(ui->actionJoin, SIGNAL(triggered()), this, SLOT(joinPressed()));
    connect(ui->treeWidget, SIGNAL(userDoubleClicked(QString)), this, SLOT(userDoubleClicked(QString)));
    connect(ui->actionPrivateChat, SIGNAL(triggered()), this, SLOT(privateChatPressed()));
    connect(ui->actionLeave_channel, SIGNAL(triggered()), this, SLOT(leaveChannelPressed()));
    connect(ui->actionKick, SIGNAL(triggered()), this, SLOT(kickPressed()));
    connect(ui->actionBan, SIGNAL(triggered()), this, SLOT(BanPressed()));
    connect(ui->actionKickBan, SIGNAL(triggered()), this, SLOT(kickBanPressed()));
    connect(ui->actionOp, SIGNAL(triggered()), this, SLOT(opPressed()));
    connect(ui->actionDeOp, SIGNAL(triggered()), this, SLOT(deOpPressed()));
    connect(ui->actionVoice, SIGNAL(triggered()), this, SLOT(voicePressed()));
    connect(ui->actiondeVoice, SIGNAL(triggered()), this, SLOT(devoicePressed()));
    connect(ui->pushButtonNick, SIGNAL(clicked()), this, SLOT(nickButtonPressed()));
    connect(ui->actionList_of_channels, SIGNAL(triggered()), irc, SLOT(getChannelsList()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
    connect(ui->actionInsert_to_editor, SIGNAL(triggered()), this, SLOT(insertUserToEditorPressed()));
    connect(ui->actionShowHide, SIGNAL(triggered()), this, SLOT(trayIconActivated()));
    connect(ui->actionQuit_program, SIGNAL(triggered()), this, SLOT(quitProgram()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPressed()));
    connect(ui->actionSound, SIGNAL(toggled(bool)), this, SLOT(soundActionToogled(bool)));
}
Example #4
0
void MainWindow::initUI()
{
    mainlayout = new QVBoxLayout(this);


    inventory = new QPushButton(tr("Inventory"));
    connect(inventory,SIGNAL(clicked()),this,SLOT(inventoryGoods()));

    shipping = new QPushButton(tr("Shipping"));
    connect(shipping,SIGNAL(clicked()),this,SLOT(shippingGoods()));

    delivered = new QPushButton(tr("Delivered"));
    connect(delivered,SIGNAL(clicked()),this,SLOT(deliveredGoods()));

    status = new QHBoxLayout;

    status->addWidget(inventory);
    status->addWidget(shipping);
    status->addWidget(delivered);


    mainlayout->addLayout(status);




    table = new QTableWidget(0,3);
    table->setSelectionBehavior(QAbstractItemView::SelectRows);  //设置为选择整行
    QStringList header;
    header.append(tr("Name"));
    header.append(tr("Amount"));
    header.append(tr("Price"));
    table->setHorizontalHeaderLabels(header);
    table->setEditTriggers(QAbstractItemView::NoEditTriggers); //禁止编辑表格
    table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);//使列完全填充并且平分
    table->setTextElideMode(Qt::ElideMiddle);
    mainlayout->addWidget(table);




    categoryLabel = new QLabel(tr("Category:"));
    category = new QComboBox;
    category->insertItem(0,"All");
    category->insertItem(1,"PC");
    category->insertItem(2,"TV");
    category->insertItem(3,"laptop");
    category->insertItem(4,"camera");
    category->insertItem(5,"telephone");
    connect(category,SIGNAL(currentIndexChanged(int)),this,SLOT(changeCategory(int)));

    nameLabel = new QLabel(tr("Name:"));
    nameEdit = new QLineEdit;
    amountLabel = new QLabel(tr("Amount:"));
    amount = new QSpinBox;
    amount->setMinimumWidth(100);
    amount->setMinimum(1);
    amount->setMaximum(1000000000);
    priceLabel = new QLabel(tr("Price:"));
    priceBox = new QSpinBox;
    priceBox->setMinimumWidth(100);
    priceBox->setMaximum(1000000000);
    priceBox->setMinimum(1);

    add = new QPushButton(tr("Add"));
    connect(add,SIGNAL(clicked()),this,SLOT(addGoods()));


    inventoryLayout = new QHBoxLayout;

    inventoryLayout->addWidget(categoryLabel);
    inventoryLayout->addWidget(category);
    inventoryLayout->addWidget(nameLabel);
    inventoryLayout->addWidget(nameEdit);
    inventoryLayout->addWidget(amountLabel);
    inventoryLayout->addWidget(amount);
    inventoryLayout->addWidget(priceLabel);
    inventoryLayout->addWidget(priceBox);
    inventoryLayout->addWidget(add);

    mainlayout->addLayout(inventoryLayout);



    ship = new QPushButton(tr("Ship"));
    connect(ship,SIGNAL(clicked()),this,SLOT(shipGoods()));
    deliver = new QPushButton(tr("Deliver"));
    deliver->setEnabled(false);
    connect(deliver,SIGNAL(clicked()),this,SLOT(deliverGoods()));
    quit = new QPushButton(tr("Quit"));
    connect(quit,SIGNAL(clicked()),this,SLOT(quitProgram()));


    buttonLayout = new QHBoxLayout;
    buttonLayout->addWidget(ship);
    buttonLayout->addWidget(deliver);
    buttonLayout->addWidget(quit);

    mainlayout->addLayout(buttonLayout);


}
Example #5
0
static void commandList(void)
{
	unsigned short  nOfSys = 0, nOfCmd = 0, pageSys = 0, 
					i, j, page = 0, row, column;
	int				cmd;

	while( strcmp(function[nOfCmd].cmdName, "NOCOMMAND") )
		nOfCmd++;

	while( 1 )
	{
		clrscr();
		con_puts("       --- Demonstration of use of CAEN HV Wrapper Library --- ");
		gotoxy(1, 3);
		for(i=page*20;(i<(page*20+20))&&(strcmp(function[i].cmdName,"NOCOMMAND"));i++)
		{
			row = 3 + (i - page * 20)%10;
			column = ((i - page * 20) > 9 ? 30 : 1);
			gotoxy(column, row);
			con_printf("[%c] %s", alpha[i], function[i].cmdName);
		}

		for( j = pageSys*10; (j<pageSys*10+10)&&(System[j].ID!=-1); j++ )
		{
			row = 3+(j-pageSys*10)%10;
			gotoxy(60,row);
			con_printf("System[%d]: %d", j, System[j].Handle);
		}

		gotoxy(1, 14);
		con_printf("[r] Loop = %s",loop ? "Yes" : "No");

		gotoxy(1, 15);
		con_printf("[x] Exit \n\n");

		switch(cmd = tolower(con_getch()))
		{
			// Handle future next page command
			//	case "next page"
			//		if( nOfCmd > page*20 + 20 )
			//			page++;
			//		else
			//			page = 0;
			//       break;

			// Handle future next system command
			//  case "next system"
			//		while( System[nOfSys].ID != -1 )
            //			nOfSys++;
			//		if( nOfSys > pageSys*10+10 )
            //			pageSys++;
			//		else
            //			pageSys = 0;
			//        break;

	   case 'r':
	     loop = (loop ? 0 : 1);
	    break;

		case 'x':
			quitProgram();
			break;

	    default:
			if( cmd >= 'a' && cmd < 'a' + nOfCmd )
				(*function[cmd-'a'].pFun)();      
	        break;
      }
  }
}