示例#1
0
void ScrollBar::recountSize() {
	setGeometry(_vertical ? QRect(_area->width() - _st->width, 0, _st->width, _area->height()) : QRect(0, _area->height() - _st->width, _area->width(), _st->width));
}
void KonvergoWindow::loadGeometry()
{
  QRect rc = loadGeometryRect();
  if (rc.isValid())
    setGeometry(rc);
}
示例#3
0
void popupWindow::updateSize() {
    setGeometry(x(), y(), width(), height());
    emit geometryChanged();
}
示例#4
0
MainWindow::MainWindow(QWidget* parent)
  : QWidget(parent) {
  TimeEntryActivitiesModel someModel;

  // Position the window to the last place we stored it at.
  QPoint mainWindowPos(Config::Get().mainWindowPos());
  QSize mainWindowSize(Config::Get().mainWindowSize());
  if (mainWindowPos != QPoint(0, 0) && mainWindowSize != QSize(0, 0))
    setGeometry(QRect(mainWindowPos, mainWindowSize));

  // Create and link up the worker object that will load our issues for us.
  m_dataLoader = new DataLoader(this);
  connect(m_dataLoader, SIGNAL(progress(int, int)), this,
          SLOT(onDataLoaderProgress(int, int)));
  connect(m_dataLoader, SIGNAL(finished()), this, SLOT(onDataLoaderFinished()));

  // Create the main buttons.

  m_settingsButton = new QPushButton("Settings");
  connect(m_settingsButton, SIGNAL(clicked()), this,
          SLOT(onSettingsButtonClicked()));

  m_updateButton = new QPushButton("Update");
  connect(m_updateButton, SIGNAL(clicked()), this,
          SLOT(onUpdateButtonClicked()));

  m_startButton = new QPushButton("Start");
  connect(m_startButton, SIGNAL(clicked()), this, SLOT(onStartButtonClicked()));

  // Create the active issue widget.

  m_activeIssueWidget = new ActiveIssueWidget;
  m_activeIssueWidget->hide();
  connect(m_activeIssueWidget, SIGNAL(trackingCompleted()), this,
          SLOT(onActiveIssueWidgetTrackingCompleted()));

  // Create the progress bar.

  m_progressBar = new QProgressBar;
  m_progressBar->setMinimum(0);
  m_progressBar->setMaximum(100);
  m_progressBar->setValue(50);
  m_progressBar->setTextVisible(false);
  m_progressBar->setVisible(false);

  // Create the issues model that we use in the issues table.

  m_issuesTableModel = new IssuesTableModel(this);

  // Create the issues table.

  m_issuesTable = new IssuesTableView;
  m_issuesTable->setFrameShape(QFrame::NoFrame);
  m_issuesTable->setItemDelegate(new IssueTableItemDelegate);
  m_issuesTable->setModel(m_issuesTableModel);
  connect(m_issuesTable, SIGNAL(clicked(QModelIndex)), this,
          SLOT(onSelectIssue(QModelIndex)));

  // Set up the layouts.
  QHBoxLayout* buttonsLayout = new QHBoxLayout;
  buttonsLayout->setMargin(5);
  buttonsLayout->setSpacing(5);
  buttonsLayout->addWidget(m_settingsButton);
  buttonsLayout->addWidget(m_updateButton);
  buttonsLayout->addWidget(m_startButton);

  QVBoxLayout* mainLayout = new QVBoxLayout(this);
  mainLayout->setMargin(0);
  mainLayout->setSpacing(0);
  mainLayout->addLayout(buttonsLayout);
  mainLayout->addWidget(m_activeIssueWidget);
  mainLayout->addWidget(m_issuesTable);
  mainLayout->addWidget(m_progressBar);

  setLayout(mainLayout);

  m_issueListTimer = new QTimer(this);
  connect(m_issueListTimer, SIGNAL(timeout()), this,
          SLOT(onUpdateButtonClicked()));

  // Do an update.
  onUpdateButtonClicked();
}
示例#5
0
QScreenScallingWin::QScreenScallingWin(QWidget* parent) : QMainWindow(parent)
{
    app_settings settings;
    setWindowFlags(Qt::FramelessWindowHint);   
    setFocusPolicy(Qt::NoFocus);
    setObjectName("scalling_window");
    
    sel_bit = 1;
    //musimy ustawic okno jako nieprzeźroczyste - białe tło
    QPalette transparentPallete;
    transparentPallete.setColor(QPalette::Window, QColor(255, 255, 255, 255));
    //transparentPallete.setBrush(QPalette::Background,*(new QBrush(*(new QPixmap(QString::fromUtf8(":/img/scr_adj.png"))))));
    setPalette(transparentPallete);
    
    adj_buttons[1] = new QLabel(this);
    adj_buttons[1]->setGeometry(452,(332),120,80);
    adj_buttons[1]->setText("sdsdd");
    adj_buttons[1]->setObjectName("simple_label");
    adj_buttons[1]->setAlignment(Qt::AlignCenter);
    adj_buttons[1]->setPixmap(QPixmap(":/img/Przesuniecie.xpm"));
 //   adj_buttons[1]->image (*new xpmImage(Przesuniecie_xpm));

    adj_buttons[0] = new QLabel(this);
    adj_buttons[0]->setGeometry(472,(adj_buttons[1]->y()-160),80,80);
    adj_buttons[0]->setText("\u25b3");
    adj_buttons[0]->setObjectName("simple_label");
    adj_buttons[0]->setAlignment(Qt::AlignCenter);


    adj_buttons[2] = new QLabel(this);
    adj_buttons[2]->setGeometry(472,(adj_buttons[1]->y()+160),80,80);
    adj_buttons[2]->setText("\u25bd");
    adj_buttons[2]->setObjectName("simple_label");
    adj_buttons[2]->setAlignment(Qt::AlignCenter);
  //  adj_buttons[2]->image (*new xpmImage(mainmenu_arrowdown_xpm));



    adj_buttons[3] = new QLabel(this);
    adj_buttons[3]->setGeometry((adj_buttons[1]->x()-160),adj_buttons[1]->y(),80,80);
    adj_buttons[3]->setText("\u25c1");
    adj_buttons[3]->setObjectName("simple_label");
    adj_buttons[3]->setAlignment(Qt::AlignCenter);
 //   adj_buttons[3]->image (*new xpmImage(mainmenu_arrow_left_xpm));


    adj_buttons[4] = new QLabel(this);
    adj_buttons[4]->setGeometry((adj_buttons[1]->x()+180),adj_buttons[1]->y(),80,80);
    adj_buttons[4]->setText("\u25b7");
    adj_buttons[4]->setObjectName("simple_label");
    adj_buttons[4]->setAlignment(Qt::AlignCenter);
 //   adj_buttons[4]->image (*new xpmImage(mainmenu_arrow_right_xpm));
    
    show();
    
    adj_buttons[0]->setFont(QFont( "Arial", 50, QFont::Normal));
    adj_buttons[1]->setFont(QFont( "Arial", 50, QFont::Normal));
    adj_buttons[2]->setFont(QFont( "Arial", 50, QFont::Normal));
    adj_buttons[3]->setFont(QFont( "Arial", 50, QFont::Normal));
    adj_buttons[4]->setFont(QFont( "Arial", 50, QFont::Normal));
    
    setGeometry(0,0,1024,768);
    via_fd=-1;
    connect(parentWidget(),SIGNAL(sigMenuAction(int)),this,SLOT(doSigMenuAction(int)));
    via_connect();
    
    volatile uint32_t via_data = settings.getViaSettings();
    
    if(via_data!=0)
    {
        h_diff = ((via_data & 0x0000ff00)>>8);
        panel_h_temp = 576 - h_diff;
     //   printf("panel_h_temp:%d\n",panel_h_temp);
    }
示例#6
0
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, NULL)
{
	setWindowTitle("Debug: Disassembly View");

	if (parent != NULL)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The top frame & groupbox that contains the input widgets
	QFrame* topSubFrame = new QFrame(mainWindowFrame);

	// The input edit
	m_inputEdit = new QLineEdit(topSubFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted);

	// The cpu combo box
	m_cpuComboBox = new QComboBox(topSubFrame);
	m_cpuComboBox->setObjectName("cpu");
	m_cpuComboBox->setMinimumWidth(300);
	connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged);

	// The main disasm window
	m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this);
	connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated);

	// Force a recompute of the disassembly region
	downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");

	// Populate the combo box & set the proper cpu
	populateComboBox();
	//const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
	//gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
	//mem->views[0]->view->set_source(*source);


	// Layout
	QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
	subLayout->addWidget(m_inputEdit);
	subLayout->addWidget(m_cpuComboBox);
	subLayout->setSpacing(3);
	subLayout->setContentsMargins(2,2,2,2);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(topSubFrame);
	vLayout->addWidget(m_dasmView);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//
	// Create three commands
	m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this);
	m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this);
	m_runToCursorAct = new QAction("Run to Cursor", this);
	m_breakpointToggleAct->setShortcut(Qt::Key_F9);
	m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9);
	m_runToCursorAct->setShortcut(Qt::Key_F4);
	connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor);
	connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor);
	connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor);

	// Right bar options
	QActionGroup* rightBarGroup = new QActionGroup(this);
	rightBarGroup->setObjectName("rightbargroup");
	QAction* rightActRaw = new QAction("Raw Opcodes", this);
	QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
	QAction* rightActComments = new QAction("Comments", this);
	rightActRaw->setCheckable(true);
	rightActEncrypted->setCheckable(true);
	rightActComments->setCheckable(true);
	rightActRaw->setActionGroup(rightBarGroup);
	rightActEncrypted->setActionGroup(rightBarGroup);
	rightActComments->setActionGroup(rightBarGroup);
	rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
	rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
	rightActComments->setShortcut(QKeySequence("Ctrl+C"));
	rightActRaw->setChecked(true);
	connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addAction(m_breakpointToggleAct);
	optionsMenu->addAction(m_breakpointEnableAct);
	optionsMenu->addAction(m_runToCursorAct);
	optionsMenu->addSeparator();
	optionsMenu->addActions(rightBarGroup->actions());
}
示例#7
0
void Widget::move( const Point& relativeMovement )
{
  setGeometry( _d->desiredRect + relativeMovement );
}
示例#8
0
/*******************************************************
 * Simple widgets
 *******************************************************/
InterfacePreviewWidget::InterfacePreviewWidget
        ( QWidget *parent ) : QLabel( parent, 0 )
{
    setGeometry( 0, 0, 128, 100 );
    setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
}
示例#9
0
void InspectorWidget::resizeSlot(int h, int w)
{
    setGeometry(this->x(),this->y(),w,h);
}
示例#10
0
void AddContactBox::parentResized() {
	QSize s = parentWidget()->size();
	setGeometry((s.width() - _width) / 2, (s.height() - _height) / 2, _width, _height);
	update();
}
示例#11
0
Ui::DetachedVideoWindow::DetachedVideoWindow(QWidget* parent)
    : AspectRatioResizebleWnd()
    , parent_(parent)
	, closed_manualy_(false)
	, show_panel_timer_(this)
	, video_panel_header_(new VideoPanelHeader(this, kVPH_ShowClose)) {

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("detachedVideoWnd"));
        this->resize(400, 300);
        this->setMinimumSize(QSize(0, 0));
        this->setMaximumSize(QSize(16777215, 16777215));
        this->setProperty("DetachedVideoWindowCommon", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setAlignment(Qt::AlignVCenter);
        QMetaObject::connectSlotsByName(this);
        
#ifdef _WIN32
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SubWindow);
#else
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Window | Qt::WindowDoesNotAcceptFocus/*| Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint*/);
        setAttribute(Qt::WA_ShowWithoutActivating);
        setAttribute(Qt::WA_X11DoNotAcceptFocus);
#endif

        video_panel_header_effect_ = new UIEffects(*video_panel_header_.get());
#ifndef __linux__
        std::vector<QWidget*> panels;
        panels.push_back(video_panel_header_.get());
        _rootWidget = platform_specific::GraphicsPanel::create(this, panels);
        _rootWidget->setContentsMargins(0, 0, 0, 0);
        //_rootWidget->setProperty("WidgetWithBG", true);
        _rootWidget->setAttribute(Qt::WA_UpdatesDisabled);
        _rootWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
        layout()->addWidget(_rootWidget);
#endif //__linux__
        std::vector<QWidget*> topPanels;
        topPanels.push_back(video_panel_header_.get());
        std::vector<QWidget*> bottomPanels;
        event_filter_ = new video_window::ResizeEventFilter(topPanels, bottomPanels, this);
		installEventFilter(event_filter_);

        setAttribute(Qt::WA_UpdatesDisabled);
        setAttribute(Qt::WA_ShowWithoutActivating);

		connect(&show_panel_timer_, SIGNAL(timeout()), this, SLOT(_check_panels_vis()), Qt::QueuedConnection);
		show_panel_timer_.setInterval(1500);

		assert(!!video_panel_header_);
		if (!!video_panel_header_) {
			//video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
			//video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
			//video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true); 

            video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
            video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
            video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true);  

			connect(video_panel_header_.get(), SIGNAL(onMouseEnter()), this, SLOT(onPanelMouseEnter()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMouseLeave()), this, SLOT(onPanelMouseLeave()), Qt::QueuedConnection);

			connect(video_panel_header_.get(), SIGNAL(onClose()), this, SLOT(onPanelClickedClose()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMinimize()), this, SLOT(onPanelClickedMinimize()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMaximize()), this, SLOT(onPanelClickedMaximize()), Qt::QueuedConnection);
		}

        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowRemoveComplete(quintptr)), this, SLOT(onVoipWindowRemoveComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowAddComplete(quintptr)), this, SLOT(onVoipWindowAddComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);

        setMinimumSize(Utils::scale_value(320), Utils::scale_value(80));
        
        QDesktopWidget dw;
        const auto screen_rect = dw.screenGeometry(dw.primaryScreen());
        const auto detached_wnd_rect = rect();

        auto detached_wnd_pos = screen_rect.topRight();
        detached_wnd_pos.setX(detached_wnd_pos.x() - detached_wnd_rect.width() - 0.01f * screen_rect.width());
        detached_wnd_pos.setY(detached_wnd_pos.y() + 0.05f * screen_rect.height());

        const QRect rc(detached_wnd_pos.x(), detached_wnd_pos.y(), detached_wnd_rect.width(), detached_wnd_rect.height());
        setGeometry(rc);
}
示例#12
0
文件: vcbutton.cpp 项目: speakman/qlc
void VCButton::createContents(QPtrList <QString> &list)
{
  QRect rect(30, 30, 30, 30);

  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Name"))
	{
	  setCaption(*(list.next()));
	}
      else if (*s == QString("Parent"))
	{
	  VCFrame* parent =
	    _app->virtualConsole()->getFrame(list.next()->toInt());
	  if (parent != NULL)
	    {
	      reparent((QWidget*)parent, 0, QPoint(0, 0), true);
	    }
	}
      else if (*s == QString("X"))
	{
	  rect.setX(list.next()->toInt());
	}
      else if (*s == QString("Y"))
	{
	  rect.setY(list.next()->toInt());
	}
      else if (*s == QString("Width"))
	{
	  rect.setWidth(list.next()->toInt());
	}
      else if (*s == QString("Height"))
	{
	  rect.setHeight(list.next()->toInt());
	}
      else if (*s == QString("Textcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteForegroundColor(qc);
	}
      else if (*s == QString("Backgroundcolor"))
	{
	  QColor qc;
	  qc.setRgb(list.next()->toUInt());
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Color"))
	{
	  // Backwards compatibility for button background color
	  QString t = *(list.next());
	  int i = t.find(QString(","));
	  int r = t.left(i).toInt();
	  int j = t.find(QString(","), i + 1);
	  int g = t.mid(i+1, j-i-1).toInt();
	  int b = t.mid(j+1).toInt();
	  QColor qc(r, g, b);
	  setPaletteBackgroundColor(qc);
	}
      else if (*s == QString("Pixmap"))
	{
	  QString t;
	  t = *(list.next());
	  
	  QPixmap pm(t);
	  if (pm.isNull() == false)
	    {
	      setIconText(t);
	      setPaletteBackgroundPixmap(pm);
	    }
	}
      else if (*s == QString("Font"))
	{
	  QFont f = font();
	  QString q = *(list.next());
	  f.fromString(q);
	  setFont(f);
	}
      else if (*s == QString("Function"))
	{
	  attachFunction(list.next()->toInt());
	}
      else if (*s == QString("BindKey"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setKey(t.toInt());
	}
      else if (*s == QString("BindMod"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setMod(t.toInt());
	}
      else if (*s == QString("BindPress"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setPressAction((KeyBind::PressAction) t.toInt());
	}
      else if (*s == QString("BindRelease"))
	{
	  assert(m_keyBind);
	  QString t = *(list.next());
	  m_keyBind->setReleaseAction((KeyBind::ReleaseAction) t.toInt());
	}
      else
	{
	  // Unknown keyword, ignore
	  *list.next();
	}
    }

  setGeometry(rect);
}
示例#13
0
ParameterEditor::ParameterEditor(QWidget* parent) :
        QDialog (parent)
{
    setAttribute(Qt::WA_DeleteOnClose,true);
    QSettings settings;
    settings.beginGroup("Editor");
    if (settings.contains("Geometry")) {
        restoreGeometry(settings.value("Geometry").toByteArray());
    } else {
        setGeometry(0,0,600,600);;
    }
    settings.endGroup();
    setAutoFillBackground(true);
    pixmapLabel = new QLabel(this);
    setWindowTitle("Editor");
    // This gets replaced with the controls from the 'plugins'.
    controlWidget = new QWidget (this);

    QWidget *controls_pane = new QWidget (this);
    controlLayout = new QGridLayout (this);
    controlLayout->setColumnMinimumWidth(0,150);
    controlLayout->setColumnMinimumWidth(1,150);
    controls_pane->setLayout(controlLayout);
    display = new DisplayFrame (this);
    display->setFixedSize(300,300);
    controlLayout->addWidget(display,0,0,1,2);
    controlLayout->addWidget(controlWidget,2,0,1,2);
    tree = new ShowTreeWidget (this);
    tree->setIconSize(QSize(48,48));
    QStringList headerlabels;
    headerlabels.push_back(tr("Source"));
    headerlabels.push_back(tr("Parameters"));
    tree->setHeaderLabels(headerlabels);
    tree->setColumnWidth (0,250);
    connect (tree,SIGNAL(itemClicked(QTreeWidgetItem *, int)),this,SLOT(itemClickedData(QTreeWidgetItem *, int)));
    connect (tree,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChangedData()));
    root = NULL;
    available = new NodeSelectorWidget (this);
    available->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding);

    displayTimer = new QTimer (this);
    connect (displayTimer,SIGNAL(timeout()),this,SLOT(updateDisplay()));
    playbutton = new QPushButton (this);
    playbutton->setText(tr("Run"));
    playbutton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    connect (playbutton,SIGNAL(clicked(bool)),this,SLOT(playButtonData(bool)));
    stopbutton = new QPushButton (this);
    stopbutton->setText(tr("Stop/Reset"));
    stopbutton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    connect (stopbutton,SIGNAL(clicked(bool)),this,SLOT(stopButtonData(bool)));
    controlLayout->addWidget(playbutton,1,0);
    controlLayout->addWidget(stopbutton,1,1);

    hbox = new QHBoxLayout(this);
    hbox->addWidget(tree);
    hbox->addWidget(available);
    hbox->addWidget (controls_pane);

    load (SourceImplPtr());
    setLayout(hbox);
    
    show();
}
示例#14
0
void KoToolDockMoveManager::setGeometry( const QRect& r )
{
    setGeometry(r.x(),r.y(),r.width(),r.height());
}
示例#15
0
/** Set the pointer to the feature geometry
*/
void QgsFeature::setGeometryAndOwnership( unsigned char *geom, size_t length )
{
  QgsGeometry *g = new QgsGeometry();
  g->fromWkb( geom, length );
  setGeometry( g );
}
void PartSelectionForm::putInPlace()
{
    QPoint p = triggerButtonRef->mapToGlobal(QPoint(0, triggerButtonRef->height()));
    setGeometry(p.x(), p.y(), width(), height());
}
示例#17
0
void ContextMenu::showAt(QPoint pos) {
    QRect geom = geometry();
    geom.moveTopLeft(pos);
    setGeometry(geom);
    show();
}
示例#18
0
void DkColorSlider::updatePos(int parentWidth) {

	int pos = qRound(normedPos * (parentWidth - sliderWidth - 1));
	setGeometry(pos, 23, sliderWidth + 1, sliderWidth + sliderHalfWidth + 1);
}
示例#19
0
void Widget::setPosition( const Point& position )
{
	const Rect rectangle( position, getSize() );
    setGeometry( rectangle );
}
示例#20
0
QMoreLongInfo::QMoreLongInfo(QWidget* parent,eit_event *ev,QString service_name) : QMainWindow(parent) 
{
    setWindowFlags(Qt::FramelessWindowHint);    
//    setGeometry(112,56,800,655);
    setGeometry(0,0,1024,768);
    setObjectName("audio_win");
    setFocusPolicy(Qt::NoFocus);
    
    
    QPalette transparentPallete;
    transparentPallete.setColor(QPalette::Window, QColor(255, 255, 255, 255));
    setPalette(transparentPallete);
    
    header = new QLabel(this);
    header->setGeometry(112,30,800,60);
    header->setText(service_name);
    header->setAlignment(Qt::AlignCenter);
    header->setStyleSheet("border: none; color:white;");

    
    QWidget *horizontalLineWidget1 = new QWidget(this);
    horizontalLineWidget1->setGeometry(20,51+56,(1024-40),3);
    horizontalLineWidget1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    horizontalLineWidget1->setStyleSheet(QString("background-color: #ff6600;"));
    
    title = new QLabel(this);
    title->setObjectName("simple_label");
    title->setGeometry(20,20+50+56,(1024-40),60);
    title->setAlignment(Qt::AlignLeft|Qt::AlignHCenter);
    
    progress = new QProgressBar(this);
    progress->setObjectName("progress_bar1");
    progress->setGeometry(150,100+50+65,724,10);
    progress->setTextVisible(false);
    
    time_label = new QLabel(this);
    time_label->setObjectName("simple_label");
    time_label->setGeometry(20,80+50+65,122,50);
    time_label->setAlignment(Qt::AlignCenter);
    
    time_end_label = new QLabel(this);
    time_end_label->setObjectName("simple_label");
    time_end_label->setGeometry(1024-122-20,80+50+65,122,50);
    time_end_label->setAlignment(Qt::AlignCenter);
    
    txt = new QPlainTextEdit(this);
    txt->setObjectName("more_info_text");
    txt->setGeometry(20,155+50+56,(1024-40),480);
    txt->setReadOnly(true);
    txt->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    txt->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    txt->verticalScrollBar()->setStyleSheet("QScrollBar:vertical {border: 2px solid white; border-radius: 5px; background: solid black;width: 12px;} QScrollBar::handle:vertical { border: none; background: lightgrey; min-height: 20px;} QScrollBar::add-line:vertical {background: solid black; height: 0px; subcontrol-position: bottom; subcontrol-origin: margin;} QScrollBar::sub-line:vertical {background: solid black; height: 0px; subcontrol-position: top; subcontrol-origin: margin; } ");
    
    show();
    
//    title->setFont(QFont( "Arial", 45, QFont::Normal));
    header->setFont(QFont( "Arial", 50, QFont::Normal));
    
 //=====================================================================================================
    updateInfo(ev,service_name.toAscii().data());
}
示例#21
0
void Widget::setWidth( unsigned int width )
{
  const Rect rectangle( getRelativeRect().UpperLeftCorner, Size( width, getHeight() ) );
  setGeometry( rectangle );
}
示例#22
0
//======================================================//
void UpDownLineEdit::setPosition(int x, int y) 
{
    buttonUp->setGeometry(x, y, EDIT_WIDTH, BUTTON_HEIGHT);
    setGeometry(x, y+BUTTON_HEIGHT, EDIT_WIDTH, EDIT_HEIGHT);
    buttonDown->setGeometry(x, y+BUTTON_HEIGHT+EDIT_HEIGHT, EDIT_WIDTH, BUTTON_HEIGHT);
}
示例#23
0
void UBRubberBand::mouseMoveEvent(QMouseEvent *event)
{
    determineResizingMode(event->pos());

    if (mMouseIsPressed)
    {
        UBBoardView *view = UBApplication::boardController->controlView();
        QRect currentGeometry = geometry();

        QPoint pressPoint(event->pos());
        QPoint pressPointGlobal(view->mapToGlobal(pressPoint));
        QPoint prevPressPointGlobal(view->mapToGlobal(mLastPressedPoint));
        QPoint movePointGlogal = (view->mapToGlobal(mLastMousePos));

        QPoint topLeftResizeVector(pressPointGlobal - prevPressPointGlobal);
        QPoint rightBottomResizeVector(pressPointGlobal - movePointGlogal);

        bool bGeometryChange = true;

        switch(mResizingMode)
        {
        case None:
            {
                QPointF itemsMoveVector(view->mapToScene(pressPointGlobal) - view->mapToScene(prevPressPointGlobal));

                move(pos()+pressPointGlobal - prevPressPointGlobal);
                view->moveRubberedItems(itemsMoveVector);

                bGeometryChange = false;
                break;
            }

        case Top:
            {
                currentGeometry.setY(currentGeometry.y()+topLeftResizeVector.y());
            }break;

        case Bottom:
            {
                currentGeometry.setHeight(currentGeometry.height()+rightBottomResizeVector.y());
            }break;

        case Left:
            {
                currentGeometry.setX(currentGeometry.x()+topLeftResizeVector.x());
            }break;
        case Right:
            {
                currentGeometry.setWidth(currentGeometry.width()+rightBottomResizeVector.x());
            }break;

        case TopLeft:
            {
                currentGeometry.setX(currentGeometry.x()+topLeftResizeVector.x());  
                currentGeometry.setY(currentGeometry.y()+topLeftResizeVector.y());
            }break;

        case TopRight:
            {
                currentGeometry.setY(currentGeometry.y()+topLeftResizeVector.y());  
                currentGeometry.setWidth(currentGeometry.width()+rightBottomResizeVector.x());                
            }
            break;

        case BottomLeft:
            {
                currentGeometry.setX(currentGeometry.x()+topLeftResizeVector.x());
                currentGeometry.setHeight(currentGeometry.height()+rightBottomResizeVector.y());  
            }break;

        case BottomRight:
            {
                currentGeometry.setWidth(currentGeometry.width()+rightBottomResizeVector.x());
                currentGeometry.setHeight(currentGeometry.height()+rightBottomResizeVector.y());        
            }break;
        
        }
        if(bGeometryChange)
        {   
            setGeometry(currentGeometry);
        }

        mLastMousePos = event->pos();
    }

    QRubberBand::mouseMoveEvent(event);
} 
示例#24
0
void QEglFSWindow::setWindowState(Qt::WindowState)
{
    setGeometry(QRect());
}
示例#25
0
RecWindow::RecWindow(QWidget *parent) :
    QDialog(parent)
{
    CreateLayout(parent);
    CreateMenu();

    connect(slider1,SIGNAL(valueChanged(int)), this, SLOT(slider1_change(int)));
    connect(slider2,SIGNAL(valueChanged(int)), this, SLOT(slider2_change(int)));
    connect(rec_btn, SIGNAL(released()), this, SLOT(rec_clicked()));
    connect(save_btn, SIGNAL(released()), this, SLOT(save_clicked()));
    connect(analysis_btn, SIGNAL(released()), this, SLOT(analysis_clicked()));

    connect(a_open, SIGNAL(triggered(bool)),this,SLOT(open_clicked()));
    connect(a_focus, SIGNAL(triggered(bool)),this,SLOT(afocus_changed(bool)));
    connect(a_preview, SIGNAL(triggered(bool)),this,SLOT(preview_changed(bool)));
    filename = filter_param.filename;

    setGeometry((qApp->desktop()->geometry().center() - rect().center()).x(),(qApp->desktop()->geometry().center() - rect().center()).y(),rect().width(),rect().height());

    //load camera
    QString DeviceName;
    if (filter_param.deviceID == -1)
    {
        QStringList cam_list = getDeviceName();
        if (cam_list.size() > 1)
        {
            DeviceName = QInputDialog::getItem(this,"Select Camera","Camera",cam_list);
            DeviceName = DeviceName[DeviceName.size()-1];
            filter_param.deviceID = DeviceName.toInt();
        }
        else if (cam_list.size() == 1)
        {
            DeviceName = cam_list[0];
            DeviceName = DeviceName[DeviceName.size()-1];
            filter_param.deviceID = DeviceName.toInt();
        }
        //else device id is unchanged
    }
    capture = cvCreateCameraCapture(filter_param.deviceID);
    if (!capture)
    {
        if (filter_param.deviceID != -1)
        {
            QStringList cam_list = getDeviceName();
            if (cam_list.size() > 1)
            {
                DeviceName = QInputDialog::getItem(this,"Select Camera","Camera",cam_list);
                DeviceName = DeviceName[DeviceName.size()-1];
                filter_param.deviceID = DeviceName.toInt();
            }
            else if (cam_list.size() == 1)
            {
                DeviceName = cam_list[0];
                DeviceName = DeviceName[DeviceName.size()-1];
                filter_param.deviceID = DeviceName.toInt();
            }
            else
            {
                imageView = QImage((const unsigned char*)(NA_image->imageData), NA_image->width,NA_image->height,QImage::Format_RGB888).rgbSwapped();
                surface->setPixmap(QPixmap::fromImage(imageView.scaled(surface_width,
                                           floor((surface_width/NA_image->width)*NA_image->height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
				printf("no camera detected\n");
                return;
            }
            capture = cvCreateCameraCapture(filter_param.deviceID);
        }
        else
        {
            imageView = QImage((const unsigned char*)(NA_image->imageData), NA_image->width,NA_image->height,QImage::Format_RGB888).rgbSwapped();
            surface->setPixmap(QPixmap::fromImage(imageView.scaled(surface_width,
                                       floor((surface_width/NA_image->width)*NA_image->height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
			printf("no camera detected\n");
            return;
        }
    }
    camID = filter_param.deviceID;
    cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH,1280);
    cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT,720);
    char command[50];
    sprintf(command,"v4l2-ctl -d %d -c exposure_auto=1",camID);
    system(command);
    sprintf(command,"v4l2-ctl -d %d -c exposure_absolute=1",camID);
    system(command);
    sprintf(command,"v4l2-ctl -d %d -c focus_auto=0",camID);
    system(command);
    if (thread_cam_active)
        pthread_cancel(thread_cam);
	printf("tread started\n");
    pthread_create( &thread_cam, NULL, capture_main, (void*) this);
}
示例#26
0
xwindow::xwindow(Window w, QWidget *parent) : QWidget(parent) 
{
	dt = QApplication::desktop();
	maxstate = 0;
	mrb = NULL;
	clientid = w;
	actpal = TRUE;
	urgpal = FALSE;
	cmapwins = NULL;
	sstate = FALSE;
	tstate = FALSE;
	trsize = FALSE;
	ncmaps = 0;
	withdrawnstate = unmapped = TRUE;

	// get ClassHint
	get_classhint();
	clientname = res_class;

	// get flags for WM_COMMAND
	
	char **argv;
	int argc;
	if(XGetCommand(QX11Info::display(), w, &argv, &argc) && argc)
	{
		int ncm=0;
		while(1)
		{
			command += argv[ncm];

			if(argc > ++ncm)
				command += ' ';
			else
				break;
		}
		
		if(clientname.isEmpty() && ! command.isEmpty())
		{
			char *base;
			if((base = strrchr(argv[0], '/')) == NULL)
				base = argv[0];
			else
				base++;

			clientname = base;
		}	
		XFreeStringList(argv);
	}
	clientname = clientname.simplified();
	pflags = get_clientflags();
	
	if(pflags & WindowManager::SmallFrame)
	{
		uborderh = defaults::lowerborderheight;
		borderh = 2*uborderh;
	}
	else
	{
		uborderh = defaults::windowbuttonsize;
		borderh = defaults::windowbuttonsize+defaults::lowerborderheight;
	}

	// check for nonrectangular window
	shaped = (WindowManager::servershapes)?(query_shape()):(FALSE);

	if(pflags & WindowManager::NoResize)
		borderh -= defaults::lowerborderheight;

	// save window geometry
	Window root;
	uint bwidth,depth;
	XGetGeometry(QX11Info::display(), w, &root, &pos_x, &pos_y, &init_w, &init_h, &bwidth, &depth);
	base_w = init_w;
	base_h = init_h;
	init_h += borderh;
	
	// reparent
	XSetWindowBorderWidth(QX11Info::display(), w, 0);
	XSetWindowBorderWidth(QX11Info::display(), winId(), 0);
	XReparentWindow(QX11Info::display(), w, winId(), 0, uborderh);
	XAddToSaveSet(QX11Info::display(), w);

	// get TransientForHint
	transfor = None;
	XGetTransientForHint(QX11Info::display(), w, &transfor);

	// set Font
	setFont(defaults::borderfont);

	// get colormap and check for WM_COLORMAP_WINDOWS property
	get_colormaps();

	// get WM_CLIENT_MACHINE
	XTextProperty prop;
	if(XGetWMClientMachine(QX11Info::display(), w, &prop) && prop.nitems && prop.format == 8)
	{
		clientfqdn = (char *)prop.value;

		if(defaults::showclientmachines)
		{
			int pos = clientfqdn.indexOf('.');
			if(pos == -1)
				clientmachine = clientfqdn;
			else	
				clientmachine = clientfqdn.left(pos);
		}
	}	

	// get WMHints
	get_wmhints();

	// get WMNormalhints
	get_wmnormalhints();
	
	int cw = init_w;
	int ch = init_h;
	getsize(&cw, &ch);
		
	// window position

	if(wmnflags & USPosition)
	{
		if(wmnflags & PWinGravity && 
			(wingrav == SouthWestGravity || wingrav == SouthEastGravity))
				pos_y -= uborderh;
	}

	// a transient window with program specified position looks like a dialog box,
	// otherwise use autoplacement
	
	else if(! defaults::start_restart && (transfor == None || ! (wmnflags & PPosition)))
	{
		if(WindowManager::next_x+cw > dt->width())
		{
			pos_x = 0;
			if(cw < dt->width())
				WindowManager::next_x = 2*defaults::windowbuttonsize;
		}
		else
		{
			pos_x = WindowManager::next_x;
			WindowManager::next_x += 2*defaults::windowbuttonsize;
		}	

		int sy,ey;
		if(defaults::toolbar_top)
		{
			sy = defaults::tb_height;
			ey = dt->height();
		}
		else
		{
			sy = 0;
			ey = dt->height()-defaults::tb_height;
		}
		
		if(WindowManager::next_y+ch > ey)
		{
			pos_y = sy;
			if(ch < dt->height())
				WindowManager::next_y = sy+2*defaults::windowbuttonsize;
		}
		else
		{
			pos_y = WindowManager::next_y;
			WindowManager::next_y += 2*defaults::windowbuttonsize;
		}
	}	

	// move and resize
	
	XResizeWindow(QX11Info::display(), clientid, cw, ch-borderh);
	
	if(pos_y < 0)
		pos_y = 0;
		
	setGeometry(pos_x, pos_y, cw, ch);

    	// overwrite Qt-defaults because we need SubstructureNotifyMask
	
	XSelectInput(QX11Info::display(), winId(),
  		 KeyPressMask | KeyReleaseMask |
  		 ButtonPressMask | ButtonReleaseMask |
  		 KeymapStateMask |
   		 ButtonMotionMask |
  		 PointerMotionMask |
		 EnterWindowMask | LeaveWindowMask |
  		 FocusChangeMask |
  		 ExposureMask |
		 StructureNotifyMask |
		 SubstructureRedirectMask |
		 SubstructureNotifyMask);

	XSetWindowAttributes attr;
	attr.event_mask = ColormapChangeMask|PropertyChangeMask;
	XChangeWindowAttributes(QX11Info::display(), w, CWEventMask, &attr);

	// get WM protocols
	getwmprotocols();

	// create window borders
	create_wborder();

	// add client to lookup tables
	
	WindowManager::cwindows.insert(w, this);
	WindowManager::pwindows.insert(winId(), this);

	// get WM_NAME and set window title
	get_wmname();

	if(shaped)
		reshape();

	// init autofocus timer
	
	focustimer = new QTimer(this);
	Q_CHECK_PTR(focustimer);
	focustimer->setSingleShot(TRUE);
	connect(focustimer, SIGNAL(timeout()), SLOT(raise()));

	tfocustimer = new QTimer(this);  // used for tiled mode
	Q_CHECK_PTR(tfocustimer);
	tfocustimer->setSingleShot(TRUE);
	connect(tfocustimer, SIGNAL(timeout()), SLOT(tile_maximize()));
	
	WindowManager::send_configurenotify(this);
	
	if(! urgent && ! defaults::starturgent)
	{
		setinactive();
	}
	else 
	{
		seturgent();
	}	

	if(defaults::start_restart)  // restore original state
	{
		int clstate = get_clientstate();

		if(clstate == IconicState)
		{
			iconify();
		}	
		else if(clstate == WithdrawnState)
		{
			withdraw();
		}
		else map();
	}	
	else map();

#ifdef DEBUGMSG
	logmsg << "class xwindow constructed (WId:" << winId() << ")\n";
#endif	
}
示例#27
0
void App::init()
{
    QSettings settings;

    setWindowIcon(QIcon(":/qlcplus.png"));

    m_tab = new QTabWidget(this);
    m_tab->setTabPosition(QTabWidget::South);
    setCentralWidget(m_tab);

    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
    {
        this->restoreGeometry(var.toByteArray());
    }
    else
    {
        /* Application geometry and window state */
        QSize size = settings.value("/workspace/size").toSize();
        if (size.isValid() == true)
            resize(size);
        else
        {
            if (QLCFile::isRaspberry())
            {
                QRect geometry = qApp->desktop()->availableGeometry();
                int w = geometry.width();
                int h = geometry.height();
                if (m_overscan == true)
                {
                    // if we're on a Raspberry Pi, introduce a 5% margin
                    w = (float)geometry.width() * 0.95;
                    h = (float)geometry.height() * 0.95;
                }
                setGeometry((geometry.width() - w) / 2, (geometry.height() - h) / 2,
                            w, h);
            }
            else
                resize(800, 600);
        }

        QVariant state = settings.value("/workspace/state", Qt::WindowNoState);
        if (state.isValid() == true)
            setWindowState(Qt::WindowState(state.toInt()));
    }

    QVariant dir = settings.value(SETTINGS_WORKINGPATH);
    if (dir.isValid() == true)
        m_workingDirectory = QDir(dir.toString());

    // The engine object
    initDoc();
    // Main view actions
    initActions();
    // Main tool bar
    initToolBar();

    m_dumpProperties = new DmxDumpFactoryProperties(KUniverseCount);

    // Create primary views.
    m_tab->setIconSize(QSize(24, 24));
    QWidget* w = new FixtureManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/fixture.png"), tr("Fixtures"));
    w = new FunctionManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/function.png"), tr("Functions"));
    w = new ShowManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/show.png"), tr("Shows"));
    w = new VirtualConsole(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/virtualconsole.png"), tr("Virtual Console"));
    w = new SimpleDesk(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/slidermatrix.png"), tr("Simple Desk"));
    w = new InputOutputManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/input_output.png"), tr("Inputs/Outputs"));

    // Listen to blackout changes and toggle m_controlBlackoutAction
    connect(m_doc->inputOutputMap(), SIGNAL(blackoutChanged(bool)), this, SLOT(slotBlackoutChanged(bool)));

    // Listen to DMX value changes and update each Fixture values array
    connect(m_doc->inputOutputMap(), SIGNAL(universesWritten(int, const QByteArray&)),
            this, SLOT(slotUniversesWritten(int, const QByteArray&)));

    // Enable/Disable panic button
    connect(m_doc->masterTimer(), SIGNAL(functionListChanged()), this, SLOT(slotRunningFunctionsChanged()));
    slotRunningFunctionsChanged();

    // Start up in non-modified state
    m_doc->resetModified();

    QString ssDir;

#if defined(WIN32) || defined(Q_OS_WIN)
    /* User's input profile directory on Windows */
    LPTSTR home = (LPTSTR) malloc(256 * sizeof(TCHAR));
    GetEnvironmentVariable(TEXT("UserProfile"), home, 256);
    ssDir = QString("%1/%2").arg(QString::fromUtf16(reinterpret_cast<ushort*> (home)))
                            .arg(USERQLCPLUSDIR);
    free(home);
#else
    /* User's input profile directory on *NIX systems */
    ssDir = QString("%1/%2").arg(getenv("HOME")).arg(USERQLCPLUSDIR);
#endif

    QFile ssFile(ssDir + QDir::separator() + "qlcplusStyle.qss");
    if (ssFile.exists() == true)
    {
        ssFile.open(QFile::ReadOnly);
        QString styleSheet = QLatin1String(ssFile.readAll());
        this->setStyleSheet(styleSheet);
    }

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    m_videoProvider = new VideoProvider(m_doc, this);
#endif
}
示例#28
0
void QgsFeature::setGeometry( const QgsGeometry& geom )
{
  setGeometry( new QgsGeometry( geom ) );
}
示例#29
0
MainWindow::MainWindow(const QDir &home)
{
    /*----------------------------------------------------------------------
     *  Bootstrap
     *--------------------------------------------------------------------*/
    setAttribute(Qt::WA_DeleteOnClose);
    mainwindows.append(this);  // add us to the list of open windows
    context = new Context(this);
    context->athlete = new Athlete(context, home);

    setInstanceName(context->athlete->cyclist);
    setWindowIcon(QIcon(":images/gc.png"));
    setWindowTitle(context->athlete->home.dirName());
    setContentsMargins(0,0,0,0);
    setAcceptDrops(true);
    GCColor *GCColorSet = new GCColor(context); // get/keep colorset
    GCColorSet->colorSet(); // shut up the compiler

    #ifdef Q_OS_MAC
    // get an autorelease pool setup
    static CocoaInitializer cocoaInitializer;
    #endif
    #ifdef GC_HAVE_WFAPI
    WFApi *w = WFApi::getInstance(); // ensure created on main thread
    w->apiVersion();//shutup compiler
    #endif
    Library::initialise(context->athlete->home);
    QNetworkProxyQuery npq(QUrl("http://www.google.com"));
    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
    if (listOfProxies.count() > 0) {
        QNetworkProxy::setApplicationProxy(listOfProxies.first());
    }

    if (desktop == NULL) desktop = QApplication::desktop();
    static const QIcon hideIcon(":images/toolbar/main/hideside.png");
    static const QIcon rhideIcon(":images/toolbar/main/hiderside.png");
    static const QIcon showIcon(":images/toolbar/main/showside.png");
    static const QIcon rshowIcon(":images/toolbar/main/showrside.png");
    static const QIcon tabIcon(":images/toolbar/main/tab.png");
    static const QIcon tileIcon(":images/toolbar/main/tile.png");
    static const QIcon fullIcon(":images/toolbar/main/togglefull.png");

#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
    fullScreen = new LionFullScreen(context);
#endif
#ifndef Q_OS_MAC
    fullScreen = new QTFullScreen(context);
#endif

    // if no workout directory is configured, default to the
    // top level GoldenCheetah directory
    if (appsettings->value(NULL, GC_WORKOUTDIR).toString() == "")
        appsettings->setValue(GC_WORKOUTDIR, QFileInfo(context->athlete->home.absolutePath() + "/../").absolutePath());

    /*----------------------------------------------------------------------
     *  GUI setup
     *--------------------------------------------------------------------*/

    // need to restore geometry before setUnifiedToolBar.. on Mac
    appsettings->setValue(GC_SETTINGS_LAST, context->athlete->home.dirName());
    QVariant geom = appsettings->value(this, GC_SETTINGS_MAIN_GEOM);
    if (geom == QVariant()) {

        // first run -- lets set some sensible defaults...
        // lets put it in the middle of screen 1
        QRect size = desktop->availableGeometry();
        struct SizeSettings app = GCColor::defaultSizes(size.height(), size.width());

        // center on the available screen (minus toolbar/sidebar)
        move((size.width()-size.x())/2 - app.width/2,
             (size.height()-size.y())/2 - app.height/2);

        // set to the right default
        resize(app.width, app.height);

        // set all the default font sizes
        appsettings->setValue(GC_FONT_DEFAULT_SIZE, app.defaultFont);
        appsettings->setValue(GC_FONT_TITLES_SIZE, app.titleFont);
        appsettings->setValue(GC_FONT_CHARTMARKERS_SIZE, app.markerFont);
        appsettings->setValue(GC_FONT_CHARTLABELS_SIZE, app.labelFont);
        appsettings->setValue(GC_FONT_CALENDAR_SIZE, app.calendarFont);
        appsettings->setValue(GC_FONT_POPUP_SIZE, app.popupFont);

        // set the default fontsize
        QFont font;
        font.setPointSize(app.defaultFont);
        QApplication::setFont(font);

    } else {

        QRect size = desktop->availableGeometry();

        // ensure saved geometry isn't greater than current screen size
        if ((geom.toRect().height() >= size.height()) || (geom.toRect().width() >= size.width()))
            setGeometry(size.x()+30,size.y()+30,size.width()-60,size.height()-60);
        else
            setGeometry(geom.toRect());
    }


    /*----------------------------------------------------------------------
     *  Mac Toolbar
     *--------------------------------------------------------------------*/
#ifdef Q_OS_MAC 
    setUnifiedTitleAndToolBarOnMac(true);
    head = addToolBar(context->athlete->cyclist);
    head->setContentsMargins(0,0,0,0);

    // widgets
    QWidget *macAnalButtons = new QWidget(this);
    macAnalButtons->setContentsMargins(0,0,20,0);

    // lhs buttons
    QHBoxLayout *lb = new QHBoxLayout(macAnalButtons);
    lb->setContentsMargins(0,0,0,0);
    lb->setSpacing(0);
    import = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *importImg = new QPixmap(":images/mac/download.png");
    import->setImage(importImg);
    import->setToolTip("Download");
    lb->addWidget(import);
    lb->addWidget(new Spacer(this));
    compose = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *composeImg = new QPixmap(":images/mac/compose.png");
    compose->setImage(composeImg);
    compose->setToolTip("Create");
    lb->addWidget(compose);

    // connect to actions
    connect(import, SIGNAL(clicked(bool)), this, SLOT(downloadRide()));
    connect(compose, SIGNAL(clicked(bool)), this, SLOT(manualRide()));

    lb->addWidget(new Spacer(this));

    // activity actions .. peaks, split, delete
    QWidget *acts = new QWidget(this);
    acts->setContentsMargins(0,0,0,0);
    QHBoxLayout *pp = new QHBoxLayout(acts);
    pp->setContentsMargins(0,0,0,0);
    pp->setContentsMargins(0,0,0,0);
    pp->setSpacing(5);
    sidebar = new QtMacButton(this, QtMacButton::TexturedRounded);
    QPixmap *sidebarImg = new QPixmap(":images/mac/sidebar.png");
    sidebar->setImage(sidebarImg);
    sidebar->setMinimumSize(25, 25);
    sidebar->setMaximumSize(25, 25);
    sidebar->setToolTip("Sidebar");
    sidebar->setSelected(true); // assume always start up with sidebar selected

    actbuttons = new QtMacSegmentedButton(3, acts);
    actbuttons->setWidth(115);
    actbuttons->setNoSelect();
    actbuttons->setImage(0, new QPixmap(":images/mac/stop.png"));
    actbuttons->setImage(1, new QPixmap(":images/mac/split.png"));
    actbuttons->setImage(2, new QPixmap(":images/mac/trash.png"));
    pp->addWidget(actbuttons);
    lb->addWidget(acts);
    lb->addStretch();
    connect(actbuttons, SIGNAL(clicked(int,bool)), this, SLOT(actionClicked(int)));

    lb->addWidget(new Spacer(this));

    QWidget *viewsel = new QWidget(this);
    viewsel->setContentsMargins(0,0,0,0);
    QHBoxLayout *pq = new QHBoxLayout(viewsel);
    pq->setContentsMargins(0,0,0,0);
    pq->setSpacing(5);
    pq->addWidget(sidebar);
    styleSelector = new QtMacSegmentedButton(2, viewsel);
    styleSelector->setWidth(80); // actually its 80 but we want a 30px space between is and the searchbox
    styleSelector->setImage(0, new QPixmap(":images/mac/tabbed.png"), 24);
    styleSelector->setImage(1, new QPixmap(":images/mac/tiled.png"), 24);
    pq->addWidget(styleSelector);
    connect(sidebar, SIGNAL(clicked(bool)), this, SLOT(toggleSidebar()));
    connect(styleSelector, SIGNAL(clicked(int,bool)), this, SLOT(toggleStyle()));

    // setup Mac thetoolbar
    head->addWidget(macAnalButtons);
    head->addWidget(new Spacer(this));
    head->addWidget(new Spacer(this));
    head->addWidget(viewsel);

#ifdef GC_HAVE_LUCENE
    SearchFilterBox *searchBox = new SearchFilterBox(this,context,false);
    QCleanlooksStyle *toolStyle = new QCleanlooksStyle();
    searchBox->setStyle(toolStyle);
    searchBox->setFixedWidth(200);
    head->addWidget(searchBox);
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
#endif

#endif 

    /*----------------------------------------------------------------------
     *  Windows and Linux Toolbar
     *--------------------------------------------------------------------*/
#ifndef Q_OS_MAC

    head = new GcToolBar(this);

    QCleanlooksStyle *toolStyle = new QCleanlooksStyle();
    QPalette metal;
    metal.setColor(QPalette::Button, QColor(215,215,215));

    // get those icons
    importIcon = iconFromPNG(":images/mac/download.png");
    composeIcon = iconFromPNG(":images/mac/compose.png");
    intervalIcon = iconFromPNG(":images/mac/stop.png");
    splitIcon = iconFromPNG(":images/mac/split.png");
    deleteIcon = iconFromPNG(":images/mac/trash.png");
    sidebarIcon = iconFromPNG(":images/mac/sidebar.png");
    tabbedIcon = iconFromPNG(":images/mac/tabbed.png");
    tiledIcon = iconFromPNG(":images/mac/tiled.png");
    QSize isize(19,19);

    Spacer *spacerl = new Spacer(this);
    spacerl->setFixedWidth(5);

    import = new QPushButton(this);
    import->setIcon(importIcon);
    import->setIconSize(isize);
    import->setFixedHeight(25);
    import->setStyle(toolStyle);
    import->setToolTip(tr("Download from Device"));
    import->setPalette(metal);
    connect(import, SIGNAL(clicked(bool)), this, SLOT(downloadRide()));

    compose = new QPushButton(this);
    compose->setIcon(composeIcon);
    compose->setIconSize(isize);
    compose->setFixedHeight(25);
    compose->setStyle(toolStyle);
    compose->setToolTip(tr("Create Manual Activity"));
    compose->setPalette(metal);
    connect(compose, SIGNAL(clicked(bool)), this, SLOT(manualRide()));

    sidebar = new QPushButton(this);
    sidebar->setIcon(sidebarIcon);
    sidebar->setIconSize(isize);
    sidebar->setFixedHeight(25);
    sidebar->setStyle(toolStyle);
    sidebar->setToolTip(tr("Toggle Sidebar"));
    sidebar->setPalette(metal);
    connect(sidebar, SIGNAL(clicked(bool)), this, SLOT(toggleSidebar()));

    actbuttons = new QtSegmentControl(this);
    actbuttons->setStyle(toolStyle);
    actbuttons->setIconSize(isize);
    actbuttons->setCount(3);
    actbuttons->setSegmentIcon(0, intervalIcon);
    actbuttons->setSegmentIcon(1, splitIcon);
    actbuttons->setSegmentIcon(2, deleteIcon);
    actbuttons->setSelectionBehavior(QtSegmentControl::SelectNone); //wince. spelling. ugh
    actbuttons->setFixedHeight(25);
    actbuttons->setSegmentToolTip(0, tr("Find Intervals..."));
    actbuttons->setSegmentToolTip(1, tr("Split Activity..."));
    actbuttons->setSegmentToolTip(2, tr("Delete Activity"));
    actbuttons->setPalette(metal);
    connect(actbuttons, SIGNAL(segmentSelected(int)), this, SLOT(actionClicked(int)));

    styleSelector = new QtSegmentControl(this);
    styleSelector->setStyle(toolStyle);
    styleSelector->setIconSize(isize);
    styleSelector->setCount(2);
    styleSelector->setSegmentIcon(0, tabbedIcon);
    styleSelector->setSegmentIcon(1, tiledIcon);
    styleSelector->setSegmentToolTip(0, tr("Tabbed View"));
    styleSelector->setSegmentToolTip(1, tr("Tiled View"));
    styleSelector->setSelectionBehavior(QtSegmentControl::SelectOne); //wince. spelling. ugh
    styleSelector->setFixedHeight(25);
    styleSelector->setPalette(metal);
    connect(styleSelector, SIGNAL(segmentSelected(int)), this, SLOT(setStyleFromSegment(int))); //avoid toggle infinitely

    head->addWidget(spacerl);
    head->addWidget(import);
    head->addWidget(compose);
    head->addWidget(actbuttons);

    head->addStretch();
    head->addWidget(sidebar);
    head->addWidget(styleSelector);

#ifdef GC_HAVE_LUCENE
    // add a search box on far right, but with a little space too
    SearchFilterBox *searchBox = new SearchFilterBox(this,context,false);
    searchBox->setStyle(toolStyle);
    searchBox->setFixedWidth(200);
    head->addWidget(searchBox);
    connect(searchBox, SIGNAL(searchResults(QStringList)), this, SLOT(setFilter(QStringList)));
    connect(searchBox, SIGNAL(searchClear()), this, SLOT(clearFilter()));
#endif
    Spacer *spacer = new Spacer(this);
    spacer->setFixedWidth(5);
    head->addWidget(spacer);
#endif

    /*----------------------------------------------------------------------
     * ScopeBar
     *--------------------------------------------------------------------*/
    scopebar = new GcScopeBar(context);
    connect(scopebar, SIGNAL(selectDiary()), this, SLOT(selectDiary()));
    connect(scopebar, SIGNAL(selectHome()), this, SLOT(selectHome()));
    connect(scopebar, SIGNAL(selectAnal()), this, SLOT(selectAnalysis()));
    connect(scopebar, SIGNAL(selectTrain()), this, SLOT(selectTrain()));

    // Add chart is on the scope bar
    chartMenu = new QMenu(this);
    QCleanlooksStyle *styler = new QCleanlooksStyle();
    QPushButton *newchart = new QPushButton("+", this);
    scopebar->addWidget(newchart);
    newchart->setStyle(styler);
    newchart->setFixedHeight(20);
    newchart->setFixedWidth(24);
    newchart->setFlat(true);
    newchart->setFocusPolicy(Qt::NoFocus);
    newchart->setToolTip(tr("Add Chart"));
    newchart->setAutoFillBackground(false);
    newchart->setAutoDefault(false);
    newchart->setMenu(chartMenu);
    connect(chartMenu, SIGNAL(aboutToShow()), this, SLOT(setChartMenu()));
    connect(chartMenu, SIGNAL(triggered(QAction*)), this, SLOT(addChart(QAction*)));

    /*----------------------------------------------------------------------
     * Central Widget
     *--------------------------------------------------------------------*/

    tab = new Tab(context);

    /*----------------------------------------------------------------------
     * Central Widget
     *--------------------------------------------------------------------*/

    QWidget *central = new QWidget(this);
    setContentsMargins(0,0,0,0);
    central->setContentsMargins(0,0,0,0);
    QVBoxLayout *mainLayout = new QVBoxLayout(central);
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
#ifndef Q_OS_MAC // nonmac toolbar on main view -- its not 
                 // unified with the title bar.
    mainLayout->addWidget(head);
#endif
    mainLayout->addWidget(scopebar);
    mainLayout->addWidget(tab);
    setCentralWidget(central);

    /*----------------------------------------------------------------------
     * Application Menus
     *--------------------------------------------------------------------*/
#ifdef WIN32
    menuBar()->setStyleSheet("QMenuBar { background: rgba(225,225,225); }"
		    	     "QMenuBar::item { background: rgba(225,225,225); }");
    menuBar()->setContentsMargins(0,0,0,0);
#endif

    QMenu *fileMenu = menuBar()->addMenu(tr("&Athlete"));
    fileMenu->addAction(tr("&New..."), this, SLOT(newCyclist()), tr("Ctrl+N"));
    fileMenu->addAction(tr("&Open..."), this, SLOT(openCyclist()), tr("Ctrl+O"));
    fileMenu->addAction(tr("&Close Window"), this, SLOT(close()), tr ("Ctrl+W"));
    fileMenu->addAction(tr("&Quit All Windows"), this, SLOT(closeAll()), tr("Ctrl+Q"));

    QMenu *rideMenu = menuBar()->addMenu(tr("A&ctivity"));
    rideMenu->addAction(tr("&Download from device..."), this, SLOT(downloadRide()), tr("Ctrl+D"));
    rideMenu->addAction(tr("&Import from file..."), this, SLOT (importFile()), tr ("Ctrl+I"));
    rideMenu->addAction(tr("&Manual activity entry..."), this, SLOT(manualRide()), tr("Ctrl+M"));
    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Export..."), this, SLOT(exportRide()), tr("Ctrl+E"));
    rideMenu->addAction(tr("&Batch export..."), this, SLOT(exportBatch()), tr("Ctrl+B"));
    rideMenu->addAction(tr("Export Metrics as CSV..."), this, SLOT(exportMetrics()), tr(""));
#ifdef GC_HAVE_SOAP
    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Upload to TrainingPeaks"), this, SLOT(uploadTP()), tr("Ctrl+U"));
    rideMenu->addAction(tr("Down&load from TrainingPeaks..."), this, SLOT(downloadTP()), tr("Ctrl+L"));
#endif

#ifdef GC_HAVE_LIBOAUTH
    tweetAction = new QAction(tr("Tweet Activity"), this);
    connect(tweetAction, SIGNAL(triggered(bool)), this, SLOT(tweetRide()));
    rideMenu->addAction(tweetAction);

    shareAction = new QAction(tr("Share (Strava, RideWithGPS, CyclingAnalytics)..."), this);
    connect(shareAction, SIGNAL(triggered(bool)), this, SLOT(share()));
    rideMenu->addAction(shareAction);
#endif

    ttbAction = new QAction(tr("Upload to Trainingstagebuch..."), this);
    connect(ttbAction, SIGNAL(triggered(bool)), this, SLOT(uploadTtb()));
    rideMenu->addAction(ttbAction);

    rideMenu->addSeparator ();
    rideMenu->addAction(tr("&Save activity"), this, SLOT(saveRide()), tr("Ctrl+S"));
    rideMenu->addAction(tr("D&elete activity..."), this, SLOT(deleteRide()));
    rideMenu->addAction(tr("Split &activity..."), this, SLOT(splitRide()));
    rideMenu->addAction(tr("Merge activities..."), this, SLOT(mergeRide()));
    rideMenu->addSeparator ();

    QMenu *optionsMenu = menuBar()->addMenu(tr("&Tools"));
    optionsMenu->addAction(tr("&Options..."), this, SLOT(showOptions()));
    optionsMenu->addAction(tr("Critical Power Estimator..."), this, SLOT(showTools()));
    optionsMenu->addAction(tr("Air Density (Rho) Estimator..."), this, SLOT(showRhoEstimator()));

    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Get &Withings Data..."), this,
                        SLOT (downloadMeasures()));
    optionsMenu->addAction(tr("Get &Zeo Data..."), this,
                        SLOT (downloadMeasuresFromZeo()));
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Create a new workout..."), this, SLOT(showWorkoutWizard()));
    optionsMenu->addAction(tr("Download workouts from ErgDB..."), this, SLOT(downloadErgDB()));
    optionsMenu->addAction(tr("Import workouts or videos..."), this, SLOT(importWorkout()));
    optionsMenu->addAction(tr("Scan disk for videos and workouts..."), this, SLOT(manageLibrary()));

#ifdef GC_HAVE_ICAL
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Upload Activity to Calendar"), this, SLOT(uploadCalendar()), tr (""));
    //optionsMenu->addAction(tr("Import Calendar..."), this, SLOT(importCalendar()), tr ("")); // planned for v3.1
    //optionsMenu->addAction(tr("Export Calendar..."), this, SLOT(exportCalendar()), tr ("")); // planned for v3.1
    optionsMenu->addAction(tr("Refresh Calendar"), this, SLOT(refreshCalendar()), tr (""));
#endif
    optionsMenu->addSeparator();
    optionsMenu->addAction(tr("Find intervals..."), this, SLOT(addIntervals()), tr (""));

    // Add all the data processors to the tools menu
    const DataProcessorFactory &factory = DataProcessorFactory::instance();
    QMap<QString, DataProcessor*> processors = factory.getProcessors();

    if (processors.count()) {

        optionsMenu->addSeparator();
        toolMapper = new QSignalMapper(this); // maps each option
        QMapIterator<QString, DataProcessor*> i(processors);
        connect(toolMapper, SIGNAL(mapped(const QString &)), this, SLOT(manualProcess(const QString &)));

        i.toFront();
        while (i.hasNext()) {
            i.next();
            // The localized processor name is shown in menu
            QAction *action = new QAction(QString("%1...").arg(i.value()->name()), this);
            optionsMenu->addAction(action);
            connect(action, SIGNAL(triggered()), toolMapper, SLOT(map()));
            toolMapper->setMapping(action, i.key());
        }
    }
示例#30
0
bool VCSlider::loadXML(const QDomElement* root)
{
    bool visible = false;
    int x = 0;
    int y = 0;
    int w = 0;
    int h = 0;

    SliderMode sliderMode = Playback;
    QDomElement tag;
    QDomNode node;
    QString caption;
    QString str;

    Q_ASSERT(root != NULL);

    if (root->tagName() != KXMLQLCVCSlider)
    {
        qWarning() << Q_FUNC_INFO << "Slider node not found";
        return false;
    }

    /* Caption */
    caption = root->attribute(KXMLQLCVCCaption);
    if (root->attribute(KXMLQLCVCSliderInvertedAppearance) == "false")
        setInvertedAppearance(false);
    else
        setInvertedAppearance(true);

    /* Children */
    node = root->firstChild();
    while (node.isNull() == false)
    {
        tag = node.toElement();
        if (tag.tagName() == KXMLQLCWindowState)
        {
            loadXMLWindowState(&tag, &x, &y, &w, &h, &visible);
            setGeometry(x, y, w, h);
        }
        else if (tag.tagName() == KXMLQLCVCWidgetAppearance)
        {
            loadXMLAppearance(&tag);
        }
        else if (tag.tagName() == KXMLQLCVCSliderMode)
        {
            sliderMode = stringToSliderMode(tag.text());

            str = tag.attribute(KXMLQLCVCSliderValueDisplayStyle);
            setValueDisplayStyle(stringToValueDisplayStyle(str));
        }
        else if (tag.tagName() == KXMLQLCVCSliderLevel)
        {
            loadXMLLevel(&tag);
        }
        else if (tag.tagName() == KXMLQLCVCWidgetInput)
        {
            loadXMLInput(&tag);
        }
        else if (tag.tagName() == KXMLQLCVCSliderPlayback)
        {
            loadXMLPlayback(&tag);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown slider tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    /* Set the mode last, after everything else has been set */
    setSliderMode(sliderMode);
    setCaption(caption);

    return true;
}