Ejemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //qDebug() << additionEvent("Olegrok");
    qDebug() << *(int*)QThread::currentThreadId();
    ui->setupUi(this);
    this->setGeometry(QDesktopWidget().availableGeometry().width()/2 - this->width()/2,
                      QDesktopWidget().availableGeometry().height()/2 - this->width()/2,
                      this->width(), this->height());
    auth.setUpProfile(&account);
    addfriend.setUpProfile(&account);

    connect(&auth, &authwindow::showMainWindow, this, &MainWindow::windowInit, Qt::UniqueConnection);
    connect(&addfriend, &AddFriend::sendContact, this, &MainWindow::addContact, Qt::UniqueConnection);
    connect(&opt, &Options::logoutProfile, this, &MainWindow::logoutProfile, Qt::UniqueConnection);
    connect(&account, &Profile::authorizationError, this, &MainWindow::logout, Qt::UniqueConnection);
    connect(&account, &Profile::updateWindow, this, &MainWindow::updateWindow, Qt::UniqueConnection);
    connect(&account, SIGNAL(logout(QString)), this, SLOT(logout(QString)), Qt::DirectConnection);
    connect(ui->lineFindLogin, SIGNAL(textChanged(const QString&)), this, SLOT(findContact(const QString&)));
    connect(ui->lineFindMsg, SIGNAL(textChanged(const QString&)), this, SLOT(changeMsgLineEvent(const QString&)));
    connect(account.getMonitor_ptr(), SIGNAL(authorizationError()), this, SLOT(logout()));
    auth.show();

//    this->show();
//    ui->ContactsList->addItem("Green");
//    ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackgroundColor(Qt::green);
//    //ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackground(Qt::gray);

}
Ejemplo n.º 2
0
ScreenshotEditWidget::ScreenshotEditWidget(QPixmap* source) :
    QDialog(NULL),
    _selectedTool(ST_CustomDraw),
    _toolActive(false),
    _source(source),
    _newPixmap(*source),
    ui(new Ui::ScreenshotEditWidget)
{
    QString new_color = Application::settings().GetParameter("color", DEFAULT_COLOR);
    _color = QColor(new_color);
    ui->setupUi(this);
    this->setGeometry(0, 0,
                      source->width() + ui->colorDisplayWidget->x() * 2,
                      ui->screenshotDisplayWidget->y() + source->height() +
                        ui->colorDisplayWidget->height() + 10);

    int minWidth = ui->clearButton->x() + ui->clearButton->width() + ui->colorDisplayWidget->x();

    if (this->width() < minWidth) {
        this->setGeometry(this->x(), this->y(), minWidth, this->height());
    }

    ui->screenshotDisplayWidget->setGeometry(width() / 2 - source->width() / 2,
                                        ui->screenshotDisplayWidget->y(),
                                        source->width(), source->height());

    this->move(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
               QDesktopWidget().availableGeometry().center().y() - (this->height() / 2));
    ui->buttonBox->setGeometry(ui->buttonBox->x(),
                               ui->screenshotDisplayWidget->y() + ui->screenshotDisplayWidget->height() + 10,
                               this->width() - ui->buttonBox->x() * 2 - 20,
                               ui->buttonBox->height());

    this->setFixedSize(this->size());
}
Ejemplo n.º 3
0
qreal Screen::dpi() const
{
    Q_D(const Screen);
    qreal sdpi = 0.0;
#ifdef CALCULATE_DPI
    int w = width();
    int h = height();
    qreal physicalDisplaySize = 0.0;
    if (w*h == 640*360)
        physicalDisplaySize = 3.5;
    else if (w*h == 640*480)
        physicalDisplaySize = 2.46;
    else if (w*h == 320*240)
        physicalDisplaySize = 2.8;
    else if (w*h == 800*480)
        physicalDisplaySize = 3.5;
    else
        physicalDisplaySize = 3.5;

    qreal width_r = w;
    qreal height_r = h;
    sdpi = sqrt(width_r*width_r + height_r*height_r) / physicalDisplaySize;
#else
    sdpi = QDesktopWidget().physicalDpiX();
#endif
#ifdef TRACE_SCREEN
    qDebug() << "dpi=" <<sdpi <<", logicalX="<<QDesktopWidget().logicalDpiX()
                <<", logicalY="<<QDesktopWidget().logicalDpiY()
                  <<", physicalX="<<QDesktopWidget().physicalDpiX()
                    <<", physicalY="<<QDesktopWidget().physicalDpiY();
#endif
    return sdpi;
}
Ejemplo n.º 4
0
TLoginWindow::TLoginWindow()
    : QWidget(NULL)
{
    qDebug() << Q_FUNC_INFO;
    this->setFixedSize(LOGIN_WINDOW_WIDTH, LOGIN_WINDOW_HEIGHT_NOCAPTCHA);
    this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
                      QDesktopWidget().availableGeometry().center().y() - (this->height() / 2),
                       this->width(), this->height());

    QGridLayout* layout = new QGridLayout(this);

    QLabel* loginLabel = new QLabel(tr("Login:"******"Password:"******"Captcha:"), this);
    layout->addWidget(captchaLabel, 3, 0);

    LoginEdit = new QLineEdit(this);
    layout->addWidget(LoginEdit, 0, 1);

    PasswordEdit = new QLineEdit(this);
    layout->addWidget(PasswordEdit, 1, 1);

    CaptchaEdit = new QLineEdit(this);
    layout->addWidget(CaptchaEdit, 3, 1);
    CaptchaEdit->setEnabled(false);

    LoginButton = new QPushButton(tr("Login"), this);
    connect(LoginButton.data(), &QPushButton::clicked, this,
            &TLoginWindow::OnLoginButtonClicked);
    layout->addWidget(LoginButton, 4, 0);

    RegisterButton = new QPushButton(tr("Register"), this);
    connect(RegisterButton.data(), &QPushButton::clicked, this,
            &TLoginWindow::OnRegisterButtonClicked);
    layout->addWidget(RegisterButton, 4, 1);


    layout->setColumnMinimumWidth(0, 120);
    layout->setColumnMinimumWidth(1, 120);

    this->show();
}
Ejemplo n.º 5
0
QRect WinSnippingArea::getFullScreenRect() const
{
    QRect fullScreenRect = QDesktopWidget().rect();
    auto screenCount = QDesktopWidget().screenCount();
    for(int i = 0; i < screenCount; i++) {
        auto screenRect = QDesktopWidget().screenGeometry(i);
        if(screenRect.x() < fullScreenRect.x()) {
            fullScreenRect.moveLeft(screenRect.x());
        }
        if(screenRect.y() < fullScreenRect.y()) {
            fullScreenRect.moveBottom(screenRect.y());
        }
    }
    return fullScreenRect;
}
Ejemplo n.º 6
0
TChatWindow::TChatWindow(const QString& frndLogin)
    : FriendLogin(frndLogin)
{
    this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (CHAT_WINDOW_WIDTH / 2),
                      QDesktopWidget().availableGeometry().center().y() - (CHAT_WINDOW_HEIGHT / 2),
                       CHAT_WINDOW_WIDTH, CHAT_WINDOW_HEIGHT);
    this->setWindowTitle(frndLogin);

    MessagesModel.setStringList(Messages);

    QVBoxLayout* currentLayout = new QVBoxLayout(this);

    CallStatusLabel = new QLabel(this);
    CallStatusLabel->setStyleSheet("QLabel { font-size: 12px; font: bold; }");
    currentLayout->addWidget(CallStatusLabel.data());
    CallStatusLabel->hide();

    CallButton = new QPushButton(this);
    currentLayout->addWidget(CallButton.data());
    connect(CallButton.data(), &QPushButton::clicked, this, &TChatWindow::OnCallClicked);

    DeclineButton = new QPushButton(this);
    currentLayout->addWidget(DeclineButton.data());
    connect(DeclineButton.data(), &QPushButton::clicked, [this] () {
        CallStatus = NVocal::CAS_NotCalling;
        UpdateCallStatus();
        emit OnFinishCall(FriendLogin);
    });

    UpdateCallStatus();

    QListView* messagesListView = new QListView();
    messagesListView->setModel(&MessagesModel);
    currentLayout->addWidget(messagesListView);
    MessageEdit = new TChatMessageEdit();
    connect(MessageEdit.data(), &TChatMessageEdit::SendMessage, this, &TChatWindow::OnSendMessage);

    MessageEdit->setFixedHeight(CHAT_MESSAGE_HEIGHT);
    currentLayout->addWidget(MessageEdit);

    RingSound = new QSound(":/sounds/ring.wav");
    RingSound->setLoops(-1);

    CallSound = new QSound(":/sounds/call.wav");
    CallSound->setLoops(-1);

    this->show();
}
Ejemplo n.º 7
0
void PreviewWidget::zoomOut()
{
	m_currentZoom -= m_zoomStep;
	if (m_currentZoom < m_zoomMin)
		m_currentZoom = m_zoomMin;
	emit(zoomChanged((int)((m_currentZoom/((double)QDesktopWidget().screen()->width()/(screen_widthMM*10)))*100 + 0.5)));
}
Ejemplo n.º 8
0
/** Restores the last size and location of the window. */
void
VidaliaWindow::restoreWindowState()
{
#if QT_VERSION >= 0x040200
  QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
  if (geometry.isEmpty())
    adjustSize();
  else
    restoreGeometry(geometry);
#else
  QRect screen = QDesktopWidget().availableGeometry();

  /* Restore the window size. */
  QSize size = getSetting("Size", QSize()).toSize();
  if (!size.isEmpty()) {
    size = size.boundedTo(screen.size());
    resize(size);
  }

  /* Restore the window position. */
  QPoint pos = getSetting("Position", QPoint()).toPoint();
  if (!pos.isNull() && screen.contains(pos)) {
    move(pos);
  }
#endif
}
Ejemplo n.º 9
0
SplashScreen::SplashScreen( QWidget* parent ) : QDialog( parent )
{
    setupUi( this );

      // On top + no decoration
    setWindowFlags( Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );

      // Center of the screen
    QRect rect = frameGeometry();
    rect.moveCenter( QDesktopWidget().availableGeometry().center() );
    move( rect.topLeft() );

      // Information
    lAppName->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lAppName ) );
    lAppName->setText( Alexandra::appNameGui );

    lVersion->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lVersion ) );
    lVersion->setText( QString( "version %1").arg( Alexandra::appVersionFull ) );

    lAuthor->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lAuthor ) );
    lAuthor->setText( Alexandra::appAuthor );

    lWebsite->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lWebsite ) );
    lWebsite->setText( Alexandra::appWebsite );

    lLoading->setGraphicsEffect( new EffectDropShadow( 0, 0, "white", lLoading ) );
}
Ejemplo n.º 10
0
void
MainWindow::centralizeFrame()
{
	QRect frect = frameGeometry();
	frect.moveCenter(QDesktopWidget().availableGeometry().center());
	move(frect.topLeft());
}
Ejemplo n.º 11
0
void Widget::setCentralWidgetPropreties()
{
    this->setWindowTitle("Vadim Khakham & Gilad Eini Soduku Solver using sat4j");
    this->resize(QDesktopWidget().availableGeometry(this).size() * 0.7);
    mainLayout = new QVBoxLayout;
    this->setLayout(mainLayout);
}
Ejemplo n.º 12
0
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    /*kozepre teszi a nyito kepernyot*/
    QRect available_geom = QDesktopWidget().availableGeometry();
    QRect current_geom =  frameGeometry();

    setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
        available_geom.height() / 2 - current_geom.height() / 2,
        current_geom.width(),
        current_geom.height());
    /********************************/

    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));    
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(MenTXT()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
    connect(ui->actionBinom, SIGNAL(triggered()), this, SLOT(binom()) );
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(printIt()));

    ui->mainToolBar->addAction(ui->actionSave);
    ui->mainToolBar->addAction(ui->actionPrint);
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addAction(ui->actionBinom);
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addAction(ui->actionHelp);

    verzio = "2010-03-03";

    settingClear();

}
Ejemplo n.º 13
0
QPoint ThemepackLoader::widgetPos(const QString &name)
{
    d->mSettings->beginGroup(name);
    int x = 0;
    int y = 0;
    QRect screenRect = QDesktopWidget().availableGeometry();

    QString x_value = d->mSettings->value("x").toString();
    QString y_value = d->mSettings->value("y").toString();

    QRegExp rx("(\\d+)");
    rx.indexIn(x_value, 0);

    qDebug() << Q_FUNC_INFO << "Parsed Value" << rx.cap(1); 
    x = rx.cap(1).toUInt();
    x = (screenRect.width()/100) * x;


    rx.indexIn(y_value, 0);
    y = rx.cap(1).toUInt();
    y = (screenRect.height()/100) * y;

    qDebug() << Q_FUNC_INFO << x << ": " << y;

    d->mSettings->endGroup();

    return QPoint(x, y);
}
Ejemplo n.º 14
0
frmNapiProjektUpload::frmNapiProjektUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    ui.setupUi(this);

    setAttribute(Qt::WA_QuitOnClose, false);

    connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory()));
    connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged()));
    connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked()));
    connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool)));
    connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString)));
    connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked()));
    connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished()));
    connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int)));
    connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString)));
    connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass()));
    connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

    if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
        ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());

    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());
}
Ejemplo n.º 15
0
SMGui::SMGui(QWidget *parent) :
    QMainWindow(parent)
{
    QRect available_geom = QDesktopWidget().availableGeometry();
    QRect current_geom = frameGeometry();
    setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
                            available_geom.height()  - current_geom.height() / 2,
                            current_geom.width()/2,
                            current_geom.height()/2);


    this->setMaximumHeight(400);
    this->setMaximumWidth(300);
    vlayout = new QVBoxLayout;
    vGroup = new QGroupBox;
    vGroup->setLayout(vlayout);

    widgetlayout = new QVBoxLayout;
    centralWidget = new QWidget;

    this->setMaximumWidth(300);
    this->show();
    Logger::getInstance().log("creating GUI", 1);

}
Ejemplo n.º 16
0
frmProgress::frmProgress(QWidget * parent, Qt::WindowFlags f)
    : QWidget(parent, f)
{
    qRegisterMetaType<QNapiSubtitleInfoList>("QNapiSubtitleInfoList");

    ui.setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, false);
    setAttribute(Qt::WA_QuitOnClose, false);

    setBatchMode(false);

    connect(&getThread, SIGNAL(fileNameChange(const QString &)),
            ui.lbFileName, SLOT(setText(const QString &)));
    connect(&getThread, SIGNAL(actionChange(const QString &)),
            ui.lbAction, SLOT(setText(const QString &)));
    connect(&getThread, SIGNAL(progressChange(int, int, float)),
            this, SLOT(updateProgress(int, int, float)));
    connect(&getThread, SIGNAL(selectSubtitles(QString, QNapiSubtitleInfoList)),
            this, SLOT(selectSubtitles(QString, QNapiSubtitleInfoList)));
    connect(this, SIGNAL(subtitlesSelected(int)),
            &getThread, SLOT(subtitlesSelected(int)));
    connect(&getThread, SIGNAL(finished()),
            this, SLOT(downloadFinished()));

    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());
}
Ejemplo n.º 17
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->model = new SailSizeModel(parent, 80);
    this->windSizeTableModel = new WindSizeTableModel(this, this->model);
    // connect the weightslider to the model
    QObject::connect(ui->weightSlider,SIGNAL(valueChanged(int)), this->model, SLOT(setWeight(int)));

    // connect the fromWindSlider to the model
    QObject::connect(ui->windSlider1,SIGNAL(valueChanged(int)),
                     this, SLOT(setWindSpeed(int)));

    // connect the fromWindSlider to the model
    QObject::connect(ui->windSlider2,SIGNAL(valueChanged(int)),
                     this, SLOT(setWindSpeed(int)));

    // connect the model update signal to the main window
    QObject::connect(this->model,SIGNAL(updated()), this, SLOT(modelUpdated()));

    ui->weightSlider->setValue(this->model->weight());

    ui->weightLabel->setMinimumWidth(90);
    ui->windRangeLabel->setMinimumWidth(90);

    this->updateWeightLabel();
    this->updateWindRangeLabel();

    ui->sailSizeTable->setModel(this->windSizeTableModel);
    ui->sailSizeTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    // center window on screen
    QRect frect = frameGeometry();
    frect.moveCenter(QDesktopWidget().availableGeometry().center());
    move(frect.topLeft());
}
Ejemplo n.º 18
0
bool ConfigManager::hasConfigPacks()
{
    //Warning message: if no installed config packs
    if(ui->configList->findItems(QString("*"), Qt::MatchWrap | Qt::MatchWildcard).isEmpty())
    {
        QMessageBox msgBox(this);
        msgBox.setWindowTitle(tr("No config packs were found"));
        msgBox.setTextFormat(Qt::RichText); //this is what makes the links clickable
        #if (QT_VERSION >= 0x050100)
        msgBox.setTextInteractionFlags(Qt::TextBrowserInteraction);
        #endif
        msgBox.setText(
            tr("No configuration packages were found!<br>\n"
               "Please download and install them into this directory<br>\n<br>\n%1<br>\n<br>\n"
               "You can use any configuration package here:<br>%2")
            .arg(AppPathManager::userAppDir() + "/configs")
            .arg("<a href=\"http://wohlsoft.ru/config_packs/\">"
                 "http://wohlsoft.ru/config_packs/"
                 "</a>")
        );
        QSize mSize = msgBox.sizeHint();
        QRect screenRect = QDesktopWidget().screen()->rect();
        msgBox.move(QPoint(screenRect.width() / 2 - mSize.width() / 2,
                           screenRect.height() / 2 - mSize.height() / 2));
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.exec();
        return false;
    }
    return true;
}
Ejemplo n.º 19
0
void PsMainWindow::psInitSize() {
	setMinimumWidth(st::wndMinWidth);
	setMinimumHeight(st::wndMinHeight);

	TWindowPos pos(cWindowPos());
	QRect avail(QDesktopWidget().availableGeometry());
	bool maximized = false;
	QRect geom(avail.x() + (avail.width() - st::wndDefWidth) / 2, avail.y() + (avail.height() - st::wndDefHeight) / 2, st::wndDefWidth, st::wndDefHeight);
	if (pos.w && pos.h) {
		QList<QScreen*> screens = App::app()->screens();
		for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
			QByteArray name = (*i)->name().toUtf8();
			if (pos.moncrc == hashCrc32(name.constData(), name.size())) {
				QRect screen((*i)->geometry());
				int32 w = screen.width(), h = screen.height();
				if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
					if (pos.w > w) pos.w = w;
					if (pos.h > h) pos.h = h;
					pos.x += screen.x();
					pos.y += screen.y();
					if (pos.x < screen.x() + screen.width() - 10 && pos.y < screen.y() + screen.height() - 10) {
						geom = QRect(pos.x, pos.y, pos.w, pos.h);
					}
				}
				break;
			}
		}

		if (pos.y < 0) pos.y = 0;
		maximized = pos.maximized;
	}
	setGeometry(geom);
}
Ejemplo n.º 20
0
bool MainWindow::canExtendNoMove(int extendBy) const {
	auto desktop = QDesktopWidget().availableGeometry(this);
	auto inner = geometry();
	auto innerRight = (inner.x() + inner.width() + extendBy);
	auto desktopRight = (desktop.x() + desktop.width());
	return innerRight <= desktopRight;
}
Ejemplo n.º 21
0
QPoint ThemepackLoader::widgetPos(const QString &name)
{
    // TODO: Do the same with the width and height of the widget
    // getting relative width/height and returning either QPoint or width/height pair
    d->mSettings->beginGroup(name);
    int x = 0;
    int y = 0;
    QRect screenRect = QDesktopWidget().screenGeometry();
#ifdef Q_WS_WIN
    // A 1px hack to make the widget fullscreen and not covering the toolbar on Win
    screenRect.setHeight(screenRect.height()-1);
#endif

    QString x_value = d->mSettings->value("x").toString();
    QString y_value = d->mSettings->value("y").toString();

    QRegExp rx("(\\d+)");
    rx.indexIn(x_value, 0);

    qDebug() << Q_FUNC_INFO << "Parsed Value: " << rx.cap(1);
    x = rx.cap(1).toUInt();
    x = (screenRect.width()/100) * x;


    rx.indexIn(y_value, 0);
    y = rx.cap(1).toUInt();
    y = (screenRect.height()/100) * y;

    qDebug() << Q_FUNC_INFO << x << ": " << y;

    d->mSettings->endGroup();

    return QPoint(x, y);
}
Ejemplo n.º 22
0
QPoint Widget::stringToPos(QString string)
{
    string.replace("X", "x");
    string.replace("*", "x");
    const QStringList splitted = string.split("x");
    if (string.isEmpty() || !string.contains('x') || splitted.size() < 2)
        return QPoint();
    QPoint ret;
    ret.setX(QString(splitted[0]).toInt());
    ret.setY(QString(splitted[1]).toInt());
    if (ret.x() < 0)
      ret.setX(QDesktopWidget().screenGeometry(this).width() + ret.x());
    if (ret.y() < 0)
      ret.setY(QDesktopWidget().screenGeometry(this).height() + ret.y());

    return ret;
}
Ejemplo n.º 23
0
PreviewWidget::PreviewWidget(QWidget *parent)
		: QGraphicsView(parent)
{
	m_currentZoom=(double)QDesktopWidget().screen()->width()/(screen_widthMM*10);
	m_zoomMin=m_currentZoom/4;
	m_zoomMax=m_currentZoom*4;
	m_zoomStep=m_currentZoom/4;
}
Ejemplo n.º 24
0
void starter::showMenu()
{
   startMenu->setMinimumSize ( 0, 0 );
   startMenu->setMaximumSize ( 32767, 32767 );
   startMenu->setPanelPosition((StartMenu::PanelPosition)configDialog->dialogPanelPos->currentItem());
   if (configDialog->customDialogSize->isChecked())
   {
      startMenu->resize(configDialog->dialogW->value(), configDialog->dialogH->value());
      startMenu->setFixedSize(startMenu->size());
//       startMenu->setFixedSize(_MAX_(configDialog->dialogW->value(), startMenu->minimumWidth()), _MAX_(startMenu->minimumHeight(), configDialog->dialogH->value()));
   }
   else
   {
      QRect desktop = QDesktopWidget().availableGeometry( startMenu );
//    setActiveWindow();
      startMenu->resize(desktop.width()/2, desktop.width()*9/32);
      startMenu->setFixedSize(startMenu->size());
//       startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/2) , _MAX_(startMenu->minimumHeight(), desktop.width()*9/32)); // 16:9 window, width == 1/2 screen
   }
   QPoint pt;
   if (configDialog->customDialogPos->isChecked())
   {
      if (configDialog->dialogFollowMouse->isChecked())
      {
         QRect desktop = QDesktopWidget().availableGeometry( startMenu );
         int x,y;
         x = QCursor::pos().x() + startMenu->width()/2 < desktop.width() ? QCursor::pos().x() - startMenu->width()/2 : desktop.width() - startMenu->width();
         if (x < 0) x = 0;
         y = QCursor::pos().y() + startMenu->height()/2 < desktop.height() ? QCursor::pos().y() - startMenu->height()/2 : desktop.height() - startMenu->height();
         if (y < 0) y = 0;
         pt = QPoint(x, y);
      }
      else
         pt = QPoint(configDialog->dialogX->value(), configDialog->dialogY->value());
   }
   else
   {
      QRect desktop = QDesktopWidget().availableGeometry( startMenu );
      pt = QPoint((desktop.right() - startMenu->width())/2, (desktop.bottom() - startMenu->height())/2);
   }
   if (configDialog->showDialogTitlebar->isChecked())
      startMenu->reparent(this, Qt::WType_TopLevel, pt, true);
   else
      startMenu->reparent(this, Qt::WType_TopLevel | Qt::WStyle_Customize | Qt::WStyle_NoBorder, pt, true);
}
Ejemplo n.º 25
0
void MetricFontDialog::updateSample()
{
	sampleGraphicsView->scene()->clear();
	QFont f=m_font;
	double scale=(double)screen_heightMM/QDesktopWidget().screen()->height();
	f.setPixelSize(m_font.pointSizeF()/scale);
	sampleGraphicsView->scene()->setFont(f);
	sampleGraphicsView->scene()->addText(m_fontDatabase.writingSystemSample(m_fontDatabase.writingSystems(f.family()).size()?m_fontDatabase.writingSystems(f.family())[writingSystemComboBox->currentIndex()>-1 && m_fontDatabase.writingSystems(f.family()).size()>writingSystemComboBox->currentIndex() ? writingSystemComboBox->currentIndex(): 0]:QFontDatabase::Any),f);
}
Ejemplo n.º 26
0
void SMGui::setLower(){
    QRect available_geom = QDesktopWidget().availableGeometry();
    QRect current_geom = frameGeometry();
    setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
                            available_geom.height()  - current_geom.height() / 2,
                            current_geom.width()/2,
                            current_geom.height()/2);

}
Ejemplo n.º 27
0
void Widget::updateTopRightAnimation(QVariant value)
{
    const int end = QDesktopWidget().screenGeometry(this).width();
    const int val = value.toInt();
    const int finalHeight = getHeight();
    QPoint p(end, 0);
    if (m_settings.has("gui/screen") && !m_settings.get("gui/screen").toString().isEmpty()) {
        p = QDesktopWidget().screenGeometry(m_settings.get("gui/screen").toInt()).topRight();
        ++p.rx();
    } else if (m_settings.has("gui/absolute_position") && !m_settings.get("gui/absolute_position").toString().isEmpty()) {
        QPoint tmp = stringToPos(m_settings.get("gui/absolute_position").toString());
        if (!tmp.isNull()) {
          p = tmp;
        }
    }
    setGeometry(p.x()-val, p.y(), val, finalHeight);
    layout()->setSpacing(0);
    show();
}
Ejemplo n.º 28
0
AboutForm::AboutForm(QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	ui.setupUi(this);
	QRect frect = frameGeometry();
	frect.moveCenter(QDesktopWidget().availableGeometry().center());
	move(frect.topLeft());

	connect(ui.okButton, SIGNAL(click()), this, SLOT(OnOkClick()));
}
Ejemplo n.º 29
0
CopyGui::CopyGui(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::CopyGui)
{
    ui->setupUi(this);

    checkEdit = false;

    //combo box borrowed status
    ui->cbCPStatus->addItem(tr("In Storeroom"));
    ui->cbCPStatus->addItem(tr("In Library"));
    ui->cbCPStatus->addItem(tr("Lost"));
    ui->cbCPStatus->addItem(tr("Borrowed"));    
    ui->cbStatus->addItem(tr("All"));
    ui->cbStatus->addItem(tr("In Storeroom"));
    ui->cbStatus->addItem(tr("In Library"));
    ui->cbStatus->addItem(tr("Lost"));
    ui->cbStatus->addItem(tr("Borrowed"));


    //selected_id = Library::collection_id;
    readData();
    //made the widget hide
    ui->widget->hide();
    checkHide = false;

    //hide select borrower
    ui->widget_2->hide();
    checkHide2 = false;

    //set middle position for display screen
    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());

    //Get borrower list
    QSqlQuery qry;
    qry.prepare( "SELECT * FROM borrowers");
    if( !qry.exec() )
        qDebug() << qry.lastError();
    else
    {
        for(int row = 0; qry.next(); row++){
            ui->cbBorrower->addItem(qry.value("name").toString(),qry.value("id").toInt());



//            for(int col = 0; col < cols; col++){

//                copyModel->setData(index, qry.value(col));//index of the table, data
//            }
        }
    }

}
Ejemplo n.º 30
0
    void show(const char* message) {
        message_label.setText(QString::fromUtf8(message));

        // resize and move the window to the top right corner
        resize(WIDTH, HEIGHT);
        move(QDesktopWidget().screenGeometry().width() - WIDTH, 0);

        QMainWindow::show();

        startTimer(1000);
    }