Beispiel #1
0
void MainWindow::closeEvent(QCloseEvent *event)
{
  if(opt.arg_debug) printf("MainWindow::closeEvent()\n");
  if(opt.exitpassword == 1)
  {
    bool ok;
    QString pass = QInputDialog::getText(this,tr("pvbrowser"),tr("Exit Password ?"),QLineEdit::Password,QString::null,&ok);
    if( ok && !pass.isEmpty() ) 
    {
      // user entered something and pressed OK
      FILE *fp;
      fp = fopen(passfile(),"r");
      if(fp == NULL)
      {
        fp = fopen(passfile(),"w");
        if(fp != NULL)
        {
          fprintf(fp,"%s\n",pvpass(pass.toUtf8()));
          fclose(fp);
        }
        opt.exitpassword = 0;
        slotExit();
        event->accept();
      }
      else
      {
        const char *cptr;
        char buf[1024];
        cptr = fgets(buf,sizeof(buf)-1,fp);
        fclose(fp);
        if(cptr != NULL && strncmp(buf,pvpass(pass.toUtf8()),strlen(buf)-1) != 0)
        {
          QMessageBox::information(this,"pvbrowser","Wrong Password",1);
          event->ignore();
        }
        else
        { 
          slotExit();
          event->accept();
        }  
      }
    }
    else
    {
      event->ignore();
    }
  }
  else
  {
    slotExit();
    event->accept();
  }
}
QHBoxLayout* Shortcut::setUpBottomPanel(){
    QHBoxLayout *bottomPanel = new QHBoxLayout;
    editBut = new QPushButton("Edit Shortcut");
    delBut = new QPushButton("Delete");
    exitBut = new QPushButton("Exit");
    searchBox = new QLineEdit;
    searchBox->setFocus();
    searchBox->setMaximumWidth(120);
    QLabel *searchLabel = new QLabel(tr("Search:"));

    bottomPanel->addWidget(searchLabel);
    bottomPanel->addWidget(searchBox);
    bottomPanel->addStretch(1);
    bottomPanel->addWidget(editBut);
    bottomPanel->addWidget(delBut);
    bottomPanel->addWidget(exitBut);

    bottomPanel->setAlignment(Qt::AlignLeft);
    connect(delBut,SIGNAL(clicked()),this, SLOT(slotDeleteShortcut()));
    connect(exitBut,SIGNAL(clicked()),this, SLOT(slotExit()));
    connect(editBut,SIGNAL(clicked()),this, SLOT(slotEditShortcutButton()));
    connect(searchBox,SIGNAL(textEdited(QString)),this,SLOT(slotFind()));
    connect(searchBox,SIGNAL(textChanged(QString)),this,SLOT(slotSearchBoxTextChanged()));

    return bottomPanel;
}
void GameEngine::makeConnections()
{
    //Connect the gameOver signal from the
    //game state to this class's exit function.
    connect( _gamestate, SIGNAL(gameOver()),
             this, SLOT(slotExit()) );
}
Beispiel #4
0
KXNeurApp::KXNeurApp()
 : KUniqueApplication()
{
    xnkb = KXNKeyboard::self();
    trayicon = new KXNeurTray();
    setMainWidget( trayicon );
    trayicon->show();

    xneur_pid = 0;
    xnconf = NULL;
    cur_lang = -1;
    prev_lang = -1;
    if ( KXNeurSettings::self()->RunXNeur() )
	xneur_start(); // TODO: проверить старт
    else {
	trayicon->run->setText(i18n("Start xneur daemon"));
	trayicon->run->setIcon("fork");
	trayicon->mode->setEnabled(false);
	xnconf_reload();
    }
    cur_lang = xnkb->getGroupNo();
    refreshLang();
    trayicon->setPixmap(langs[cur_lang]->pic);

    QObject::connect(xnkb, SIGNAL(groupChanged(int)), this, SLOT(groupChange(int)));
    QObject::connect(xnkb, SIGNAL(layoutChanged()), this, SLOT(refreshLang()));
    QObject::connect(trayicon, SIGNAL(clicked()), this, SLOT(setNextLang()));
    QObject::connect(trayicon, SIGNAL(quitSelected()), this, SLOT(slotExit()));
}
Beispiel #5
0
KXNeurApp::KXNeurApp()
 : KUniqueApplication()
// : KApplication()
{
    KGlobal::dirs()->addResourceDir("appdata", ".");
    all_langs = new KConfig("langs", true, true, "appdata");
    all_langs->setGroup("Languages");

    xnkb = KXNKeyboard::self();
    trayicon = new KXNeurTray();
    setMainWidget( trayicon );
    trayicon->show();

    xneur_pid = 0;
    xnconf = NULL;
    cur_lang = -1;
    prev_lang = -1;
    if ( !(KXNeurSettings::self()->RunXNeur() && xneur_start()) ) {
//	printf("start -- ok\n");
//    else {
	trayicon->run->setText(i18n("Start xneur daemon"));
	trayicon->run->setIcon("fork");
	trayicon->mode->setEnabled(false);
	xnconf_reload();
    }
    cur_lang = xnkb->getGroupNo();
    refreshLang();
    trayicon->setPixmap(langs[cur_lang]->pic);

    QObject::connect(xnkb, SIGNAL(groupChanged(int)), this, SLOT(groupChange(int)));
    QObject::connect(xnkb, SIGNAL(layoutChanged()), this, SLOT(refreshLang()));
    QObject::connect(trayicon, SIGNAL(clicked()), this, SLOT(setNextLang()));
    QObject::connect(trayicon, SIGNAL(quitSelected()), this, SLOT(slotExit()));
}
Beispiel #6
0
void FLReportViewer::slotPrintReport()
{
  if (slotsPrintDisabled_)
    return;
  reportPrinted_ = rptViewer_->printReport();
  if (reportPrinted_ && autoClose_)
    slotExit();
}
Beispiel #7
0
void FLReportViewer::slotPrintReportToPDF(const QString &outPdfFile)
{
  if (slotsPrintDisabled_)
    return;
  reportPrinted_ = rptViewer_->printReportToPDF(outPdfFile);
  if (reportPrinted_ && autoClose_)
    slotExit();
}
void FLReportViewer::slotPrintReport()
{
  if (slotsPrintDisabled_)
    return;
  setDisabled(true);
  printing_ = true;
  reportPrinted_ = rptViewer_->printReport();
  if (reportPrinted_ && autoClose_)
    QTimer::singleShot(0, this, SLOT(slotExit()));
  printing_ = false;
  setDisabled(false);
}
Beispiel #9
0
// Constructor
SimpleView::SimpleView() 
{
  this->ui = new Ui_SimpleView;
  this->ui->setupUi(this);

  // Qt Table View
  this->TableView = vtkSmartPointer<vtkQtTableView>::New();

  // Place the table view in the designer form
  this->ui->tableFrame->layout()->addWidget(this->TableView->GetWidget());

  // Geometry
  VTK_CREATE(vtkVectorText, text);
  text->SetText("VTK and Qt!");
  VTK_CREATE(vtkElevationFilter, elevation);
  elevation->SetInputConnection(text->GetOutputPort());
  elevation->SetLowPoint(0,0,0);
  elevation->SetHighPoint(10,0,0);

  // Mapper
  VTK_CREATE(vtkPolyDataMapper, mapper);
  mapper->ImmediateModeRenderingOn();
  mapper->SetInputConnection(elevation->GetOutputPort());

  // Actor in scene
  VTK_CREATE(vtkActor, actor);
  actor->SetMapper(mapper);

  // VTK Renderer
  VTK_CREATE(vtkRenderer, ren);

  // Add Actor to renderer
  ren->AddActor(actor);

  // VTK/Qt wedded
  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(ren);

  // Just a bit of Qt interest: Culling off the
  // point data and handing it to a vtkQtTableView
  VTK_CREATE(vtkDataObjectToTable, toTable);
  toTable->SetInputConnection(elevation->GetOutputPort());
  toTable->SetFieldType(vtkDataObjectToTable::POINT_DATA);

  // Here we take the end of the VTK pipeline and give it to a Qt View
  this->TableView->SetRepresentationFromInputConnection(toTable->GetOutputPort());

  // Set up action signals and slots
  connect(this->ui->actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));

};
Beispiel #10
0
void MainDialog::NowRun()
{
	centerWidget(this);
	this->show();

	obj_this = this;

	ui.setupUi(this);
	QIcon accountIcon(QLatin1String(":rc/user.png"));
	QListWidgetItem *account = new QListWidgetItem(accountIcon, "Account", ui.labelWidget);
	account->setSizeHint(QSize(0, 32));
	this->accountSettings = new AccountSettings(this);
	ui.stack->addWidget(this->accountSettings);

	QIcon syslogIcon(QLatin1String(":rc/loop_alt4.png"));
	QListWidgetItem *syslog = new QListWidgetItem(syslogIcon, "Log Activity", ui.labelWidget);
	syslog->setSizeHint(QSize(0, 32));
	this->logSettings = new LogSettings;
	ui.stack->addWidget(this->logSettings);

	QIcon generalIcon(QLatin1String(":rc/cog.png"));
	QListWidgetItem *general = new QListWidgetItem(generalIcon, "General", ui.labelWidget);
	general->setSizeHint(QSize(0, 32));
	this->generalSettings = new GeneralSettings(this);
	ui.stack->addWidget(this->generalSettings);

	ui.labelWidget->setCurrentRow(ui.labelWidget->row(account));

	connect(ui.labelWidget, SIGNAL(currentRowChanged(int)),
		ui.stack, SLOT(setCurrentIndex(int)));

	connect(this->ui.exitButton, SIGNAL(clicked()), this, SLOT(slotExit()));

	createTrayIcon();
	setTrayIcon();
	trayIcon->show();	
	
	agent_cfg = (struct agent_cfg*)calloc(1, sizeof(struct agent_cfg));
	agent_cfg->ev.on_log = this->onLog;

	if (agent_config_init(agent_cfg)) {
		jlog(L_ERROR, "agent_config_init failed");
		return;
	}

	if (agent_cfg->auto_connect != 0) {
		emit this->generalSettings->slotCheckAutoConnect();
		emit accountSettings->slotConnWaiting();
		emit this->slotFireConnection();
	}
}
Beispiel #11
0
void 
pcl::modeler::MainWindow::connectFileMenuActions()
{
  connect(this->ui_->actionOpenPointCloud, SIGNAL(triggered()), this, SLOT(slotOpenPointCloud()));
  connect(this->ui_->actionImportPointCloud, SIGNAL(triggered()), this, SLOT(slotImportPointCloud()));
  connect(this->ui_->actionSavePointCloud, SIGNAL(triggered()), this, SLOT(slotSavePointCloud()));
  connect(this->ui_->actionClosePointCloud, SIGNAL(triggered()), this, SLOT(slotClosePointCloud()));
  createRecentPointCloudActions();

  connect(this->ui_->actionOpenProject, SIGNAL(triggered()), this, SLOT(slotOpenProject()));
  connect(this->ui_->actionSaveProject, SIGNAL(triggered()), this, SLOT(slotSaveProject()));
  connect(this->ui_->actionCloseProject, SIGNAL(triggered()), this, SLOT(slotCloseProject()));
  createRecentProjectActions();

  connect(this->ui_->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
}
Beispiel #12
0
DbgMainWindow::DbgMainWindow(IGui *igui, event_def *init_done) {
    igui_ = igui;
    initDone_ = init_done;

    setWindowTitle(tr("RISC-V platform debugger"));
    resize(QDesktopWidget().availableGeometry(this).size() * 0.7);

    listConsoleListeners_.make_list(0);
    /** Console commands used by main window: */
    cmdIsRunning_.make_string("isrunning");
    cmdRun_.make_string("c");
    cmdHalt_.make_string("halt");
    cmdStep_.make_string("c 1");
 
    createActions();
    createMenus();
    createStatusBar();
    createMdiWindow();

    /** QT documeneted behaviour:
     *
     * If you add a child widget to an already visible widget 
     * you must explicitly show the child to make it visible.
     *
     * @todo Fix exception with PNP when initially opened 
     */
    addWidgets();
    
    setUnifiedTitleAndToolBarOnMac(true);

    /** 
     * To use the following type in SIGNAL -> SLOT definitions 
     * we have to register them using qRegisterMetaType template
     */
    qRegisterMetaType<uint64_t>("uint64_t");
    qRegisterMetaType<uint32_t>("uint32_t");

    connect(this, SIGNAL(signalPostInit(AttributeType *)),
            this, SLOT(slotPostInit(AttributeType *)));
    connect(this, SIGNAL(signalExit()), this, SLOT(slotExit()));

    tmrGlobal_ = new QTimer(this);
    connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotConfigDone()));
    tmrGlobal_->setSingleShot(true);
    tmrGlobal_->setInterval(1);
    tmrGlobal_->start();
}
Beispiel #13
0
Datei: main.cpp Projekt: KDE/kppp
TopWidget::TopWidget() : KXmlGuiWindow(0) {
  // Check command line args for "-kppp"

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  bool kpppmode = args->isSet("kppp");
  args->clear();

  setCaption(i18n("KPPP Log Viewer"));

  w = new QWidget(this);
  QBoxLayout *l = new QVBoxLayout(w);
  l->setSpacing(5);

  td = new QTabWidget(w);
  mw = new MonthlyWidget();
  td->addTab(mw, i18n("Monthly Log"));

  // remove buttons
  if(!kpppmode) {
    // create menu
    mb = new KMenuBar;
    l->addWidget(mb);
    l->addWidget(td);
    QMenu *fm = new QMenu;
    QAction *action = fm->addAction(QIcon(SmallIcon("application-exit")), KStandardGuiItem::quit().text());
    action->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(action,SIGNAL(triggered()), this, SLOT(slotExit()));
    fm->setTitle(i18n("&File"));
    mb->addMenu(fm);
  } else {
    l->addWidget(td);
    mb = 0;
    QPushButton *but = new KPushButton(KStandardGuiItem::close(),w);
    QHBoxLayout *lh = new QHBoxLayout();
    l->addItem(lh);
    lh->addStretch(10);
    lh->addWidget(but);

    connect(but, SIGNAL(clicked()),
	    kapp, SLOT(quit()));
  }

  setMinimumSize(mw->sizeHint().width() + 15,
                 mw->sizeHint().height() + 120);
  setCentralWidget(w);
}
Beispiel #14
0
/*!
 * Setup the user interface
 */
void MainWindow::setupUi() {
    this->setMinimumSize(640, 480);
    this->resize(800, 600);
    actionAboutCaSSiS = new QAction(this);
    actionAboutQt = new QAction(this);
    actionOpenPhylogram = new QAction(this);
    actionOpenBGRT = new QAction(this);
    actionManualSearch = new QAction(this);
    actionSaveResults = new QAction(this);
    actionClose = new QAction(this);
    actionExit = new QAction(this);
    actionMatchSelection = new QAction(this);
    actionMarkResults = new QAction(this);
    centralwidget = new QWidget(this);
    verticalLayout = new QVBoxLayout(centralwidget);
    mainSplitter = new QSplitter(centralwidget);
    mainSplitter->setOrientation(Qt::Horizontal);
    treeView = new TreeView(mainSplitter);
    mainSplitter->addWidget(treeView);
    resultTab = new ResultTab(mainSplitter);
    mainSplitter->addWidget(resultTab);

    verticalLayout->addWidget(mainSplitter);

    this->setCentralWidget(centralwidget);
    menubar = new QMenuBar(this);
    menubar->setGeometry(QRect(0, 0, 800, 24));
    menuFile = new QMenu(menubar);
    menuAbout = new QMenu(menubar);
    this->setMenuBar(menubar);
    statusbar = new QStatusBar(this);
    this->setStatusBar(statusbar);

    menubar->addAction(menuFile->menuAction());
    menubar->addAction(menuAbout->menuAction());
    //
    menuFile->addAction(actionOpenPhylogram);
    connect(actionOpenPhylogram, SIGNAL(triggered()), treeView,
            SLOT(slotOpenPhylo()));
    //
    menuFile->addAction(actionOpenBGRT);
    connect(actionOpenBGRT, SIGNAL(triggered()), resultTab,
            SLOT(slotOpenBGRT()));
    //
    menuFile->addSeparator();
    menuFile->addAction(actionManualSearch);
    menuFile->addAction(actionMatchSelection);
    menuFile->addSeparator();
    menuFile->addAction(actionMarkResults);
    menuFile->addAction(actionSaveResults);
    menuFile->addSeparator();
    menuFile->addAction(actionClose);
    //
    menuFile->addAction(actionExit);
    connect(actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
    //
    menuAbout->addAction(actionAboutCaSSiS);
    connect(actionAboutCaSSiS, SIGNAL(triggered()), this, SLOT(slotAbout()));
    //
    menuAbout->addAction(actionAboutQt);
    connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(slotAboutQt()));
    //
    connect(treeView, SIGNAL(triggerGroupMatch(const QStringList &)), resultTab,
            SLOT(slotGroupMatch(const QStringList &)));

    retranslateUi();
}
Beispiel #15
0
int qtbook::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotResizeColumns(); break;
        case 1: slotDisplaySummary(); break;
        case 2: slotExit(); break;
        case 3: slotAbout(); break;
        case 4: slotAllGo(); break;
        case 5: slotQuery(); break;
        case 6: slotReset(); break;
        case 7: slotDelete(); break;
        case 8: slotModify(); break;
        case 9: slotSearch(); break;
        case 10: slotRefresh(); break;
        case 11: slotRequest(); break;
        case 12: slotAddAdmin(); break;
        case 13: slotCheckout(); break;
        case 14: slotCDSearch(); break;
        case 15: slotInsertCD(); break;
        case 16: slotNextPage(); break;
        case 17: slotSaveUser(); break;
        case 18: slotSetFonts(); break;
        case 19: slotShowGrid(); break;
        case 20: slotShowMenu(); break;
        case 21: slotShowNext(); break;
        case 22: slotShowPrev(); break;
        case 23: slotConnectDB(); break;
        case 24: slotCopyError(); break;
        case 25: slotDVDSearch(); break;
        case 26: slotDuplicate(); break;
        case 27: slotInsertMag(); break;
        case 28: slotInsertDVD(); break;
        case 29: slotMagSearch(); break;
        case 30: slotPrintView(); break;
        case 31: slotBookSearch(); break;
        case 32: slotChangeView((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 33: slotDisconnect(); break;
        case 34: slotInsertBook(); break;
        case 35: slotSaveConfig(); break;
        case 36: slotSetColumns(); break;
        case 37: slotAddBorrower(); break;
        case 38: slotDeleteAdmin(); break;
        case 39: slotExportAsCSV(); break;
        case 40: slotJournSearch(); break;
        case 41: slotPageClicked((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 42: slotViewDetails(); break;
        case 43: slotReserveCopy(); break;
        case 44: slotShowColumns(); break;
        case 45: slotShowHistory(); break;
        case 46: slotInsertJourn(); break;
        case 47: slotPreviousPage(); break;
        case 48: slotRemoveMember(); break;
        case 49: slotSavePassword(); break;
        case 50: slotCancelAddUser(); break;
        case 51: slotBranchChanged(); break;
        case 52: slotPrintReserved(); break;
        case 53: slotResetErrorLog(); break;
        case 54: slotModifyBorrower(); break;
        case 55: slotSectionResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 56: slotAutoPopOnFilter(); break;
        case 57: slotClearSqliteMenu((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 58: slotGrantPrivileges(); break;
        case 59: slotInsertVideoGame(); break;
        case 60: slotShowAdminDialog(); break;
        case 61: slotShowCustomQuery(); break;
        case 62: slotShowErrorDialog(); break;
        case 63: slotVideoGameSearch(); break;
        case 64: slotListOverdueItems(); break;
        case 65: slotRefreshAdminList(); break;
        case 66: slotResetLoginDialog(); break;
        case 67: slotShowConnectionDB(); break;
        case 68: slotListReservedItems(); break;
        case 69: slotExecuteCustomQuery(); break;
        case 70: slotSaveAdministrators(); break;
        case 71: slotSelectDatabaseFile(); break;
        case 72: slotShowChangePassword(); break;
        case 73: slotShowDbEnumerations(); break;
        case 74: slotShowMembersBrowser(); break;
        case 75: slotSqliteFileSelected((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 76: slotCloseMembersBrowser(); break;
        case 77: slotAdminCheckBoxClicked((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 78: slotSceneSelectionChanged(); break;
        case 79: slotCloseCustomQueryDialog(); break;
        case 80: slotDisplayNewSqliteDialog(); break;
        case 81: slotPopulateMembersBrowser(); break;
        case 82: slotResizeColumnsAfterSort(); break;
        case 83: slotUpdateIndicesAfterSort((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 84: slotPrintReservationHistory(); break;
        default: ;
        }
        _id -= 85;
    }
    return _id;
}
Beispiel #16
0
void MainWindow::createActions()
{
  if(opt.arg_debug) printf("createActions\n");

  if(opt.arg_disable == 0)
  {
    optionAct = new QAction(QIcon(":/images/option.png"), l_options, this);
#ifndef USE_MAEMO
    optionAct->setShortcut(tr("Ctrl+O"));
#endif
    optionAct->setStatusTip(l_status_options);
    connect(optionAct, SIGNAL(triggered()), this, SLOT(slotFileOpt()));
  }

  if(opt.arg_disable == 0)
  {
    windowAct = new QAction(QIcon(":/images/window.png"), l_new_window, this);
    windowAct->setShortcut(tr("Ctrl+N"));
    windowAct->setStatusTip(l_status_new_window);
    connect(windowAct, SIGNAL(triggered()), this, SLOT(slotWindow()));

    newtabAct = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this);
    //newtabAct->setShortcut(tr("Ctrl+N"));
    newtabAct->setStatusTip(l_status_new_tab);
    connect(newtabAct, SIGNAL(triggered()), this, SLOT(slotNewTab()));
  }

  reconnectAct = new QAction(QIcon(":/images/view-refresh.png"), l_reconnect, this);
  reconnectAct->setShortcut(tr("Ctrl+R"));
  reconnectAct->setStatusTip(l_status_reconnect);
  connect(reconnectAct, SIGNAL(triggered()), this, SLOT(slotReconnect()));

  storebmpAct = new QAction(QIcon(":/images/storebmp.png"), l_save_as_bmp, this);
  storebmpAct->setShortcut(tr("Ctrl+B"));
  storebmpAct->setStatusTip(l_status_save_as_bmp);
  connect(storebmpAct, SIGNAL(triggered()), this, SLOT(slotStorebmp()));

  gohomeAct = new QAction(QIcon(":/images/gohome.png"), opt.initialhost, this);
  gohomeAct->setStatusTip(opt.initialhost);
  connect(gohomeAct, SIGNAL(triggered()), this, SLOT(slotGohome()));

  logbmpAct = new QAction(QIcon(":/images/logbmp.png"), l_log_as_bmp, this);
  logbmpAct->setStatusTip(l_status_log_as_bmp);
  connect(logbmpAct, SIGNAL(triggered()), this, SLOT(slotLogbmp()));

  logpvmAct = new QAction(QIcon(":/images/logpvm.png"), l_log_as_pvm, this);
  logpvmAct->setStatusTip(l_status_log_as_pvm);
  connect(logpvmAct, SIGNAL(triggered()), this, SLOT(slotLogpvm()));

  printAct = new QAction(QIcon(":/images/print.png"), l_print, this);
  printAct->setShortcut(tr("Ctrl+P"));
  printAct->setStatusTip(l_status_print);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));

  newtabActToolBar = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this);
  newtabActToolBar->setStatusTip(l_status_new_tab);
  connect(newtabActToolBar, SIGNAL(triggered()), this, SLOT(slotNewTab()));

  exitAct = new QAction(QIcon(":/images/exit.png"), l_exit, this);
  exitAct->setShortcut(tr("Ctrl+Q"));
  exitAct->setStatusTip(l_status_exit);
  connect(exitAct, SIGNAL(triggered()), this, SLOT(slotExit()));

  copyAct = new QAction(QIcon(":/images/copy.png"), l_copy, this);
  copyAct->setShortcut(tr("Ctrl+C"));
  copyAct->setStatusTip(l_status_copy);
  connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));

  if(opt.arg_disable == 0)
  {
    editmenuAct = new QAction(l_editmenu, this);
    editmenuAct->setShortcut(tr("Ctrl+E"));
    editmenuAct->setStatusTip(l_status_editmenu);
    connect(editmenuAct, SIGNAL(triggered()), this, SLOT(slotEditmenu()));
    addAction(editmenuAct);

    toolbarAct = new QAction(QIcon(":/images/toolbar.png"), l_toolbar, this);
    toolbarAct->setShortcut(tr("Ctrl+T"));
    toolbarAct->setStatusTip(l_status_toolbar);
    connect(toolbarAct, SIGNAL(triggered()), this, SLOT(slotToolbar()));
    addAction(toolbarAct);

    statusbarAct = new QAction(QIcon(":/images/statusbar.png"), l_statusbar, this);
    statusbarAct->setShortcut(tr("Ctrl+S"));
    statusbarAct->setStatusTip(l_status_statusbar);
    connect(statusbarAct, SIGNAL(triggered()), this, SLOT(slotStatusbar()));
    addAction(statusbarAct);

    maximizedAct = new QAction(l_maximized, this);
    maximizedAct->setShortcut(tr("Ctrl+M"));
    maximizedAct->setStatusTip(l_status_toggle_maximized);
    connect(maximizedAct, SIGNAL(triggered()), this, SLOT(slotMaximized()));
    addAction(maximizedAct);

    fullscreenAct = new QAction(QIcon(":/images/fullscreen.png"), l_fullscreen, this);
    fullscreenAct->setShortcut(tr("Ctrl+F"));
    fullscreenAct->setStatusTip(l_status_toggle_full_screen);
    connect(fullscreenAct, SIGNAL(triggered()), this, SLOT(slotFullscreen()));
    addAction(fullscreenAct);
  }

  manualAct = new QAction(l_manual, this);
  manualAct->setShortcut(tr("Ctrl+H"));
  manualAct->setStatusTip(l_status_manual);
  connect(manualAct, SIGNAL(triggered()), this, SLOT(slotManual()));

  aboutAct = new QAction(l_about, this);
  aboutAct->setStatusTip(l_status_about);
  connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

  aboutQtAct = new QAction("About &Qt", this);
  aboutQtAct->setStatusTip("About Qt library");
  connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

  logoAct = new QAction(QIcon(":/images/app.png"),"pvbrowser", this);
  logoAct->setStatusTip(tr("About pvbrowser"));
  connect(logoAct, SIGNAL(triggered()), this, SLOT(about()));
}
Beispiel #17
0
MainWindow::~MainWindow()
{
  if(opt.arg_debug) printf("MainWindow::~MainWindow()\n");
  slotExit();
}
Beispiel #18
0
void MainWindow::initMenu()
{
	//file
	_fileMenu = menuBar()->addMenu(QWidget::tr("文件(&F)"));
	QAction* actionNewFile = new QAction(QIcon(":/images/new.png"), QWidget::tr("新建(&New)"), this);
	actionNewFile->setShortcut(QWidget::tr("Ctrl+N"));
	actionNewFile->setToolTip(QWidget::tr("新建场景文件"));
	connect(actionNewFile, SIGNAL(triggered()), this, SLOT(slotNewFile()));
	_fileMenu->addAction(actionNewFile);
	QAction* actionOpenFile = new QAction(QIcon(":/images/open.png"), QWidget::tr("打开(&Open)"), this);
	actionOpenFile->setShortcut(QWidget::tr("Ctrl+O"));
	actionOpenFile->setToolTip(QWidget::tr("打开一个场景文件"));
	connect(actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
	_fileMenu->addAction(actionOpenFile);
	QAction* actionSaveFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("保存(&Save)"), this);
	actionSaveFile->setShortcut(QWidget::tr("Ctrl+S"));
	actionSaveFile->setToolTip(QWidget::tr("保存场景文件"));
	actionSaveFile->setEnabled(false);
	connect(actionSaveFile, SIGNAL(triggered()), this, SLOT(slotSaveFile()));
	_fileMenu->addAction(actionSaveFile);
	QAction* actionSaveAsFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("另存(SaveAs)"), this);
	actionSaveAsFile->setToolTip(QWidget::tr("另存场景文件"));
	actionSaveAsFile->setEnabled(false);
	connect(actionSaveAsFile, SIGNAL(triggered()), this, SLOT(slotSaveAsFile()));
	_fileMenu->addAction(actionSaveAsFile);
	QAction* actionExit = new QAction(QIcon(":/images/close.png"), QWidget::tr("退出(&X)"), this);
	actionExit->setToolTip(QWidget::tr("退出场景编辑器"));
	connect(actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
	_fileMenu->addAction(actionExit);
	//edit
	_editMenu = menuBar()->addMenu(QWidget::tr("编辑(&E)"));
	QAction* actionUndo = new QAction(QIcon(":/images/undo.png"), QWidget::tr("撤销"), this);
	actionUndo->setShortcut(QWidget::tr("Ctrl+Z"));
	actionUndo->setToolTip(QWidget::tr("撤销Ctrl+Z"));
	actionUndo->setEnabled(false);
	connect(actionUndo, SIGNAL(triggered()), this, SLOT(slotUndo()));
	_editMenu->addAction(actionUndo);
	QAction* actionRedo = new QAction(QIcon(":/images/redo.png"), QWidget::tr("重做"), this);
	actionRedo->setShortcut(QWidget::tr("Ctrl+Y"));
	actionRedo->setToolTip(QWidget::tr("重做Ctrl+Y"));
	actionRedo->setEnabled(false);
	connect(actionRedo, SIGNAL(triggered()), this, SLOT(slotRedo()));
	_editMenu->addAction(actionRedo);
	QAction* actionCopy = new QAction(QIcon(":/images/copy.png"), QWidget::tr("复制"), this);
	actionCopy->setShortcut(QWidget::tr("Ctrl+C"));
	actionCopy->setToolTip(QWidget::tr("复制Ctrl+C"));
	actionCopy->setEnabled(false);
	connect(actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy()));
	_editMenu->addAction(actionCopy);
	QAction* actionRotateFast = new QAction(QIcon(":/images/rotate.png"), QWidget::tr("快速旋转"), this);
	actionRotateFast->setShortcut(QKeySequence(Qt::Key_F3));
	actionRotateFast->setToolTip(QWidget::tr("快速旋转F3"));
	actionRotateFast->setEnabled(false);
	connect(actionRotateFast, SIGNAL(triggered()), this, SLOT(slotRotateFast()));
	_editMenu->addAction(actionRotateFast);
	QAction* actionAlign = new QAction(QIcon(":/images/align.png"), QWidget::tr("对齐"), this);
	actionAlign->setShortcut(QWidget::tr("Ctrl+L"));
	actionAlign->setToolTip(QWidget::tr("对齐Ctrl+L"));
	actionAlign->setEnabled(false);
	connect(actionAlign, SIGNAL(triggered()), this, SLOT(slotAlign()));
	_editMenu->addAction(actionAlign);
	QAction* actionDelete = new QAction(QIcon(":/images/delete.png"), QWidget::tr("删除"), this);
	actionDelete->setShortcut(QKeySequence(QKeySequence::Delete));
	actionDelete->setToolTip(QWidget::tr("删除Delete"));
	actionDelete->setEnabled(false);
	connect(actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete()));
	_editMenu->addAction(actionDelete);
	//windowsMenu
	_windowsMenu = menuBar()->addMenu(QWidget::tr("窗口(&W)"));
	QAction* actionObjectsTreeDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("场景树(&ObjTree)"), this);
	actionObjectsTreeDockWidget->setShortcut(QKeySequence("h"));
	actionObjectsTreeDockWidget->setToolTip(QWidget::tr("打开或隐藏对象树窗口"));
	actionObjectsTreeDockWidget->setEnabled(false);
	connect(actionObjectsTreeDockWidget, SIGNAL(triggered()), this, SLOT(slotObjectTreeWidgetActive()));
	_windowsMenu->addAction(actionObjectsTreeDockWidget);
	QAction* actionPropertyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("属性窗"), this);
	actionPropertyDockWidget->setToolTip(QWidget::tr("打开或隐藏属性窗口"));
	actionPropertyDockWidget->setEnabled(false);
	connect(actionPropertyDockWidget, SIGNAL(triggered()), this, SLOT(slotPropertyDockWidgetActive()));
	_windowsMenu->addAction(actionPropertyDockWidget);
	QAction* actionBuiltinResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("内置资源列表"), this);
	actionBuiltinResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏内置资源列表窗口"));
	actionBuiltinResourcesDockWidget->setEnabled(false);
	connect(actionBuiltinResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotBuiltinResourcesDockWidgetActive()));
	_windowsMenu->addAction(actionBuiltinResourcesDockWidget);
	QAction* actionvdsResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("资源列表"), this);
	actionvdsResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏资源列表窗口"));
	actionvdsResourcesDockWidget->setEnabled(false);
	connect(actionvdsResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotvdsResourcesDockWidgetActive()));
	_windowsMenu->addAction(actionvdsResourcesDockWidget);
	QAction* actionCSharpAssemblyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("脚本列表"), this);
	actionCSharpAssemblyDockWidget->setToolTip(QWidget::tr("打开或隐藏脚本列表窗口"));
	actionCSharpAssemblyDockWidget->setEnabled(false);
	connect(actionCSharpAssemblyDockWidget, SIGNAL(triggered()), this, SLOT(slotCSharpAssemblyDockWidgetActive()));
	_windowsMenu->addAction(actionCSharpAssemblyDockWidget);
	//tool
	_toolMenu = menuBar()->addMenu(QWidget::tr("工具(&T)"));
	QAction* actionAnimationMerge = new QAction(QIcon(":/images/default.png"), QWidget::tr("动画合并(&AnimationMerge)"), this);
	actionAnimationMerge->setToolTip(QWidget::tr("完成骨骼动画合并"));
	actionAnimationMerge->setEnabled(false);
	connect(actionAnimationMerge, SIGNAL(triggered()), this, SLOT(slotAnimationMerge()));
	_toolMenu->addAction(actionAnimationMerge);
	QAction* particleEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("粒子编辑(&Particle)"), this);
	particleEdit->setToolTip(QWidget::tr("编辑粒子效果"));
	particleEdit->setEnabled(false);
	connect(particleEdit, SIGNAL(triggered()), this, SLOT(slotParticleEdit()));
	_toolMenu->addAction(particleEdit);
	QAction* actionPlantBrushDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("植被编辑"), this);
	actionPlantBrushDockWidget->setToolTip(QWidget::tr("打开或隐藏植被编辑窗口"));
	actionPlantBrushDockWidget->setEnabled(false);
	connect(actionPlantBrushDockWidget, SIGNAL(triggered()), this, SLOT(slotPlantBrushDockWidgetActive()));
	_toolMenu->addAction(actionPlantBrushDockWidget);
	QAction* actionViewPointEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点编辑(&ViewPoint)"), this);
	actionViewPointEdit->setToolTip(QWidget::tr("定义视点"));
	actionViewPointEdit->setEnabled(false);
	connect(actionViewPointEdit, SIGNAL(triggered()), this, SLOT(slotViewPointEdit()));
	_toolMenu->addAction(actionViewPointEdit);
	QAction* actionPhysicalEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("物理编辑"), this);
	actionPhysicalEdit->setToolTip(QWidget::tr("定义碰撞体或碰撞面"));
	actionPhysicalEdit->setEnabled(false);
	connect(actionPhysicalEdit, SIGNAL(triggered()), this, SLOT(slotPhysicalEditDockWidgetActive()));
	_toolMenu->addAction(actionPhysicalEdit);
	QAction* actionRiverEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("河流编辑"), this);
	actionRiverEdit->setToolTip(QWidget::tr("定义河流效果"));
	actionRiverEdit->setEnabled(false);
	connect(actionRiverEdit, SIGNAL(triggered()), this, SLOT(slotRiverEditDockWidgetActive()));
	_toolMenu->addAction(actionRiverEdit);
	QAction* modelConvert = new QAction(QIcon(":/images/default.png"), QWidget::tr("模型转换(&ConvertModel)"), this);
	modelConvert->setToolTip(QWidget::tr("转换模型到其他平台"));
	modelConvert->setEnabled(true);
	connect(modelConvert, SIGNAL(triggered()), this, SLOT(slotConvertModel()));
	_toolMenu->addAction(modelConvert);
	QAction* compressDir = new QAction(QIcon(":/images/default.png"), QWidget::tr("压缩文件夹"), this);
	compressDir->setToolTip(QWidget::tr("压缩文件夹,可以设定文件名编码"));
	compressDir->setEnabled(true);
	connect(compressDir, SIGNAL(triggered()), this, SLOT(slotCompressDir()));
	_toolMenu->addAction(compressDir);
	//animation
	_animationMenu = menuBar()->addMenu(QWidget::tr("动画(&A)"));
	///////////////////////////////////////////////////////////////////should move to PlotAnimation later
	QAction* actionViewPointAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点动画编辑"), this);
	actionViewPointAnimationEdit->setToolTip(QWidget::tr("编辑视点动画"));
	actionViewPointAnimationEdit->setEnabled(false);
	connect(actionViewPointAnimationEdit, SIGNAL(triggered()), this, SLOT(slotViewPointAnimationEdit()));
	_animationMenu->addAction(actionViewPointAnimationEdit);
	QAction* actionPlotAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("剧情编辑"), this);
	actionPlotAnimationEdit->setToolTip(QWidget::tr("编辑一段剧情"));
	actionPlotAnimationEdit->setEnabled(false);
	connect(actionPlotAnimationEdit, SIGNAL(triggered()), this, SLOT(slotPlotAnimationEdit()));
	_animationMenu->addAction(actionPlotAnimationEdit);
}
Beispiel #19
0
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
	, m_ui(new Ui::MainWindow)
	, m_inst(0)
	, m_aspect(-1)
	, m_preview(0)
	, m_previewDock(0)
	, m_posBoxLock(false)
	, m_accelBoxLock(false)
	, m_pos(0)
	, m_setPosLock(false)
{
	static_mainWindow = this;
	m_ui->setupUi(this);

	setWindowTitle("Teleprompter - DViz");
	setWindowIcon(QIcon(":/data/icon-d.png"));

	connect(m_ui->actionOpen_Text_File, SIGNAL(triggered()), this, SLOT(slotOpen()));
	connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSave()));
	connect(m_ui->actionSave_As, SIGNAL(triggered()), this, SLOT(slotSaveAs()));
	connect(m_ui->actionSetup_Outputs, SIGNAL(triggered()), this, SLOT(slotOutputSetup()));
	connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
	
	m_ui->playBtn->setIcon(QIcon(":/data/action-play.png"));
	connect(m_ui->playBtn, SIGNAL(clicked()), this, SLOT(slotTogglePlay()));
	
	connect(m_ui->posBox, SIGNAL(valueChanged(int)), this, SLOT(slotPosBoxChanged(int)));
	connect(m_ui->accelBox, SIGNAL(valueChanged(int)), this, SLOT(slotAccelBoxChanged(int)));
	connect(m_ui->accelResetBtn, SIGNAL(clicked()), this, SLOT(slotResetAccel()));
	m_ui->accelResetBtn->setIcon(QIcon(":/data/stock-undo.png"));
	m_ui->accelResetBtn->setToolTip("Reset to Normal Speed (CTRL+SHIFT+Z)");
	m_ui->accelResetBtn->setShortcut(QString(tr("CTRL+SHIFT+Z")));
	
	connect(&m_animTimer, SIGNAL(timeout()), this, SLOT(animate()));
	m_animTimer.setInterval(ANIMATE_BASE_MS);
	
	m_editor = new RichTextEditorWidget(m_ui->mainWidget);
	QLayoutItem * firstItem = m_ui->mainWidget->layout()->takeAt(0);
	m_ui->mainWidget->layout()->addWidget(m_editor);
	m_ui->mainWidget->layout()->addItem(firstItem);
	
	connect(m_editor, SIGNAL(contentsChanged()), this, SLOT(slotTextChanged()));
	
	m_ui->actionSetup_Outputs->setIcon(QIcon(":data/stock-preferences.png"));

	QSettings s;
	bool flag = s.value("teleprompter/firstrun",true).toBool();
	if(flag)
	{
		s.setValue("teleprompter/firstrun",false);
		slotOutputSetup();
	}
	
	AppSettings::setGridEnabled(false);
	

	Output * output = AppSettings::outputs().first();
	m_previewDock = new QDockWidget(QString(tr("%1 Preiew")).arg(output->name()), this);
	m_previewDock->setObjectName(output->name());

	m_preview = new OutputViewer(0,m_previewDock);
	m_previewDock->setWidget(m_preview);
	addDockWidget(Qt::BottomDockWidgetArea, m_previewDock);
	
	m_group = new SlideGroup();
	m_group->setGroupTitle("Group"); //AbstractItem::guessTitle(QFileInfo(fileName).baseName()));
		
	m_slide = new Slide();
	
	m_textbox = new TextBoxItem();
	m_textbox->setItemId(ItemFactory::nextId());
	m_textbox->setItemName(QString("TextBoxItem%1").arg(m_textbox->itemId()));



	AbstractVisualItem * bg = dynamic_cast<AbstractVisualItem*>(m_slide->background());

// 	qDebug() << "Slide "<<slideNum<<": [\n"<<tmpList.join("\n")<<"\n]";;

	bg->setFillType(AbstractVisualItem::Solid);
	bg->setFillBrush(Qt::black);


	// Outline pen for the text
	QPen pen = QPen(Qt::black,1.5);
	pen.setJoinStyle(Qt::MiterJoin);

	m_textbox->setPos(QPointF(0,0));
	m_textbox->setOutlinePen(pen);
	m_textbox->setOutlineEnabled(true);
	m_textbox->setFillBrush(Qt::white);
	m_textbox->setFillType(AbstractVisualItem::Solid);
	m_textbox->setShadowEnabled(false);
// 	m_textbox->setShadowBrush(Qt::red);
//  	m_textbox->setShadowBlurRadius(3);

	m_slide->addItem(m_textbox);
	
	m_slide->setSlideNumber(0);
	m_group->addSlide(m_slide);
	
	openOutput();
	
	m_inst->setSlideGroup(m_group);
	
	openTextFile("test.txt");
	
}