コード例 #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowIcon(QIcon(":icons/icon.png"));
    setWindowTitle("quickly translate");
    QSystemTrayIcon * trayIcon = new QSystemTrayIcon(this);
    mNetManager = new QNetworkAccessManager(this);
    mLangageModel = new LanguageModel;

    trayIcon->setIcon(QIcon(":icons/icon.png"));

    trayIcon->setContextMenu(ui->menuFile);
    trayIcon->show();

    ui->dockWidget->hide();
    ui->sourceComboBox->setModel(mLangageModel);
    ui->targetComboBox->setModel(mLangageModel);

    QDesktopWidget * desktop = new QDesktopWidget;

    QPoint startPos = QPoint(desktop->geometry().bottomRight() );
    QPoint finalPos = desktop->geometry().center() - QPoint(width()/2,height()/2);

    move(finalPos);
    connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exit()));
    connect(ui->translateButton,SIGNAL(clicked()),this,SLOT(translate()));
    connect(ui->sourceTextEdit,SIGNAL(returnPressed()),this,SLOT(translate()));
    connect(ui->swapButton,SIGNAL(clicked()),this,SLOT(swapLangages()));

    connect(ui->actionCopy,SIGNAL(triggered()),this,SLOT(copy()));
    connect(ui->actionCut,SIGNAL(triggered()),this,SLOT(cut()));
    connect(ui->actionPast,SIGNAL(triggered()),this,SLOT(past()));
    connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences()));
    connect(ui->actionAboutQt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout()));
    connect(ui->actionTTS,SIGNAL(triggered()),this,SLOT(showTextTTS()));


    connect(ui->sourceSoundButton,SIGNAL(clicked()),this,SLOT(textToSpeak()));
    connect(ui->targetSoundButton,SIGNAL(clicked()),this,SLOT(textToSpeak()));


    //    mPropertyAnimation  = new QPropertyAnimation(this, "pos");
    //    mPropertyAnimation->setDuration(800);
    //    mPropertyAnimation->setStartValue(startPos);
    //    mPropertyAnimation->setEndValue(finalPos);


    //load default langage

    QSettings settings;
    QString sourceId = settings.value("source").toString();
    QString targetId = settings.value("target").toString();
    ui->sourceComboBox->setCurrentIndex(mLangageModel->findLangageId(sourceId));
    ui->targetComboBox->setCurrentIndex(mLangageModel->findLangageId(targetId));

}
コード例 #2
0
ファイル: MainWindow.cpp プロジェクト: Anvarcz/vcard-editor
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->actionNew_project, SIGNAL(triggered()), SLOT(addNewProject()));
    connect(ui->actionOpen_project, SIGNAL(triggered()), SLOT(openProject()));
    connect(ui->actionSave_project, SIGNAL(triggered()), SLOT(saveProject()));
    connect(ui->actionSave_project_as, SIGNAL(triggered()), SLOT(saveProjectAs()));
    connect(ui->actionClose_project, SIGNAL(triggered()), SLOT(closeProject()));

    connect(ui->actionUndo, SIGNAL(triggered()), SLOT(undo()));
    connect(ui->actionRedo, SIGNAL(triggered()), SLOT(redo()));

    connect(ui->actionImport, SIGNAL(triggered()), SLOT(importProject()));
    connect(ui->actionExport, SIGNAL(triggered()), SLOT(exportProject()));

    connect(ui->actionAbout, SIGNAL(triggered()), SLOT(showAbout()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), SLOT(showAboutQt()));

    QString fileName =
          //"/home/gogi/Downloads/pcsc_pcsc_00001.vcf";
          "G:\\pcsc_pcsc_00001.vcf";
    QFile file(fileName);
    //showProject(new VCardProject(file));

    updateProjectState();
}
コード例 #3
0
ファイル: mainwidget.cpp プロジェクト: MarcoLeongDev/qcma
void MainWidget::createTrayIcon()
{    
    trayIcon = createTrayObject(this);
    trayIcon->init();

#ifndef Q_OS_WIN32
    trayIcon->setIcon("qcma_off");
#else
    trayIcon->setIcon("tray/qcma_off_16");
#endif
    trayIcon->show();

    connect(trayIcon, SIGNAL(openConfig()), this, SLOT(openConfig()));
    connect(trayIcon, SIGNAL(openManager()), this, SLOT(openManager()));
    connect(trayIcon, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
    connect(trayIcon, SIGNAL(showAboutDialog()), this, SLOT(showAboutDialog()));
    connect(trayIcon, SIGNAL(showAboutQt()), this, SLOT(showAboutQt()));
    connect(trayIcon, SIGNAL(stopServer()), this, SLOT(stopServer()));

    connect(managerForm, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnect(QString)));
    connect(managerForm, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
    connect(managerForm, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString)));
}
コード例 #4
0
ファイル: simmainwindow.cpp プロジェクト: dridk/estel
SimMainWindow::SimMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::SimMainWindow)
{
    ui->setupUi(this);
    mEngine = new LifeEngine(100,100);
    mView = new LifeEngineView(mEngine);
    mLifeFileView = new LifeFileView;
    mLifesView = new LifesView(mEngine);
    mUndoStack = new QUndoStack(this);
    mOldLifeCount = 0;

    ui->dock1->setWidget(mLifeFileView);
    ui->dock2->setWidget(mLifesView);

    ui->dock1->setWindowTitle(mLifeFileView->windowTitle());
    ui->dock2->setWindowTitle(mLifesView->windowTitle());

    setCentralWidget(mView);

    ui->menuEdit->addActions(mLifeFileView->actions());
    ui->menuEdit->addSeparator();
    ui->menuEdit->addActions(mLifesView->actions());


    connect(mView->gridView()->grid(),SIGNAL(squareClicked(QPoint)),this,SLOT(clicked(QPoint)));

    connect(ui->actionRun,SIGNAL(triggered()),this,SLOT(startSimulation()));
    connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newSim()));
    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveSim()));
    connect(ui->actionSaveAs,SIGNAL(triggered()),this,SLOT(saveAsSim()));
    connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openSim()));
    connect(ui->actionClear,SIGNAL(triggered()),this,SLOT(clear()));
    connect(ui->actionAnimator,SIGNAL(triggered()),this,SLOT(showAnimator()));
    connect(ui->actionLifeEditor,SIGNAL(triggered()),this,SLOT(showLifeEditor()));
    connect(mLifesView,SIGNAL(changed()),this,SLOT(refresh()));
    connect(mLifesView,SIGNAL(clicked()),this,SLOT(setGridSelection()));
    connect(ui->actionAboutQt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout()));


    connect(ui->actionUndo,SIGNAL(triggered()),mUndoStack,SLOT(undo()));
    connect(ui->actionRedo,SIGNAL(triggered()),mUndoStack,SLOT(redo()));
    connect(mUndoStack,SIGNAL(canUndoChanged(bool)),ui->actionUndo,SLOT(setEnabled(bool)));
    connect(mUndoStack,SIGNAL(canRedoChanged(bool)),ui->actionRedo,SLOT(setEnabled(bool)));

    ui->actionSave->setEnabled(false);
    newSim();
}
コード例 #5
0
TrayIcon::TrayIcon(QmlView * view, QObject *parent) :
    QSystemTrayIcon(parent)
{
    this->view = view;
    QMenu * menu = new QMenu();
    menu->addAction((tr("&End of day")), this, SLOT(showScore()));
    menu->addSeparator();
    menu->addAction(tr("&Tick"), this, SLOT(showTick()));
    menu->addAction(tr("&Manage..."), this, SLOT(showManage()));
    menu->addSeparator();
    menu->addAction(tr("&About"), this, SLOT(showAbout()));
    menu->addAction(tr("About &Qt"), this, SLOT(showAboutQt()));
    menu->addAction(tr("Exit"), this, SLOT(exitApp()));
    setContextMenu(menu);

    this->setIcon(QIcon(":/Gupaa.png"));
}
コード例 #6
0
bool ParamConverter::initMenuBar()
{
    mainMenuBar = menuBar();

    //edit menu
    editMenu = new QMenu("Edit");
    copyAction = new QAction("Copy", this);
    copyAction->setShortcut(QKeySequence::Copy);
    connect(copyAction, SIGNAL(triggered()), this, SLOT(editCopy()));

    cutAction  = new QAction("Cut", this);
    cutAction->setShortcut(QKeySequence::Cut);
    connect(cutAction, SIGNAL(triggered()), this, SLOT(editCut()));

    pasteAction  = new QAction("Paste", this);
    pasteAction->setShortcut(QKeySequence::Paste);
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(editPaste()));

    convertAction = new QAction("Convert", this);
    connect(convertAction, SIGNAL(triggered()), this, SLOT(editConvert()));

    editMenu->addAction(copyAction);
    editMenu->addAction(cutAction);
    editMenu->addAction(pasteAction);

    editMenu->addSeparator();
    editMenu->addAction(convertAction);

    helpMenu = new QMenu("Help");

    aboutAction = new QAction("About", this);
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAbout()));

    aboutQtAction = new QAction("About Qt", this);
    connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(showAboutQt()));

    helpMenu->addAction(aboutAction);
    helpMenu->addAction(aboutQtAction);

    mainMenuBar->addMenu(editMenu);
    mainMenuBar->addMenu(helpMenu);

    return true;
}
コード例 #7
0
void KDENotifierTray::init()
{
    options = new QAction(tr("Settings"), this);
    reload = new QAction(tr("Refresh database"), this);
    backup = new QAction(tr("Backup Manager"), this);
    about = new QAction(tr("About QCMA"), this);
    about_qt = new QAction(tr("About Qt"), this);
    quit = new QAction(tr("Quit"), this);

    connect(options, SIGNAL(triggered()), this, SIGNAL(openConfig()));
    connect(backup, SIGNAL(triggered()), this, SIGNAL(openManager()));
    connect(reload, SIGNAL(triggered()), this, SIGNAL(refreshDatabase()));
    connect(about, SIGNAL(triggered()), this, SIGNAL(showAboutDialog()));
    connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt()));
    connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer()));

#if QT_VERSION < 0x050000
    KMenu *tray_icon_menu = new KMenu(this);
#else
    QMenu *tray_icon_menu = new QMenu(this);
#endif

    tray_icon_menu->addAction(options);
    tray_icon_menu->addAction(reload);
    tray_icon_menu->addAction(backup);
    tray_icon_menu->addSeparator();
    tray_icon_menu->addAction(about);
    tray_icon_menu->addAction(about_qt);
    tray_icon_menu->addSeparator();
    tray_icon_menu->addAction(quit);

    m_notifier_item = new KDENotifier("QcmaNotifier", this);
    m_notifier_item->setContextMenu(tray_icon_menu);
    m_notifier_item->setTitle("Qcma");
    m_notifier_item->setCategory(KStatusNotifierItem::ApplicationStatus);
    m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/qcma_off.png"));
    m_notifier_item->setStatus(KStatusNotifierItem::Active);
    m_notifier_item->setToolTipTitle(tr("Qcma status"));
    m_notifier_item->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png"));
    m_notifier_item->setToolTipSubTitle(tr("Disconnected"));
    m_notifier_item->setStandardActionsEnabled(false);
}
コード例 #8
0
ファイル: clattr.cpp プロジェクト: blblblu/Clattr
Clattr::Clattr(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::Clattr)
{
	ui->setupUi(this);

	latexWorker = new LatexWorker;
	latexThread = new QThread;
	latexWorker->moveToThread(latexThread);
	latexThread->start();

	Letter letter;

	setUiData(letter);

	connect(ui->actionAbout,       SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(ui->actionAboutQt,     SIGNAL(triggered()), this, SLOT(showAboutQt()));
	connect(ui->actionExportAsTex, SIGNAL(triggered()), this, SLOT(exportAsTex()));
	connect(ui->actionLicense,     SIGNAL(triggered()), this, SLOT(showLicense()));
	connect(ui->actionNew,         SIGNAL(triggered()), this, SLOT(newFile()));
	connect(ui->actionOpen,        SIGNAL(triggered()), this, SLOT(openLetter()));
	connect(ui->actionSaveAs,      SIGNAL(triggered()), this, SLOT(saveLetterAs()));
	connect(ui->actionSettings,    SIGNAL(triggered()), this, SLOT(showSettings()));
}
コード例 #9
0
ファイル: mento.cpp プロジェクト: 981213/mentohust
Mento::Mento(QObject *parent) :
    QObject(parent)
{
    if(CocoaInitialize::DefaultApp()->checkRunning())
    {
        initsuccess=false;
        QMessageBox::warning(0,"Warning","Cocoa Mento 正在运行当中!",QMessageBox::Ok,QMessageBox::Ok);
        return;
    }
    else initsuccess=true;

    log=new QTextBrowser();
    log->setWindowModality(Qt::WindowModal);
    log->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
    log->setGeometry(200,200,400,500);
    log->setWindowTitle(tr("认证日志"));

    gt=new Guite();

    main=new Menu("Cocoa Mento");
    sub=new Menu("Settings");

    status=new MenuItem("[状态:正常] 未连接");
    connectHandle=new MenuItem("开始认证");
    settings=new MenuItem("偏好设置");
    about=new MenuItem("关于CocoaMento");
    aboutQt=new MenuItem("关于Qt");
    help=new MenuItem("使用说明");
    exit=new MenuItem("退出");
    resetsettings=new MenuItem("重置偏好设置");
    logs=new MenuItem("显示日志");

    cv=new ConfigView();
    cvcontainer=new MenuViewItem("Settings",cv);

    cv->setPalette(Qt::white);
    cv->show();

    settings->setSubMenu(sub);

    main->addMenuItem(status);
    main->addMenuSeparator();
    main->addMenuItem(connectHandle);
    main->addMenuItem(settings);
    main->addMenuItem(resetsettings);
    main->addMenuItem(logs);
    main->addMenuSeparator();
    main->addMenuItem(help);
    main->addMenuItem(about);
    main->addMenuItem(aboutQt);
    main->addMenuSeparator();
    main->addMenuItem(exit);

    sub->addMenuItem(cvcontainer);

    icon=new StatusIcon();
    icon->setMenu(main);
    icon->showIcon();

    mainthread=new MentoThread(cv->Config());

    connect((QObject*)exit->port,SIGNAL(trigger()),this,SLOT(quitApp()));
    connect((QObject*)resetsettings->port,SIGNAL(trigger()),cv,SLOT(resetConfig()));
    connect((QObject*)connectHandle->port,SIGNAL(trigger()),this,SLOT(toggleConnect()));
    connect((QObject*)logs->port,SIGNAL(trigger()),log,SLOT(show()));
    connect((QObject*)about->port,SIGNAL(trigger()),gt,SLOT(showAbout()));
    connect((QObject*)aboutQt->port,SIGNAL(trigger()),this,SLOT(showAboutQt()));
    connect((QObject*)help->port,SIGNAL(trigger()),gt,SLOT(showHelp()));


    connect(mainthread,SIGNAL(output(QString)),this,SLOT(outputHandle(QString)));
    connect(mainthread,SIGNAL(exitSuccess()),this,SLOT(exitHandle()));
    connect(mainthread,SIGNAL(statusChanged(QString,int)),this,SLOT(statusHandle(QString,int)));
    connect(mainthread,SIGNAL(error(QString)),this,SLOT(errorHandle(QString)));
    connect(mainthread,SIGNAL(authError()),this,SLOT(authMento()));
    connect(mainthread,SIGNAL(noConfig()),this,SLOT(noconfigHandle()));
    connect(mainthread,SIGNAL(notify(QString)),this,SLOT(notifyHandle(QString)));

    if(cv->autoConnect()) toggleConnect();
}
コード例 #10
0
AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
:
	QDialog(parent),
	ui(new Ui::AboutDialog),
	m_settings(settings),
	m_initFlags(new QMap<QWidget*,bool>),
	m_disque(NULL),
	m_disqueTimer(NULL),
	m_rotateNext(false),
	m_lastTab(0)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
	resize(this->minimumSize());
	
	//Disable "X" button
	if(firstStart)
	{
		MUtils::GUI::enable_close_button(this, false);
	}

	//Init images
	for(int i = 0; i < 4; i++)
	{
		m_cartoon[i] = NULL;
	}

	//Init tab widget
	connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));

	//Make transparent
	const type_info &styleType = typeid(*qApp->style());
	if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
	{
		MAKE_TRANSPARENT(ui->infoScrollArea);
		MAKE_TRANSPARENT(ui->contributorsScrollArea);
		MAKE_TRANSPARENT(ui->softwareScrollArea);
		MAKE_TRANSPARENT(ui->licenseScrollArea);
	}

	//Show about dialog for the first time?
	if(!firstStart)
	{
		ui->acceptButton->hide();
		ui->declineButton->hide();
		ui->aboutQtButton->show();
		ui->closeButton->show();

		QPixmap disque(":/images/Disque.png");
		m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
		m_disque->resize(disque.size());
		m_disque->setStyleSheet("background:transparent;");
		m_disque->setAttribute(Qt::WA_TranslucentBackground);
		m_disque->setPixmap(disque);
		m_disque->setCursor(QCursor(Qt::PointingHandCursor));
		m_disque->installEventFilter(this);

		connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
		geometryUpdated();

		m_discOpacity = 0.01;
		m_disquePos.setX(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.right()  - disque.width()  - m_disqueBound.left())) + m_disqueBound.left());
		m_disquePos.setY(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top()))  + m_disqueBound.top());
		m_disqueFlags[0] = (MUtils::next_rand_u32() > (UINT_MAX/2));
		m_disqueFlags[1] = (MUtils::next_rand_u32() > (UINT_MAX/2));
		m_disque->move(m_disquePos);
		m_disque->setWindowOpacity(m_discOpacity);
		m_disque->show();

		m_disqueTimer = new QTimer;
		connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
		m_disqueTimer->start(10);

		connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
	}
コード例 #11
0
ファイル: mainwindow.cpp プロジェクト: uazure/qLab
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    QLocale::setDefault(QLocale::English);
    //setAttribute(Qt::WA_DeleteOnClose,true);
    ui->setupUi(this);
    experimentSettings=new QSettings (QSettings::IniFormat,QSettings::UserScope,QApplication::organizationName(),"experiment",this);
    experiment=new Experiment();

    tcp=new TcpServer(this);
    tcp->setExperiment(experiment);
    udp=new UdpServer(this);
    udp->setExperiment(experiment);

    connect(tcp,SIGNAL(warning(QString)),SLOT(warning(QString)));
    connect(tcp,SIGNAL(notify(QString)),SLOT(notify(QString)));

    //bind tcp socket to local port 25050
    tcp->bind(25050);

    connect(experiment,SIGNAL(statusChanged(bool)),tcp,SLOT(experimentStatusChanged(bool)));
    connect(experiment,SIGNAL(intervalChanged(int)),tcp,SLOT(experimentIntervalChanged(int)));
    connect(experiment,SIGNAL(TcpForbidden(QString)),tcp,SLOT(experimentForbidden(QString)));


    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->actionFullscreen,SIGNAL(triggered(bool)),this,SLOT(setFullscreen(bool)));
    connect(ui->actionAbout_Qt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionNew_experiment,SIGNAL(triggered()),this,SLOT(getExperiment()));
    connect(ui->actionSave,SIGNAL(triggered()),experiment,SLOT(saveFile()));
    connect(ui->actionSave_as,SIGNAL(triggered()),this,SLOT(getFile()));
    connect(ui->actionStartMeasure,SIGNAL(toggled(bool)),experiment,SLOT(start(bool)));
    connect(ui->actionMeasuring_interval,SIGNAL(triggered()),this,SLOT(changeMeasureIntervalDialog()));
    connect(ui->actionControls,SIGNAL(triggered()),SLOT(showExperimentControlMangement()));
    connect(ui->actionData,SIGNAL(triggered()),SLOT(showData()));

    connect(experiment,SIGNAL(statusChanged(bool)),ui->actionStartMeasure,SLOT(setChecked(bool)));
    connect(experiment,SIGNAL(statusChanged(bool)),this,SLOT(statusChanged(bool)));
    connect(experiment,SIGNAL(experimentChanged(QString)),this,SLOT(setExperiment(QString)));
    connect(experiment,SIGNAL(measured(QString)),ui->plainTextEdit,SLOT(appendPlainText(QString)));
    connect(experiment,SIGNAL(fileChanged(QString)),this,SLOT(setFile(QString)));
    connect(experiment,SIGNAL(Notify(QString)),SLOT(notify(QString)));
    connect(experiment,SIGNAL(intervalChanged(int)),SLOT(setMeasureInterval(int)));
    connect(experiment,SIGNAL(updateProgress(int)),ui->measureIntervalProgressBar,SLOT(setValue(int)));

    connect(tcp,SIGNAL(clientCountChanged(int)),&tcpClientsLabel,SLOT(setNum(int)));

    experiment->setInterval(2000);

    // Additional ui preparation
    experimentLabel.setToolTip("Experiment configuration");
    statusLabel.setToolTip("Experiment status:\nR - running\nS - stopped");
    QFont font(statusLabel.font());
    font.setBold(true);
    statusLabel.setFont(font);
    //set experiment status to stopped
    statusChanged(false);
    tcpClientsLabel.setToolTip("Number of tcp clients");
    tcpClientsLabel.setNum(0);

    statusBar()->addPermanentWidget(&tcpClientsLabel);
    statusBar()->addPermanentWidget(&fileLabel);
    statusBar()->addPermanentWidget(&experimentLabel);
    statusBar()->addPermanentWidget(&statusLabel);

    // Ask user to select experiment
    getExperiment();
}
コード例 #12
0
IQTempMainWindow::IQTempMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::IQTempMainWindow),
    _tempModel(new IQObjectBasedTableModel<IQTempSensor>(this)),
    _tempProxyModel(new IQTempProxyModel(this)),
    _mediaPlayer(new QMediaPlayer(this)),
    _warningPlaylist(new QMediaPlaylist(_mediaPlayer)),
    _criticalPlaylist(new QMediaPlaylist(_mediaPlayer)),
    _warningsCount(0),
    _criticalsCount(0)
{
    QSettings settings;
    if (!settings.contains("silentTime"))
        settings.setValue("silentTime", 300000);

    ui->setupUi(this);
    _instance = this;
    IQLogger::logger()->setDebugLogEnabled(false);

    connect(ui->actionAddSensor, SIGNAL(triggered()), this, SLOT(addNewTempSensor()));
    connect(ui->actionRemoveSensor, SIGNAL(triggered()), this, SLOT(removeCurrentTempSensor()));
    connect(ui->actionEditCurrentSensor, SIGNAL(triggered()), this, SLOT(editCurrentTempSensor()));
    connect(ui->actionMoveSensorUp, SIGNAL(triggered()), this, SLOT(moveCurrentTempSensroUp()));
    connect(ui->actionMoveSensorDown, SIGNAL(triggered()), this, SLOT(moveCurrentTempSensorDown()));

    ui->editingToolBar->addAction(ui->actionAddSensor);
    ui->editingToolBar->addAction(ui->actionRemoveSensor);
    ui->editingToolBar->addAction(ui->actionEditCurrentSensor);
    ui->editingToolBar->addSeparator();
    ui->editingToolBar->addAction(ui->actionMoveSensorUp);
    ui->editingToolBar->addAction(ui->actionMoveSensorDown);

    ui->helpToolBar->addAction(ui->actionAbout);
    ui->helpToolBar->addAction(ui->actionAboutQt);

    ui->tempTableView->addAction(ui->actionAddSensor);
    ui->tempTableView->addAction(ui->actionRemoveSensor);
    ui->tempTableView->addAction(ui->actionEditCurrentSensor);
    ui->tempTableView->addAction(ui->actionMoveSensorUp);
    ui->tempTableView->addAction(ui->actionMoveSensorDown);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
    connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(showAboutQt()));

    ui->tempTableView->setContextMenuPolicy(Qt::ActionsContextMenu);

    _tempModel->showProperty("name", tr("Sensor Name"));
    _tempModel->showProperty("temp", tr("Temp"));
    _tempModel->showProperty("humidity", tr("Humidity"));

    _tempProxyModel->setSourceModel(_tempModel);

    ui->tempTableView->setModel(_tempProxyModel);

    ui->tempTableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    ui->tempTableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
    ui->tempTableView->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);

    connect(ui->tempTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(checkCurrentSelectedItem(QModelIndex,QModelIndex)));

    connect(ui->tempTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editCurrentTempSensor()));

    checkCurrentSelectedItem(QModelIndex(), QModelIndex());

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(checkEditingToolBarEnabled()));

    QFileInfo warningMP3 ("warning.mp3");
    if (warningMP3.exists())
    {
        iqInfo() << tr("Found %0. Warning sound enabled.").arg(warningMP3.absoluteFilePath());
        _warningPlaylist->addMedia(QUrl::fromLocalFile(warningMP3.absoluteFilePath()));
        _warningPlaylist->setCurrentIndex(1);
        _warningPlaylist->setPlaybackMode(QMediaPlaylist::Loop);
    }
    else
    {
        iqInfo() << tr("Not found %0. Warning sound disabled.").arg(warningMP3.absoluteFilePath());
    }

    QFileInfo criticalMP3 ("critical.mp3");
    if (criticalMP3.exists())
    {
        iqInfo() << tr("Found %0. Critical sound enabled.").arg(criticalMP3.absoluteFilePath());
        _criticalPlaylist->addMedia(QUrl::fromLocalFile(criticalMP3.absoluteFilePath()));
        _criticalPlaylist->setCurrentIndex(1);
        _criticalPlaylist->setPlaybackMode(QMediaPlaylist::Loop);
    }
    else
    {
        iqInfo() << tr("Not found %0. Critical sound disabled.").arg(criticalMP3.absoluteFilePath());
    }

    //Добавим QML
    qmlRegisterType<IQTempSensor>("ru.itquasar.iqtemp", 1, 0, "IQTempSensor");
    QQuickView *view = new QQuickView();
    view->rootContext()->setContextProperty("tempModel", _tempModel);
    view->setSource(QUrl("qrc:/qml/iqtemp/MimicPanel.qml"));
    view->setResizeMode(QQuickView::SizeRootObjectToView);
    if (view->rootObject())
        view->rootObject()->setProperty("borderColor", ui->tabWidget->palette().color(QPalette::Mid));

    QWidget *container = QWidget::createWindowContainer(view, this);
    ui->mimicPanelLayout->addWidget(container);

    loadAllSensors();
}
コード例 #13
0
ファイル: Dialog_About.cpp プロジェクト: arestarh/LameXP
AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
    :
    QMessageBox(parent),
    m_settings(settings),
    m_disque(NULL),
    m_disqueTimer(NULL),
    m_rotateNext(false),
    m_disqueDelay(_I64_MAX)
{
    const QString versionStr = QString().sprintf
                               (
                                   "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
                                   lamexp_version_major(),
                                   lamexp_version_minor(),
                                   lamexp_version_release(),
                                   lamexp_version_build(),
                                   lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
                                   lamexp_version_compiler(),
                                   lamexp_version_arch(),
                                   qVersion()
                               );
    const QString copyrightStr = QString().sprintf
                                 (
                                     "Copyright (C) 2004-%04d LoRd_MuldeR &lt;[email protected]&gt;. Some rights reserved.",
                                     qMax(lamexp_version_date().year(), QDate::currentDate().year())
                                 );

    for(int i = 0; i < 4; i++)
    {
        m_cartoon[i] = NULL;
    }

    QString aboutText;

    aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
    aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
    aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
    aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));

    if(LAMEXP_DEBUG)
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }
    else if(lamexp_version_demo())
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }

    aboutText += "<hr><br>";
    aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
    aboutText += "modify it under the terms of the GNU General Public License<br>";
    aboutText += "as published by the Free Software Foundation; either version 2<br>";
    aboutText += "of the License, or (at your option) any later version.<br><br>";
    aboutText += "This program is distributed in the hope that it will be useful,<br>";
    aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
    aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>";
    aboutText += "GNU General Public License for more details.<br><br>";
    aboutText += "You should have received a copy of the GNU General Public License<br>";
    aboutText += "along with this program; if not, write to the Free Software<br>";
    aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110&minus;1301, USA.</tt></nobr><br>";
    aboutText += "<hr><table><tr>";
    aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
    aboutText += QString("<td><font color=\"darkred\">%1</font></td>").arg(tr("Note: LameXP is free software. Do <b>not</b> pay money to obtain or use LameXP! If some third-party website tries to make you pay for downloading LameXP, you should <b>not</b> respond to the offer !!!"));
    aboutText += "</tr></table><hr><br>";
    aboutText += QString("%1<br>").arg(NOBR(tr("Special thanks go out to \"John33\" from %1 for his continuous support.")).arg(LINK("http://www.rarewares.org/")));

    setText(aboutText);
    setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
    setWindowTitle(tr("About LameXP"));

    if(firstStart)
    {
        QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/script.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(135);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));

        QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":/icons/accept.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);

        QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/icons/delete.png"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->setEnabled(false);
    }
    else
    {
        QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(120);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));

        QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":icons/user_suit.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);
        secondButton->disconnect();
        connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));

        QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/images/Qt.svg"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->disconnect();
        connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));

        QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
        fourthButton->setIcon(QIcon(":/icons/cross.png"));
        fourthButton->setIconSize(QSize(16, 16));
        fourthButton->setMinimumWidth(90);

        QPixmap disque(":/images/Disque.png");
        QRect screenGeometry = QApplication::desktop()->availableGeometry();
        m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
        m_disque->installEventFilter(this);
        m_disque->setStyleSheet("background:transparent;");
        m_disque->setAttribute(Qt::WA_TranslucentBackground);
        m_disque->setGeometry(qrand() % (screenGeometry.width() - disque.width()), qrand() % (screenGeometry.height() - disque.height()), disque.width(), disque.height());
        m_disque->setPixmap(disque);
        m_disque->setWindowOpacity(0.01);
        m_disque->show();
        m_disqueFlags[0] = (qrand() > (RAND_MAX/2));
        m_disqueFlags[1] = (qrand() > (RAND_MAX/2));
        m_disqueTimer = new QTimer;
        connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
        m_disqueTimer->setInterval(10);
        m_disqueTimer->start();
    }

    m_firstShow = firstStart;
}