Exemplo n.º 1
0
KSnapshot::KSnapshot(QWidget *parent, const char *name)
    : super(parent, name, false, QString::null, Ok|Cancel)
{
    grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
    Q_CHECK_PTR(grabber);
    grabber->move( -1000, -1000 );
    grabber->installEventFilter( this );

#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
    int tmp1, tmp2;
    //Check whether the extension is available
    haveXShape = XShapeQueryExtension( qt_xdisplay(), &tmp1, &tmp2 );
#endif

    QVBox *vbox = makeVBoxMainWidget();
    mainWidget = new KSnapshotWidget( vbox, "mainWidget" );
    Q_CHECK_PTR(mainWidget);

    mainWidget->btnSave->hide();
    mainWidget->btnPrint->hide();
    connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));

    connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
    connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );

    grabber->show();
    grabber->grabMouse( waitCursor );
    
    snapshot = QPixmap::grabWindow( qt_xrootwin() );
    updatePreview();
    grabber->releaseMouse();
    grabber->hide();

    KConfig *conf=KGlobal::config();
    conf->setGroup("GENERAL");
    mainWidget->setDelay(conf->readNumEntry("delay",0));
    mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
    mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));

    connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );

    KAccel* accel = new KAccel(this);
    Q_CHECK_PTR(accel);
    accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
    accel->insert(KStdAccel::New, this, SLOT(slotGrab()));

    accel->insert( "Print2", Qt::Key_P, this, SLOT(slotPrint()));
    accel->insert( "New2", Qt::Key_N, this, SLOT(slotGrab()));
    accel->insert( "New3", Qt::Key_Space, this, SLOT(slotGrab()));

    mainWidget->btnNew->setFocus();
    
}
Exemplo n.º 2
0
int qtbook_cd::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotGo(); break;
        case 1: slotPrint(); break;
        case 2: slotQuery(); break;
        case 3: slotReset(); break;
        case 4: slotCancel(); break;
        case 5: slotShowUsers(); break;
        case 6: slotSaveTracks(); break;
        case 7: slotDeleteTrack(); break;
        case 8: slotInsertTrack(); break;
        case 9: slotSelectImage(); break;
        case 10: slotComputeRuntime(); break;
        case 11: slotCloseTracksBrowser(); break;
        case 12: slotPopulateCopiesEditor(); break;
        case 13: slotPopulateTracksBrowser(); break;
        default: ;
        }
        _id -= 14;
    }
    return _id;
}
Exemplo n.º 3
0
OutputWindow::OutputWindow(QWidget* parent)
    : QMainWindow(parent, "OutputWindow")
{
    QVBox* main = new QVBox(this);

    _list = new ListView(main);
    _list->addNumberColumn("#", 4);
    _list->addTextColumn("Type", 10);
    _list->addTextColumn("Message", 40);
    _list->setAllColumnsShowFocus(true);
    _list->setShowSortIndicator(true);
    _list->setSorting(0);

    QFrame* buttons = new QFrame(main);

    QPushButton* print = new QPushButton(tr("&Print"), buttons);
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* close = new QPushButton(tr("&Close"), buttons);
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(6);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(print, 0, 1);
    buttonGrid->addWidget(close, 0, 2);

    setCentralWidget(main);
    setCaption(tr("Output Window"));
}
Exemplo n.º 4
0
void KSlovar::registerButtons()
{
  m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary");
  m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
  m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection());

  m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection());
  m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection());
  m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection());

  m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary");
  m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection());

  m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection());
  m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection());
  m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch");
  m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch");

  m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection());
  m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection());

  m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase");
  m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase");
  m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase");

  m_listPopup=new QPopupMenu;
  m_addPhrase->plug(m_listPopup);
  m_editPhrase->plug(m_listPopup);
  m_removePhrase->plug(m_listPopup);

  m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());
  m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion");
  m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages");
  m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard");
}
Exemplo n.º 5
0
extern "C" int KDE_EXPORT kdemain(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, "kprinter", I18N_NOOP("KPrinter"), I18N_NOOP("A printer tool for KDE"), "0.0.1");
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;
    PrintWrapper *wrap = new PrintWrapper;
    app.setMainWidget(wrap);
    QTimer::singleShot(10, wrap, SLOT(slotPrint()));

    int result = app.exec();
    delete wrap;

    return result;
}
Exemplo n.º 6
0
ReportPreviewWindow::ReportPreviewWindow( QWidget* parent )
    : QDialog( parent )
    , m_ui( new Ui::ReportPreviewWindow )
    , m_document( 0 )
{
    m_ui->setupUi( this );
    setAttribute( Qt::WA_DeleteOnClose );
    connect( m_ui->pushButtonClose, SIGNAL( clicked() ),
             SLOT( slotClose() ) );
    connect( m_ui->pushButtonUpdate, SIGNAL( clicked() ),
             SLOT( slotUpdate() ) );
    connect( m_ui->pushButtonSave, SIGNAL( clicked() ),
             SLOT( slotSaveToXml() ) );
    connect( m_ui->pushButtonSaveTotals, SIGNAL( clicked() ),
             SLOT( slotSaveToText() ) );
    connect( m_ui->pushButtonPrint, SIGNAL( clicked() ),
             SLOT( slotPrint() ) );
}
Exemplo n.º 7
0
LuaMachine::LuaMachine( QXmppPeer * parent, TInit init )
    : QObject( parent )
{
	pd = new PD( this, init );
    pd->client = parent;

    connect( this,       SIGNAL(sigPrint(QString)), 
             this,       SLOT(slotPrint(QString)), 
             Qt::QueuedConnection );
    connect( this,       SIGNAL(sigStatus(QString, QString)),
             this,       SLOT(slotStatus(QString, QString)),
             Qt::QueuedConnection );
    connect( this,       SIGNAL(sigProcess(QString)),
             this,       SLOT(slotProcess(QString)),
             Qt::QueuedConnection );
    connect( pd->client, SIGNAL(textmsg(QString)),
             this,       SLOT(qxmppMessageReceived(QString)), 
             Qt::QueuedConnection );
}
void ActionManagerImpl::initArticleViewer(ArticleViewer* articleViewer)
{
    if (d->articleViewer)
        return;
    else
        d->articleViewer = articleViewer;

    KActionCollection* coll = actionCollection();
    KAction* action = 0;

    action = KStandardAction::print(articleViewer, SLOT(slotPrint()), actionCollection());
    coll->addAction("viewer_print", action);

    action = KStandardAction::copy(articleViewer, SLOT(slotCopy()), coll);
    coll->addAction("viewer_copy", action);

    connect(d->tabWidget, SIGNAL(signalZoomInFrame(int)), d->articleViewer, SLOT(slotZoomIn(int)));
    connect(d->tabWidget, SIGNAL(signalZoomOutFrame(int)), d->articleViewer, SLOT(slotZoomOut(int)));
}
Exemplo n.º 9
0
bool MainWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: slotPrint(); break;
    case 1: slotClearPsth(); break;
    case 2: slotTriggerPsth(); break;
    case 3: slotSetChannel((double)static_QUType_double.get(_o+1)); break;
    case 4: slotSetPsthLength((double)static_QUType_double.get(_o+1)); break;
    case 5: slotSetPsthBinw((double)static_QUType_double.get(_o+1)); break;
    case 6: slotSetSpikeThres((double)static_QUType_double.get(_o+1)); break;
    case 7: slotSavePsth(); break;
    case 8: slotSetNumTrials((double)static_QUType_double.get(_o+1)); break;
    case 9: slotStartPsthRec(); break;
    case 10: slotSoundToggle(); break;
    case 11: slotAveragePsth(); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 10
0
int qtbook_videogame::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotGo(); break;
        case 1: slotPrint(); break;
        case 2: slotQuery(); break;
        case 3: slotReset(); break;
        case 4: slotCancel(); break;
        case 5: slotShowUsers(); break;
        case 6: slotSelectImage(); break;
        case 7: slotPopulateCopiesEditor(); break;
        default: ;
        }
        _id -= 8;
    }
    return _id;
}
Exemplo n.º 11
0
imageViewer::imageViewer(QWidget *parent): QLabel(parent)
{
  addToLog("image creation",LOGIMAG);
  validImage=false;
  setFrameStyle(QFrame::Sunken | QFrame::Panel);
  QBrush b;
  QPalette palette;
  b.setTexture(QPixmap::fromImage(QImage(":/icons/transparency.png")));
  palette.setBrush(QPalette::Active,QPalette::Base,b);
  palette.setBrush(QPalette::Inactive,QPalette::Base,b);
  palette.setBrush(QPalette::Disabled,QPalette::Base,b);
  setPalette(palette);
  setBackgroundRole(QPalette::Base);
  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

  setBackgroundRole(QPalette::Dark);

  popup=new QMenu (this);
  newAct = new QAction(tr("&New"),this);
  connect(newAct, SIGNAL(triggered()), this, SLOT(slotNew()));
  loadAct = new QAction(tr("&Load"), this);
  connect(loadAct, SIGNAL(triggered()), this, SLOT(slotLoad()));
  toTXAct = new QAction(tr("&To TX"), this);
  connect(toTXAct, SIGNAL(triggered()), this, SLOT(slotToTX()));
  editAct = new QAction(tr("&Edit"), this);
  connect(editAct, SIGNAL(triggered()), this, SLOT(slotEdit()));
  printAct = new QAction(tr("&Print"), this);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
  deleteAct = new QAction(tr("&Delete"), this);
  connect(deleteAct, SIGNAL(triggered()), this, SLOT(slotDelete()));
  viewAct = new QAction(tr("&View"), this);
  connect(viewAct, SIGNAL(triggered()), this, SLOT(slotView()));
  propertiesAct = new QAction(tr("Propert&ies"), this);
  connect(propertiesAct, SIGNAL(triggered()), this, SLOT(slotProperties()));
  connect(configDialogPtr,SIGNAL(bgColorChanged()), SLOT(slotBGColorChanged()));

  init(RXIMG);
  activeMovie=false;
  //
}
Exemplo n.º 12
0
ReportPreviewWindow::ReportPreviewWindow( QWidget* parent )
    : QDialog( parent )
    , m_ui( new Ui::ReportPreviewWindow )
    , m_document( 0 )
{
    m_ui->setupUi( this );
    setAttribute( Qt::WA_DeleteOnClose );
    connect( m_ui->pushButtonClose, SIGNAL( clicked() ),
             SLOT( slotClose() ) );
    connect( m_ui->pushButtonUpdate, SIGNAL( clicked() ),
             SLOT( slotUpdate() ) );
    connect( m_ui->pushButtonSave, SIGNAL( clicked() ),
             SLOT( slotSaveToXml() ) );
    connect( m_ui->pushButtonSaveTotals, SIGNAL( clicked() ),
             SLOT( slotSaveToText() ) );
#ifndef QT_NO_PRINTER
    connect( m_ui->pushButtonPrint, SIGNAL( clicked() ),
             SLOT( slotPrint() ) );
#else
    m_ui->pushButtonPrint->setEnabled(false);
#endif
    resize(600, 600);
}
Exemplo n.º 13
0
Inquiry::Inquiry(MainWindow* main)
    : QuasarWindow(main, "Inquiry"), _loading(false)
{
    _helpSource = "inquiry.html";

    QFrame* frame = new QFrame(this);

    QLabel* dateLabel = new QLabel(tr("Dates:"), frame);
    _dateRange = new DateRange(frame);
    dateLabel->setBuddy(_dateRange);

    QLabel* fromLabel = new QLabel(tr("From:"), frame);
    _from = new DatePopup(frame);
    fromLabel->setBuddy(_from);

    QLabel* toLabel = new QLabel(tr("To:"), frame);
    _to = new DatePopup(frame);
    toLabel->setBuddy(_to);

    QLabel* storeLabel = new QLabel(tr("&Store:"), frame);
    _store = new LookupEdit(new StoreLookup(_main, this), frame);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChange()));

    _tabs = new QTabWidget(frame);
    _account = new AccountInquiry(main, _tabs);
    _card = new CardInquiry(main, _tabs);
    _item = new ItemInquiry(main, _tabs);

    _tabs->addTab(_account, tr("&Account"));
    _tabs->addTab(_card, tr("Car&d"));
    _tabs->addTab(_item, tr("&Item"));

    QFrame* box = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), box);
    refresh->setMinimumSize(refresh->sizeHint());
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* print = new QPushButton(tr("&Print"), box);
    print->setMinimumSize(refresh->sizeHint());
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* close = new QPushButton(tr("Cl&ose"), box);
    close->setMinimumSize(refresh->sizeHint());
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* boxGrid = new QGridLayout(box);
    boxGrid->setSpacing(6);
    boxGrid->setMargin(6);
    boxGrid->setColStretch(2, 1);
    boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    boxGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter);
    boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(2, 1);
    grid->setColStretch(6, 1);
    grid->addWidget(dateLabel, 0, 0);
    grid->addWidget(_dateRange, 0, 1);
    grid->addWidget(fromLabel, 0, 2);
    grid->addWidget(_from, 0, 3, AlignLeft | AlignVCenter);
    grid->addWidget(toLabel, 0, 4);
    grid->addWidget(_to, 0, 5, AlignLeft | AlignVCenter);
    grid->addWidget(storeLabel, 1, 0);
    grid->addMultiCellWidget(_store, 1, 1, 1, 5, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(_tabs, 2, 2, 0, 6);
    grid->addMultiCellWidget(box, 3, 3, 0, 6);

    connect(_tabs, SIGNAL(selected(const QString&)), SLOT(slotTabChange()));

    connect(_account->search, SIGNAL(validData()), SLOT(slotAccountChange()));
    connect(_account->list, SIGNAL(doubleClicked(QListViewItem*)),
            SLOT(slotEdit()));
    connect(_account->list, SIGNAL(returnPressed(QListViewItem*)),
            SLOT(slotEdit()));

    connect(_card->search, SIGNAL(validData()), SLOT(slotCardChange()));
    connect(_card->list, SIGNAL(doubleClicked(QListViewItem*)),
            SLOT(slotEdit()));
    connect(_card->list, SIGNAL(returnPressed(QListViewItem*)),
            SLOT(slotEdit()));

    connect(_item->search, SIGNAL(validData()), SLOT(slotItemChange()));
    connect(_item->list, SIGNAL(doubleClicked(QListViewItem*)),
            SLOT(slotEdit()));
    connect(_item->list, SIGNAL(returnPressed(QListViewItem*)),
            SLOT(slotEdit()));

    _dateRange->setFromPopup(_from);
    _dateRange->setToPopup(_to);
    _dateRange->setCurrentItem(DateRange::Today);
    _dateRange->setFocus();

    _store->setId(_quasar->defaultStore());
    if (_quasar->storeCount() == 1) {
        storeLabel->hide();
        _store->hide();
    }

    setCaption(tr("Inquiry"));
    setCentralWidget(frame);
    finalize();
}
Exemplo n.º 14
0
void MainWindow::createActions()
{
  if(opt.arg_debug) printf("createActions\n");

  if(opt.arg_disable == 0)
  {
    optionAct = new QAction(QIcon(":/images/option.png"), l_options, this);
#ifndef USE_MAEMO
    optionAct->setShortcut(tr("Ctrl+O"));
#endif
    optionAct->setStatusTip(l_status_options);
    connect(optionAct, SIGNAL(triggered()), this, SLOT(slotFileOpt()));
  }

  if(opt.arg_disable == 0)
  {
    windowAct = new QAction(QIcon(":/images/window.png"), l_new_window, this);
    windowAct->setShortcut(tr("Ctrl+N"));
    windowAct->setStatusTip(l_status_new_window);
    connect(windowAct, SIGNAL(triggered()), this, SLOT(slotWindow()));

    newtabAct = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this);
    //newtabAct->setShortcut(tr("Ctrl+N"));
    newtabAct->setStatusTip(l_status_new_tab);
    connect(newtabAct, SIGNAL(triggered()), this, SLOT(slotNewTab()));
  }

  reconnectAct = new QAction(QIcon(":/images/view-refresh.png"), l_reconnect, this);
  reconnectAct->setShortcut(tr("Ctrl+R"));
  reconnectAct->setStatusTip(l_status_reconnect);
  connect(reconnectAct, SIGNAL(triggered()), this, SLOT(slotReconnect()));

  storebmpAct = new QAction(QIcon(":/images/storebmp.png"), l_save_as_bmp, this);
  storebmpAct->setShortcut(tr("Ctrl+B"));
  storebmpAct->setStatusTip(l_status_save_as_bmp);
  connect(storebmpAct, SIGNAL(triggered()), this, SLOT(slotStorebmp()));

  gohomeAct = new QAction(QIcon(":/images/gohome.png"), opt.initialhost, this);
  gohomeAct->setStatusTip(opt.initialhost);
  connect(gohomeAct, SIGNAL(triggered()), this, SLOT(slotGohome()));

  logbmpAct = new QAction(QIcon(":/images/logbmp.png"), l_log_as_bmp, this);
  logbmpAct->setStatusTip(l_status_log_as_bmp);
  connect(logbmpAct, SIGNAL(triggered()), this, SLOT(slotLogbmp()));

  logpvmAct = new QAction(QIcon(":/images/logpvm.png"), l_log_as_pvm, this);
  logpvmAct->setStatusTip(l_status_log_as_pvm);
  connect(logpvmAct, SIGNAL(triggered()), this, SLOT(slotLogpvm()));

  printAct = new QAction(QIcon(":/images/print.png"), l_print, this);
  printAct->setShortcut(tr("Ctrl+P"));
  printAct->setStatusTip(l_status_print);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));

  newtabActToolBar = new QAction(QIcon(":/images/newtab.png"), l_new_tab, this);
  newtabActToolBar->setStatusTip(l_status_new_tab);
  connect(newtabActToolBar, SIGNAL(triggered()), this, SLOT(slotNewTab()));

  exitAct = new QAction(QIcon(":/images/exit.png"), l_exit, this);
  exitAct->setShortcut(tr("Ctrl+Q"));
  exitAct->setStatusTip(l_status_exit);
  connect(exitAct, SIGNAL(triggered()), this, SLOT(slotExit()));

  copyAct = new QAction(QIcon(":/images/copy.png"), l_copy, this);
  copyAct->setShortcut(tr("Ctrl+C"));
  copyAct->setStatusTip(l_status_copy);
  connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));

  if(opt.arg_disable == 0)
  {
    editmenuAct = new QAction(l_editmenu, this);
    editmenuAct->setShortcut(tr("Ctrl+E"));
    editmenuAct->setStatusTip(l_status_editmenu);
    connect(editmenuAct, SIGNAL(triggered()), this, SLOT(slotEditmenu()));
    addAction(editmenuAct);

    toolbarAct = new QAction(QIcon(":/images/toolbar.png"), l_toolbar, this);
    toolbarAct->setShortcut(tr("Ctrl+T"));
    toolbarAct->setStatusTip(l_status_toolbar);
    connect(toolbarAct, SIGNAL(triggered()), this, SLOT(slotToolbar()));
    addAction(toolbarAct);

    statusbarAct = new QAction(QIcon(":/images/statusbar.png"), l_statusbar, this);
    statusbarAct->setShortcut(tr("Ctrl+S"));
    statusbarAct->setStatusTip(l_status_statusbar);
    connect(statusbarAct, SIGNAL(triggered()), this, SLOT(slotStatusbar()));
    addAction(statusbarAct);

    maximizedAct = new QAction(l_maximized, this);
    maximizedAct->setShortcut(tr("Ctrl+M"));
    maximizedAct->setStatusTip(l_status_toggle_maximized);
    connect(maximizedAct, SIGNAL(triggered()), this, SLOT(slotMaximized()));
    addAction(maximizedAct);

    fullscreenAct = new QAction(QIcon(":/images/fullscreen.png"), l_fullscreen, this);
    fullscreenAct->setShortcut(tr("Ctrl+F"));
    fullscreenAct->setStatusTip(l_status_toggle_full_screen);
    connect(fullscreenAct, SIGNAL(triggered()), this, SLOT(slotFullscreen()));
    addAction(fullscreenAct);
  }

  manualAct = new QAction(l_manual, this);
  manualAct->setShortcut(tr("Ctrl+H"));
  manualAct->setStatusTip(l_status_manual);
  connect(manualAct, SIGNAL(triggered()), this, SLOT(slotManual()));

  aboutAct = new QAction(l_about, this);
  aboutAct->setStatusTip(l_status_about);
  connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

  aboutQtAct = new QAction("About &Qt", this);
  aboutQtAct->setStatusTip("About Qt library");
  connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

  logoAct = new QAction(QIcon(":/images/app.png"),"pvbrowser", this);
  logoAct->setStatusTip(tr("About pvbrowser"));
  connect(logoAct, SIGNAL(triggered()), this, SLOT(about()));
}
Exemplo n.º 15
0
QmvFormTool::QmvFormTool( QmvRelationWidget * rlw, QmvApplication * parent, const char * name )
        : QmvToolWindow( rlw->getRelation(), parent, name )
{
    
        // ------------------------------------------------------------
        // Query Objects
        // ------------------------------------------------------------
    
    
        // Form header
    fh = 0;
    pagesize = background.size();
    
    if ( rlw )
        rlw_form = rlw;
    else
        throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>"
                                      "Failed to build FORM object" ),
                             QmvException::Critical) );
    reln_form = rlw->getRelation();
    if ( !reln_form )
        throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>"
                                      "Failed to build FORM object" ),
                             QmvException::Critical) );
        // Form details.
    
    QmvSqlClass * fmdt_existing = (QmvSqlClass *) reln_form->dataBase()->dbRelation( "fmdt" );
    if ( fmdt_existing )
        reln_fmdt = new QmvSqlClass( *fmdt_existing );
    else
        throw( QmvException( QString( "<h3>QmvFormTool::QmvFormTool</h2>"
                                      "Failed to build FMDT object" ),
                             QmvException::Critical) );
    
    
 
        // -------------------------------------------
        // Mouse Clicks ------------------------------
        // -------------------------------------------
    
        // notice button clicks on grid
    connect( canvasView(), SIGNAL( clicked( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ),
             this, SLOT( popupEventDetails( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ) );

        //  doubleclick - edit
    connect( canvasView(), SIGNAL( doubleClicked( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ),
             this, SLOT( dataChangeRequested( QCanvasItem *, const QPoint &, ButtonState, ButtonState ) ) );

        // notice grid movements
    connect( canvasView(), SIGNAL( moved( QCanvasItem *, const QPoint &, const QPoint & ) ),
             this, SLOT( eventLabelMoved( QCanvasItem *, const QPoint &, const QPoint & ) ) );

        // notice resizes
    connect( canvasView(), SIGNAL( resized( QCanvasItem *, const QRect &, const QRect & ) ),
             this, SLOT( eventLabelResized( QCanvasItem *, const QRect &, const QRect & ) ) );

        // --- ACCELERATORS  ---------------------------------------
        // ------------------------------------------------------------

    QAccel * ap_accel = new QAccel( this, "forms" );
    int a_id;
    
        // line down
    a_id = ap_accel->insertItem( Key_Down );
    ap_accel->connectItem( a_id, this, SLOT( slotLineDown() ) );
    ap_accel->setWhatsThis( a_id, "Scroll down one line" );
        // line up
    a_id = ap_accel->insertItem( Key_Up );
    ap_accel->connectItem( a_id, this, SLOT( slotLineUp() ) );
    ap_accel->setWhatsThis( a_id, "Scroll up one line" );
    
        // page down
    a_id = ap_accel->insertItem( Key_Next );
    ap_accel->connectItem( a_id, this, SLOT( slotPageDown() ) );
    ap_accel->setWhatsThis( a_id, "Scroll down one page" );
        // page up
    a_id = ap_accel->insertItem( Key_Prior );
    ap_accel->connectItem( a_id, this, SLOT( slotPageUp() ) );
    ap_accel->setWhatsThis( a_id, "Scroll up one page" );

    QAction * ac;
    QActionGroup * ag_insert = new QActionGroup( this, "ag_insert" );
    
        // ------------------------------------------------------------
        // Navigation Toolbar
        // ------------------------------------------------------------
        // clear the navigation toolbar - not needed yet
    navigationToolBar()->clear();
    
        // ------------------------------------------------------------
        // Tool buttons for adding detail objects
        // ------------------------------------------------------------
    
    ag_insert->setExclusive(TRUE);
    QSignalMapper *ndt_sigmap = new QSignalMapper( this );
    connect( ndt_sigmap, SIGNAL( mapped(int) ),
             this, SLOT( slotAddNewDetail(int) ) );
        
        // Label -----------------------------------------------------
    ac = new QAction( "Text",
                      *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)),
                                                 tr("T"), QFont("Times"), QColor( blue ), QRect() ),
                      "Text",
                      ALT+SHIFT+Key_T,
                      ag_insert, "text", FALSE );
    ndt_sigmap->setMapping( ac, formDetail::Label );
    connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) );
        
        // Field -----------------------------------------------------
    ac = new QAction( "Field",
                      *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)),
                                                 tr("F"), QFont("Times"), QColor( blue ), QRect() ),
                      "Field",
                      ALT+SHIFT+Key_F,
                      ag_insert, "Field", FALSE );
    ndt_sigmap->setMapping( ac, formDetail::Field );
    connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) );
        
        // Line -----------------------------------------------------
    ac = new QAction( "Line",
                      *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)),
                                                 tr("L"), QFont("Times"), QColor( blue ), QRect() ),
                      "Line",
                      ALT+SHIFT+Key_L,
                      ag_insert, "Line", FALSE );
    ndt_sigmap->setMapping( ac, formDetail::Line );
    connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) );
        
        // Calc -----------------------------------------------------
    ac = new QAction( "Calculation",
                      *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)),
                                                 tr("C"), QFont("Times"), QColor( blue ), QRect() ),
                      "Calculation",
                      ALT+SHIFT+Key_C,
                      ag_insert, "Calculation", FALSE );
    ndt_sigmap->setMapping( ac, formDetail::Calc );
    connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) );
        
        // Special -----------------------------------------------------
    ac = new QAction( "Special",
                      *stdicons->makeTextPixmap( new QPixmap(stdicons->getPixmap(QmvIcons::BlankPageIcon)),
                                                 tr("S"), QFont("Times"), QColor( blue ), QRect() ),
                      "Special",
                      ALT+SHIFT+Key_S,
                      ag_insert, "Special", FALSE );
    ndt_sigmap->setMapping( ac, formDetail::Special );
    connect( ac, SIGNAL( activated() ), ndt_sigmap, SLOT( map() ) );
    
        // Print ------------------------------------------------------
    ac = new QAction( "Print",
                      QPixmap( QmvFormToolIcons::print_xpm ),
                      "&Print",
                      Key_P,
                      ag_insert, "form_print", FALSE );
    connect( ac, SIGNAL( activated() ), this, SLOT( slotPrint() ) );

        // Fax ------------------------------------------------------
    ac = new QAction( "Fax",
                      QPixmap( QmvFormToolIcons::fax_xpm ),
                      "Fa&x",
                      Key_X,
                      ag_insert, "form_fax", FALSE );
    connect( ac, SIGNAL( activated() ), this, SLOT( slotFax() ) );

        // Email ------------------------------------------------------
    ac = new QAction( "Email",
                      QPixmap( QmvFormToolIcons::email_xpm ),
                      "&Email",
                      Key_E,
                      ag_insert, "form_email", FALSE );
    connect( ac, SIGNAL( activated() ), this, SLOT( slotEmail() ) );

        // Add actiongroup to toolbar
    otherToolBar()->clear();
    new QLabel( "Add new detail: ", otherToolBar(), "display_label" );
    ag_insert->addTo( otherToolBar() );

   
        // prepare for display
    setToolBarsMovable(FALSE);
    adjustSize();
    updateGeometry();
    setFocus();
        // adjust canvas to the base magnification.
    setCanvasSize();
}
Exemplo n.º 16
0
void KStars::initActions() {
    KIconLoader::global()->addAppDir( "kstars" );
    KAction *ka;

    // ==== File menu ================
    ka = KNS3::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
        << KShortcut( Qt::CTRL+Qt::Key_D );
    ka->setWhatsThis(i18n("Downloads new data"));
    ka->setToolTip(ka->whatsThis());
    ka->setStatusTip(ka->whatsThis());

#ifdef HAVE_CFITSIO_H
    actionCollection()->addAction("open_file", this, SLOT(slotOpenFITS()) )
        << i18n("Open FITS...")
        << KIcon("document-open")
        << KShortcut( Qt::CTRL+Qt::Key_O );
#endif

    actionCollection()->addAction("export_image", this, SLOT( slotExportImage() ) )
        << i18n("&Save Sky Image...")
        << KIcon("document-export-image")
        << KShortcut( Qt::CTRL+Qt::Key_I );
    actionCollection()->addAction("run_script", this, SLOT( slotRunScript() ))
        << i18n("&Run Script...")
        << KIcon("system-run" )
        << KShortcut( Qt::CTRL+Qt::Key_R );
    actionCollection()->addAction("printing_wizard", this, SLOT(slotPrintingWizard() ) )
            << i18nc("start Printing Wizard", "Printing &Wizard");
    actionCollection()->addAction( KStandardAction::Print, "print", this, SLOT( slotPrint() ) );
    actionCollection()->addAction( KStandardAction::Quit,  "quit",  this, SLOT( close() ) );

    // ==== Time Menu ================
    actionCollection()->addAction("time_to_now", this, SLOT( slotSetTimeToNow() ))
        << i18n("Set Time to &Now")
        << KShortcut( Qt::CTRL+Qt::Key_E )
        << KIcon("clock");

    actionCollection()->addAction("time_dialog", this, SLOT( slotSetTime() ) )
        << i18nc("set Clock to New Time", "&Set Time..." )
        << KShortcut( Qt::CTRL+Qt::Key_S )
        << KIcon("view-history");

    ka = actionCollection()->add<KToggleAction>("clock_startstop")
        << i18n("Stop &Clock" )
        << KIcon("media-playback-pause" );
    if ( ! StartClockRunning )
        ka->toggle();
    QObject::connect( ka, SIGNAL( triggered() ), this, SLOT( slotToggleTimer() ) );
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), ka, SLOT(setChecked(bool)) );
    //UpdateTime() if clock is stopped (so hidden objects get drawn)
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), this, SLOT(updateTime()) );
    actionCollection()->addAction("time_step_forward", this, SLOT( slotStepForward() ) )
        << i18n("Advance one step forward in time")
        << KIcon("media-skip-forward" )
        << KShortcut( Qt::Key_Greater, Qt::Key_Period );
    actionCollection()->addAction("time_step_backward", this, SLOT( slotStepBackward() ) )
        << i18n("Advance one step backward in time")
        << KIcon("media-skip-backward" )
        << KShortcut( Qt::Key_Less, Qt::Key_Comma );

    // ==== Pointing Menu ================
    actionCollection()->addAction("zenith", this, SLOT( slotPointFocus() ) )
        << i18n("&Zenith")
        << KShortcut("Z");
    actionCollection()->addAction("north", this, SLOT( slotPointFocus() ) )
        << i18n("&North")
        << KShortcut("N");
    actionCollection()->addAction("east", this, SLOT( slotPointFocus() ) )
        << i18n("&East")
        << KShortcut("E");
    actionCollection()->addAction("south", this, SLOT( slotPointFocus() ) )
        << i18n("&South")
        << KShortcut("S");
    actionCollection()->addAction("west", this, SLOT( slotPointFocus() ) )
        << i18n("&West")
        << KShortcut("W");

    actionCollection()->addAction("find_object", this, SLOT( slotFind() ) )
        << i18n("&Find Object...")
        << KIcon("edit-find")
        << KShortcut( Qt::CTRL+Qt::Key_F );
    actionCollection()->addAction("track_object", this, SLOT( slotTrack() ) )
        << i18n("Engage &Tracking")
        << KIcon("object-locked" )
        << KShortcut( Qt::CTRL+Qt::Key_T  );
    actionCollection()->addAction("manual_focus", this, SLOT( slotManualFocus() ) )
        << i18n("Set Coordinates &Manually..." )
        << KShortcut( Qt::CTRL+Qt::Key_M );

    // ==== View Menu ================
    actionCollection()->addAction( KStandardAction::ZoomIn,  "zoom_in",  map(), SLOT( slotZoomIn() ) );
    actionCollection()->addAction( KStandardAction::ZoomOut, "zoom_out", map(), SLOT( slotZoomOut() ) );
    actionCollection()->addAction("zoom_default", map(), SLOT( slotZoomDefault() ) )
        << i18n("&Default Zoom")
        << KIcon("zoom-fit-best" )
        << KShortcut( Qt::CTRL+Qt::Key_Z );
    actionCollection()->addAction("zoom_set", this, SLOT( slotSetZoom() ) )
        << i18n("&Zoom to Angular Size..." )
        << KIcon("zoom-original" )
        << KShortcut( Qt::CTRL+Qt::SHIFT+Qt::Key_Z );

    actionCollection()->addAction( KStandardAction::FullScreen, this, SLOT( slotFullScreen() ) );

    actionCollection()->addAction("coordsys", this, SLOT( slotCoordSys() ) )
        << (Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)"))
        << KShortcut("Space" );

    #ifdef HAVE_OPENGL
    Q_ASSERT( SkyMap::Instance() ); // This assert should not fail, because SkyMap is already created by now. Just throwing it in anyway.
    actionCollection()->addAction("opengl", SkyMap::Instance(), SLOT( slotToggleGL() ) )
        << (Options::useGL() ? i18n("Switch to QPainter backend"): i18n("Switch to OpenGL backend"));
    #endif

    actionCollection()->addAction("project_lambert", this, SLOT( slotMapProjection() ) )
        << i18n("&Lambert Azimuthal Equal-area" )
        << KShortcut("F5" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Lambert);
    actionCollection()->addAction("project_azequidistant", this, SLOT( slotMapProjection() ) )
        << i18n("&Azimuthal Equidistant" )
        << KShortcut("F6" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::AzimuthalEquidistant);
    actionCollection()->addAction("project_orthographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Orthographic" )
        << KShortcut("F7" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Orthographic);
    actionCollection()->addAction("project_equirectangular", this, SLOT( slotMapProjection() ) )
        << i18n("&Equirectangular" )
        << KShortcut("F8" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Equirectangular);
    actionCollection()->addAction("project_stereographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Stereographic" )
        << KShortcut("F9" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Stereographic);
    actionCollection()->addAction("project_gnomonic", this, SLOT( slotMapProjection() ) )
        << i18n("&Gnomonic" )
        << KShortcut("F10" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Gnomonic);

    //Settings Menu:
    //Info Boxes option actions
    KAction* kaBoxes = actionCollection()->add<KToggleAction>("show_boxes" )
        << i18nc("Show the information boxes", "Show &Info Boxes")
        << Checked( Options::showInfoBoxes() );
    connect( kaBoxes, SIGNAL(toggled(bool)), map(), SLOT(slotToggleInfoboxes(bool)));
    kaBoxes->setChecked( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_time_box")
        << i18nc("Show time-related info box", "Show &Time Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleTimeBox(bool)));
    ka->setChecked( Options::showTimeBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_focus_box")
        << i18nc("Show focus-related info box", "Show &Focus Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleFocusBox(bool)));
    ka->setChecked( Options::showFocusBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_location_box")
        << i18nc("Show location-related info box", "Show &Location Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleGeoBox(bool)));
    ka->setChecked( Options::showGeoBox() );
    ka->setEnabled( Options::showInfoBoxes() );


    //Toolbar options
    newToggleAction( actionCollection(), "show_mainToolBar", i18n("Show Main Toolbar"),
                     toolBar("kstarsToolBar"), SLOT(setVisible(bool)));
    newToggleAction( actionCollection(), "show_viewToolBar", i18n("Show View Toolbar"),
                     toolBar( "viewToolBar" ), SLOT(setVisible(bool)));

    //Statusbar view options
    newToggleAction( actionCollection(), "show_statusBar", i18n("Show Statusbar"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbAzAlt",   i18n("Show Az/Alt Field"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbRADec",   i18n("Show RA/Dec Field"),
                     this, SLOT(slotShowGUIItem(bool)));

    //Color scheme actions.  These are added to the "colorschemes" KActionMenu.
    colorActionMenu = actionCollection()->add<KActionMenu>("colorschemes" );
    colorActionMenu->setText( i18n("C&olor Schemes" ) );
    addColorMenuItem( i18n("&Classic" ), "cs_classic" );
    addColorMenuItem( i18n("&Star Chart" ), "cs_chart" );
    addColorMenuItem( i18n("&Night Vision" ), "cs_night" );
    addColorMenuItem( i18n("&Moonless Night" ), "cs_moonless-night" );

    //Add any user-defined color schemes:
    QFile file( KStandardDirs::locate("appdata", "colors.dat" ) ); //determine filename in local user KDE directory tree.
    if ( file.exists() && file.open( QIODevice::ReadOnly ) ) {
        QTextStream stream( &file );
        while ( !stream.atEnd() ) {
            QString line = stream.readLine();
            QString schemeName = line.left( line.indexOf( ':' ) );
            QString actionname = "cs_" + line.mid( line.indexOf( ':' ) +1, line.indexOf( '.' ) - line.indexOf( ':' ) - 1 );
            addColorMenuItem( i18n( schemeName.toLocal8Bit() ), actionname.toLocal8Bit() );
        }
        file.close();
    }

    //Add FOV Symbol actions
    fovActionMenu = actionCollection()->add<KActionMenu>("fovsymbols" );
    fovActionMenu->setText( i18n("&FOV Symbols" ) );
    repopulateFOV();

    actionCollection()->addAction("geolocation", this, SLOT( slotGeoLocator() ) )
        << i18nc("Location on Earth", "&Geographic..." )
        << KIcon("applications-internet" )
        << KShortcut( Qt::CTRL+Qt::Key_G );
    actionCollection()->addAction( KStandardAction::Preferences, "configure", this, SLOT( slotViewOps() ) );
    actionCollection()->addAction("startwizard", this, SLOT( slotWizard() ) )
        << i18n("Startup Wizard..." )
        << KIcon("tools-wizard" );

    // Updates actions
    actionCollection()->addAction( "update_comets", this, SLOT( slotUpdateComets() ) )
        << i18n( "Update comets orbital elements" );
    actionCollection()->addAction( "update_asteroids", this, SLOT( slotUpdateAsteroids() ) )
        << i18n( "Update asteroids orbital elements" );
    actionCollection()->addAction("update_supernovae", this, SLOT(slotUpdateSupernovae() ) )
        << i18n( "Update Recent Supernovae data" );
    actionCollection()->addAction("update_satellites", this, SLOT(slotUpdateSatellites() ) )
        << i18n( "Update satellites orbital elements" );

    //Tools Menu:
    actionCollection()->addAction("astrocalculator", this, SLOT( slotCalculator() ) )
        << i18n("Calculator")
        << KIcon("accessories-calculator" )
        << KShortcut( Qt::CTRL+Qt::Key_C );

    actionCollection()->addAction("moonphasetool", this, SLOT( slotMoonPhaseTool() ) )
        << i18n("Moon Phase Calendar");

    actionCollection()->addAction("obslist", this, SLOT( slotObsList() ) )
        << i18n("Observation Planner")
        << KShortcut( Qt::CTRL+Qt::Key_L );

    actionCollection()->addAction("altitude_vs_time", this, SLOT( slotAVT() ) )
        << i18n("Altitude vs. Time")
        << KShortcut( Qt::CTRL+Qt::Key_A );
    actionCollection()->addAction("whats_up_tonight", this, SLOT( slotWUT() ) )
        << i18n("What's up Tonight")
        << KShortcut(Qt::CTRL+Qt::Key_U );
    actionCollection()->addAction("whats_interesting", this, SLOT( slotWISettings() ) )
        << i18n("What's Interesting...")
        << KShortcut(Qt::CTRL+Qt::Key_W );
    actionCollection()->addAction("skycalendar", this, SLOT( slotCalendar() ) )
        << i18n("Sky Calendar");

#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN
        actionCollection()->addAction("ekos", this, SLOT( slotEkos() ) )
            << i18n("Ekos");
#endif
#endif

//FIXME: implement glossary
//     ka = actionCollection()->addAction("glossary");
//     ka->setText( i18n("Glossary...") );
//     ka->setShortcuts( KShortcut(Qt::CTRL+Qt::Key_K ) );
//     connect( ka, SIGNAL( triggered() ), this, SLOT( slotGlossary() ) );

    actionCollection()->addAction("scriptbuilder", this, SLOT( slotScriptBuilder() ) )
        << i18n("Script Builder")
        << KShortcut(Qt::CTRL+Qt::Key_B );
    actionCollection()->addAction("solarsystem", this, SLOT( slotSolarSystem() ) )
        << i18n("Solar System")
        << KShortcut(Qt::CTRL+Qt::Key_Y );
    actionCollection()->addAction("jmoontool", this, SLOT( slotJMoonTool() ) )
        << i18n("Jupiter's Moons")
        << KShortcut(Qt::CTRL+Qt::Key_J );
    actionCollection()->addAction("flagmanager", this, SLOT( slotFlagManager() ) )
        << i18n("Flags");

    actionCollection()->addAction("ewriter", this, SLOT( slotEquipmentWriter() ) )
        << i18n("Define Equipment...")
        << KShortcut( Qt::CTRL+Qt::Key_0 );
    actionCollection()->addAction("obsadd", this, SLOT( slotObserverAdd() ) )
        << i18n( "Add Observer..." )
        << KShortcut( Qt::CTRL+Qt::Key_1 );

    // ==== observation menu ================
    ka = actionCollection()->addAction("execute", this, SLOT( slotExecute() ) )
        << i18n( "Execute the session Plan..." )
        << KShortcut( Qt::CTRL+Qt::Key_2 );

    // ==== devices Menu ================
#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN


        actionCollection()->addAction("telescope_wizard", this, SLOT( slotTelescopeWizard() ) )
            << i18n("Telescope Wizard...")
            << KIcon("tools-wizard" );
        actionCollection()->addAction("device_manager", this, SLOT( slotINDIDriver() ) )
            << i18n("Device Manager...")
            << KIcon("network-server" );
        ka = actionCollection()->addAction("indi_cpl", this, SLOT( slotINDIPanel() ) )
            << i18n("INDI Control Panel...");
        ka->setEnabled(false);


#endif
#endif

    //Help Menu:
    actionCollection()->addAction( KStandardAction::TipofDay, "help_tipofday", this, SLOT( slotTipOfDay() ) )
	->setWhatsThis(i18n("Displays the Tip of the Day"));

    //	KStandardAction::help(this, SLOT( appHelpActivated() ), actionCollection(), "help_contents" );

    //Add timestep widget for toolbar
    TimeStep = new TimeStepBox( toolBar("kstarsToolBar") );
    // Add a tool tip to TimeStep describing the weird nature of time steps
    QString TSBToolTip = i18nc( "Tooltip describing the nature of the time step control", "Use this to set the rate at which time in the simulation flows.\nFor time step \'X\' up to 10 minutes, time passes at the rate of \'X\' per second.\nFor time steps larger than 10 minutes, frames are displayed at an interval of \'X\'." );
    TimeStep->setToolTip( TSBToolTip );
    TimeStep->tsbox()->setToolTip( TSBToolTip );
    ka = actionCollection()->addAction("timestep_control")
        << i18n("Time step control");
    ka->setDefaultWidget( TimeStep );

    // ==== viewToolBar actions ================
    actionCollection()->add<KToggleAction>("show_stars", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Stars in the display", "Stars" )
        << KIcon("kstars_stars" )
        << ToolTip( i18n("Toggle stars") );
    actionCollection()->add<KToggleAction>("show_deepsky", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Deep Sky Objects in the display", "Deep Sky" )
        << KIcon("kstars_deepsky" )
        << ToolTip( i18n("Toggle deep sky objects") );
    actionCollection()->add<KToggleAction>("show_planets", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Solar System objects in the display", "Solar System" )
        << KIcon("kstars_planets" )
        << ToolTip( i18n("Toggle Solar system objects") );
    actionCollection()->add<KToggleAction>("show_clines", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Lines in the display", "Const. Lines" )
        << KIcon("kstars_clines" )
        << ToolTip( i18n("Toggle constellation lines") );
    actionCollection()->add<KToggleAction>("show_cnames", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Names in the display", "Const. Names" )
        << KIcon("kstars_cnames" )
        << ToolTip( i18n("Toggle constellation names") );
    actionCollection()->add<KToggleAction>("show_cbounds", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Boundaries in the display", "C. Boundaries" )
        << KIcon("kstars_cbound" )
        << ToolTip( i18n("Toggle constellation boundaries") );
    actionCollection()->add<KToggleAction>("show_mw", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Milky Way in the display", "Milky Way" )
        << KIcon("kstars_mw" )
        << ToolTip( i18n("Toggle milky way") );
    actionCollection()->add<KToggleAction>("show_equatorial_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Equatorial Coordinate Grid in the display", "Equatorial coord. grid" )
        << KIcon("kstars_grid" )
        << ToolTip( i18n("Toggle equatorial coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizontal_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Horizontal Coordinate Grid in the display", "Horizontal coord. grid" )
        << KIcon("kstars_hgrid" )
        << ToolTip( i18n("Toggle horizontal coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizon", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle the opaque fill of the ground polygon in the display", "Ground" )
        << KIcon("kstars_horizon" )
        << ToolTip( i18n("Toggle opaque ground") );
    actionCollection()->add<KToggleAction>("show_flags", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle flags in the display", "Flags" )
        << KIcon("kstars_flag" )
        << ToolTip( i18n("Toggle flags") );
    actionCollection()->add<KToggleAction>("show_satellites", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle satellites in the display", "Satellites" )
        << KIcon("kstars_satellites" )
        << ToolTip( i18n("Toggle satellites") );
    actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle supernovae in the display", "Supernovae" )
        << KIcon("kstars_supernovae" )
        << ToolTip( i18n("Toggle supernovae") );

    setXMLFile("kstarsui.rc" );

    if (Options::fitsDir().isEmpty())
        Options::setFitsDir(QDir:: homePath());
}
Exemplo n.º 17
0
void NCPreview::initTools()
{
	/////////////////
	// ACTIONS
	/////////////////
	actionPrint = new QAction( this );
	actionPrint->setText( tr("Print...") );
	actionPrint->setIcon( iconFactory->findIcon("print") );
	actionPrint->setToolTip( tr("Print") );
	connect( actionPrint, SIGNAL( triggered() ), this, SLOT( slotPrint() ) );
	actionPrint->setEnabled( false );	// alapetelmezetten kikapcsolva

	actionZP = new QAction( this );
	actionZP->setText( tr("Zoom") );
	actionZP->setIcon( iconFactory->findIcon("zoom_plus")  );
	actionZP->setToolTip( tr("Zoom page") );
	actionZP->setShortcut( Qt::Key_Plus );
	connect( actionZP, SIGNAL( triggered() ), this, SLOT( zoomPlus() ) );

	actionZM = new QAction( this );
	actionZM->setText( tr("Unzoom") );
	actionZM->setIcon( iconFactory->findIcon("zoom_minus") );
	actionZM->setToolTip( tr("Unzoom page") );
	actionZM->setShortcut( Qt::Key_Minus );
	connect( actionZM, SIGNAL( triggered() ), this, SLOT( zoomMinus() ) );

	actionFrst = new QAction( this );
	actionFrst->setText( tr("First page") );
	actionFrst->setIcon( iconFactory->findIcon("firstpage") );
	actionFrst->setToolTip( tr("Go to first page") );
	actionFrst->setShortcut( Qt::CTRL+Qt::Key_Home );
	connect( actionFrst, SIGNAL( triggered() ), this, SLOT( slotFirst() ) );

	actionPrev = new QAction( this );
	actionPrev->setText( tr("Previous page") );
	actionPrev->setIcon( iconFactory->findIcon("prevpage") );
	actionPrev->setToolTip( tr("Go to previous page") );
	actionPrev->setShortcut( Qt::CTRL+Qt::Key_Left );
	connect( actionPrev, SIGNAL( triggered() ), this, SLOT( slotPrev() ) );

	actionNext = new QAction( this );
	actionNext->setText( tr("Next page") );
	actionNext->setIcon( iconFactory->findIcon("nextpage") );
	actionNext->setToolTip( tr("Go to next page") );
	actionNext->setShortcut( Qt::CTRL+Qt::Key_Right );
	connect( actionNext, SIGNAL( triggered() ), this, SLOT( slotNext() ) );

	actionLast = new QAction( this );
	actionLast->setText( tr("Last page") );
	actionLast->setIcon( iconFactory->findIcon("lastpage") );
	actionLast->setToolTip( tr("Go to final page") );
	actionLast->setShortcut( Qt::CTRL+Qt::Key_End );
	connect( actionLast, SIGNAL( triggered() ), this, SLOT( slotLast() ) );

	actionGo = new QAction( this );
	actionGo->setText( tr("Go to page...") );
	actionGo->setIcon( iconFactory->findIcon("gotopage") );
	actionGo->setToolTip( tr("Go to specified page") );
	actionGo->setShortcut( Qt::CTRL+Qt::Key_G );
	connect( actionGo, SIGNAL( triggered() ), this, SLOT( slotGoTo() ) );

	actionExit = new QAction( this );
	actionExit->setText( tr("Exit") );
	actionExit->setIcon( iconFactory->findIcon("exit") );
	actionExit->setToolTip( tr("Exit preview") );
	actionExit->setShortcut( Qt::Key_Escape );
	connect( actionExit, SIGNAL( triggered() ), this, SLOT( close() ) );

	/////////////////
	// MENUS
	/////////////////
	//QAction *actionPrint, *actionFrst, *actionNext, *actionPrev, *actionLast;
	//QAction *actionGo, *actionExit, *actionZP, *actionZM;

	mnFile = menuBar()->addMenu(tr("&File"));
	mnFile->addAction(actionPrint);
	mnFile->addAction(actionZP);
	mnFile->addAction(actionZM);
	mnFile->addSeparator();
	mnFile->addAction(actionExit);
	
	mnNav = menuBar()->addMenu(tr("&Navigate"));
	mnNav->addAction(actionFrst);
	mnNav->addAction(actionPrev);
	mnNav->addAction(actionNext);
	mnNav->addAction(actionLast);
	mnNav->addSeparator();
	mnNav->addAction(actionGo);	
	
	/////////////////
	// TOOLBAR
	/////////////////
	toolbar = addToolBar( tr("Tools") );
	//********************************************* combo
	cbZoom =  new QComboBox( toolbar );
	cbZoom->addItem( tr( " 10 %" ));
	cbZoom->addItem( tr( " 20 %" ));
	cbZoom->addItem( tr( " 50 %" ));
	cbZoom->addItem( tr( " 75 %" ));
	cbZoom->addItem( tr( "100 %" ));
	cbZoom->addItem( tr( "120 %" ));
	cbZoom->addItem( tr( "150 %" ));
	cbZoom->addItem( tr( "200 %" ));
	cbZoom->addItem( tr( "300 %" ));
	cbZoom->addItem( tr( "400 %" ));
	cbZoom->addItem( tr( "500 %" ));
	cbZoom->setFocusPolicy( Qt::NoFocus );
	cbZoom->setCurrentIndex( 4 );
	connect( cbZoom, SIGNAL(activated(const QString &) ), SLOT( slotZoom(const QString &) ) );
	
	toolbar->addAction(actionPrint);
	toolbar->addSeparator();
	toolbar->addAction(actionZP);
	toolbar->addAction(actionZM);
	toolbar->addSeparator();
	toolbar->addWidget(cbZoom);	
	toolbar->addSeparator();
	toolbar->addAction(actionFrst);
	toolbar->addAction(actionPrev);
	toolbar->addAction(actionNext);
	toolbar->addAction(actionLast);

	toolbar->setIconSize(QSize(16,16));
	statusBar();
	//statusBar()->showMessage(tr("Ready"));	
}
Exemplo n.º 18
0
void
PromoBatchMaster::slotExecute()
{
    Id store_id = _store->getId();
    if (store_id == INVALID_ID) {
        qApp->beep();
        QMessageBox::critical(this, tr("Error"), tr("A store is required"));
        _store->setFocus();
        return;
    }

    QDate oldDate = _execDate->getDate();
    if (!oldDate.isNull()) {
        qApp->beep();
        QMessageBox::critical(this, tr("Error"), tr("Already executed"));
        return;
    }

    QString message = tr("Are you sure you want to execute this batch?");
    int ch = QMessageBox::warning(this, tr("Continue?"), message,
                                  QMessageBox::No, QMessageBox::Yes);
    if (ch != QMessageBox::Yes) return;

    _execDate->setDate(QDate::currentDate());
    QDate fromDate = _fromDate->getDate();
    QDate toDate = _toDate->getDate();

    QApplication::setOverrideCursor(waitCursor);
    qApp->processEvents();

    // Create ItemPrice
    for (int row = 0; row < _items->rows(); ++row) {
        Id item_id = _items->cellValue(row, 0).toId();
        if (item_id == INVALID_ID) continue;

        QString number = _items->cellValue(row, 0).toPlu().number();
        QString size = _items->cellValue(row, 2).toString();
        Price price = _items->cellValue(row, 4).toPrice();

        Item item;
        findItem(item_id, item);

        ItemPrice info;
        info.setIsCost(false);
        info.setItemId(item_id);
        info.setNumber(number);
        info.setSize(size);
        info.setStoreId(store_id);
        info.setPromotion(true);
        info.setDiscountable(item.isDiscountable());
        info.setStartDate(fromDate);
        info.setStopDate(toDate);
        info.setMethod(ItemPrice::PRICE);
        info.setPrice(price);
        _db->create(info);

        _items->row(row)->setValue(6, info.id());
    }

    saveItem(false);
    dataToWidget();

    QApplication::restoreOverrideCursor();
    qApp->beep();

    message = tr("Do you wish to print out the price\n"
                 "changes that were done?");
    ch = QMessageBox::information(this, tr("Print"), message,
                                  QMessageBox::No, QMessageBox::Yes);
    if (ch == QMessageBox::Yes)
        slotPrint();

    message = tr("Do you wish to create labels for the\n"
                 "changes that were done?");
    ch = QMessageBox::information(this, tr("Labels"), message,
                                  QMessageBox::No, QMessageBox::Yes);
    if (ch == QMessageBox::Yes)
        slotLabels();

    QMessageBox::information(this, tr("Complete"),
                             tr("Promotion batch executed"));
    close();
}
Exemplo n.º 19
0
PromoBatchMaster::PromoBatchMaster(MainWindow* main, Id batch_id)
    : DataWindow(main, "PromoBatchMaster", batch_id)
{
    _helpSource = "promo_batch_master.html";

    QPushButton* print = new QPushButton(tr("Print"), _buttons);
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* labels = new QPushButton(tr("Labels"), _buttons);
    connect(labels, SIGNAL(clicked()), SLOT(slotLabels()));

    QPushButton* execute = new QPushButton(tr("Execute"), _buttons);
    connect(execute, SIGNAL(clicked()), SLOT(slotExecute()));

    QFrame* top = new QFrame(_frame);
    top->setFrameStyle(QFrame::Raised | QFrame::Panel);

    QLabel* numberLabel = new QLabel(tr("Batch No.:"), top);
    _number = new LineEdit(top);
    _number->setLength(10, '9');
    numberLabel->setBuddy(_number);

    QLabel* descLabel = new QLabel(tr("Description:"), top);
    _description = new LineEdit(top);
    _description->setLength(40);
    descLabel->setBuddy(_description);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(_main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    QLabel* fromDateLabel = new QLabel(tr("From:"), top);
    _fromDate = new DatePopup(top);
    fromDateLabel->setBuddy(_fromDate);

    QLabel* toDateLabel = new QLabel(tr("To:"), top);
    _toDate = new DatePopup(top);
    toDateLabel->setBuddy(_toDate);

    QLabel* execDateLabel = new QLabel(tr("Executed On:"), top);
    _execDate = new DateEdit(top);
    _execDate->setFocusPolicy(NoFocus);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setColStretch(2, 1);
    topGrid->addColSpacing(2, 20);
    topGrid->addWidget(numberLabel, 0, 0);
    topGrid->addWidget(_number, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addWidget(_description, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(storeLabel, 2, 0);
    topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(fromDateLabel, 0, 3);
    topGrid->addWidget(_fromDate, 0, 4, AlignLeft | AlignVCenter);
    topGrid->addWidget(toDateLabel, 1, 3);
    topGrid->addWidget(_toDate, 1, 4, AlignLeft | AlignVCenter);
    topGrid->addWidget(execDateLabel, 2, 3);
    topGrid->addWidget(_execDate, 2, 4, AlignLeft | AlignVCenter);

    QFrame* mid = new QFrame(_frame);
    mid->setFrameStyle(QFrame::Raised | QFrame::Panel);

    _items = new Table(mid);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(10);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
            SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
            SLOT(focusNext(bool&,int&,int&,int)));

    // Lookups
    _itemLookup = new ItemLookup(_main, this);
    _itemLookup->soldOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _itemLookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 8);
    new PriceColumn(_items, tr("Price"));
    new PriceColumn(_items, tr("Promo"));
    new NumberColumn(_items, tr("Ordered"));

    // Add editors
    _size = new QComboBox(false, _items);
    new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items));
    new ComboEditor(_items, 2, _size);
    new PriceEditor(_items, 4, new PriceEdit(_items));
    new NumberEditor(_items, 5, new DoubleEdit(_items));

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(0, 1);
    midGrid->addWidget(_items, 0, 0);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setRowStretch(1, 1);
    grid->addWidget(top, 0, 0);
    grid->addWidget(mid, 1, 0);

    if (_quasar->storeCount() == 1) {
        storeLabel->hide();
        _store->hide();
    }

    setCaption(tr("Promotion Batch"));
    finalize();
}
Exemplo n.º 20
0
TxSummary::TxSummary(MainWindow* main)
    : QuasarWindow(main, "TxSummary")
{
    _helpSource = "tx_summary.html";

    QFrame* frame = new QFrame(this);

    QGroupBox* select = new QGroupBox(tr("Data Selection"), frame);
    QGridLayout* grid1 = new QGridLayout(select, 2, 1, select->frameWidth()*2);
    grid1->addRowSpacing(0, select->fontMetrics().height());

    QLabel* rangeLabel = new QLabel(tr("Date Range:"), select);
    _range = new DateRange(select);

    QLabel* fromLabel = new QLabel(tr("From Date:"), select);
    _from = new DatePopup(select);
    _range->setFromPopup(_from);
    fromLabel->setBuddy(_from);

    QLabel* toLabel = new QLabel(tr("To Date:"), select);
    _to = new DatePopup(select);
    _range->setToPopup(_to);
    toLabel->setBuddy(_to);

    QLabel* storeLabel = new QLabel(tr("Store:"), select);
    _store = new LookupEdit(new StoreLookup(main, this), select);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    QLabel* stationLabel = new QLabel(tr("Station:"), select);
    _station = new LookupEdit(new StationLookup(main, this), select);
    _station->setLength(30);
    stationLabel->setBuddy(_station);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), select);
    _employee = new LookupEdit(new EmployeeLookup(main, this), select);
    _employee->setLength(30);
    employeeLabel->setBuddy(_employee);

    grid1->setColStretch(2, 1);
    grid1->addColSpacing(2, 20);
    grid1->addWidget(rangeLabel, 1, 0);
    grid1->addWidget(_range, 1, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(fromLabel, 2, 0);
    grid1->addWidget(_from, 2, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(toLabel, 3, 0);
    grid1->addWidget(_to, 3, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(storeLabel, 1, 3);
    grid1->addWidget(_store, 1, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(stationLabel, 2, 3);
    grid1->addWidget(_station, 2, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(employeeLabel, 3, 3);
    grid1->addWidget(_employee, 3, 4, AlignLeft | AlignVCenter);

    _tabs = new QTabWidget(frame);

    QFrame* buttons = new QFrame(frame);
    QPushButton* refresh = new QPushButton(tr("&Refresh"), buttons);
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));
    refresh->setMinimumSize(refresh->sizeHint());

    QPushButton* print = new QPushButton(tr("&Print"), buttons);
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));
    print->setMinimumSize(refresh->sizeHint());

    QPushButton* ok = new QPushButton(tr("&Close"), buttons);
    connect(ok, SIGNAL(clicked()), SLOT(close()));
    ok->setMinimumSize(refresh->sizeHint());

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(2, 1);
    buttonGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    buttonGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter);
    buttonGrid->addWidget(ok, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(3);
    grid->setRowStretch(1, 1);
    grid->setColStretch(0, 1);
    grid->addWidget(select, 0, 0);
    grid->addWidget(_tabs, 1, 0);
    grid->addWidget(buttons, 2, 0);

    _range->setFocus();
    _range->setCurrentItem(DateRange::Today);
    _tabs->hide();

    TenderSelect conditions;
    _quasar->db()->select(_tenders, conditions);
    for (unsigned int i = 0; i < _tenders.size(); ++i)
	_tenderCnts.push_back(0);

    setCentralWidget(frame);
    setCaption(tr("Daily Summary"));
    finalize();
}
Exemplo n.º 21
0
Journal::Journal(MainWindow* main)
    : QuasarWindow(main, "Journal")
{
    _helpSource = "journal.html";

    QFrame* frame = new QFrame(this);

    QLabel* dateLabel = new QLabel(tr("Dates:"), frame);
    _dateRange = new DateRange(frame);
    dateLabel->setBuddy(_dateRange);

    QLabel* fromLabel = new QLabel(tr("From:"), frame);
    _from = new DatePopup(frame);
    fromLabel->setBuddy(_from);

    QLabel* toLabel = new QLabel(tr("To:"), frame);
    _to = new DatePopup(frame);
    toLabel->setBuddy(_to);

    QLabel* storeLabel = new QLabel(tr("Store:"), frame);
    _store = new LookupEdit(new StoreLookup(_main, this), frame);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    _tabs = new QTabWidget(frame);
    _general = new JournalWindow(_tabs, "GeneralTab");
    _disbursements = new JournalWindow(_tabs, "DisbursementsTab");
    _receipts = new JournalWindow(_tabs, "ReceiptsTab");
    _sales = new JournalWindow(_tabs, "SalesTab");
    _purchases = new JournalWindow(_tabs, "PurchasesTab");
    _inventory = new JournalWindow(_tabs, "InventoryTab");
    _all = new JournalWindow(_tabs, "AllTab");

    _tabs->addTab(_general, tr("&General"));
    _tabs->addTab(_disbursements, tr("&Disbursements"));
    _tabs->addTab(_receipts, tr("&Receipts"));
    _tabs->addTab(_sales, tr("&Sales"));
    _tabs->addTab(_purchases, tr("&Purchases"));
    _tabs->addTab(_inventory, tr("&Inventory"));
    _tabs->addTab(_all, tr("&All"));

    QFrame* box = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), box);
    refresh->setMinimumSize(refresh->sizeHint());
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* print = new QPushButton(tr("&Print"), box);
    print->setMinimumSize(refresh->sizeHint());
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* close = new QPushButton(tr("Cl&ose"), box);
    close->setMinimumSize(refresh->sizeHint());
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* grid = new QGridLayout(box);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setColStretch(2, 1);
    grid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    grid->addWidget(print, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(close, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid2 = new QGridLayout(frame);
    grid2->setSpacing(6);
    grid2->setMargin(6);
    grid2->setRowStretch(2, 1);
    grid2->setColStretch(6, 1);
    grid2->addWidget(dateLabel, 0, 0);
    grid2->addWidget(_dateRange, 0, 1);
    grid2->addWidget(fromLabel, 0, 2);
    grid2->addWidget(_from, 0, 3, AlignLeft | AlignVCenter);
    grid2->addWidget(toLabel, 0, 4);
    grid2->addWidget(_to, 0, 5, AlignLeft | AlignVCenter);
    grid2->addWidget(storeLabel, 1, 0);
    grid2->addMultiCellWidget(_store, 1, 1, 1, 5, AlignLeft | AlignVCenter);
    grid2->addMultiCellWidget(_tabs, 2, 2, 0, 6);
    grid2->addMultiCellWidget(box, 3, 3, 0, 6);

    connect(_general->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_general->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_disbursements->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_disbursements->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_receipts->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_receipts->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_sales->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_sales->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_purchases->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_purchases->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_inventory->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_inventory->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_all->list, SIGNAL(doubleClicked(QListViewItem*)),
	    SLOT(slotEdit()));
    connect(_all->list, SIGNAL(returnPressed(QListViewItem*)),
	    SLOT(slotEdit()));

    _dateRange->setFromPopup(_from);
    _dateRange->setToPopup(_to);
    _dateRange->setCurrentItem(DateRange::Today);
    _dateRange->setFocus();
    _loading = false;

    _store->setId(_quasar->defaultStore());
    if (_quasar->storeCount() == 1) {
	storeLabel->hide();
	_store->hide();
    }

    setCaption(tr("Transaction Journal"));
    setCentralWidget(frame);
    finalize();
    _refreshPending = false;
}
Exemplo n.º 22
0
// TODO convert to use xmlui file
void KuickShow::initGUI( const KURL& startDir )
{
	KURL startURL( startDir );
	if ( !KProtocolInfo::supportsListing( startURL ) )
		startURL = KURL();

    fileWidget = new FileWidget( startURL, this, "MainWidget" );
    setFocusProxy( fileWidget );

    KActionCollection *coll = fileWidget->actionCollection();

    redirectDeleteAndTrashActions(coll);

    connect( fileWidget, SIGNAL( fileSelected( const KFileItem * ) ),
             this, SLOT( slotSelected( const KFileItem * ) ));

    connect( fileWidget, SIGNAL( fileHighlighted( const KFileItem * )),
             this, SLOT( slotHighlighted( const KFileItem * ) ));

    connect( fileWidget, SIGNAL( urlEntered( const KURL&  )),
             this, SLOT( dirSelected( const KURL& )) );


    fileWidget->setAcceptDrops(true);
    connect( fileWidget, SIGNAL( dropped( const KFileItem *, QDropEvent *, const KURL::List & )),
             this, SLOT( slotDropped( const KFileItem *, QDropEvent *, const KURL::List &)) );

    // setup actions
    KAction *open = KStdAction::open( this, SLOT( slotOpenURL() ),
                                      coll, "openURL" );

    KAction *print = KStdAction::print( this, SLOT( slotPrint() ),
                                        coll, "kuick_print" );
    print->setText( i18n("Print Image...") );

    KAction *configure = new KAction( i18n("Configure %1...").arg( KGlobal::instance()->aboutData()->programName() ), "configure",
                                      KShortcut(),
                                      this, SLOT( configuration() ),
                                      coll, "kuick_configure" );
    KAction *slide = new KAction( i18n("Start Slideshow" ), "ksslide",
                                  KShortcut( Key_F2 ),
                                  this, SLOT( startSlideShow() ),
                                  coll, "kuick_slideshow" );
    KAction *about = new KAction( i18n( "About KuickShow" ), "about",
                                  KShortcut(),
                                  this, SLOT( about() ), coll, "about" );

    oneWindowAction = new KToggleAction( i18n("Open Only One Image Window"),
                                         "window_new",
                                         KShortcut( CTRL+Key_N ), coll,
                                         "kuick_one window" );

    m_toggleBrowserAction = new KToggleAction( i18n("Show File Browser"), KShortcut( Key_Space ), coll, "toggleBrowser" );
    m_toggleBrowserAction->setCheckedState(i18n("Hide File Browser"));
    connect( m_toggleBrowserAction, SIGNAL( toggled( bool ) ),
             SLOT( toggleBrowser() ));

    KAction *showInOther = new KAction( i18n("Show Image"), KShortcut(),
                                        this, SLOT( slotShowInOtherWindow() ),
                                        coll, "kuick_showInOtherWindow" );
    KAction *showInSame = new KAction( i18n("Show Image in Active Window"),
                                       KShortcut(),
                                       this, SLOT( slotShowInSameWindow() ),
                                       coll, "kuick_showInSameWindow" );
    KAction *showFullscreen = new KAction( i18n("Show Image in Fullscreen Mode"),
					   KShortcut(), this, SLOT( slotShowFullscreen() ),
					   coll, "kuick_showFullscreen" );

    KAction *quit = KStdAction::quit( this, SLOT(slotQuit()), coll, "quit");

    // remove QString::null parameter -- ellis
    coll->readShortcutSettings( QString::null );
    m_accel = coll->accel();

    // menubar
    KMenuBar *mBar = menuBar();
    QPopupMenu *fileMenu = new QPopupMenu( mBar, "file" );
    open->plug( fileMenu );
    showInOther->plug( fileMenu );
    showInSame->plug( fileMenu );
    showFullscreen->plug( fileMenu );
    fileMenu->insertSeparator();
    slide->plug( fileMenu );
    print->plug( fileMenu );
    fileMenu->insertSeparator();
    quit->plug( fileMenu );

    QPopupMenu *editMenu = new QPopupMenu( mBar, "edit" );
    coll->action("mkdir")->plug( editMenu );
    coll->action("delete")->plug( editMenu );
    editMenu->insertSeparator();
    coll->action("properties")->plug( editMenu );


    // remove the Sorting submenu (and the separator below)
    // from the main contextmenu
    KActionMenu *sortingMenu = static_cast<KActionMenu*>( coll->action("sorting menu"));
    KActionMenu *mainActionMenu = static_cast<KActionMenu*>( coll->action("popupMenu"));
    QPopupMenu *mainPopup = mainActionMenu->popupMenu();
    int sortingIndex = mainPopup->indexOf( sortingMenu->itemId( 0 ) );
    int separatorId = mainPopup->idAt( sortingIndex + 1 );
    QMenuItem *separatorItem = mainPopup->findItem( separatorId );
    if ( separatorItem && separatorItem->isSeparator() )
        mainPopup->removeItem( separatorId );
    mainActionMenu->remove( sortingMenu );

    // add the sorting menu and a separator into the View menu
    KActionMenu *viewActionMenu = static_cast<KActionMenu*>( coll->action("view menu"));
    viewActionMenu->popupMenu()->insertSeparator( 0 );
    sortingMenu->plug( viewActionMenu->popupMenu(), 0 ); // on top of the menu


    QPopupMenu *settingsMenu = new QPopupMenu( mBar, "settings" );
    configure->plug( settingsMenu );

    mBar->insertItem( i18n("&File"), fileMenu );
    mBar->insertItem( i18n("&Edit"), editMenu );
    viewActionMenu->plug( mBar );
    mBar->insertItem( i18n("&Settings"), settingsMenu );

    // toolbar
    KToolBar *tBar = toolBar();
    tBar->setText( i18n( "Main Toolbar" ) );

    coll->action("up")->plug( tBar );
    coll->action("back")->plug( tBar );
    coll->action("forward")->plug( tBar );
    coll->action("home")->plug( tBar );
    coll->action("reload")->plug( tBar );

    tBar->insertSeparator();

    coll->action( "short view" )->plug( tBar );
    coll->action( "detailed view" )->plug( tBar );
    coll->action( "preview")->plug( tBar );

    tBar->insertSeparator();
    configure->plug( tBar );
    slide->plug( tBar );
    tBar->insertSeparator();
    oneWindowAction->plug( tBar );
    print->plug( tBar );
    tBar->insertSeparator();
    about->plug( tBar );

    QPopupMenu *help = helpMenu( QString::null, false );
    mBar->insertItem( KStdGuiItem::help().text() , help );


    KStatusBar* sBar = statusBar();
    sBar->insertItem( "           ", URL_ITEM, 10 );
    sBar->insertItem( "                          ", META_ITEM, 2 );
    sBar->setItemAlignment(URL_ITEM, QLabel::AlignVCenter | QLabel::AlignLeft);

    fileWidget->setFocus();

    KConfig *kc = KGlobal::config();
    kc->setGroup("SessionSettings");
    bool oneWindow = kc->readBoolEntry("OpenImagesInActiveWindow", true );
    oneWindowAction->setChecked( oneWindow );

    tBar->show();

    // Address box in address tool bar
    KToolBar *addressToolBar = toolBar( "address_bar" );
    const int ID_ADDRESSBAR = 1;

    cmbPath = new KURLComboBox( KURLComboBox::Directories,
                                true, addressToolBar, "address_combo_box" );
    KURLCompletion *cmpl = new KURLCompletion( KURLCompletion::DirCompletion );
    cmbPath->setCompletionObject( cmpl );
    cmbPath->setAutoDeleteCompletionObject( true );

    addressToolBar->insertWidget( ID_ADDRESSBAR, 1, cmbPath);
    addressToolBar->setItemAutoSized( ID_ADDRESSBAR );

    connect( cmbPath, SIGNAL( urlActivated( const KURL& )),
             this, SLOT( slotSetURL( const KURL& )));
    connect( cmbPath, SIGNAL( returnPressed()),
             this, SLOT( slotURLComboReturnPressed()));


    fileWidget->initActions();
    fileWidget->clearHistory();
    dirSelected( fileWidget->url() );

    setCentralWidget( fileWidget );
    setupGUI( KMainWindow::Save );

    coll->action( "reload" )->setShortcut( KStdAccel::reload() );
    coll->action( "short view" )->setShortcut(Key_F6);
    coll->action( "detailed view" )->setShortcut(Key_F7);
    coll->action( "show hidden" )->setShortcut(Key_F8);
    coll->action( "mkdir" )->setShortcut(Key_F10);
    coll->action( "preview" )->setShortcut(Key_F11);
    coll->action( "separate dirs" )->setShortcut(Key_F12);
}
Exemplo n.º 23
0
void KHelpMain::createMenu()
{
    KStdAccel stdAccel;
	fileMenu = new QPopupMenu;
	CHECK_PTR( fileMenu );
	fileMenu->insertItem( klocale->translate("&New Help Window"), this,
                        SLOT( slotCloneWindow() ), stdAccel.openNew() );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Open File..."), helpwin,
                        SLOT(slotOpenFile()), stdAccel.open() );
//	fileMenu->insertItem( klocale->translate("Open UR&L..."), helpwin,
//                        SLOT(slotOpenURL()) );
	fileMenu->insertItem( klocale->translate("&Reload"), helpwin,
                        SLOT(slotReload()) );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Search"), helpwin,
                        SLOT(slotSearch()) );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Print..."), helpwin,
                        SLOT(slotPrint()), stdAccel.print() );
	fileMenu->insertSeparator();
	idClose = fileMenu->insertItem(klocale->translate("&Close"),this,
                        SLOT(slotClose()), stdAccel.close()); // CC :!!!!!
	fileMenu->insertItem( klocale->translate("&Quit"), this,
                        SLOT(slotQuit()), stdAccel.quit() );

	editMenu = new QPopupMenu;
	CHECK_PTR( editMenu );
	idCopy = editMenu->insertItem(klocale->translate("&Copy"), helpwin,
                        SLOT(slotCopy()), stdAccel.copy() );
	editMenu->insertItem(klocale->translate("&Find..."), helpwin,
                        SLOT(slotFind()), stdAccel.find() );
	editMenu->insertItem(klocale->translate("Find &next"), helpwin,
                        SLOT(slotFindNext()), Key_F3 );

	gotoMenu = new QPopupMenu;
	CHECK_PTR( gotoMenu );
	idBack = gotoMenu->insertItem( klocale->translate("&Back"), helpwin,
                        SLOT(slotBack()) );
	idForward = gotoMenu->insertItem( klocale->translate("&Forward"), helpwin,
                        SLOT(slotForward()) );
	gotoMenu->insertSeparator();
	idDir = gotoMenu->insertItem( klocale->translate("&Contents"), helpwin,
                        SLOT(slotDir()) );
	idTop = gotoMenu->insertItem( klocale->translate("&Top"), helpwin,
                        SLOT(slotTop()) );
	idUp = gotoMenu->insertItem( klocale->translate("&Up"), helpwin,
                        SLOT(slotUp()) );
	idPrev = gotoMenu->insertItem( klocale->translate("&Previous"), helpwin,
                        SLOT(slotPrev()) );
	idNext = gotoMenu->insertItem( klocale->translate("&Next"), helpwin,
                        SLOT(slotNext()) );

	bookmarkMenu = new QPopupMenu;
	CHECK_PTR( bookmarkMenu );
	connect( bookmarkMenu, SIGNAL( activated( int ) ),
			helpwin, SLOT( slotBookmarkSelected( int ) ) );
	connect( bookmarkMenu, SIGNAL( highlighted( int ) ),
			helpwin, SLOT( slotBookmarkHighlighted( int ) ) );

	optionsMenu = new QPopupMenu;
	CHECK_PTR( optionsMenu );
	optionsMenu->setCheckable( true );
	optionsMenu->insertItem( klocale->translate("&General Preferences..."), this,
			SLOT(slotOptionsGeneral()) );
	optionsMenu->insertSeparator();
	optionsMenu->insertItem(klocale->translate( "Show &Toolbar"), this,
                        SLOT(slotOptionsToolbar()));

	optionsMenu->insertItem( klocale->translate("Show &Location"), this,
                        SLOT(slotOptionsLocation()) );
	optionsMenu->insertItem( klocale->translate("Show Status&bar"), this,
		SLOT(slotOptionsStatusbar()) );
	optionsMenu->insertSeparator();
	optionsMenu->insertItem( klocale->translate("&Save Options"), this,
                        SLOT(slotOptionsSave()) );

	QString at = klocale->translate("KDE Help System\n");
	at+= klocale->translate("Version ");
	at+= KDEHELP_VERSION;
	at+=klocale->translate("\n\nCopyright (c) 1997 Martin Jones <*****@*****.**>"\
	"\n\nThis program is licensed under the GNU General Public License (GPL)."\
	"\nKDEHelp comes with ABSOLUTELY NO WARRANY to the extent permitted by applicable law.");

	QPopupMenu *helpMenu = kapp->getHelpMenu( true, at );
/*
	QPopupMenu *helpMenu = new QPopupMenu;
	CHECK_PTR( helpMenu );
	helpMenu->insertItem( klocale->translate("&Using KDE Help"), this,
                        SLOT(slotUsingHelp()) ); 
	helpMenu->insertSeparator();
	helpMenu->insertItem( klocale->translate("&About"), this, SLOT(slotAbout()) );
*/
	menu = new KMenuBar( this );
	CHECK_PTR( menu );
	menu->insertItem( klocale->translate("&File"), fileMenu );
	menu->insertItem( klocale->translate("&Edit"), editMenu );
	menu->insertItem( klocale->translate("&Goto"), gotoMenu );
	menu->insertItem( klocale->translate("&Bookmarks"), bookmarkMenu );
	menu->insertItem( klocale->translate("&Options"), optionsMenu );
	menu->insertSeparator();
	menu->insertItem( klocale->translate("&Help"), helpMenu );
}
Exemplo n.º 24
0
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
  : DCOPObject("interface"), 
    KDialogBase(parent, name, true, QString::null, Help|User1, User1, 
    true, KStdGuiItem::quit() )
{
    grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
    grabber->move( -1000, -1000 );
    grabber->installEventFilter( this );

    KStartupInfo::appStarted();

    QVBox *vbox = makeVBoxMainWidget();
    mainWidget = new KSnapshotWidget( vbox, "mainWidget" );

    connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));

    connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
    connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) );
    connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );
    connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) );

    grabber->show();
    grabber->grabMouse( waitCursor );

    if ( !grabCurrent )
	snapshot = QPixmap::grabWindow( qt_xrootwin() );
    else {
	mainWidget->setMode( WindowUnderCursor );
	mainWidget->setIncludeDecorations( true );
	performGrab();
    }

    updatePreview();
    grabber->releaseMouse();
    grabber->hide();

    KConfig *conf=KGlobal::config();
    conf->setGroup("GENERAL");
    mainWidget->setDelay(conf->readNumEntry("delay",0));
    mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
    mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));
    filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));

    // Make sure the name is not already being used
    while(KIO::NetAccess::exists( filename, false, this )) {
	autoincFilename();
    }

    connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );
    connect( &updateTimer, SIGNAL( timeout() ), this, SLOT(  updatePreview() ) );
    QTimer::singleShot( 0, this, SLOT( updateCaption() ) );

    KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);

    QPushButton *helpButton = actionButton( Help );
    helpButton->setPopup(helpMenu->menu());

    KAccel* accel = new KAccel(this);
    accel->insert(KStdAccel::Quit, kapp, SLOT(quit()));
    accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user without showing the file dialog."),
		   CTRL+SHIFT+Key_S, this, SLOT(slotSave()));
    accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs()));
//    accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs()));
    accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user."),
		   CTRL+Key_A, this, SLOT(slotSaveAs()));
    accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
    accel->insert(KStdAccel::New, this, SLOT(slotGrab()));
    accel->insert(KStdAccel::Copy, this, SLOT(slotCopy()));

    accel->insert( "Quit2", Key_Q, this, SLOT(slotSave()));
    accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs()));
    accel->insert( "Print2", Key_P, this, SLOT(slotPrint()));
    accel->insert( "New2", Key_N, this, SLOT(slotGrab()));
    accel->insert( "New3", Key_Space, this, SLOT(slotGrab()));

    setEscapeButton( User1 );
    connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );

    mainWidget->btnNew->setFocus();
}
Exemplo n.º 25
0
SalesHistory::SalesHistory(MainWindow* main)
    : QuasarWindow(main, "SalesHistory"), _grid(NULL)
{
    _helpSource = "sales_history.html";

    QFrame* frame = new QFrame(this);

    QGroupBox* select = new QGroupBox(tr("Data Selection"), frame);
    QGridLayout* grid1 = new QGridLayout(select, 2, 1, select->frameWidth()*2);
    grid1->addRowSpacing(0, select->fontMetrics().height());

    _lookup = new ItemLookup(_main, this);
    _lookup->soldOnly = true;
    _lookup->store_id = _quasar->defaultStore();

    QLabel* itemLabel = new QLabel(tr("Item Number:"), select);
    _item = new ItemEdit(_lookup, select);
    _item->setLength(18, '9');
    itemLabel->setBuddy(_item);

    QLabel* descLabel = new QLabel(tr("Description:"), select);
    _desc = new LineEdit(select);
    _desc->setLength(30);
    _desc->setFocusPolicy(NoFocus);

    QLabel* storeLabel = new QLabel(tr("Store:"), select);
    _store = new LookupEdit(new StoreLookup(_main, this), select);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    QLabel* sizeLabel = new QLabel(tr("Size:"), select);
    _size = new ComboBox(false, select);
    sizeLabel->setBuddy(_size);
    _size->insertItem(tr("All Sizes"));

    QLabel* dateLabel = new QLabel(tr("Date:"), select);
    _date = new DatePopup(select);
    dateLabel->setBuddy(_date);

    grid1->setColStretch(2, 1);
    grid1->addWidget(itemLabel, 1, 0);
    grid1->addWidget(_item, 1, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(descLabel, 2, 0);
    grid1->addWidget(_desc, 2, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(storeLabel, 3, 0);
    grid1->addWidget(_store, 3, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(sizeLabel, 1, 2, AlignRight | AlignVCenter);
    grid1->addWidget(_size, 1, 3, AlignLeft | AlignVCenter);
    grid1->addWidget(dateLabel, 2, 2, AlignRight | AlignVCenter);
    grid1->addWidget(_date, 2, 3, AlignLeft | AlignVCenter);

    QGroupBox* format = new QGroupBox(tr("Data Format"), frame);
    QGridLayout* grid2 = new QGridLayout(format, 2, 1, format->frameWidth()*2);
    grid2->addRowSpacing(0, format->fontMetrics().height());

    QLabel* qtySizeLabel = new QLabel(tr("Quantity Size:"), format);
    _qtySize = new ComboBox(false, format);
    qtySizeLabel->setBuddy(_qtySize);
    _qtySize->insertItem("EACH");

    QLabel* periodLabel = new QLabel(tr("Period:"), format);
    _period = new ComboBox(false, format);
    periodLabel->setBuddy(_period);

    _period->insertItem(tr("Month"));
    _period->insertItem(tr("Week"));
    _period->insertItem(tr("Day"));

    QLabel* countLabel = new QLabel(tr("Count:"), format);
    _count = new IntegerEdit(format);
    _count->setLength(4);
    countLabel->setBuddy(_count);

    grid2->setColStretch(2, 1);
    grid2->addWidget(qtySizeLabel, 1, 0);
    grid2->addWidget(_qtySize, 1, 1, AlignLeft | AlignVCenter);
    grid2->addWidget(periodLabel, 1, 2, AlignRight | AlignVCenter);
    grid2->addWidget(_period, 1, 3, AlignLeft | AlignVCenter);
    grid2->addWidget(countLabel, 2, 2, AlignRight | AlignVCenter);
    grid2->addWidget(_count, 2, 3, AlignLeft | AlignVCenter);

    _list = new ListView(frame);
    _list->addTextColumn(tr("Period"), 10);
    _list->addDateColumn(tr("Start Date"));
    _list->addNumberColumn(tr("Quantity"));
    _list->addMoneyColumn(tr("Total Cost"));
    _list->addMoneyColumn(tr("Total Price"));
    _list->addMoneyColumn(tr("Profit"));
    _list->addPercentColumn(tr("Margin"));
    _list->setSorting(1, false);
    _list->setShowSortIndicator(true);

    QFrame* info = new QFrame(frame);

    QLabel* minLabel = new QLabel(tr("Min:"), info);
    _minQty = new DoubleEdit(info);
    _minQty->setFocusPolicy(NoFocus);

    QLabel* maxLabel = new QLabel(tr("Max:"), info);
    _maxQty = new DoubleEdit(info);
    _maxQty->setFocusPolicy(NoFocus);

    QLabel* onHandLabel = new QLabel(tr("On Hand:"), info);
    _onHand = new DoubleEdit(info);
    _onHand->setFocusPolicy(NoFocus);

    QLabel* onOrderLabel = new QLabel(tr("On Order:"), info);
    _onOrder = new DoubleEdit(info);
    _onOrder->setFocusPolicy(NoFocus);

    QGridLayout* infoGrid = new QGridLayout(info);
    infoGrid->setSpacing(6);
    infoGrid->setMargin(6);
    infoGrid->setColStretch(2, 1);
    infoGrid->addWidget(minLabel, 0, 0);
    infoGrid->addWidget(_minQty, 0, 1, AlignLeft | AlignVCenter);
    infoGrid->addWidget(onHandLabel, 0, 3);
    infoGrid->addWidget(_onHand, 0, 4, AlignLeft | AlignVCenter);
    infoGrid->addWidget(maxLabel, 1, 0);
    infoGrid->addWidget(_maxQty, 1, 1, AlignLeft | AlignVCenter);
    infoGrid->addWidget(onOrderLabel, 1, 3);
    infoGrid->addWidget(_onOrder, 1, 4, AlignLeft | AlignVCenter);

    QFrame* box = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), box);
    refresh->setMinimumSize(refresh->sizeHint());
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* print = new QPushButton(tr("&Print"), box);
    print->setMinimumSize(refresh->sizeHint());
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* close = new QPushButton(tr("Cl&ose"), box);
    close->setMinimumSize(refresh->sizeHint());
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* boxGrid = new QGridLayout(box);
    boxGrid->setSpacing(6);
    boxGrid->setMargin(6);
    boxGrid->setColStretch(2, 1);
    boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    boxGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter);
    boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(2, 1);
    grid->addWidget(select, 0, 0);
    grid->addWidget(format, 1, 0);
    grid->addWidget(_list, 2, 0);
    grid->addWidget(info, 3, 0);
    grid->addWidget(box, 4, 0);

    connect(_item, SIGNAL(validData()), SLOT(slotItemChanged()));
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));
    connect(_size, SIGNAL(activated(int)), SLOT(slotRefresh()));
    connect(_date, SIGNAL(validData()), SLOT(slotRefresh()));
    connect(_qtySize, SIGNAL(activated(int)), SLOT(slotRefresh()));
    connect(_period, SIGNAL(activated(int)), SLOT(slotRefresh()));
    connect(_count, SIGNAL(validData()), SLOT(slotRefresh()));

    _store->setId(_quasar->defaultStore());
    _date->setDate(QDate::currentDate());
    _count->setInt(12);
    _item->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Sales History"));
    finalize();
}