예제 #1
0
QFTreeViewComboBox::QFTreeViewComboBox(QWidget *parent) :
    QFEnhancedComboBox(parent), _treeView(NULL)
{
    _treeView = new QTreeView(this);
    _treeView->setFrameShape(QFrame::NoFrame);
    _treeView->setEditTriggers(QTreeView::NoEditTriggers);
    _treeView->setAlternatingRowColors(true);
    _treeView->setSelectionBehavior(QTreeView::SelectRows);
    _treeView->setRootIsDecorated(false);
    _treeView->setWordWrap(true);
    _treeView->setAllColumnsShowFocus(true);
    _treeView->header()->setVisible(false);
    connect(_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(indexSelected(QModelIndex)));
    connect(_treeView, SIGNAL(activated(QModelIndex)), this, SLOT(indexSelected(QModelIndex)));
    connect(_treeView, SIGNAL(pressed(QModelIndex)), this, SLOT(indexSelected(QModelIndex)));
    setView(_treeView);
    currentItemIndex=QModelIndex();
}
예제 #2
0
ColorDialog::ColorDialog(QWidget* parent) : QDialog(parent)
{
	setupUi(this);

	setSelectedColor(QColor(Qt::white));

	connect(m_hsLabel, SIGNAL(colorSelected(QPoint)),
			this, SLOT(indexSelected(QPoint)));
	connect(m_vLabel, SIGNAL(colorSelected(QPoint)),
			this, SLOT(indexSelected(QPoint)));
	connect(m_okButton, SIGNAL(pressed()), this, SLOT(accept()));
	connect(m_cancelButton, SIGNAL(pressed()), this, SLOT(reject()));

	connect(m_rSpinBox, SIGNAL(valueChanged(int)), this, SLOT(rgbSpinValueChanged()));
	connect(m_gSpinBox, SIGNAL(valueChanged(int)), this, SLOT(rgbSpinValueChanged()));
	connect(m_bSpinBox, SIGNAL(valueChanged(int)), this, SLOT(rgbSpinValueChanged()));
	connect(m_aSpinBox, SIGNAL(valueChanged(int)), this, SLOT(rgbSpinValueChanged()));

	connect(m_hSpinBox, SIGNAL(valueChanged(int)), this, SLOT(hsvSpinValueChanged()));
	connect(m_sSpinBox, SIGNAL(valueChanged(int)), this, SLOT(hsvSpinValueChanged()));
	connect(m_vSpinBox, SIGNAL(valueChanged(int)), this, SLOT(hsvSpinValueChanged()));
}
예제 #3
0
DiaryWindow::DiaryWindow(MainWindow *mainWindow) :
    GcWindow(mainWindow), mainWindow(mainWindow), active(false)
{
    setInstanceName("Diary Window");
    setControls(NULL);

    // get config
    fieldDefinitions = mainWindow->rideMetadata()->getFields();

    QVBoxLayout *vlayout = new QVBoxLayout(this);

    // controls
    QHBoxLayout *controls = new QHBoxLayout;
    QFont bold;
    bold.setPointSize(14);
    bold.setWeight(QFont::Bold);
    title = new QLabel("", this);
    title->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
    title->setFont(bold);

    QIcon prevIcon(":images/toolbar/back_alt.png");
    QIcon nextIcon(":images/toolbar/forward_alt.png");
    next = new QPushButton(nextIcon, "", this);
    prev = new QPushButton(prevIcon, "", this);
#ifdef Q_OS_MAC
    next->setFlat(true);
    prev->setFlat(true);
#endif

#if 0
    // viewMode - monthly or weekly
    viewMode = new QComboBox;
    viewMode->addItem("View Month");
    viewMode->addItem("View Week"); // we can add more later...
    viewMode->addItem("View Ride"); // we can add more later...
    viewMode->setFixedWidth(120);

    viewMode->setCurrentIndex(appsettings->cvalue(mainWindow->cyclist, GC_DIARY_VIEW, "1").toInt());
#endif

    controls->addWidget(prev);
    controls->addWidget(next);
    controls->addStretch();
    controls->addWidget(title, Qt::AlignCenter | Qt::AlignVCenter);
    controls->addStretch();
#if 0
    controls->addWidget(viewMode);
#endif

    vlayout->addLayout(controls);

    // monthly view via QCalendarWidget
    calendarModel = new GcCalendarModel(this, &fieldDefinitions, mainWindow);
    calendarModel->setSourceModel(mainWindow->listView->sqlModel);

    monthlyView = new QTableView(this);
    monthlyView->setItemDelegate(new GcCalendarDelegate);
    monthlyView->setModel(calendarModel);
    monthlyView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->hide();
    monthlyView->viewport()->installEventFilter(this);
    monthlyView->setGridStyle(Qt::DotLine);
    monthlyView->setFrameStyle(QFrame::NoFrame);

    // weekly view via QxtScheduleView
    weeklyView = new QxtScheduleView;
    weeklyViewProxy = new QxtScheduleViewProxy(this, &fieldDefinitions, mainWindow);
    weeklyViewProxy->setSourceModel(mainWindow->listView->sqlModel);
    weeklyView->setCurrentZoomDepth (30, Qxt::Minute);
    weeklyView->setDateRange(QDate(2010,9,2), QDate(2010,9,8));
    weeklyView->setModel(weeklyViewProxy);

    RideSummaryWindow *rideSummary = new RideSummaryWindow(mainWindow);
    allViews = new QStackedWidget(this);
    allViews->addWidget(monthlyView);
    allViews->addWidget(weeklyView);
    allViews->addWidget(rideSummary);
    //allViews->setCurrentIndex(viewMode->currentIndex());
    allViews->setCurrentIndex(0);

    vlayout->addWidget(allViews);

    //connect(viewMode, SIGNAL(currentIndexChanged(int)), allViews, SLOT(setCurrentIndex(int)));
    //connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setDefaultView(int)));
    //connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(rideSelected()));
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
    connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(weeklyView, SIGNAL(indexSelected(QModelIndex)), this, SLOT(weeklySelected(QModelIndex)));
    connect(next, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(prev, SIGNAL(clicked()), this, SLOT(prevClicked()));
}
예제 #4
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{

    // NOTE: these dataextractors are deleted by
    // routecontainer class instance.
    dataExtractor = new bacra::DataExtractor();
    dataExtractor->initialize();
    dataExtractor2 = new bacra::DataExtractor();
    dataExtractor2->initialize();


    routeContainer = new bacra::RouteContainer(dataExtractor, this);
    stopContainer = new bacra::RouteContainer(dataExtractor2, this);
    stopDelegate = new bacra::StopDelegate(this);
    routeDelegate = new bacra::StopDelegate(this);



    ui->setupUi(this);



    QRegExp rx("\\d{0,6}");
    QValidator *validator = new QRegExpValidator(rx, this);
    ui->stopLineEdit->setValidator(validator);

    ui->routesView->setModel(routeContainer);
    ui->routesView->setItemDelegate(new bacra::StopDelegate());

    ui->stopsView->setModel(stopContainer);
    ui->stopsView->setItemDelegate(new bacra::StopDelegate());

    ui->tab_2->setDisabled(true);

    ui->progressBar->setVisible(false);

    //ui->stopsView->setStyleSheet("QTableView {background: url(:/bacra/images/bacra.png); background-attachment: fixed; background-position: bottom-center;}");
    //ui->departuresView->setStyleSheet("QTableView {background: url(:/bacra/images/bacra.png); background-attachment: fixed; background-position: bottom-center;}");
    //ui->routesView->setStyleSheet("QTableView {background: url(:/bacra/images/bacra.png); background-attachment: fixed; background-position: bottom-center;}");
    ui->addStopButton->setIcon(QIcon(":/bacra/images/add.png"));

    ui->stopsView->setDragEnabled(true);
    ui->stopsView->setAcceptDrops(true);

    connect(stopContainer, SIGNAL(updatedDepartures()), ui->departuresView, SLOT(setFocus()));

    connect(dataExtractor, SIGNAL(infoResponseReady(int)), ui->progressBar, SLOT(setValue(int)));
    connect(dataExtractor2, SIGNAL(infoResponseReady(int)), ui->progressBar, SLOT(setValue(int)));

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(commercialAnnouncement(int)));

    connect(ui->fromLineEdit, SIGNAL(returnPressed()), ui->toLineEdit, SLOT(setFocus()));
    connect(ui->toLineEdit, SIGNAL(returnPressed()), ui->addRouteButton, SLOT(click()));
    connect(ui->addRouteButton, SIGNAL(clicked()), this, SLOT(addRouteClicked()));
    connect(this, SIGNAL(addRoute(QString, QString)), routeContainer, SLOT(addRouteItem(QString, QString)));

    connect(ui->stopLineEdit, SIGNAL(returnPressed()), ui->addStopButton, SLOT(click()));
    connect(ui->addStopButton, SIGNAL(clicked()), this, SLOT(addStopClicked()));
    connect(this, SIGNAL(addStop(QString)), stopContainer, SLOT(addStopItem(QString)));
    connect(ui->stopsView, SIGNAL(clicked(QModelIndex)), stopContainer, SLOT(indexSelected(QModelIndex)));
    connect(ui->routesView, SIGNAL(clicked(QModelIndex)), routeContainer, SLOT(indexSelected(QModelIndex)));

    connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateDepartures()));
    
    connect(stopContainer, SIGNAL(dataChanged(QModelIndex,QModelIndex)), ui->stopsView, SLOT(dataChanged(QModelIndex,QModelIndex)));

    connect(routeContainer, SIGNAL(routeAdded()), this, SLOT(routeAdded()));
    connect(stopContainer, SIGNAL(stopAdded()), this, SLOT(stopAdded()));

    connect(stopContainer, SIGNAL(showDepartures(bacra::Route*)), this, SLOT(showDepartures(bacra::Route*)));

    connect(stopContainer, SIGNAL(invalidStop()), this, SLOT(invalidStop()));
    connect(routeContainer, SIGNAL(invalidRoute()), this, SLOT(invalidRoute()));

     //Loading routes from disk
     //setting ui so loaded stops display themselves
    //correctly
//    ui->stopsView->setColumnWidth(0, 170);
 //   ui->stopsView->setColumnWidth(1, 40);
    ui->stopsView->setColumnWidth(0, 180);
    ui->stopsView->setColumnWidth(1, 30);
    stopContainer->loadRoutes("./savedata.txt");
}