Пример #1
0
void VideoPlayer::metaDataChanged()
{
    if (player->state() == QMediaPlayer::StoppedState)
    {
        return;
    }
    if (this->isFullScreen())
    {
        return;
    }
    QSize size = videoWidget->sizeHint();
    if (size.width()>0 && size.height()>0)
    {
        if (size.width()<WIDTH || size.height() <HEIGHT)
        {
            size = QSize(size.width()*2, size.height()*2);
        }
        int videoWidth = size.width();
        int videoHeight = size.height();
//        emit gotVideoSize(size);            ///////////////////////////////////////////何用?
        QDesktopWidget desktop;
        if (videoHeight > desktop.availableGeometry().height())
        {
            qreal bilv = qreal(videoWidth) / qreal(videoHeight);qDebug() << bilv;
            videoHeight = desktop.availableGeometry().height();
            videoWidth = videoHeight * bilv;
        }
        this->setGeometry((desktop.width()-videoWidth)/2, (desktop.availableGeometry().height()-videoHeight)/2, videoWidth, videoHeight);
    }
}
Пример #2
0
int main(int argc, char *argv[])
{   
    if (QLibraryInfo::isDebugBuild())
    {
        qInstallMessageHandler(myMessageOutput);
    }

    QApplication a(argc, argv);

    QTranslator qtTranslator;
       qtTranslator.load("qt_" + QLocale::system().name(),
               QLibraryInfo::location(QLibraryInfo::TranslationsPath));
       a.installTranslator(&qtTranslator);

       QTranslator myappTranslator;
       myappTranslator.load("mDownloader_" + QLocale::system().name());
       a.installTranslator(&myappTranslator);

    a.setQuitOnLastWindowClosed(true);

    QDesktopWidget qd;

    MainWindow w;

    w.move((qd.availableGeometry(-1).width()-w.width())/2, (qd.availableGeometry(-1).height()-w.height())/2);
    w.show();


    return a.exec();
}
Пример #3
0
RenderArea::RenderArea(QWidget *parent)
            : QWidget(parent), ui(new Ui::RenderArea)
{
    ui->setupUi(this);
    QDesktopWidget desktop; // Get the resolution od the main screen
    this->xRes = desktop.availableGeometry(desktop.primaryScreen()).width();
    this->yRes = desktop.availableGeometry(desktop.primaryScreen()).height();
    img = QImage(this->xRes, this->yRes, QImage::Format_ARGB32);
    fraktal = new Fraktal_Manager(xRes, yRes);
    currentFraktal = Mandelbrot;
    setEnabled(true);   // Must be enabled to recieve mouse wheel event
}
Пример #4
0
void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition)
{
#ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1
    QWidget *pTopLevelWidget = window();

    /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */
    if (pTopLevelWidget->isMaximized())
        return;

    /* Calculate client window offsets: */
    QRect frameGeo = pTopLevelWidget->frameGeometry();
    QRect geo = pTopLevelWidget->geometry();
    int dl = geo.left() - frameGeo.left();
    int dt = geo.top() - frameGeo.top();
    int dr = frameGeo.right() - geo.right();
    int db = frameGeo.bottom() - geo.bottom();

    /* Get the best size w/o scroll bars: */
    QSize s = pTopLevelWidget->sizeHint();

    /* Resize the frame to fit the contents: */
    s -= pTopLevelWidget->size();
    frameGeo.setRight(frameGeo.right() + s.width());
    frameGeo.setBottom(frameGeo.bottom() + s.height());

    if (bAdjustPosition)
    {
        QRegion availableGeo;
        QDesktopWidget *dwt = QApplication::desktop();
        if (dwt->isVirtualDesktop())
            /* Compose complex available region */
            for (int i = 0; i < dwt->numScreens(); ++ i)
                availableGeo += dwt->availableGeometry(i);
        else
            /* Get just a simple available rectangle */
            availableGeo = dwt->availableGeometry(pTopLevelWidget->pos());

        frameGeo = VBoxGlobal::normalizeGeometry(frameGeo, availableGeo, vboxGlobal().vmRenderMode() != SDLMode /* can resize? */);
    }

#if 0
    /* Center the frame on the desktop: */
    frameGeo.moveCenter(availableGeo.center());
#endif

    /* Finally, set the frame geometry */
    pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db);

#else /* !VBOX_GUI_WITH_CUSTOMIZATIONS1 */
    Q_UNUSED(bAdjustPosition);
#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
}
Пример #5
0
void FMainWindow::readSettings()
{
   QDesktopWidget* desktopWidget = QApplication::desktop();
   int w = desktopWidget->availableGeometry().width();
   int h = desktopWidget->availableGeometry().height();
   QSettings settings(QDir::currentPath() + "/HIS.ini", QSettings::IniFormat);
   settings.beginGroup("FMainWindow");
   setFixedSize(settings.value("size", QSize(w * 0.6, h * 0.6)).toSize());
   printf("%d\n" ,(settings.value("size", QSize(w * 0.6, h * 0.6)).toSize().height()));
   printf("%d\n" ,(settings.value("size", QSize(w * 0.6, h * 0.6)).toSize().width()));
   move(settings.value("pos", QPoint(w * 0.2, h * 0.1)).toPoint());
   settings.endGroup();
}
Пример #6
0
void FBaseDialog::showEvent(QShowEvent *event)
{

    QDesktopWidget* desktopWidget = QApplication::desktop();
    QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
    animation->setDuration(200);
    int w = desktopWidget->availableGeometry().width();
    int h = desktopWidget->availableGeometry().height();
    animation->setStartValue(QRect(w * 0.5, h*0.5, 0, 0));
    animation->setEndValue(QRect(w /2 - normalSize.width()/2,
                                 h / 2 - normalSize.height() / 2,
                                 normalSize.width(), normalSize.height()));
    animation->start();
    QWidget::showEvent(event);
}
void CompletedPopupImpl::displayPopup(const QIcon &serviceIcon, const QString videoTitle, const QString videoFile)
{
#ifdef Q_OS_MACX
	// check if growl is installed
	if (QSystemTrayIcon::supportsMessages())
	{
		trayIconRef->showMessage(tr("Download completed"), videoTitle, QSystemTrayIcon::Information, 5000);
		// don't display the standard message
		return;
	}
#endif
	// set window info
	imgVideoService->hide();
	lblVideoTitle->hide();
	imgVideoService->setPixmap(serviceIcon.pixmap(QSize(16,16)));
	lblVideoTitle->setText(videoTitle);
	imgVideoService->show();
	lblVideoTitle->show();

	this->videoFile = videoFile;

	QDesktopWidget *desktop = QApplication::desktop();
	QRect availableGeometry  = desktop->availableGeometry(this);
	move(desktop->width(), availableGeometry.height() - size().height());
	this->show();

	alpha = 0;

	displayState = dsShowing;
	displayTimer->start(2);
}
void CompletedPopupImpl::displayTimerOnTimer()
{
	if (!isVisible()) return;

	QDesktopWidget *desktop = QApplication::desktop();
	QRect availableGeometry  = desktop->availableGeometry(this);

	// display popup animation
	if (displayState == dsShowing)
		if (pos().x() > availableGeometry.width() - size().width())// - 15)
			move(pos().x() - 2, pos().y());
		else
		{
			displayState = dsWaiting;
			displayTimer->start(5000);
		}
	// hide popup animation
	else if (displayState == dsHiding)
		if (pos().x() < availableGeometry.width())
			move(pos().x() + 2, pos().y());
		else
		{
			displayState = dsWaiting;
			displayTimer->stop();
			hide();
		}
	else if (displayState == dsWaiting)
	{
		displayState = dsHiding;
		displayTimer->start(2);
	}
}
Пример #9
0
void AddTaskDialog::construct()
{
    ++obj_cnt;
    upd_mode = false;
    additional_flag = false;
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle("REXLoader - "+tr("Новое задание"));
    priority = 2; //нормальный приоритет
    if(!parent())setWindowIcon(QIcon(":/appimages/trayicon.png"));
    FileNameValidator *validator = new FileNameValidator(this);
    gui->fileName->setValidator(validator);
    gui->categoryBox->setValidator(validator);
    gui->saveFrame->setVisible(false);
    urlValidator();

    loadDatabaseData();
    connect(gui->categoryBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateLocation(int)));
    connect(gui->urlBox,SIGNAL(editTextChanged(QString)),this,SLOT(urlValidator()));
    connect(gui->browseButton,SIGNAL(released()),this,SLOT(openDirDialog()));
    connect(gui->startNowBtn,SIGNAL(released()),this,SLOT(startNow()));
    connect(gui->startLaterBtn,SIGNAL(released()),this,SLOT(startLater()));
    connect(gui->urlBox,SIGNAL(activated(QString)),this,SLOT(getCategory(QString)));
    connect(gui->saveButton,SIGNAL(released()),this,SLOT(updateTaskInfo()));
    connect(gui->cancelButton_2,SIGNAL(released()),this,SLOT(reject()));

    QDesktopWidget ds;
    QRect desktop = ds.availableGeometry();
    QPoint top_left = QPoint((desktop.bottomRight().x()-size().width())/2+20*(obj_cnt-1),(desktop.bottomRight().y()-size().height())/2+20*(obj_cnt-1));
    move(top_left);

    setAttribute(Qt::WA_AlwaysShowToolTips);
    gui->errorFrame->setHidden(true);

    scanClipboard();
}
Пример #10
0
void FrontPanel::displayImageGL(Image const &img)
{
    m_GlWidget->setWindowTitle("Front Panel");    

    Image cpyImg(img);
    m_GlWidget->loadImage(cpyImg);
    m_GlWidget->loadShaders(HDR_DIR"/shaders/frontPanel.vert", HDR_DIR"/shaders/frontPanel.frag");

    QDesktopWidget *backDesktop = QApplication::desktop();
    QRect screenGeo = backDesktop->availableGeometry(m_DisplayId);
    if (m_CurrentMode == FULLSCREEN)
        m_GlWidget->showFullScreen();
    else
    {
        m_GlWidget->resize(screenGeo.size());
        m_GlWidget->show();
    }
    //Move the window to the target device.
    m_GlWidget->move(screenGeo.topLeft());

    if (m_ToneMapped)
        m_GlWidget->toggleToneMapping();
    else
        m_GlWidget->toggleHDRDisplay();

    //Compute and set tone-mapping parameters.
    computeShaderParameters(cpyImg);
    m_GlWidget->setToneMappingParameters(m_Parameters);
}
Пример #11
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    InitProduct(argc, argv);
    app.setWindowIcon(QIcon("logo.ico"));
    QDesktopWidget* desktopWidget = QApplication::desktop();
    //获取可用桌面大小
    QRect deskRect =desktopWidget->availableGeometry();
    //获取设备屏幕大小
    //QRect screenRect =desktopWidget->screenGeometry();

    DataFilter dataFilter;
    QDeclarativeView viewer;
    viewer.setWindowFlags(Qt::FramelessWindowHint);
    QDeclarativeEngine *engine=viewer.engine();
    QDeclarativeContext *context=engine->rootContext();
    context->setContextProperty("dataFilter", &dataFilter);
    context->setContextProperty("app", &app);
    context->setContextProperty("main_window", &viewer);
    context->setContextProperty("windowTitle", WindowTitle);
    context->setContextProperty("SMF_Product", SMF_Product);
    context->setContextProperty("WIDTH", deskRect.width());
    context->setContextProperty("HEIGHT", deskRect.height());
    viewer.setSource(QUrl("qml/LotNo/main.qml"));
    viewer.show();
    return app.exec();
}
DBoxFE_ProfileWizard::DBoxFE_ProfileWizard( QDialog *parent, Qt::WFlags flags )
    : QDialog( parent, flags ) {

  // setup grafical user interface (gui)
  setupUi( this );

  page = 0;

  // for download game database file
  m_http = new QHttp( this );
  connect( m_http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( httpRequestFinished( int, bool ) ) );
  connect( m_http, SIGNAL( responseHeaderReceived( const QHttpResponseHeader & ) ), this, SLOT( readResponseHeader( const QHttpResponseHeader & ) ) );

  // connection
  connect( btnBack, SIGNAL( clicked() ), this, SLOT( slotBack() ) );
  connect( btnNext, SIGNAL( clicked() ), this, SLOT( slotNext() ) );
  connect( btnNext, SIGNAL( clicked() ), this, SLOT( slotFinish() ) );

  connect( btnHelp, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
  connect( btnAbort, SIGNAL( clicked() ), this, SLOT( slotAbort() ) );
  connect( btnSelectDir, SIGNAL( clicked() ), this, SLOT( slotSelectDir() ) );
  connect( btnSearch, SIGNAL( clicked() ), this, SLOT( slotSearch() ) );

  // enable button
  btnNext->setEnabled( true );

  // center the wiget on desktop screen
  QDesktopWidget *desktop = qApp->desktop();
  const QRect rect = desktop->availableGeometry( desktop->primaryScreen() );
  int left = ( rect.width() - width() ) / 2;
  int top = ( rect.height() - height() ) / 2;
  setGeometry( left, top, width(), height() );

  downloadFile();
}
Пример #13
0
void OSDPretty::mouseMoveEvent(QMouseEvent* e) {
  if (mode_ == Mode_Draggable) {
    QPoint delta = e->globalPos() - drag_start_pos_;
    QPoint new_pos = original_window_pos_ + delta;

    // Keep it to the bounds of the desktop
    QDesktopWidget* desktop = QApplication::desktop();
    QRect geometry(desktop->availableGeometry(e->globalPos()));

    new_pos.setX(
        qBound(geometry.left(), new_pos.x(), geometry.right() - width()));
    new_pos.setY(
        qBound(geometry.top(), new_pos.y(), geometry.bottom() - height()));

    // Snap to center
    int snap_x = geometry.center().x() - width() / 2;
    if (new_pos.x() > snap_x - kSnapProximity &&
        new_pos.x() < snap_x + kSnapProximity) {
      new_pos.setX(snap_x);
    }

    move(new_pos);

    popup_display_ = current_display();
    popup_pos_ = current_pos();
  }
}
GameDosBoxDialog::GameDosBoxDialog( QDialog *parent, Qt::WFlags flags ) : QDialog( parent, flags )
{
	setupUi( this );

	gd_sql = new GameDatabaseSql( this );

	XMLPreferences xmlPreferences( "DBoxFE - GDB", "Alexander Saal" );
	xmlPreferences.load( QDir::homePath() + "/.dboxfe-gdb/dboxfegdb.xml" );

	database = xmlPreferences.getString( "Database", "DatabaseFile" );	

	gd_sql->createConnection( database );

	connect( btnAccept, SIGNAL ( clicked() ), this, SLOT ( select() ) );
	connect( btnCancel, SIGNAL ( clicked() ), this, SLOT ( cancel() ) );

	connect( lineEditSearch, SIGNAL( textChanged( const QString & ) ), this, SLOT( lineEditSearchTextChanged( const QString & ) ) );
	connect( comboBoxDosboxVersion, SIGNAL ( currentIndexChanged( const QString & ) ), this, SLOT ( comboBoxDosboxVersionCurrentIndexChanged( const QString & ) ) );
	connect( treeWidgetDosboxGames, SIGNAL ( itemClicked( QTreeWidgetItem *, int ) ), this, SLOT ( treeWidgetDosboxGamesItemClicked( QTreeWidgetItem *, int ) ) );

	QDesktopWidget *desktop = qApp->desktop();
	const QRect rect = desktop->availableGeometry ( desktop->primaryScreen() );
	int left = ( rect.width() - width() ) / 2;
	int top = ( rect.height() - height() ) / 2;
	setGeometry ( left, top, width(), height() );

	getDosboxVersion();
}
Пример #15
0
void mixer_main::constructWindow()
{

    Controller *contP = &controller;
    QDesktopWidget *desktop = new QDesktopWidget();
    QRect screen = desktop->availableGeometry(this);
    this->setFixedSize(screen.width(),screen.height()-50);

    //Tab Object
    QTabWidget *tabs = new QTabWidget(this);
    tabs->setMinimumSize(screen.width(), screen.height()-50);
    tabs->setStyleSheet("QTabBar::tab { background: white; border: 2px solid black; } QTabBar::tab:selected { background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0,"
                        "stop: 0 #FF0000, stop: 0.8 #FFFFFF); }");


    //Widgets used as frames for Scroll Areas
    QWidget *main1 = new QWidget();
    QWidget *main2 = new QWidget();
    QWidget *main3 = new QWidget();
    QWidget *main4 = new QWidget();

    //Mixer Objects
    mix1 = new Mixer(0, 26, contP);
    mix2 = new Mixer(1, 28, contP);
    mix3 = new Mixer(2, 30, contP);
    mix4 = new Mixer(3, 32, contP);


    //Scroll Area Objects
    QFingerScrollArea *mix1slide = new QFingerScrollArea(main1);
    QFingerScrollArea *mix2slide = new QFingerScrollArea(main2);
    QFingerScrollArea *mix3slide = new QFingerScrollArea(main3);
    QFingerScrollArea *mix4slide = new QFingerScrollArea(main4);


    //Setting Scroll Area targets and size
    mix1slide->setWidget(mix1);
    mix2slide->setWidget(mix2);
    mix3slide->setWidget(mix3);
    mix4slide->setWidget(mix4);
    mix1slide->setMinimumSize(screen.width()-30, screen.height()-30);
    mix2slide->setMinimumSize(screen.width()-30, screen.height()-30);
    mix3slide->setMinimumSize(screen.width()-30, screen.height()-30);
    mix4slide->setMinimumSize(screen.width()-30, screen.height()-30);

    //Show Scroll Areas
    mix1slide->show();
    mix2slide->show();
    mix3slide->show();
    mix4slide->show();

    //Add Frames to tab object
    tabs->addTab(main1, "Mix 1");
    tabs->addTab(main2, "Mix 2");
    tabs->addTab(main3, "Mix 3");
    tabs->addTab(main4, "Mix 4");

    connect(tabs,SIGNAL(currentChanged(int)),this,SLOT(saveAndLoadArray(int)));

}
Пример #16
0
int main(int argc, char *argv[])
{
    BrowserApplication a(argc, argv);
    //MainWindow w;
    BrowserMainWindow w;
    QRect maxRect;
    {
        QDesktopWidget desktop;
        maxRect = desktop.availableGeometry();
        maxRect.adjust(50,50,-50,-50);
    }
    w.setGeometry(maxRect);

    qDebug() << QApplication::applicationDirPath() << QApplication::applicationFilePath();
    {
        QPixmap splashPixmap(QApplication::applicationDirPath() + "/comm/conf/pics/splash.png");
        QSplashScreen splash(splashPixmap);
        splash.show();

        enum {
            splashTime = 1500
        };
        QTimer timer;
        timer.start(splashTime);
        do {
            a.processEvents();
            splash.showMessage(QString("Loading Process: %1%").arg(timer.remainingTime()*100.0/splashTime),Qt::AlignBottom);
        } while(timer.remainingTime() > 1);

        splash.finish(&w);
    }
    w.show();
    a.processEvents();
    return a.exec();
}
Пример #17
0
void MainWindow::updateSong(QString state, QString songArtist, QString songTitle, QString songName){
    if (state == "play")
        this->ui->btnPlayPause->setText("Pause");
    else
        this->ui->btnPlayPause->setText("Play");

    // QLabel breaks layout:
    //      [done] elide text
    //      [todo] scroll text?!

    QDesktopWidget* desktopWidget = QApplication::desktop();
    QRect clientRect = desktopWidget->availableGeometry();

    QFont font = ui->label_artist->font();
    QFontMetrics fm(font);

    songArtist.isEmpty() ?
        ui->label_artist->setVisible(false) :
        ui->label_artist->setVisible(true);

    songTitle.isEmpty() ?
        ui->label_title->setVisible(false) :
        ui->label_title->setVisible(true);

    songName.isEmpty() ?
        ui->label_name->setVisible(false) :
        ui->label_name->setVisible(true);

    ui->label_artist->setText(fm.elidedText(songArtist, Qt::ElideRight, clientRect.width() - 10));
    ui->label_title->setText(fm.elidedText(songTitle, Qt::ElideRight, clientRect.width() - 10));
    ui->label_name->setText(fm.elidedText(songName, Qt::ElideRight, clientRect.width() - 10));
}
Пример #18
0
dlgPrint::dlgPrint( QWidget* parent, CardInformation& CI_Data, GenPur::UI_LANGUAGE lng, QString const& cardTypeText)
    : QDialog(parent)
    , m_CI_Data(CI_Data)
    , m_CurrReaderName("")
{
    if (CI_Data.isDataLoaded())
    {
        PTEID_EIDCard*	Card = dynamic_cast<PTEID_EIDCard*>(m_CI_Data.m_pCard);
        ui.setupUi(this);
        setFixedSize(420, 245);
        const QIcon Ico = QIcon( ":/images/Images/Icons/Print.png" );
        this->setWindowIcon( Ico );

        QDesktopWidget* desktop = QApplication::desktop();
        int screenNr = desktop->screenNumber();
        QRect rect = desktop->availableGeometry(screenNr);
        int height = rect.height();

        int thiswidth = this->width();
        int thisheight = this->height();

        if (thisheight > height)
        {
            this->resize(thiswidth,height-20); //make sure the window fits
        }

        CI_Data.LoadData(*Card,m_CurrReaderName);
    }

}
Пример #19
0
void QtToaster::changeToasterPosition() {
	QDesktopWidget * desktop = QApplication::desktop();
	QPoint p = _toaster->pos();

	//Toaster is showing slowly
	if (_show) {
		_toaster->move(p.x(), p.y() - 3);

		QRect desktopGeometry = desktop->availableGeometry(desktop->primaryScreen());

		if (p.y() < (desktopGeometry.bottom() - _toaster->size().height() - 5)) {
			//Toaster should be hidden now
			_show = false;
			_timer->stop();
			//Waits 5 seconds with the toaster on top
			_timer->start(_timeOnTop);
		}
	}

	//Toaster is hiding slowly
	else {
		_toaster->move(p.x(), p.y() + 3);
		_toaster->repaint();
		QRect screenGeometry = desktop->screenGeometry(desktop->primaryScreen());

		_timer->stop();
		_timer->start(TIME_TO_SHOW);

		if (p.y() > (screenGeometry.bottom())) {
			//Closes the toaster -> hide it completely
			close();
		}
	}
}
QSplashScreen *Application::buildSplashScreen() {
	const QPixmap logoPixmap(":/images/logo.png");
	QDesktopWidget *desktop = QApplication::desktop();
	QRect desktopRect = desktop->availableGeometry();
	QPixmap splashPixmap(desktopRect.width(), desktopRect.height());
	QPainter painter;
	painter.begin(&splashPixmap);
	QLinearGradient backgroundGradient(
		splashPixmap.rect().width() / 2, 0,
		splashPixmap.rect().width() / 2, splashPixmap.rect().height());
    backgroundGradient.setColorAt(0, QColor::fromRgb(40, 50, 57));
    backgroundGradient.setColorAt(1, QColor::fromRgb(19, 25, 29));
    painter.fillRect(splashPixmap.rect(), backgroundGradient);
	QRect logoRect((splashPixmap.width() - logoPixmap.width()) / 2,
	               (splashPixmap.height() - logoPixmap.height()) / 2,
	               logoPixmap.width(),
	               logoPixmap.height());
	painter.drawPixmap(logoRect, logoPixmap);
	painter.end();
	QScopedPointer<QSplashScreen> splashScreen(new QSplashScreen(splashPixmap));
	if (desktopRect.width() > desktopRect.height()) {
		splashScreen->setAttribute(Qt::WA_LockLandscapeOrientation, true);
	} else {
		splashScreen->setAttribute(Qt::WA_LockPortraitOrientation, true);
	}
	return splashScreen.take();
}
Пример #21
0
void AboutDialog::showEvent(QShowEvent *event)
{
    QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");

    QDesktopWidget* desktopWidget = QApplication::desktop();
    int x = (desktopWidget->availableGeometry().width() - normalSize.width()) / 2;
    int y = (desktopWidget->availableGeometry().height() - normalSize.height()) / 2;

    connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
    animation->setDuration(1500);
    animation->setStartValue(QRect(x, 0, normalSize.width(), normalSize.height()));
    animation->setEndValue(QRect(x, y, normalSize.width(), normalSize.height()));
    animation->setEasingCurve(QEasingCurve::OutElastic);
    animation->start();
    QDialog::showEvent(event);
}
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	QDesktopWidget desktop;
	QRectF screenRect = desktop.availableGeometry();

	Controles controls(DEFAULT_WIDTH, DEFAULT_ITER_MAX);
	Processeur processor(DEFAULT_WIDTH, DEFAULT_ITER_MAX);
	Widget w;

	QObject::connect(&controls, &Controles::SignalWidthChanged, &processor, &Processeur::SlotSetWidth);
	QObject::connect(&controls, &Controles::SignalPlay, &processor, &Processeur::SlotStartAnim);
	QObject::connect(&controls, &Controles::SignalPause, &processor, &Processeur::SlotStopAnim);
	QObject::connect(&controls, &Controles::SignalIterationMaxChanged, &processor, &Processeur::SlotSetMaxValue);
	QObject::connect(&processor, &Processeur::SignalDataChanged, &w, &Widget::SlotUpdateLines);

	w.resize(800, 800);
	controls.show();
	w.show();

	controls.move(screenRect.width()/2 - (controls.frameSize().width()+w.frameSize().width())/2, 50);
	w.move(controls.x()+controls.frameSize().width(), 50);

	QObject::connect(&a, &QGuiApplication::lastWindowClosed, &QCoreApplication::quit);

	return a.exec();
}
Пример #23
0
void FMainWindow::initUI()
{
    titleBar = FTitleBar::getInstace();

    setObjectName(QString("FMainWindow"));
    QDesktopWidget* desktopWidget = QApplication::desktop();
    setMaximumSize(desktopWidget->availableGeometry().size());
    readSettings();

    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
	
	setWindowTitle(sql.strtitle);

    pstatusbar = new QStatusBar;
    pstatusbar->setFixedHeight(35);
	pstatusbar->setStyleSheet(QString("QStatusBar::item{border: 0px}"));


	QString currentdatetime = QDateTime::currentDateTime().toString("yyyy-MM-dd  hh:mm:ss");  
	QString strcurrentuser=QApplication::translate("ConnectDB", "\345\275\223\345\211\215\347\224\250\346\210\267", 0, QApplication::UnicodeUTF8);
	QString strtime =QApplication::translate("ConnectDB", "\347\231\273\345\275\225\346\227\266\351\227\264", 0, QApplication::UnicodeUTF8);
	strcurrentuser +=":"+sql.struser+"   ";
	strtime+=":"+currentdatetime;
	QString str=strcurrentuser+strtime;
    pstatusbar->showMessage(str);
	setStatusBar(pstatusbar);


    trayicon = new QSystemTrayIcon(QIcon(QString(":/skin/images/his.ico")), this);
    trayicon->setObjectName(QString("trayicon"));
    trayicon->setToolTip(QString(qApp->applicationName()));
    trayicon->show();
}
Пример #24
0
void MainWindow::readSettings()
{
    QSettings cfg;
    QString viewId = cfg.value("CurrentView").toString();

    m_viewMode->blockSignals(true);

    if (viewId == "list") {
        setupListView();
        m_listView->setChecked(true);
    } else if (viewId == "detailedhost") {
        setupDetailedHostView();
        m_detailedView->setChecked(true);
    } else {
        setupStarView();
        m_starView->setChecked(true);
    }

    // "icecream" is the default netname used by iceccd
    if (m_monitor->currentNet().isEmpty()) {
        QByteArray netname = cfg.value("netname", "icecream").toByteArray();
        setCurrentNet(netname);
    }

    // Load window geometry
    QRect geom = cfg.value("geometry").toRect();
    if (geom.isNull()) {
        QDesktopWidget w;
        QRect screenGeometry = w.availableGeometry(this);
        geom = QRect(screenGeometry.center()/2, screenGeometry.size()/2 );
    }
    setGeometry(geom);

    m_viewMode->blockSignals(false);
}
Пример #25
0
RemoteAssistance::RemoteAssistance(const QString &adminAddress, quint16 adminPort, const QString &adminName, QWidget *parent)
    : QWidget(parent)
{


    ui.setupUi(this);

    setWindowFlags(Qt::WindowStaysOnTopHint);

    // Get the size of screen
    QDesktopWidget* desktop = QApplication::desktop();
    QRect rect = desktop->availableGeometry(this);
//    int desktopWidth = rect.width();
//    int desktopHeight = rect.height();
//    int windowWidth = frameGeometry().width();
//    int windowHeight = frameGeometry().height();
//    //move the window
//    move((desktopWidth - windowWidth) / 2, (desktopHeight - windowHeight) / 2);

    move(rect.center());

    requestRemoteAssistance(adminAddress, adminPort, adminName);

    //        updateTimeInfo();

    //        timer = new QTimer(this);
    //        timer->setInterval(1000);
    //        connect(timer, SIGNAL(timeout()), this, SLOT(updateTimeInfo()));
    //        timer->start();

}
Пример #26
0
View::View(QObject* parent) :
    QMainWindow {},
    m_tabWidget{new QTabWidget}
{
    setObjectName("View");
    //setUnifiedTitleAndToolBarOnMac(true);

    setDockOptions(QMainWindow::ForceTabbedDocks | QMainWindow::VerticalTabs);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

    QDesktopWidget w;
    auto rect = w.availableGeometry();
    this->resize(static_cast<int>(rect.width() * 0.75),
                 static_cast<int>(rect.height() * 0.75));

    setCentralWidget(m_tabWidget);
    m_tabWidget->tabBar()->setDocumentMode(true);
    connect(m_tabWidget, &QTabWidget::currentChanged,
            [&] (int index) {
           auto view = dynamic_cast<DocumentView*>(m_tabWidget->widget(index));
           if(!view)
               return;
           emit activeDocumentChanged(view->document().model().id());
    });

    connect(m_tabWidget, &QTabWidget::tabCloseRequested, [&] (int index)
    {
        emit closeRequested(safe_cast<DocumentView*>(m_tabWidget->widget(index))->document().model().id());
    });

}
Пример #27
0
void Window::SetPositionRelative(PRectangle rc, Window relativeTo)
{
	QPoint oPos = window(relativeTo.wid)->mapToGlobal(QPoint(0,0));
	int ox = oPos.x();
	int oy = oPos.y();
	ox += rc.left;
	if (ox < 0)
		ox = 0;
	oy += rc.top;
	if (oy < 0)
		oy = 0;

	QDesktopWidget *desktop = QApplication::desktop();
	QRect rectDesk = desktop->availableGeometry(window(wid));
	/* do some corrections to fit into screen */
	int sizex = rc.right - rc.left;
	int sizey = rc.bottom - rc.top;
	int screenWidth = rectDesk.width();
	int screenHeight = rectDesk.height();
	if (sizex > screenWidth)
		ox = 0; /* the best we can do */
	else if (ox + sizex > screenWidth)
		ox = screenWidth - sizex;
	if (oy + sizey > screenHeight)
		oy = screenHeight - sizey;

	Q_ASSERT(wid);
	window(wid)->move(ox, oy);
	window(wid)->resize(sizex, sizey);
}
TrayNotificationManager::TrayNotificationManager(QObject *parent)
{
    notificationWidgets = new QList<TrayNotificationWidget*>();
    QDesktopWidget* desktopWidget = QApplication::desktop();
    QRect clientRect = desktopWidget->availableGeometry();
    m_maxTrayNotificationWidgets = 4;
    m_width = 320;
    m_height = 150;
    m_onScreenCount = 0;
#ifdef Q_WS_MACX
    m_startX = clientRect.width() - m_width;
    m_startY = 10;
    m_up = false;
#endif

#ifdef Q_WS_X11
    m_startX = clientRect.width() - m_width;
    m_startY = 10;
    m_up = false;
#endif

#ifdef Q_WS_WIN
    m_startX = clientRect.width() - m_width;
    m_startY = clientRect.height() - m_height;
    m_up = true;
#endif

    m_deltaX = 0;
    m_deltaY = 0;
}
Пример #29
0
void NotificationWidget::showNotification() {
//#ifndef Q_WS_MAC
    QMutexLocker notificationsLocker(&NotificationWidget::notificationsLock);
    QDesktopWidget *d = QApplication::desktop();

    QRect r = d->availableGeometry(this);

    show();
    move(r.right()-width(),r.bottom()-height());
    for(int x=0; x<NotificationWidget::notifications.count(); x++) {
        NotificationWidget *w = NotificationWidget::notifications.at(x);
        w->move(w->x(),w->y()-height());
    }
    NotificationWidget::notifications.append(this);
    timeout.start(10000);
//#endif
//#ifdef Q_WS_MAC
//	while (icons.count()>0) {
//		QPixmap icon = icons.takeAt(0);
//		QString msg = text.takeAt(0);
//
//		tray.showMessage(tr("Yasst"),msg);
//	}
//	tray.showMessage("Hello","hello");
//#endif
}
Пример #30
0
void QModernProgressDialog::createWidgets() {
    setWindowTitle(tr("Progress"));
    setWindowIcon(QIcon());
    m_wasCancel=false;
    label=new QLabel(this);
    longmessage=new QTextEdit(this);
    longmessage->setVisible(false);
    progress=new QModernProgressWidget(this);
    progress->setMinimumSize(QSize(48,48));
    cancel=new QPushButton(tr("Cancel"), this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));

    QVBoxLayout* vbl=new QVBoxLayout;
    setLayout(vbl);
    QHBoxLayout* hbl=new QHBoxLayout;
    hbl->addWidget(progress);
    hbl->addWidget(label);
    hbl->addStretch();
    vbl->addLayout(hbl);
    vbl->addWidget(longmessage);
    hbl=new QHBoxLayout;
    hbl->addStretch();
    hbl->addWidget(cancel);
    vbl->addLayout(hbl);
    connect(&timerDelay, SIGNAL(timeout()), this, SLOT(open()));

    QDesktopWidget desktopWidget;
    QRect desktopRect(desktopWidget.availableGeometry(desktopWidget.primaryScreen()));
    QRect widgetRect=rect();
    move(desktopRect.center() - widgetRect.center());
}