示例#1
0
文件: editwindow.cpp 项目: lgarest/42
// construction
CMdiEditWindow::CMdiEditWindow( IShader* shader )
{
	m_editors = new CSourceEdit*	[ IShader::MAX_SHADER_TYPES ];
	m_actFocusEditor = new QAction*	[ IShader::MAX_SHADER_TYPES ];
	m_attachToShader = new bool		[ IShader::MAX_SHADER_TYPES ];
	m_signalMapper = new QSignalMapper( this );
	createActions( shader );
	createMenus  ( shader );
	createTabs   ( shader );

	// setup layout
	QWidget* central = new QWidget;
	QGridLayout* layout = new QGridLayout;
	layout->addWidget( m_tabs,      0, 0, 1, 3 );
	layout->addWidget( m_chkAttach, 1, 0, 1, 1 );
	layout->addWidget( m_btnLink,   1, 1, 1, 1 );
	layout->addWidget( m_lineNumber,1, 2, 1, 1 );
	central->setLayout( layout );
	setCentralWidget( central );

	connect( m_chkAttach, SIGNAL(stateChanged(int)), this, SLOT(checkAttachToShader(int)) );

	// trigger state update
	activeEditorChanged( m_tabs->currentIndex() );
}
示例#2
0
文件: sis3350ui.cpp 项目: mojca/gecko
void Sis3350UI::createUI()
{
    QGridLayout* l = new QGridLayout;
    QGridLayout* boxL = new QGridLayout;

    QGroupBox* box = new QGroupBox;
    box->setTitle(name + " Settings");

    // Module specific code here

    QWidget* buttons = createButtons();
    QWidget* tabs = createTabs();

    boxL->addWidget(buttons,0,0,1,1);
    boxL->addWidget(tabs,1,0,1,1);

    viewport = new Viewport(0,module->rblt_data,4,module->conf.sample_length);
    viewport->setWindowTitle(tr("sis3350 Preview"));

    // End

    l->addWidget(box,0,0,1,1);
    box->setLayout(boxL);
    this->setLayout(l);
}
示例#3
0
//------------------------------------------------------------------------------------------------
//################################################################################################
//------------------------------------------------------------------------------------------------
Window::Window()
{
    errorMessage = new QErrorMessage(this);

    createTabs();

    createActions();
    createTrayIcon();

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(tabs);

    QHBoxLayout *bl = new QHBoxLayout;

    quitButton = new QPushButton(QIcon(":/images/door-open-out.png"), tr("Quit"));
    quitButton->setAutoDefault(false);
    quitButton->setFocusPolicy(Qt::NoFocus);
    connect(quitButton, SIGNAL(clicked()), this, SLOT(quitApp()));
    bl->addWidget(quitButton, 0, Qt::AlignLeft);

    aboutButton = new QPushButton(QIcon(":/images/question-balloon.png"), tr("About"));
    aboutButton->setAutoDefault(false);
    aboutButton->setFocusPolicy(Qt::NoFocus);
    connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
    bl->addWidget(aboutButton, 0, Qt::AlignCenter);

    closeButton = new QPushButton(QIcon(":/images/tick.png"), tr("Close"));
    closeButton->setAutoDefault(false);
    closeButton->setFocusPolicy(Qt::NoFocus);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeWanted()));
    bl->addWidget(closeButton, 0, Qt::AlignRight);

    mainLayout->addLayout(bl);

    setLayout(mainLayout);

    pingTimer = new QTimer(this);
    connect(pingTimer, SIGNAL(timeout()), this, SLOT(pingProc()));
    switchTimer = new QTimer(this);
    connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchProc()));
    prioTimer = new QTimer(this);
    connect(prioTimer, SIGNAL(timeout()), this, SLOT(prioProc()));

    trayIcon->show();
    setWindowTitle("QGateway");

    readSettings();

    settChanged = false;
    startupChanged = true;
    checkStartup();

    setWindowIcon(QIcon(":/images/computer-network.png"));
}
示例#4
0
qtBoincMan::qtBoincMan()
{
	createActions();
	createMenus();
	createTabs();

	setMinimumSize(160, 160);
	resize(480, 320);
}
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      clone_task_dialog_(NULL)

{
    setupUi(this);

    // seahub_messages_monitor_ = new SeahubMessagesMonitor(this);
    // mSeahubMessagesBtn->setVisible(false);

    layout()->setContentsMargins(1, 0, 1, 0);

    // Setup widgets from top down
    setupHeader();

    createAccountView();

    createTabs();

    // tool bar have to be created after tabs, since some of the toolbar
    // actions are provided by the tabs
    createToolBar();

    setupDropArea();

    setupFooter();

    QVBoxLayout *vlayout = (QVBoxLayout *)layout();
    vlayout->insertWidget(kIndexOfAccountView, account_view_);
    vlayout->insertWidget(kIndexOfToolBar, tool_bar_);
    vlayout->insertWidget(kIndexOfTabWidget, tabs_);

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));

    AccountManager *account_mgr = seafApplet->accountManager();
    connect(account_mgr, SIGNAL(accountsChanged()),
            this, SLOT(onAccountChanged()));

#if defined(Q_OS_MAC)
    mHeader->setVisible(false);
#endif

    connect(ServerStatusService::instance(), SIGNAL(serverStatusChanged()),
            this, SLOT(refreshServerStatus()));
    connect(CustomizationService::instance(), SIGNAL(serverLogoFetched(const QUrl&)),
            this, SLOT(onServerLogoFetched(const QUrl&)));

    QTimer::singleShot(0, this, SLOT(onAccountChanged()));
}
示例#6
0
OptionDialog::OptionDialog(fractal *par) : QDialog(par, Qt::Dialog) {
  setModal(true);
  setSizeGripEnabled(false);
  setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  setFixedSize(330, 300);

  setWindowTitle(tr("Fractal Options"));
  myFractal = par;
  mainOpt = new GeneralOptions(myFractal);
  tabs = createTabs();
  buttonBox =
      new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);

  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(mainOpt);
  layout->addWidget(tabs);
  layout->addWidget(buttonBox);
  setLayout(layout);
  exec();
}
示例#7
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent), trayIcon(0)
{
    resize(850, 550);
    setWindowTitle(tr("Bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));

    createActions();

    // Menus
    QMenu *file = menuBar()->addMenu("&File");
    file->addAction(sendcoins);
    file->addSeparator();
    file->addAction(quit);
    
    QMenu *settings = menuBar()->addMenu("&Settings");
    settings->addAction(receivingAddresses);
    settings->addAction(options);

    QMenu *help = menuBar()->addMenu("&Help");
    help->addAction(about);
    
    // Toolbar
    QToolBar *toolbar = addToolBar("Main toolbar");
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolbar->addAction(sendcoins);
    toolbar->addAction(addressbook);

    // Address: <address>: New... : Paste to clipboard
    QHBoxLayout *hbox_address = new QHBoxLayout();
    hbox_address->addWidget(new QLabel(tr("Your Bitcoin address:")));
    address = new QLineEdit();
    address->setReadOnly(true);
    address->setFont(GUIUtil::bitcoinAddressFont());
    address->setToolTip(tr("Your current default receiving address"));
    hbox_address->addWidget(address);
    
    QPushButton *button_new = new QPushButton(tr("&New..."));
    button_new->setToolTip(tr("Create new receiving address"));
    button_new->setIcon(QIcon(":/icons/add"));
    QPushButton *button_clipboard = new QPushButton(tr("&Copy to clipboard"));
    button_clipboard->setToolTip(tr("Copy current receiving address to the system clipboard"));
    button_clipboard->setIcon(QIcon(":/icons/editcopy"));
    hbox_address->addWidget(button_new);
    hbox_address->addWidget(button_clipboard);
    
    // Balance: <balance>
    QHBoxLayout *hbox_balance = new QHBoxLayout();
    hbox_balance->addWidget(new QLabel(tr("Balance:")));
    hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */

    labelBalance = new QLabel();
    labelBalance->setFont(QFont("Monospace", -1, QFont::Bold));
    labelBalance->setToolTip(tr("Your current balance"));
    hbox_balance->addWidget(labelBalance);
    hbox_balance->addStretch(1);
    
    QVBoxLayout *vbox = new QVBoxLayout();
    vbox->addLayout(hbox_address);
    vbox->addLayout(hbox_balance);

    vbox->addWidget(createTabs());

    QWidget *centralwidget = new QWidget(this);
    centralwidget->setLayout(vbox);
    setCentralWidget(centralwidget);
    
    // Create status bar
    statusBar();

    labelConnections = new QLabel();
    labelConnections->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    labelConnections->setMinimumWidth(150);
    labelConnections->setToolTip(tr("Number of connections to other clients"));

    labelBlocks = new QLabel();
    labelBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    labelBlocks->setMinimumWidth(130);
    labelBlocks->setToolTip(tr("Number of blocks in the block chain"));

    labelTransactions = new QLabel();
    labelTransactions->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    labelTransactions->setMinimumWidth(130);
    labelTransactions->setToolTip(tr("Number of transactions in your wallet"));

    // Progress bar for blocks download
    progressBarLabel = new QLabel(tr("Synchronizing with network..."));
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setToolTip(tr("Block chain synchronization in progress"));
    progressBar->setVisible(false);

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(labelConnections);
    statusBar()->addPermanentWidget(labelBlocks);
    statusBar()->addPermanentWidget(labelTransactions);

    // Action bindings
    connect(button_new, SIGNAL(clicked()), this, SLOT(newAddressClicked()));
    connect(button_clipboard, SIGNAL(clicked()), this, SLOT(copyClipboardClicked()));

    createTrayIcon();
}
示例#8
0
PreferencesDialog::PreferencesDialog(Config &config) : config{config} {
  setWindowTitle(tr("Preferences"));
  createLayout();
  createTabs();
}
示例#9
0
CloudView::CloudView(QWidget* parent)
    : QWidget(parent), clone_task_dialog_(NULL)

{
    setupUi(this);

    int marginTop = 0;
    if (shouldUseFramelessWindow()) {
        marginTop = 0;
    }
#ifdef Q_OS_MAC
    marginTop = 0;
#endif

    layout()->setContentsMargins(1, marginTop, 1, 0);

    // Setup widgets from top down
    setupHeader();

    createAccountView();

    createTabs();

    // tool bar have to be created after tabs, since some of the toolbar
    // actions are provided by the tabs
    // createToolBar();

    setupDropArea();

    setupFooter();

    QVBoxLayout* vlayout = (QVBoxLayout*)layout();
    vlayout->insertWidget(kIndexOfAccountView, account_view_);
    vlayout->insertWidget(kIndexOfTabWidget, tabs_);

    if (shouldUseFramelessWindow()) {
        resizer_ = new QSizeGrip(this);
        resizer_->resize(resizer_->sizeHint());
    }

    refresh_status_bar_timer_ = new QTimer(this);
    connect(refresh_status_bar_timer_, SIGNAL(timeout()), this,
            SLOT(refreshStatusBar()));

    AccountManager* account_mgr = seafApplet->accountManager();
    connect(account_mgr, SIGNAL(accountsChanged()), this,
            SLOT(onAccountChanged()));
    connect(account_mgr, SIGNAL(accountInfoUpdated(const Account&)), this,
            SLOT(onAccountInfoUpdated(const Account&)));

    if (!shouldUseFramelessWindow()) {
        mHeader->setVisible(false);
    }

    connect(ServerStatusService::instance(), SIGNAL(serverStatusChanged()),
            this, SLOT(refreshServerStatus()));
    connect(CustomizationService::instance(),
            SIGNAL(serverLogoFetched(const QUrl&)), this,
            SLOT(onServerLogoFetched(const QUrl&)));

    QTimer::singleShot(0, this, SLOT(onAccountChanged()));
}
示例#10
0
文件: meos.cpp 项目: ledusledus/meos
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  int wmId, wmEvent;
  PAINTSTRUCT ps;
  HDC hdc;

  switch (message)
  {
    case WM_CREATE:

      tabList->push_back(TabObject(gdi_main->getTabs().get(TCmpTab), "Tävling"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TRunnerTab), "Deltagare"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TTeamTab), "Lag(flera)"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TListTab), "Listor"));
      {
        TabAuto *ta = (TabAuto *)gdi_main->getTabs().get(TAutoTab);
        tabList->push_back(TabObject(ta, "Automater"));
        tabAutoRegister(ta);
      }
      tabList->push_back(TabObject(gdi_main->getTabs().get(TSpeakerTab), "Speaker"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TClassTab), "Klasser"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TCourseTab), "Banor"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TControlTab), "Kontroller"));
      tabList->push_back(TabObject(gdi_main->getTabs().get(TClubTab), "Klubbar"));

      tabList->push_back(TabObject(gdi_main->getTabs().get(TSITab), "SportIdent"));

      INITCOMMONCONTROLSEX ic;

      ic.dwSize=sizeof(ic);
      ic.dwICC=ICC_TAB_CLASSES ;
      InitCommonControlsEx(&ic);
      hMainTab=CreateWindowEx(0, WC_TABCONTROL, "tabs", WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, 0, 0, 300, 20, hWnd, 0, hInst, 0);
      createTabs(true, true, false, false, false, false, false, false);

      SetTimer(hWnd, 4, 10000, 0); //Connection check
      break;

    case WM_MOUSEWHEEL: {
      int dz = GET_WHEEL_DELTA_WPARAM(wParam);
      scrollVertical(gdi_main, -dz, hWndWorkspace);
      }
      break;

    case WM_SIZE:
      MoveWindow(hMainTab, 0,0, LOWORD(lParam), 30, 1);
      MoveWindow(hWndWorkspace, 0, 30, LOWORD(lParam), HIWORD(lParam)-30, 1);

      RECT rc;
      GetClientRect(hWndWorkspace, &rc);
      PostMessage(hWndWorkspace, WM_SIZE, wParam, MAKELONG(rc.right, rc.bottom));
      break;

    case WM_WINDOWPOSCHANGED:
      if (gEvent) {
        LPWINDOWPOS wp = (LPWINDOWPOS) lParam; // points to size and position data

        if (wp->x>=0 && wp->y>=0 && wp->cx>300 && wp->cy>200) {
          gEvent->setProperty("xpos", wp->x);
          gEvent->setProperty("ypos", wp->y);
          gEvent->setProperty("xsize", wp->cx);
          gEvent->setProperty("ysize", wp->cy);
        }
        else {
          Sleep(0);
        }
      }
      return DefWindowProc(hWnd, message, wParam, lParam);
    case WM_TIMER:

      if (!gdi_main) return 0;

      if (wParam==1) {
        if (autoTask)
          autoTask->autoSave();
      }
      else if (wParam==2) {
        // Interface timeouts (no synch)
        if (autoTask)
          autoTask->interfaceTimeout(gdi_extra);
      }
      else if (wParam==3) {
        if (autoTask)
          autoTask->synchronize(gdi_extra);
      }
      else if (wParam==4) {
        // Verify database link
        if (gEvent)
          gEvent->verifyConnection();
        //OutputDebugString("Verify link\n");
        //Sleep(0);
        if (gdi_main) {
          if (gEvent->hasClientChanged()) {
            gdi_main->makeEvent("Connections", "verify_connection", 0, 0, false);
            gEvent->validateClients();
          }
        }
      }
      break;

    case WM_ACTIVATE:
      if (LOWORD(wParam) != WA_INACTIVE)
        currentFocusIx = 0;
      return DefWindowProc(hWnd, message, wParam, lParam);

    case WM_NCACTIVATE:
      if (gdi_main && gdi_main->hasToolbar())
        gdi_main->activateToolbar(wParam != 0);
      return DefWindowProc(hWnd, message, wParam, lParam);

    case WM_NOTIFY:
    {
      LPNMHDR pnmh = (LPNMHDR) lParam;

      if (pnmh->hwndFrom==hMainTab && gdi_main && gEvent)
      {
        if (pnmh->code==TCN_SELCHANGE)
        {
          int id=TabCtrl_GetCurSel(hMainTab);

          for (list<TabObject>::iterator it=tabList->begin();it!=tabList->end();++it) {
            if (it->id==id) {
              try {
                gdi_main->setWaitCursor(true);
                it->loadPage(*gdi_main);
              }
              catch(std::exception &ex) {
                gdi_main->alert(ex.what());
              }
              gdi_main->setWaitCursor(false);
            } else {
              it->leavePage(*gdi_main);
            }
          }
        }
        else if (pnmh->code==TCN_SELCHANGING) {
          if (gdi_main == 0) {
            MessageBeep(-1);
            return true;
          }
          else {
            if (!gdi_main->canClear())
              return true;

            return false;
          }
        }
      }
      break;
    }

    case WM_USER:
      //The card has been read and posted to a synchronized
      //queue by different thread. Read and process this card.
      {
        SICard sic;
        while (gSI && gSI->GetCard(sic))
          InsertSICard(*gdi_main, sic);
        break;
      }
    case WM_USER+1:
      MessageBox(hWnd, "Kommunikationen med en SI-enhet avbröts.", "SportIdent", MB_OK);
      break;

    case WM_USER + 3:
      //OutputDebugString("Get punch from queue\n");
      if (autoTask)
        autoTask->advancePunchInformation(gdi_extra);
      break;

    case WM_USER + 4:
      if (autoTask)
        autoTask->synchronize(gdi_extra);
      break;
    case WM_COMMAND:
      wmId    = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId) {
        case IDM_EXIT:
           //DestroyWindow(hWnd);
          PostMessage(hWnd, WM_CLOSE, 0,0);
           break;
        default:
           return DefWindowProc(hWnd, message, wParam, lParam);
      }
      break;
    case WM_PAINT:
      hdc = BeginPaint(hWnd, &ps);
      // TODO: Add any drawing code here...


      EndPaint(hWnd, &ps);
      break;

    case WM_CLOSE:
      if (!gEvent || gEvent->empty() || gdi_main->ask("Vill du verkligen stänga MeOS?"))
          DestroyWindow(hWnd);
      break;

    case WM_DESTROY:
      delete gSI;
      gSI=0;

      if (gEvent) {
        try {
          gEvent->save();
        }
        catch(std::exception &ex) {
          MessageBox(hWnd, lang.tl(ex.what()).c_str(), "Fel när tävlingen skulle sparas", MB_OK);
        }

        try {
          gEvent->saveRunnerDatabase("database", true);
        }
        catch(std::exception &ex) {
          MessageBox(hWnd, lang.tl(ex.what()).c_str(), "Fel när löpardatabas skulle sparas", MB_OK);
        }

        if (gEvent)
          gEvent->saveProperties(settings);

        delete gEvent;
        gEvent=0;
      }

      PostQuitMessage(0);
      break;
    default:
      return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}