Example #1
0
int main(int argc, char **argv)
{
  using namespace qsmp;
  using boost::bind;
  using boost::filesystem::recursive_directory_iterator;
  try
  {
    qInstallMsgHandler(&qsmp::QtMsgHandler);

    DWORD tick = ::GetTickCount();
    QSMP_LOG("Seed") << tick;
    srand(tick);

    tbb::task_scheduler_init init;
    QApplication app(argc, argv);
    app.setApplicationName("SMPMediaPlayer");
    app.setApplicationVersion("0.0.1");
    app.setOrganizationName("Foobar NZ");
    app.setOrganizationDomain("foobar.co.nz");

    std::string path = (argc > 1) ? argv[1] : "";

    std::vector<Media> paths;
    std::copy(recursive_directory_iterator(path),
              recursive_directory_iterator(),
              valueOutputFilterIterator<recursive_directory_iterator::value_type>(
                  testExtension(
                      equals(".mp3",boost::is_iequal())
                    ),
                  std::back_inserter(paths)));

    sort(paths,MetadataType_FileName,SortingOrder_Ascending);

    typedef boost::iterator_range<std::vector<Media>::iterator> Range_t;
    typedef PlaylistModel<Range_t> Model_t;
    typedef boost::iterator_range<PlayerHistory::const_history_iterator> HistoryRange_t;
    typedef PlaylistModel<HistoryRange_t> HistoryModel_t;

    PlayerHistory history;
    Player player(bind(&PlayerHistory::PlayerNext,&history));
    history.SetNextCallback(bind(&chooseRandom<Range_t>,boost::ref(paths)));
    history.SetPlayer(&player);

    //Model_t model(paths);
    boost::shared_ptr<PlaylistModelBase> model = NewPlaylist(bind(construct<HistoryRange_t>(),
                                                                  bind(&PlayerHistory::begin,&history,5),
                                                                  bind(&PlayerHistory::end,&history,15)));
    QObject::connect(&history, SIGNAL(OnHistoryUpdated()), model.get(), SLOT(Reset()));

    QVBoxLayout* layout = new QVBoxLayout;
    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(0);

    layout->addWidget(new PlaylistView(model.get()));
    layout->addWidget(new PlayerControl(&player,&history));

    HotkeyWindow window;
    window.setLayout(layout);
    window.show();

    window.RegisterHotkeys();

    QObject::connect(&window, SIGNAL(OnPrevious()), &history, SLOT(Previous()));
    QObject::connect(&window, SIGNAL(OnNext()), &history, SLOT(Next()));
    QObject::connect(&window, SIGNAL(OnPlayPause()), &player, SLOT(PlayPause()));
    QObject::connect(&window, SIGNAL(OnStop()), &player, SLOT(Stop()));

    //QObject::connect(view,SIGNAL(doubleClicked(QModelIndex)),model,SLOT(onDoubleClicked(QModelIndex)));
    //QObject::connect(model,SIGNAL(itemSelected(QString)),mywindow.control,SLOT(setFilePath(QString)));


    //LuaTcpServer lua;

    return app.exec();
  }
  catch(std::exception& e)
  {
    qFatal("Exception: %s",e.what());
  }
}
Example #2
0
LayerDock::LayerDock(QWidget *parent):
    QDockWidget(parent),
    mOpacityLabel(new QLabel),
    mOpacitySlider(new QSlider(Qt::Horizontal)),
    mLayerView(new LayerView),
    mMapDocument(nullptr),
    mUpdatingSlider(false),
    mChangingLayerOpacity(false)
{
    setObjectName(QLatin1String("layerDock"));

    QWidget *widget = new QWidget(this);
    QVBoxLayout *layout = new QVBoxLayout(widget);
    layout->setMargin(0);

    QHBoxLayout *opacityLayout = new QHBoxLayout;
    mOpacitySlider->setRange(0, 100);
    mOpacitySlider->setEnabled(false);
    opacityLayout->addWidget(mOpacityLabel);
    opacityLayout->addWidget(mOpacitySlider);
    mOpacityLabel->setBuddy(mOpacitySlider);

    MapDocumentActionHandler *handler = MapDocumentActionHandler::instance();

    QMenu *newLayerMenu = new QMenu(this);
    newLayerMenu->addAction(handler->actionAddTileLayer());
    newLayerMenu->addAction(handler->actionAddObjectGroup());
    newLayerMenu->addAction(handler->actionAddImageLayer());

    const QIcon newIcon(QLatin1String(":/images/16x16/document-new.png"));
    QToolButton *newLayerButton = new QToolButton;
    newLayerButton->setPopupMode(QToolButton::InstantPopup);
    newLayerButton->setMenu(newLayerMenu);
    newLayerButton->setIcon(newIcon);
    Utils::setThemeIcon(newLayerButton, "document-new");

    QToolBar *buttonContainer = new QToolBar;
    buttonContainer->setFloatable(false);
    buttonContainer->setMovable(false);
    buttonContainer->setIconSize(QSize(16, 16));

    buttonContainer->addWidget(newLayerButton);
    buttonContainer->addAction(handler->actionMoveLayerUp());
    buttonContainer->addAction(handler->actionMoveLayerDown());
    buttonContainer->addAction(handler->actionDuplicateLayer());
    buttonContainer->addAction(handler->actionRemoveLayer());
    buttonContainer->addSeparator();
    buttonContainer->addAction(handler->actionToggleOtherLayers());

    QVBoxLayout *listAndToolBar = new QVBoxLayout;
    listAndToolBar->setSpacing(0);
    listAndToolBar->addWidget(mLayerView);
    listAndToolBar->addWidget(buttonContainer);

    layout->addLayout(opacityLayout);
    layout->addLayout(listAndToolBar);

    setWidget(widget);
    retranslateUi();

    connect(mOpacitySlider, SIGNAL(valueChanged(int)),
            this, SLOT(sliderValueChanged(int)));
    updateOpacitySlider();
}
Example #3
0
MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, nullptr),
	m_historyIndex(0),
	m_inputHistory()
{
	setGeometry(300, 300, 1000, 600);

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

	// The input line
	m_inputEdit = new QLineEdit(mainWindowFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot);
	m_inputEdit->installEventFilter(this);


	// The log view
	m_consoleView = new DebuggerView(DVT_CONSOLE,
										m_machine,
										mainWindowFrame);
	m_consoleView->setFocusPolicy(Qt::NoFocus);
	m_consoleView->setPreferBottom(true);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->addWidget(m_consoleView);
	vLayout->addWidget(m_inputEdit);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(4,0,4,2);

	setCentralWidget(mainWindowFrame);

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

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

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addAction(m_breakpointToggleAct);
	optionsMenu->addAction(m_breakpointEnableAct);
	optionsMenu->addAction(m_runToCursorAct);
	optionsMenu->addSeparator();
	optionsMenu->addActions(rightBarGroup->actions());

	//
	// Images menu
	//
	image_interface_iterator imageIterTest(m_machine->root_device());
	if (imageIterTest.first() != nullptr)
	{
		createImagesMenu();
	}

	//
	// Dock window menu
	//
	QMenu* dockMenu = menuBar()->addMenu("Doc&ks");

	setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
	setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);

	// The processor dock
	QDockWidget* cpuDock = new QDockWidget("processor", this);
	cpuDock->setObjectName("cpudock");
	cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
	m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
	cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));

	addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
	dockMenu->addAction(cpuDock->toggleViewAction());

	// The disassembly dock
	QDockWidget* dasmDock = new QDockWidget("dasm", this);
	dasmDock->setObjectName("dasmdock");
	dasmDock->setAllowedAreas(Qt::TopDockWidgetArea);
	m_dasmFrame = new DasmDockWidget(m_machine, dasmDock);
	dasmDock->setWidget(m_dasmFrame);
	connect(m_dasmFrame->view(), &DebuggerView::updated, this, &MainWindow::dasmViewUpdated);

	addDockWidget(Qt::TopDockWidgetArea, dasmDock);
	dockMenu->addAction(dasmDock->toggleViewAction());
}
ToolsDockWidget::ToolsDockWidget(QWidget * parent) :
    QDockWidget(i18n("Tools"),parent),
//    m_has_selection(false),
    m_current_item(0),
    m_scene(0),
    d(new ToolsDockWidgetPrivate)
{
    this->setFeatures(QDockWidget::DockWidgetMovable);
    this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QWidget * widget = new QWidget(this);
    QVBoxLayout * layout = new QVBoxLayout(widget);
    //layout->setSizeConstraint(QLayout::SetMinimumSize);

    // tools buttons layout
    d->formLayout = new QGridLayout();
    //formLayout->setSizeConstraint(QLayout::SetMinimumSize);
    layout->addLayout(d->formLayout);

    // stacked widget (with tools widgets)
    d->toolArea = new QScrollArea(widget);
    //sa->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    d->toolArea->setFrameShape(QFrame::NoFrame);
    d->toolArea->setWidgetResizable(true);
    d->toolArea->setWidget(0);
    layout->addWidget(d->toolArea,1);

    QButtonGroup * group = new QButtonGroup(widget);

    // Selection tool

    m_tool_pointer = new KPushButton(KGuiItem("",":/pointer.png",
                                              i18n("Allows to select and move images on canvas"),
                                              i18n("Tool which allows one to select and move images on canvas. Any other operations are disabled.")), widget);
    m_tool_pointer->setIconSize(QSize(24,24));
    m_tool_pointer->setFixedSize(32,32);
    m_tool_pointer->setCheckable(true);
    m_tool_pointer->setFlat(true);
    group->addButton(m_tool_pointer);
    connect(m_tool_pointer,SIGNAL(toggled(bool)),this,SLOT(setPointerToolVisible(bool)));

    // View tool
    m_tool_hand = new KPushButton(KGuiItem("",":/hand.png",
                                           i18n("Viewing tool"),
                                           i18n("This tool allows one to view whole canvas in read-only mode. Only scrolling and zooming are available.")), widget);
    m_tool_hand->setIconSize(QSize(24,24));
    m_tool_hand->setFixedSize(32,32);
    m_tool_hand->setCheckable(true);
    m_tool_hand->setFlat(true);
    group->addButton(m_tool_hand);
    connect(m_tool_hand,SIGNAL(toggled(bool)),this,SLOT(setHandToolVisible(bool)));

    // Zoom tool
    m_tool_zoom = new KPushButton(KGuiItem("",":/zoom.png",
                                           i18n("Zooming tool"),
                                           i18n("This tool allows one to zoom canvas to fit it to the application window or users preferences.")), widget);
    m_tool_zoom->setIconSize(QSize(24,24));
    m_tool_zoom->setFixedSize(32,32);
    m_tool_zoom->setCheckable(true);
    m_tool_zoom->setFlat(true);
    group->addButton(m_tool_zoom);
    connect(m_tool_zoom,SIGNAL(toggled(bool)),this,SLOT(setZoomWidgetVisible(bool)));

    // Canvas edit tool
    m_canvas_button = new KPushButton(KGuiItem("", ":/tool_canvas.png",
                                               i18n("Canvas editor"),
                                               i18n("This tool allows you to edit canvas properties like size and background.")), widget);
    m_canvas_button->setIconSize(QSize(24,24));
    m_canvas_button->setFixedSize(32,32);
    m_canvas_button->setCheckable(true);
    m_canvas_button->setFlat(true);
    group->addButton(m_canvas_button);
    connect(m_canvas_button,SIGNAL(toggled(bool)),this,SLOT(setCanvasWidgetVisible(bool)));

    // Text tool
    m_text_button = new KPushButton(KGuiItem("", ":/tool_text.png",
                                              i18n("Text editor"),
                                              i18n("This tool allows you to write text on the canvas. It's simple - just click on the canvas where you want to add some text and write it!")), widget);

    m_text_button->setIconSize(QSize(24,24));
    m_text_button->setFixedSize(32,32);
    m_text_button->setCheckable(true);
    m_text_button->setFlat(true);
    group->addButton(m_text_button);
    connect(m_text_button,SIGNAL(toggled(bool)),this,SLOT(setTextWidgetVisible(bool)));

    // Rotate tool
    m_rotate_button = new KPushButton(KGuiItem("", ":/tool_rotate.png",
                                              i18n("Rotation tool"),
                                              i18n("This tool allows you to rotate items on your canvas.")), widget);
    m_rotate_button->setIconSize(QSize(24,24));
    m_rotate_button->setFixedSize(32,32);
    m_rotate_button->setCheckable(true);
    m_rotate_button->setFlat(true);
    group->addButton(m_rotate_button);
    connect(m_rotate_button,SIGNAL(toggled(bool)),this,SLOT(setRotateWidgetVisible(bool)));

    // Scale tool
    m_scale_button = new KPushButton(KGuiItem("", ":/tool_scale4.png",
                                              i18n("Scaling tool"),
                                              i18n("This tool allows you to scale items on your canvas.")), widget);
    m_scale_button->setIconSize(QSize(24,24));
    m_scale_button->setFixedSize(32,32);
    m_scale_button->setCheckable(true);
    m_scale_button->setFlat(true);
    group->addButton(m_scale_button);
    connect(m_scale_button,SIGNAL(toggled(bool)),this,SLOT(setScaleWidgetVisible(bool)));

    // Crop tool
    m_crop_button = new KPushButton(KGuiItem("", ":/tool_cropt.png",
                                              i18n("Crop tool"),
                                              i18n("This tool allows you to crop items.")), widget);
    m_crop_button->setIconSize(QSize(24,24));
    m_crop_button->setFixedSize(32,32);
    m_crop_button->setCheckable(true);
    m_crop_button->setFlat(true);
    group->addButton(m_crop_button);
    connect(m_crop_button,SIGNAL(toggled(bool)),this,SLOT(setCropWidgetVisible(bool)));

    // Photo effects tool
    m_effects_button = new KPushButton(KGuiItem("", ":/tool_effects.png",
                                              i18n("Image effects editor"),
                                              i18n("This tool allows you to edit existing effects of your photo layers and add some new one.")), widget);
    m_effects_button->setIconSize(QSize(24,24));
    m_effects_button->setFixedSize(32,32);
    m_effects_button->setCheckable(true);
    m_effects_button->setFlat(true);
    group->addButton(m_effects_button);
    connect(m_effects_button,SIGNAL(toggled(bool)),this,SLOT(setEffectsWidgetVisible(bool)));

    // Border edit tool
    m_tool_border = new KPushButton(QIcon::fromTheme(":/tool_border.png"), "", widget);
    m_tool_border->setIconSize(QSize(24,24));
    m_tool_border->setFixedSize(32,32);
    m_tool_border->setCheckable(true);
    m_tool_border->setFlat(true);
    group->addButton(m_tool_border);
    connect(m_tool_border,SIGNAL(toggled(bool)),this,SLOT(setBordersWidgetVisible(bool)));

    // Spacer
    d->formLayout->setSpacing(0);
    d->formLayout->setMargin(0);

    layout->setSpacing(0);
    layout->setMargin(0);
    widget->setLayout(layout);
    //widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    this->setWidget(widget);
    this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    this->setMinimumWidth(235);

    setDefaultTool();
}
Example #5
0
runPage::runPage (QWidget *parent, RUN_PROGRESS *prog, QListWidget **cList):
  QWizardPage (parent)
{
  progress = prog;


  setTitle (tr ("Build PFM Structure(s)"));

  setPixmap (QWizard::WatermarkPixmap, QPixmap(":/icons/pfmLoadWatermark.png"));

  setFinalPage (TRUE);

  QVBoxLayout *vbox = new QVBoxLayout (this);
  vbox->setMargin (5);
  vbox->setSpacing (5);


  progress->fbox = new QGroupBox (tr ("Input file processing progress"), this);
  QVBoxLayout *fboxLayout = new QVBoxLayout;
  progress->fbox->setLayout (fboxLayout);
  fboxLayout->setSpacing (10);


  progress->fbar = new QProgressBar (this);
  progress->fbar->setRange (0, 100);
  progress->fbar->setWhatsThis (tr ("Progress of input file loading"));
  fboxLayout->addWidget (progress->fbar);


  vbox->addWidget (progress->fbox);


  progress->rbox = new QGroupBox (tr ("PFM bin recompute/filter progress"), this);
  QVBoxLayout *rboxLayout = new QVBoxLayout;
  progress->rbox->setLayout (rboxLayout);
  rboxLayout->setSpacing (10);

  progress->rbar = new QProgressBar (this);
  progress->rbar->setRange (0, 100);
  progress->rbar->setWhatsThis (tr ("Progress of PFM bin recomputation or filter process"));
  rboxLayout->addWidget (progress->rbar);


  vbox->addWidget (progress->rbox);


  QGroupBox *lbox = new QGroupBox (tr ("Process status"), this);
  QVBoxLayout *lboxLayout = new QVBoxLayout;
  lbox->setLayout (lboxLayout);
  lboxLayout->setSpacing (10);


  checkList = new QListWidget (this);
  checkList->setAlternatingRowColors (TRUE);
  lboxLayout->addWidget (checkList);


  vbox->addWidget (lbox);


  *cList = checkList;


  //  Serious cheating here ;-)  I want the finish button to be disabled when you first get to this page
  //  so I set the last progress bar to be a "mandatory" field.  I couldn't disable the damn button in
  //  initializePage in the parent for some unknown reason.

  registerField ("progress_rbar*", progress->rbar, "value");
}
QWidget *KitOptionsPage::widget()
{
    if (!m_configWidget) {
        m_configWidget = new QWidget;

        m_kitsView = new QTreeView(m_configWidget);
        m_kitsView->setUniformRowHeights(true);
        m_kitsView->header()->setStretchLastSection(true);
        m_kitsView->setSizePolicy(m_kitsView->sizePolicy().horizontalPolicy(),
                                  QSizePolicy::Ignored);

        m_addButton = new QPushButton(tr("Add"), m_configWidget);
        m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
        m_delButton = new QPushButton(tr("Remove"), m_configWidget);
        m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget);

        QVBoxLayout *buttonLayout = new QVBoxLayout();
        buttonLayout->setSpacing(6);
        buttonLayout->setContentsMargins(0, 0, 0, 0);
        buttonLayout->addWidget(m_addButton);
        buttonLayout->addWidget(m_cloneButton);
        buttonLayout->addWidget(m_delButton);
        buttonLayout->addWidget(m_makeDefaultButton);
        buttonLayout->addStretch();

        QHBoxLayout *horizontalLayout = new QHBoxLayout();
        horizontalLayout->addWidget(m_kitsView);
        horizontalLayout->addLayout(buttonLayout);

        QVBoxLayout *verticalLayout = new QVBoxLayout(m_configWidget);
        verticalLayout->addLayout(horizontalLayout);

        m_model = new Internal::KitModel(verticalLayout);
        connect(m_model, &Internal::KitModel::kitStateChanged, this, &KitOptionsPage::updateState);
        verticalLayout->setStretch(0, 1);
        verticalLayout->setStretch(1, 0);

        m_kitsView->setModel(m_model);
        m_kitsView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
        m_kitsView->expandAll();

        m_selectionModel = m_kitsView->selectionModel();
        connect(m_selectionModel, &QItemSelectionModel::selectionChanged,
                this, &KitOptionsPage::kitSelectionChanged);
        connect(KitManager::instance(), &KitManager::kitAdded,
                this, &KitOptionsPage::kitSelectionChanged);
        connect(KitManager::instance(), &KitManager::kitRemoved,
                this, &KitOptionsPage::kitSelectionChanged);
        connect(KitManager::instance(), &KitManager::kitUpdated,
                this, &KitOptionsPage::kitSelectionChanged);

        // Set up add menu:
        connect(m_addButton, &QAbstractButton::clicked, this, &KitOptionsPage::addNewKit);
        connect(m_cloneButton, &QAbstractButton::clicked, this, &KitOptionsPage::cloneKit);
        connect(m_delButton, &QAbstractButton::clicked, this, &KitOptionsPage::removeKit);
        connect(m_makeDefaultButton, &QAbstractButton::clicked, this, &KitOptionsPage::makeDefaultKit);

        updateState();

        if (m_toShow) {
            QModelIndex index = m_model->indexOf(m_toShow);
            m_selectionModel->select(index,
                                     QItemSelectionModel::Clear
                                     | QItemSelectionModel::SelectCurrent
                                     | QItemSelectionModel::Rows);
            m_kitsView->scrollTo(index);
        }
        m_toShow = 0;
    }
    return m_configWidget;
}
Example #7
0
Klavishi::Klavishi(QWidget*parent)
:QWidget(parent)
{

setWindowTitle("RDM-11");// выбираем название окна
setFixedSize(490,240); // устанавливаем размер окна
//setStyleSheet(AlignHCenter);
//setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setAutoFillBackground(true);

akkum = new QProgressBar;
akkum->setFixedSize(60,15);
akkum->setValue(24);

label = new QLabel("11:16 23.05.2013");

picture.load(":/im/image1.jpg");

picture_multichannel.load(":/im/imag.jpg");
picture_singlechannel.load(":/im/ima.jpg");


handle =new QPushButton(tr("Настройки"));// делаем кнопку для калибровки
handle->setIcon(picture);
handle->setIconSize(picture.size());
translator =new QTranslator;

multichannel = new QPushButton(tr("Сплошной режим")); // делаем кнопку для многоканального
multichannel->setIcon(picture_multichannel);
multichannel->setIconSize(picture_multichannel.size());

singlechannel = new QPushButton(tr("Одноканальный")); // делаем кнопку для
singlechannel->setIcon(picture_singlechannel);
singlechannel->setIconSize(picture_singlechannel.size());

frame_handle = new QFrame;
frame_multichannel = new QFrame;
frame_singlechannel = new QFrame;
frame_akkum =new QFrame;

connect(handle,SIGNAL(clicked()),SLOT(handle_channel()));
connect(multichannel,SIGNAL(clicked()),SLOT(multi_channel()));
connect(singlechannel,SIGNAL(clicked()),SLOT(single_channel()));
//pal_1.setBrush(QPalette::Background,Qt::white);

//frame_handle->setPalette(pal_1);
frame_handle->setAutoFillBackground(true);
frame_handle->setFixedSize(170,120);
frame_handle->setLayout(new QVBoxLayout());
frame_handle->layout()->addWidget(handle);
//frame_handle->layout()->addWidget(label);


frame_akkum->setAutoFillBackground(true);
frame_akkum->setFixedSize(150,40);
frame_akkum->setLayout(new QHBoxLayout());
frame_akkum->layout()->addWidget(akkum);
frame_akkum->layout()->addWidget(label);

//frame_multichannel->setPalette(pal_1);
frame_multichannel->setAutoFillBackground(true);
frame_multichannel->setFixedSize(250,120);
frame_multichannel->setLayout(new QVBoxLayout());
frame_multichannel->layout()->addWidget(multichannel);

//frame_singlechannel->setPalette(pal_1);
frame_singlechannel->setAutoFillBackground(true);
frame_singlechannel->setLayout(new QVBoxLayout());
frame_singlechannel->setFixedSize(190,120);
frame_singlechannel->layout()->addWidget(singlechannel);

translator =new QTranslator;
QVBoxLayout * mainLayout  = new QVBoxLayout;
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addSpacing(-50);

QHBoxLayout * phbxLayout = new QHBoxLayout;
phbxLayout->setMargin(0);
phbxLayout->addSpacing(0);

QHBoxLayout * layout_handle=new QHBoxLayout;
layout_handle->addWidget(frame_handle);
layout_handle->setAlignment(Qt::AlignLeft);



QHBoxLayout * layout_multichannel=new QHBoxLayout;
layout_multichannel->addWidget(frame_multichannel);
layout_multichannel->setAlignment(Qt::AlignCenter);
//layout_multichannel->addStretch(0);


QHBoxLayout *layout_singlechannel=new QHBoxLayout;
layout_singlechannel->addWidget(frame_singlechannel);
layout_singlechannel->setAlignment(Qt::AlignRight);



QHBoxLayout * layout_akkum = new QHBoxLayout;
layout_akkum->addWidget(frame_akkum);
layout_akkum->setAlignment(Qt::AlignRight);

phbxLayout->addLayout(layout_handle);
phbxLayout->addLayout(layout_multichannel);
phbxLayout->addLayout(layout_singlechannel);
mainLayout->addLayout(layout_akkum);
mainLayout->addLayout(phbxLayout);
setLayout(mainLayout);
}
    QueueManagerWidget::QueueManagerWidget(QueueManager* qman, QWidget* parent) : QWidget(parent), qman(qman)
    {
        QHBoxLayout* layout = new QHBoxLayout(this);
        layout->setMargin(0);
        layout->setSpacing(0);
        QVBoxLayout* vbox = new QVBoxLayout();
        vbox->setMargin(0);
        vbox->setSpacing(0);
        view = new QTreeView(this);
        view->setUniformRowHeights(true);
        toolbar = new QToolBar(this);
        toolbar->setOrientation(Qt::Vertical);
        toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
        layout->addWidget(toolbar);

        search = new KLineEdit(this);
        search->setClickMessage(i18n("Search"));
        search->setClearButtonShown(true);
        search->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
        connect(search, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
        search->hide();
        vbox->addWidget(search);
        vbox->addWidget(view);
        layout->addLayout(vbox);

        show_search = toolbar->addAction(KIcon("edit-find"), i18n("Show Search"));
        show_search->setToolTip(i18n("Show or hide the search bar"));
        show_search->setCheckable(true);
        connect(show_search, SIGNAL(toggled(bool)), this, SLOT(showSearch(bool)));

        move_top = toolbar->addAction(KIcon("go-top"), i18n("Move Top"), this, SLOT(moveTopClicked()));
        move_top->setToolTip(i18n("Move a torrent to the top of the queue"));

        move_up = toolbar->addAction(KIcon("go-up"), i18n("Move Up"), this, SLOT(moveUpClicked()));
        move_up->setToolTip(i18n("Move a torrent up in the queue"));

        move_down = toolbar->addAction(KIcon("go-down"), i18n("Move Down"), this, SLOT(moveDownClicked()));
        move_down->setToolTip(i18n("Move a torrent down in the queue"));

        move_bottom = toolbar->addAction(KIcon("go-bottom"), i18n("Move Bottom"), this, SLOT(moveBottomClicked()));
        move_bottom->setToolTip(i18n("Move a torrent to the bottom of the queue"));

        show_downloads = toolbar->addAction(KIcon("arrow-down"), i18n("Show Downloads"));
        show_downloads->setToolTip(i18n("Show all downloads"));
        show_downloads->setCheckable(true);
        connect(show_downloads, SIGNAL(toggled(bool)), this, SLOT(showDownloads(bool)));

        show_uploads = toolbar->addAction(KIcon("arrow-up"), i18n("Show Uploads"));
        show_uploads->setToolTip(i18n("Show all uploads"));
        show_uploads->setCheckable(true);
        connect(show_uploads, SIGNAL(toggled(bool)), this, SLOT(showUploads(bool)));

        show_not_queued = toolbar->addAction(KIcon("kt-queue-manager"), i18n("Show Not Queued"));
        show_not_queued->setToolTip(i18n("Show all not queued torrents"));
        show_not_queued->setCheckable(true);
        connect(show_not_queued, SIGNAL(toggled(bool)), this, SLOT(showNotQueued(bool)));

        model = new QueueManagerModel(qman, this);
        view->setModel(model);
        view->setRootIsDecorated(false);
        view->setAlternatingRowColors(true);
        view->setSelectionBehavior(QAbstractItemView::SelectRows);
        view->setSortingEnabled(false);
        view->setDragDropMode(QAbstractItemView::InternalMove);
        view->setDragEnabled(true);
        view->setAcceptDrops(true);
        view->setDropIndicatorShown(true);
        view->setAutoScroll(true);
        view->setSelectionMode(QAbstractItemView::ContiguousSelection);

        connect(view->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
                this, SLOT(selectionChanged(QItemSelection, QItemSelection)));

        updateButtons();
    }
Example #9
0
ConfigurationWindow::ConfigurationWindow(const configurations &config) :
  m_config(config)
{
  QGroupBox *configGroup = new QGroupBox(tr("Configuration"));


  QLabel *serverLabel = new QLabel(tr("CAE file path:"));
  caeFilePathTextEdit = new QTextEdit(QString(config.caeFilePath.c_str()));
  caeFilePathTextEdit->setEnabled(false);
  caeFilePathTextEdit->setFixedHeight(25);
  QHBoxLayout *filePathLayout = new QHBoxLayout;
  filePathLayout->addWidget(serverLabel);
  filePathLayout->addWidget(caeFilePathTextEdit);

  QLabel *abaqusBatPathLabel = new QLabel(tr("Abaqus.bat path:"));
  abaqusBatPathTextEdit = new QTextEdit(QString(config.abaqusBatPath.c_str()));
  abaqusBatPathTextEdit->setFixedHeight(25);
  QHBoxLayout *abaqusBatPathLayout = new QHBoxLayout;
  abaqusBatPathLayout->addWidget(abaqusBatPathLabel);
  abaqusBatPathLayout->addWidget(abaqusBatPathTextEdit);

  QLabel *openModelScriptPathLabel = new QLabel(tr("Prepare model script path:"));
  openModelScriptPathTextEdit = new QTextEdit(QString(config.openModelScriptPath.c_str()));
  openModelScriptPathTextEdit->setFixedHeight(25);
  QHBoxLayout *openModelScriptPathLayout = new QHBoxLayout;
  openModelScriptPathLayout->addWidget(openModelScriptPathLabel);
  openModelScriptPathLayout->addWidget(openModelScriptPathTextEdit);

  QLabel *runForGenomeScriptPathLabel = new QLabel(tr("Run for genome script path:"));
  runForGenomeScriptPathTextEdit = new QTextEdit(QString(config.runForGenomeScriptPath.c_str()));
  runForGenomeScriptPathTextEdit->setFixedHeight(25);
  QHBoxLayout *runForGenomeScriptPathLayout = new QHBoxLayout;
  runForGenomeScriptPathLayout->addWidget(runForGenomeScriptPathLabel);
  runForGenomeScriptPathLayout->addWidget(runForGenomeScriptPathTextEdit);

  QLabel *netSizeLabel = new QLabel(tr("Optimization net size:"));
  optimizationNetSizeTextEdit = new QTextEdit(QString::number(config.optimizationNetSize));
  optimizationNetSizeTextEdit->setFixedHeight(25);
  QHBoxLayout *netSizeLayout = new QHBoxLayout;
  netSizeLayout->addWidget(netSizeLabel);
  netSizeLayout->setSpacing(1);
  netSizeLayout->addWidget(optimizationNetSizeTextEdit);

  QLabel *meshSizeLabel = new QLabel(tr("Mesh size:"));
  meshSizeTextEdit = new QTextEdit(QString::number(config.meshSize));
  meshSizeTextEdit->setFixedHeight(25);
  QHBoxLayout *meshSizeLayout = new QHBoxLayout;
  meshSizeLayout->addWidget(meshSizeLabel);
  meshSizeLayout->addWidget(meshSizeTextEdit);
  meshSizeLayout->setSizeConstraint(QLayout::SetMaximumSize);

  QVBoxLayout *configLayout = new QVBoxLayout;
  configLayout->addLayout(filePathLayout);
  configLayout->addLayout(abaqusBatPathLayout);
  configLayout->addLayout(openModelScriptPathLayout);
  configLayout->addLayout(runForGenomeScriptPathLayout);
  configLayout->addLayout(netSizeLayout);
  configLayout->addLayout(meshSizeLayout);
  configGroup->setLayout(configLayout);
  configGroup->adjustSize();

  QPushButton *saveButton = new QPushButton(tr("Continue"));
  connect(saveButton, SIGNAL(clicked()), this, SLOT(saveConf()));

  QHBoxLayout *buttonsLayout = new QHBoxLayout;
  buttonsLayout->addStretch(1);
  buttonsLayout->addWidget(saveButton);

  QHBoxLayout *horizontalLayout = new QHBoxLayout;
  horizontalLayout->addWidget(configGroup);


  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->addLayout(horizontalLayout);
  mainLayout->setSpacing(1);
  mainLayout->addStretch(1);
  mainLayout->addLayout(buttonsLayout);
  mainLayout->setGeometry(QRect(10,10,500,300));
  setLayout(mainLayout);

  setWindowTitle(tr("Config Dialog"));
}
Example #10
0
/*!
 * Конструктор класса DaemonUi.
 */
DaemonUi::DaemonUi(QWidget *parent)
  : QDialog(parent, Qt::Tool)
  , m_core(0)
  , m_feeds(0)
  , m_plugins(0)
  , m_pool(0)
  , m_storage(0)
{
  Path::init(LS("schatd2"));

  m_settings = new Settings(Path::data() + LS("/schatd2.conf"), this);

  loadTranslation();

  m_toolBar = new QToolBar(this);
  m_toolBar->setIconSize(QSize(22, 22));
  m_toolBar->setStyleSheet(LS("QToolBar{margin:0px;border:0px;}"));

  m_menu = new QMenu();

  createActions();
  createButtons();

  m_controlGroup = new QGroupBox(this);
  QHBoxLayout *controlGroupLay = new QHBoxLayout(m_controlGroup);
  controlGroupLay->addWidget(m_toolBar);
  controlGroupLay->setMargin(2);
  controlGroupLay->setSpacing(0);

  // Отображение статуса
  m_statusLabel = new QLabel(this);
  m_ledLabel = new QLabel(this);
  m_statusGroup = new QGroupBox(this);
  QHBoxLayout *statusGroupLay = new QHBoxLayout(m_statusGroup);
  statusGroupLay->setMargin(2);
  statusGroupLay->setSpacing(0);
  statusGroupLay->addWidget(m_statusLabel);
  statusGroupLay->addStretch();
  statusGroupLay->addWidget(m_ledLabel);

  QHBoxLayout *controlLay = new QHBoxLayout;
  controlLay->addWidget(m_controlGroup);
  controlLay->addWidget(m_statusGroup);

  m_siteBtn = new QToolButton(this);
  m_siteBtn->setStyleSheet(LS("QToolButton{color:#0066cc;background:none;border:none} QToolButton:hover{text-decoration:underline}"));
  m_siteBtn->setText("schat.me");
  m_siteBtn->setFocusPolicy(Qt::NoFocus);
  m_siteBtn->setCursor(Qt::PointingHandCursor);
  m_siteBtn->setIcon(QIcon(":/images/globe-blue.png"));
  m_siteBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

  // Кнопки внизу окна
  QHBoxLayout *bottomLay = new QHBoxLayout;
  bottomLay->addWidget(m_siteBtn);
  bottomLay->addStretch();
  bottomLay->addWidget(m_hideButton);
  bottomLay->addWidget(m_quitButton);

  // Все основные виджеты
  QVBoxLayout *bodyLay = new QVBoxLayout;
  bodyLay->setMargin(6);
  bodyLay->setSpacing(6);
  bodyLay->addLayout(controlLay);
  bodyLay->addLayout(bottomLay);

  // Надпись вверху окна
  m_aboutLabel = new QLabel(QString(
      "<html><body style='color:#333;margin:6px;'>"
      "<h4 style='margin-bottom:0px;'>Simple Chat Daemon %1</h4>"
      "<p style='margin-left:16px;margin-top:5px;'>Copyright © 2008-%2 Alexander Sedov &lt;<a href='mailto:[email protected]' style='color:#0066cc;'>[email protected]</a>&gt;</p>"
      "</body></html>").arg(SCHAT_VERSION).arg(QDateTime::currentDateTime().toString("yyyy")), this);
  m_aboutLabel->setStyleSheet("background:#fff; border:4px solid #fff;");
  m_aboutLabel->setOpenExternalLinks(true);

  QFrame *line2 = new QFrame(this);
  line2->setFrameShape(QFrame::HLine);
  line2->setFrameShadow(QFrame::Sunken);

  // End
  QVBoxLayout *mainLay = new QVBoxLayout(this);
  mainLay->setMargin(0);
  mainLay->setSpacing(0);
  mainLay->addWidget(m_aboutLabel);
  mainLay->addWidget(line2);
  mainLay->addLayout(bodyLay);

  createTray();
  setState(Unknown);

  setWindowIcon(QIcon(":/images/schat16-green.png"));

  retranslateUi();

  QTimer::singleShot(0, this, SLOT(init()));

  connect(m_siteBtn, SIGNAL(clicked()), SLOT(openSite()));
}
Example #11
0
//-------------------------------------------------------------------------------
QFrame *DialogLoadGRIB::createFrameButtonsZone(QWidget *parent)
{
    int ind, lig,col;
    QFrame * ftmp;
    QFrame * frm = new QFrame(parent);
    assert(frm);
    QVBoxLayout  *lay = new QVBoxLayout(frm);
    assert(lay);
	lay->setContentsMargins (0,0,0,0);
	lay->setSpacing (3);
	//------------------------------------------------
	// Geographic area
	//------------------------------------------------
    int sizemin = 0;
    sbNorth = new QDoubleSpinBox(this);
    assert(sbNorth);
    sbNorth->setDecimals(0);
    sbNorth->setMinimum(-90);
    sbNorth->setMaximum(90);
    sbNorth->setSuffix(tr(" °N"));
    sbSouth = new QDoubleSpinBox(this);
    assert(sbSouth);
    sbSouth->setDecimals(0);
    sbSouth->setMinimum(-90);
    sbSouth->setMaximum(90);
    sbSouth->setSuffix(tr(" °N"));
    sbWest = new QDoubleSpinBox(this);
    assert(sbWest);
    sbWest->setDecimals(0);
    sbWest->setMinimum(-360);
    sbWest->setMaximum(360);
    sbWest->setSuffix(tr(" °E"));
    sbEast = new QDoubleSpinBox(this);
    assert(sbEast);
    sbEast->setDecimals(0);
    sbEast->setMinimum(-360);
    sbEast->setMaximum(360);
    sbEast->setSuffix(tr(" °E"));
	//------------------------------------------------
	// Résolution, intervalle, durée
	//------------------------------------------------
    cbResolution = new QComboBox(this);
    assert(cbResolution);
    cbResolution->addItems(QStringList()<< "0.5" << "1" << "2");
    cbResolution->setMinimumWidth (sizemin);
	ind = Util::getSetting("downloadIndResolution", 0).toInt();
	ind = Util::inRange(ind, 0, cbResolution->count()-1);
    cbResolution->setCurrentIndex(ind);
    
    cbInterval = new QComboBox(this);
    assert(cbInterval);
    cbInterval->addItems(QStringList()<< "3" << "6" << "12" << "24");
    cbInterval->setMinimumWidth (sizemin);
	ind = Util::getSetting("downloadIndInterval", 0).toInt();
	ind = Util::inRange(ind, 0, cbInterval->count()-1);
    cbInterval->setCurrentIndex(ind);
    
    cbDays = new QComboBox(this);
    assert(cbDays);
    cbDays->addItems(QStringList()<< "1"<<"2"<<"3"<<"4"<<"5"<<"6"<<"7"<<"8");
    cbDays->setMinimumWidth (sizemin);
	ind = Util::getSetting("downloadIndNbDays", 7).toInt();	
	ind = Util::inRange(ind, 0, cbDays->count()-1);
    cbDays->setCurrentIndex(ind);

	//------------------------------------------------
	// Choix des données météo
	//------------------------------------------------
    chkWind     = new QCheckBox(tr("Wind (10 m)"));
    assert(chkWind);
    chkPressure = new QCheckBox(tr("Mean sea level pressure"));
    assert(chkPressure);
    chkRain     = new QCheckBox(tr("Total precipitation"));
    assert(chkRain);
    chkCloud     = new QCheckBox(tr("Cloud cover")+" ("+tr("total")+")");
    assert(chkCloud);
    chkCloudLayers     = new QCheckBox(tr("Cloud cover")+" ("+tr("layers")+")");
    assert(chkCloudLayers);
    chkTemp     = new QCheckBox(tr("Temperature (2 m)"));
    assert(chkTemp);
    chkHumid    = new QCheckBox(tr("Relative humidity (2 m)"));
    assert(chkHumid);
    chkIsotherm0    = new QCheckBox(tr("Isotherm 0°C"));
    assert(chkIsotherm0);
    
    chkTempMin     = new QCheckBox(tr("Temperature min (2 m)"));
    assert(chkTempMin);
    chkTempMax     = new QCheckBox(tr("Temperature max (2 m)"));
    assert(chkTempMax);
    chkSnowCateg     = new QCheckBox(tr("Snow (snowfall possible)"));
    assert(chkSnowCateg);
    chkFrzRainCateg     = new QCheckBox(tr("Frozen rain (rainfall possible)"));
    assert(chkFrzRainCateg);
    chkSnowDepth     = new QCheckBox(tr("Snow (depth)"));
    assert(chkSnowDepth);
    chkCAPEsfc     = new QCheckBox(tr("CAPE (surface)"));
    assert(chkCAPEsfc);
    chkGUSTsfc     = new QCheckBox(tr("Wind gust (surface)"));
    assert(chkGUSTsfc);
    chkSUNSDsfc     = new QCheckBox(tr("Sunshine duration"));
    assert(chkSUNSDsfc);
	
    //--------------------------------------------------------------------------------
    chkWind->setChecked    (Util::getSetting("downloadWind", true).toBool());
    chkPressure->setChecked(Util::getSetting("downloadPressure", true).toBool());
    chkRain->setChecked    (Util::getSetting("downloadRain", true).toBool());
    chkCloud->setChecked   (Util::getSetting("downloadCloud", true).toBool());
    chkCloudLayers->setChecked   (Util::getSetting("downloadCloudLayers", true).toBool());
    chkTemp->setChecked    (Util::getSetting("downloadTemp", true).toBool());
    chkHumid->setChecked   (Util::getSetting("downloadHumid", true).toBool());
    chkIsotherm0->setChecked  (Util::getSetting("downloadIsotherm0", true).toBool());
    	
    chkTempMin->setChecked    (Util::getSetting("downloadTempMin", false).toBool());
    chkTempMax->setChecked    (Util::getSetting("downloadTempMax", false).toBool());
    chkSnowDepth->setChecked  (Util::getSetting("downloadSnowDepth", true).toBool());
    chkSnowCateg->setChecked  (Util::getSetting("downloadSnowCateg", true).toBool());
    chkFrzRainCateg->setChecked  (Util::getSetting("downloadFrzRainCateg", true).toBool());
    chkCAPEsfc->setChecked  (Util::getSetting("downloadCAPEsfc", true).toBool());
    chkGUSTsfc->setChecked  (Util::getSetting("downloadGUSTsfc", true).toBool());
    chkSUNSDsfc->setChecked (Util::getSetting("downloadSUNSDsfc", false).toBool());
	//----------------------------------------------------------------
    chkAltitude925  = new QCheckBox ("925 "+tr("hPa"));
    assert (chkAltitude925);
    chkAltitude925->setChecked  (Util::getSetting("downloadAltitudeData925", false).toBool());
    chkAltitude850  = new QCheckBox ("850 "+tr("hPa"));
    assert (chkAltitude850);
    chkAltitude850->setChecked  (Util::getSetting("downloadAltitudeData850", false).toBool());
    chkAltitude700  = new QCheckBox ("700 "+tr("hPa"));
    assert (chkAltitude700);
    chkAltitude700->setChecked  (Util::getSetting("downloadAltitudeData700", false).toBool());
    chkAltitude500  = new QCheckBox ("500 "+tr("hPa"));
    assert (chkAltitude500);
    chkAltitude500->setChecked  (Util::getSetting("downloadAltitudeData500", false).toBool());
    chkAltitude300  = new QCheckBox ("300 "+tr("hPa"));
    assert (chkAltitude300);
    chkAltitude300->setChecked  (Util::getSetting("downloadAltitudeData300", false).toBool());
    chkAltitude200  = new QCheckBox ("200 "+tr("hPa"));
    assert (chkAltitude200);
    chkAltitude200->setChecked  (Util::getSetting("downloadAltitudeData200", false).toBool());

    chkAltitude_All = new QCheckBox (tr("All"));
    assert (chkAltitude_All);
	chkAltitude_All->setChecked  (
		      chkAltitude200->isChecked() && chkAltitude300->isChecked() 
		   && chkAltitude500->isChecked() && chkAltitude700->isChecked() 
		   && chkAltitude850->isChecked() && chkAltitude925->isChecked()
		);
	//----------------------------------------------------------------
	// Waves
	//----------------------------------------------------------------
    chkFnmocWW3_sig  = new QCheckBox (tr("Significant height"));
    assert (chkFnmocWW3_sig);
    chkFnmocWW3_max  = new QCheckBox (tr("Maximum waves"));
    assert (chkFnmocWW3_max);
    chkFnmocWW3_swl  = new QCheckBox (tr("Swell"));
    assert (chkFnmocWW3_swl);
    chkFnmocWW3_wnd  = new QCheckBox (tr("Wind waves"));
    assert (chkFnmocWW3_wnd);
    chkFnmocWW3_prim  = new QCheckBox (tr("Primary waves"));
    assert (chkFnmocWW3_prim);
    chkFnmocWW3_scdy  = new QCheckBox (tr("Secondary waves"));
    assert (chkFnmocWW3_scdy);
    chkFnmocWW3_wcap  = new QCheckBox (tr("Whitecap probability"));
    assert (chkFnmocWW3_wcap);
	
    chkFnmocWW3_sig->setChecked  (Util::getSetting("downloadFnmocWW3_sig", false).toBool());
    chkFnmocWW3_max->setChecked  (Util::getSetting("downloadFnmocWW3_max", false).toBool());
    chkFnmocWW3_swl->setChecked  (Util::getSetting("downloadFnmocWW3_swl", false).toBool());
    chkFnmocWW3_wnd->setChecked  (Util::getSetting("downloadFnmocWW3_wnd", false).toBool());
    chkFnmocWW3_prim->setChecked (Util::getSetting("downloadFnmocWW3_prim", false).toBool());
    chkFnmocWW3_scdy->setChecked (Util::getSetting("downloadFnmocWW3_scdy", false).toBool());
    chkFnmocWW3_wcap->setChecked (Util::getSetting("downloadFnmocWW3_wcap", false).toBool());
	
    chkFnmocWW3_All = new QCheckBox (tr("All"));
    assert (chkFnmocWW3_All);
	chkFnmocWW3_All->setChecked  (
		      chkFnmocWW3_sig->isChecked() && chkFnmocWW3_max->isChecked() 
		   && chkFnmocWW3_swl->isChecked() && chkFnmocWW3_wnd->isChecked() 
		   && chkFnmocWW3_prim->isChecked() && chkFnmocWW3_scdy->isChecked() 
		   && chkFnmocWW3_wcap->isChecked()
		);
	
	waveDataModel = (DataCenterModel)(Util::getSetting("downloadFnmocWW3_DataModel", FNMOC_WW3_MED).toInt());
	bt_FNMOC_WW3_GLB = new QRadioButton 
		(tr("FNMOC-WW3-GLOBAL: all oceans (7 days, 1°x1°)"));
	bt_FNMOC_WW3_MED  = new QRadioButton 
		(tr("FNMOC-WW3-MEDIT: Mediterranean Sea, Atlantic NE (3 days, 0.2°x0.2°)"));
	
	if (waveDataModel == FNMOC_WW3_MED)
		bt_FNMOC_WW3_MED->setChecked (true);
	else
		bt_FNMOC_WW3_GLB->setChecked (true);
	
	//----------------------------------------------------------------
    btOK     = new QPushButton(tr("Download"), this);
    assert(btOK);
    btCancel = new QPushButton(tr("Cancel"), this);
    assert(btCancel);
    btServerStatus = new QPushButton(tr("Server status"), this);
    assert(btServerStatus);
    btProxy = new QPushButton(tr("Connection"), this);
    assert(btProxy);

    progressBar = new QProgressBar();
    assert(progressBar);

    QLayout  *tlay, *vlay;
    QGridLayout  *tgrid;
	//------------------------------------------------
	// Disposition des widgets
	//------------------------------------------------
	ftmp = new QFrame(this);
    tgrid = new QGridLayout(ftmp);
    assert(tgrid);
	tgrid->setContentsMargins (0,0,0,0);
		tgrid->addWidget( new QLabel(tr("Latitude min :")), 0, 0, Qt::AlignRight);
		tgrid->addWidget( sbNorth, 0, 1);
		tgrid->addWidget( new QLabel(tr("Latitude max :")), 0, 2, Qt::AlignRight);
		tgrid->addWidget( sbSouth, 0, 3);
		tgrid->addWidget( new QLabel(tr("Longitude min :")), 1, 0, Qt::AlignRight);
		tgrid->addWidget( sbWest, 1, 1);
		tgrid->addWidget( new QLabel(tr("Longitude max :")), 1, 2, Qt::AlignRight);
		tgrid->addWidget( sbEast, 1, 3);
    lay->addWidget( ftmp);
    //-------------------------
    addSeparator (lay, 'H'); 
    //-------------------------
	ftmp = new QFrame(this);
    tlay = new QHBoxLayout(ftmp);
    assert(tlay);
	tlay->setContentsMargins (0,0,0,0);
		tlay->addWidget( new QLabel(tr("Resolution :")));
		tlay->addWidget( cbResolution);
		tlay->addWidget( new QLabel(tr(" °")));
		//-------------------------
		addSeparator (tlay, 'V'); 
		//-------------------------
		tlay->addWidget( new QLabel(tr("Interval :")));
		tlay->addWidget( cbInterval);
		tlay->addWidget( new QLabel(tr(" hours")));
		//-------------------------
		addSeparator (tlay, 'V'); 
		//-------------------------
		tlay->addWidget( new QLabel(tr("Period :")));
		tlay->addWidget( cbDays);
		tlay->addWidget( new QLabel(tr(" days")));
    lay->addWidget( ftmp);
    //-------------------------
    addSeparator (lay, 'H'); 
    //-------------------------
	QTabWidget *tabWidget = new QTabWidget (this);
    lay->addWidget (tabWidget);
	//-------------------------------------------
	// Standard TAB
	//-------------------------------------------
	QWidget  *tabbox;
	ftmp = new QFrame (this);
    tgrid = new QGridLayout (ftmp);
    assert (tgrid);
	tgrid->setContentsMargins (4,2,4,2);
	tgrid->setSpacing (2);
    	// Colonne 1
    	col = 0;
    	lig = 0;
		tgrid->addWidget( chkWind ,      lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkPressure ,  lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkTemp ,      lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkTempMin ,   lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkTempMax ,   lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkIsotherm0 , lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkCAPEsfc ,  lig++, col, Qt::AlignLeft);
    	// Colonne 2
    	col = 1;
    	lig = 0;
		tgrid->addWidget( chkGUSTsfc , lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkCloud ,   lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkHumid ,   lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkRain ,    lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkSnowCateg ,  lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkSnowDepth ,  lig++, col, Qt::AlignLeft);
		tgrid->addWidget( chkFrzRainCateg , lig++, col, Qt::AlignLeft);
    tabWidget->addTab (ftmp, tr("NOAA-GFS")+" "+tr("standard"));
	//-------------------------------------------
	// Altitude TAB
	//-------------------------------------------
	tabbox = new QWidget (ftmp);
	assert (tabbox);
	vlay = new QVBoxLayout (tabbox);
	assert (vlay);
	vlay->addWidget (new QLabel (
			tr("Atmosphere: geopotential altitude, wind, temperature, theta-e, relative humidity.") 
			+"\n"+
			tr("Warning : these data increase strongly the size of the GRIB file.")
		));
		ftmp = new QFrame(this);
		assert (ftmp);
		tlay = new QHBoxLayout (ftmp);
		assert (tlay);
		tlay->setContentsMargins (0,0,0,0);
		QFrame *fgrid = new QFrame(this);
		assert (fgrid);
		QGridLayout *gtmp = new QGridLayout (fgrid);
		assert (gtmp);
		gtmp->setContentsMargins (0,0,0,0);
			gtmp->addWidget (chkAltitude925, 0,0);
			gtmp->addWidget (chkAltitude850, 0,1);
			gtmp->addWidget (chkAltitude700, 0,2);
			gtmp->addWidget (chkAltitude500, 1,0);
			gtmp->addWidget (chkAltitude300, 1,1);
			gtmp->addWidget (chkAltitude200, 1,2);
		tlay->addWidget (fgrid);
		addSeparator (tlay, 'V'); 
		tlay->addWidget (chkAltitude_All);
	vlay->addWidget (ftmp);
    tabWidget->addTab (tabbox, tr("NOAA-GFS")+" "+tr("altitude"));
	//-------------------------------------------
	// Waves TAB
	//-------------------------------------------
	tabbox = new QWidget (ftmp);
	assert (tabbox);
    tgrid = new QGridLayout (tabbox);
    assert (tgrid);
	tgrid->setContentsMargins (4,2,4,2);
	tgrid->setSpacing (2);
    	// Colonne 1
    	col = 0;
    	lig = 0;
		tgrid->addWidget (chkFnmocWW3_sig, lig++, col, Qt::AlignLeft);
		tgrid->addWidget (chkFnmocWW3_max, lig++, col, Qt::AlignLeft);
		tgrid->addWidget (chkFnmocWW3_swl, lig++, col, Qt::AlignLeft);
		tgrid->addWidget (chkFnmocWW3_wnd, lig++, col, Qt::AlignLeft);
		
		tgrid->addWidget (newSeparator ('H'), lig++, 0, 1, 2);
		tgrid->addWidget (chkFnmocWW3_All, lig++, 0, 1, 2, Qt::AlignCenter);
		tgrid->addWidget (newSeparator ('H'), lig++, 0, 1, 2);
		
		tgrid->addWidget (bt_FNMOC_WW3_GLB, lig++, 0, 1, 2);
		tgrid->addWidget (bt_FNMOC_WW3_MED, lig++, 0, 1, 2);
    	// Colonne 2
    	col = 1;
    	lig = 0;
		tgrid->addWidget (chkFnmocWW3_prim, lig++, col, Qt::AlignLeft);
		tgrid->addWidget (chkFnmocWW3_scdy, lig++, col, Qt::AlignLeft);
		tgrid->addWidget (chkFnmocWW3_wcap, lig++, col, Qt::AlignLeft);
    tabWidget->addTab (tabbox, tr("FNMOC-WW3")+" "+tr("waves"));
	
    //-------------------------
    addSeparator (lay, 'H'); 
    //-------------------------
    lay->addWidget( progressBar );
    //-------------------------
    labelMsg = new QLabel();
    lay->addWidget( labelMsg );
    //lay->addWidget(new QLabel(tr("File size max: 20000 ko.")));
    lay->addWidget(new QLabel(tr("File size max: ")+ "51200 Ko (50 Mo)"));
    //-------------------------
    addSeparator (lay, 'H'); 
    //-------------------------
	ftmp = new QFrame(this);
    tlay = new QHBoxLayout(ftmp);
    assert(tlay);
	tlay->setContentsMargins (0,0,0,0);
		tlay->addWidget (btOK);
		tlay->addWidget (btServerStatus);
		tlay->addWidget (btProxy);
		tlay->addWidget (btCancel);
    lay->addWidget( ftmp);

    return frm;
}
Example #12
0
LauncherWindow::LauncherWindow(MainObject *mainOb, QWidget *parent)
    : QMainWindow(parent)
{

    mainObject = mainOb;
    setProperty("settings_namespace", QVariant("launcher_window"));
    mainObject->settings->restoreWindow(this);

    setWindowTitle("fgX Launcher");
    setWindowIcon(QIcon(":/icons/launcher"));
    //setWindowFlags(  Qt::WindowStaysOnTopHint);


    //* MainWidget and MainLayout
    QWidget *mainWidget = new QWidget(this);
    setCentralWidget(mainWidget);


    QVBoxLayout *mainVBox = new QVBoxLayout();
    mainVBox->setContentsMargins(0,0,0,0);
    mainVBox->setSpacing(0);
    mainWidget->setLayout(mainVBox);

    //** Header Banner across the top =========================
    QString header_style("padding: 10px; font-size: 11pt; font-weight: bold; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 white, stop: 1 #F0DD17);");
    headerLabel = new QLabel(this);
    headerLabel->setText("fgX Launcher");
    headerLabel->setStyleSheet(header_style);
    mainVBox->addWidget(headerLabel, 0);

    splitter = new QSplitter();
    mainVBox->addWidget(splitter, 20);

    //** Main Tab =========================
    tabWidget = new QTabWidget(this);
    splitter->addWidget(tabWidget);
    connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tab_changed(int)));

    //==================================================
    // Widgets

    //* Aircraft Widget
    aircraftWidget = new AircraftWidget(mainObject);
    tabWidget->addTab(aircraftWidget, tr("Aircraft"));
    connect(aircraftWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));


    //* Options
    mainOptionsWidget = new MainOptionsWidget(mainObject);
    tabWidget->addTab(mainOptionsWidget, tr("Main Options"));
    connect(mainOptionsWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));

    //* MpServers
    mpServersWidget = new MpServersWidget(mainObject);
    tabWidget->addTab(mpServersWidget, tr("Network"));
    connect(mpServersWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));









    //* Airports Widget
    airportsWidget = new AirportsWidget(mainObject);
    tabWidget->addTab(airportsWidget, tr("Airports"));
    connect(airportsWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));

    //=============================================================
    // ## Tree
    tree = new QTreeWidget();
    tree->setRootIsDecorated(false);
    tree->setMinimumWidth(400);
    tree->headerItem()->setText(0, "Option");
    tree->headerItem()->setText(1, "Value");
    tree->header()->setStretchLastSection(true);
    tree->setColumnWidth(C_ARG, 200);
    splitter->addWidget(tree);
    setup_tree();

    splitter->setStretchFactor(0,3);
    splitter->setStretchFactor(1,1);


    //*********************************************************
    //** Control Bar
    //*********************************************************
    controlBarWidget = new ControlBarWidget(mainObject);
    mainVBox->addWidget(controlBarWidget, 1);
    //controlBarWidget->hide();

    set_paths();

}
Example #13
0
TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0), abandonAction(0)
{
    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);

    if (platformStyle->getUseExtraSpacing()) {
        hlayout->setSpacing(5);
        hlayout->addSpacing(26);
    } else {
        hlayout->setSpacing(0);
        hlayout->addSpacing(23);
    }

    watchOnlyWidget = new QComboBox(this);
    watchOnlyWidget->setFixedWidth(24);
    watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
    watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
    watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
    hlayout->addWidget(watchOnlyWidget);

    dateWidget = new QComboBox(this);
    if (platformStyle->getUseExtraSpacing()) {
        dateWidget->setFixedWidth(121);
    } else {
        dateWidget->setFixedWidth(120);
    }
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
    if (platformStyle->getUseExtraSpacing()) {
        typeWidget->setFixedWidth(121);
    } else {
        typeWidget->setFixedWidth(120);
    }

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
    if (platformStyle->getUseExtraSpacing()) {
        amountWidget->setFixedWidth(97);
    } else {
        amountWidget->setFixedWidth(100);
    }
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
    if (platformStyle->getUseExtraSpacing()) {
        hlayout->addSpacing(width+2);
    } else {
        hlayout->addSpacing(width);
    }
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    view->installEventFilter(this);

    transactionView = view;

    // Actions
    abandonAction = new QAction(tr("Abandon transaction"), this);
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
    QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this);
    QAction *copyTxPlainText = new QAction(tr("Copy full transaction details"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(copyTxIDAction);
    contextMenu->addAction(copyTxHexAction);
    contextMenu->addAction(copyTxPlainText);
    contextMenu->addAction(showDetailsAction);
    contextMenu->addSeparator();
    contextMenu->addAction(abandonAction);
    contextMenu->addAction(editLabelAction);

    mapperThirdPartyTxUrls = new QSignalMapper(this);

    // Connect actions
    connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString)));

    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx()));
    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
    connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex()));
    connect(copyTxPlainText, SIGNAL(triggered()), this, SLOT(copyTxPlainText()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
void ShutDownFrame::initUI() {
    m_btnsList = new QList<RoundItemButton *>;
    m_shutdownButton = new RoundItemButton(tr("Shut down"));
    m_shutdownButton->setAutoExclusive(true);
    m_shutdownButton->setObjectName("ShutDownButton");
    m_restartButton = new RoundItemButton(tr("Restart"));
    m_restartButton->setAutoExclusive(true);
    m_restartButton->setObjectName("RestartButton");
    m_suspendButton = new RoundItemButton(tr("Suspend"));
    m_suspendButton->setAutoExclusive(true);
    m_suspendButton->setObjectName("SuspendButton");
    m_lockButton = new RoundItemButton(tr("Lock"));
    m_lockButton->setAutoExclusive(true);
    m_lockButton->setObjectName("LockButton");
    m_logoutButton = new RoundItemButton(tr("Log out"));
    m_logoutButton->setAutoExclusive(true);
    m_logoutButton->setObjectName("LogoutButton");

    m_switchUserBtn = new RoundItemButton(tr("Switch user"));
    m_switchUserBtn->setAutoExclusive(true);
    m_switchUserBtn->setObjectName("SwitchUserButton");

    QLabel *tipsIcon = new QLabel;
    tipsIcon->setPixmap(QPixmap(":/img/waring.png"));
    m_tipsLabel = new QLabel;
    m_tipsLabel->setAlignment(Qt::AlignCenter);
    m_tipsLabel->setStyleSheet("color:white;"
                               "font-size:14px;");
    QHBoxLayout *tipsLayout = new QHBoxLayout;
    tipsLayout->addStretch();
    tipsLayout->addWidget(tipsIcon);
    tipsLayout->addWidget(m_tipsLabel);
    tipsLayout->addStretch();

    m_tipsWidget = new QWidget;
    m_tipsWidget->hide();
    m_tipsWidget->setLayout(tipsLayout);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->setMargin(0);
    buttonLayout->setSpacing(10);
    buttonLayout->addStretch();
    buttonLayout->addWidget(m_shutdownButton);
    buttonLayout->addWidget(m_restartButton);
    buttonLayout->addWidget(m_suspendButton);
    buttonLayout->addWidget(m_lockButton);
    buttonLayout->addWidget(m_switchUserBtn);
    buttonLayout->addWidget(m_logoutButton);
    buttonLayout->addStretch(0);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addStretch();
    mainLayout->addLayout(buttonLayout);
    mainLayout->addWidget(m_tipsWidget);
    mainLayout->addStretch();
    setFocusPolicy(Qt::StrongFocus);
    setLayout(mainLayout);

    updateStyle(":/skin/shutdown.qss", this);


    m_btnsList->append(m_shutdownButton);
    m_btnsList->append(m_restartButton);
    m_btnsList->append(m_suspendButton);
    m_btnsList->append(m_lockButton);
    m_btnsList->append(m_switchUserBtn);
    m_btnsList->append(m_logoutButton);

    m_currentSelectedBtn = m_shutdownButton;
    m_currentSelectedBtn->updateState(RoundItemButton::Default);

    //// Inhibit to shutdown
    inhibitShutdown();

    QTimer* checkTooltip = new QTimer(this);
    checkTooltip->setInterval(5*60*1000);
    checkTooltip->start();
    connect(checkTooltip,  &QTimer::timeout, this, &ShutDownFrame::inhibitShutdown);
}
Example #15
0
    MainPage::MainPage(QWidget* parent)
        : QWidget(parent)
        , search_widget_(new SearchWidget(false, this))
        , contact_dialog_(new ContactDialog(this))
#ifndef STRIP_VOIP
        , video_window_(nullptr)
#else
        , video_window_(nullptr)
#endif //STRIP_VOIP
        , pages_(new WidgetsNavigator(this))
        , search_contacts_(nullptr)
        , profile_settings_(new ProfileSettingsWidget(this))
        , general_settings_(new GeneralSettingsWidget(this))
        , live_chats_page_(new LiveChatHome(this))
        , themes_settings_(new ThemesSettingsWidget(this))
        , noContactsYetSuggestions_(nullptr)
        , contact_list_widget_(new ContactList(this, Logic::MembersWidgetRegim::CONTACT_LIST, nullptr))
        , add_contact_menu_(nullptr)
        , settings_timer_(new QTimer(this))
        , introduceYourselfSuggestions_(nullptr)
        , needShowIntroduceYourself_(false)
        , liveChats_(new LiveChats(this))
        , login_new_user_(false)
        , recv_my_info_(false)
    {
        connect(&Utils::InterConnector::instance(), &Utils::InterConnector::showPlaceholder, this, &MainPage::showPlaceholder);

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("main_page"));
        setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true));
        this->resize(400, 300);
        this->setProperty("Invisible", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        QMetaObject::connectSlotsByName(this);

        QHBoxLayout* originalLayout = qobject_cast<QHBoxLayout*>(layout());
        QVBoxLayout* contactsLayout = new QVBoxLayout();
        contactsLayout->setContentsMargins(0, 0, 0, 0);
        contactsLayout->setSpacing(0);

        contactsLayout->addWidget(search_widget_);
        contactsLayout->addWidget(contact_list_widget_);
        QSpacerItem* contactsLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        contactsLayout->addSpacerItem(contactsLayoutSpacer);

        pages_layout_ = new QVBoxLayout();
        pages_layout_->setContentsMargins(0, 0, 0, 0);
        pages_layout_->setSpacing(0);
        pages_layout_->addWidget(pages_);
        {
            auto pc = pages_->count();
            pages_->addWidget(contact_dialog_);
            pages_->addWidget(profile_settings_);
            pages_->addWidget(general_settings_);
            pages_->addWidget(live_chats_page_);
            pages_->addWidget(themes_settings_);
            if (!pc)
                pages_->push(contact_dialog_);
        }
        originalLayout->addLayout(contactsLayout);
        originalLayout->addLayout(pages_layout_);
        QSpacerItem* originalLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        originalLayout->addSpacerItem(originalLayoutSpacer);
        originalLayout->setAlignment(Qt::AlignLeft);
        setFocus();

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), contact_dialog_, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_dialog_, SIGNAL(sendMessage(QString)), contact_list_widget_, SLOT(onSendMessage(QString)), Qt::QueuedConnection);

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), this, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(addContactClicked()), this, SLOT(onAddContactClicked()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsShow(QString)), this, SLOT(onProfileSettingsShow(QString)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsShow(bool,QString)), this, SLOT(onThemesSettingsShow(bool,QString)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsShow(int)), this, SLOT(onGeneralSettingsShow(int)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(liveChatsShow()), this, SLOT(onLiveChatsShow()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(attachPhoneBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(attachUinBack()), pages_, SLOT(pop()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(makeSearchWidgetVisible(bool)), search_widget_, SLOT(setVisible(bool)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(popPagesToRoot()), this, SLOT(popPagesToRoot()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsDoMessage(QString)), contact_list_widget_, SLOT(select(QString)), Qt::QueuedConnection);

        connect(search_widget_, SIGNAL(searchBegin()), this, SLOT(searchBegin()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(searchEnd()), this, SLOT(searchEnd()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(search(QString)), Logic::GetSearchModel(), SLOT(searchPatternChanged(QString)), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(enterPressed()), contact_list_widget_, SLOT(searchResult()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(upPressed()), contact_list_widget_, SLOT(searchUpPressed()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(downPressed()), contact_list_widget_, SLOT(searchDownPressed()), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(searchEnd()), search_widget_, SLOT(searchCompleted()), Qt::QueuedConnection);

        connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), Logic::GetMessagesModel(), SLOT(contactChanged(QString)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipShowVideoWindow(bool)), this, SLOT(onVoipShowVideoWindow(bool)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncoming(const std::string&, const std::string&)), this, SLOT(onVoipCallIncoming(const std::string&, const std::string&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), this, SLOT(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallCreated(const voip_manager::ContactEx&)), this, SLOT(onVoipCallCreated(const voip_manager::ContactEx&)), Qt::DirectConnection);

        search_widget_->setVisible(!contact_list_widget_->shouldHideSearch());

        post_stats_with_settings();
        QObject::connect(settings_timer_, SIGNAL(timeout()), this, SLOT(post_stats_with_settings()));

        settings_timer_->start(Ui::period_for_stats_settings_ms);
        connect(Ui::GetDispatcher(), &core_dispatcher::myInfo, this, &MainPage::myInfo, Qt::UniqueConnection);
        connect(Ui::GetDispatcher(), &core_dispatcher::login_new_user, this, &MainPage::loginNewUser, Qt::DirectConnection);
        
        add_contact_menu_ = new FlatMenu(search_widget_->searchEditIcon());
        Utils::ApplyStyle(add_contact_menu_,
                          "QMenu { background-color: #f2f2f2; border:1px solid #cccccc; } "
                          "QMenu::item { padding-left:40dip; background-color:transparent; color:black; padding-top:6dip; padding-bottom:6dip; padding-right:12dip; } "
                          "QMenu::item:selected { background-color:#e2e2e2; } "
                          "QMenu::icon { padding-left:22dip; }"
                          );
        add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newchat_100.png")), QT_TRANSLATE_NOOP("contact_list", "New chat"), contact_list_widget_, SLOT(allClicked()));
        add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newgroup_100.png")), QT_TRANSLATE_NOOP("contact_list", "Create Groupchat"), this, SLOT(createGroupChat()));
        add_contact_menu_->setExpandDirection(Qt::AlignLeft);
        add_contact_menu_->stickToIcon();
        Utils::ApplyStyle(search_widget_->searchEditIcon(), "QPushButton::menu-indicator { image:none; } QPushButton:pressed { background-color:transparent; }");
        search_widget_->searchEditIcon()->setMenu(add_contact_menu_);
    }
Example #16
0
UserLogindlg::UserLogindlg()
	: QDialog()
{
	setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
	setAttribute(Qt::WA_TranslucentBackground);

	//初始化为未按下鼠标左键
	mouse_press = false;

	loginwidget = new QWidget(this);
	loginwidget->resize(586,379);
	loginwidget->setAutoFillBackground(true);
	QPalette lgnpalette;
	lgnpalette.setBrush(QPalette::Background,QBrush(QPixmap(":loginmainbk")));
	loginwidget->setPalette(lgnpalette);

	QHBoxLayout *plgnhlyt = new QHBoxLayout;
	QVBoxLayout *plgnvlyt = new QVBoxLayout;
	QVBoxLayout *ploginvlyt = new QVBoxLayout;

	QVBoxLayout *pvlyt = new QVBoxLayout;

	//创建标题widget
	plgntitel_widget = new QWidget(this);
	plgntitel_widget->setFixedWidth(544);
	plgntitel_widget->setFixedHeight(137);
	//button_widget->setFixedHeight(30);
	//设置widget圆角和背景图片border:1px groove gray;border-radius:5px;padding:2px 4px;
	plgntitel_widget->setStyleSheet("background-image:url(images/stategridicon);");


	plgntitel_widget->setAutoFillBackground(true);

	close_button = new PushButton(plgntitel_widget);
	//设置按钮背景图片
	close_button->setPicName(QString(":close"));

	//按钮摆放当前widget的右上角位置,默认在左上角把移动到左上角
	int width = plgntitel_widget->width();
	close_button->move(width-close_button->width(), 0);


	//登录框用户名
	//pusercobx = new QComboBox;
	//pusercobx->setEditable(true);
	//pusercobx->lineEdit()->setPlaceholderText("用户名");
	//pusercobx->setFixedSize(180,32);

	//登录框用户名
	puserlined = new QLineEdit;
	puserlined->setPlaceholderText("用户名");
	puserlined->setFixedSize(180,32);

	//登录框密码
	ppwdlined = new QLineEdit;
	ppwdlined->setPlaceholderText("密  码");
	ppwdlined->setEchoMode(QLineEdit::Password);
	ppwdlined->setFixedSize(180,32);
	//登录按钮
	ploginbtn = new QPushButton();
	//ploginbtn->setIcon(QPixmap(QString(":login")));
	ploginbtn->setStyleSheet("border-radius:5px;background-image:url(:login);");
	ploginbtn->setFixedSize(180,32);

	//布局登录用户名和密码框
	plgnvlyt->addWidget(puserlined);
	plgnvlyt->addWidget(ppwdlined);
	plgnvlyt->setSpacing(0);

	//布局登录框和按钮
	ploginvlyt->addLayout(plgnvlyt);
	ploginvlyt->addSpacing(32);
	ploginvlyt->addWidget(ploginbtn);

	//布局登录输入框及按钮
	plgnhlyt->addSpacing(265);
	plgnhlyt->addLayout(ploginvlyt);

	//总体布局
	pvlyt->addWidget(plgntitel_widget);
	pvlyt->addSpacing(45);
	pvlyt->addLayout(plgnhlyt);

	pvlyt->setContentsMargins(21,21,21,50);

	loginwidget->setLayout(pvlyt);
	//设置按钮焦点
	ploginbtn->setFocus(Qt::ActiveWindowFocusReason);
	//点击关闭按钮关闭登录界面
	connect(close_button, SIGNAL(clicked()), this, SLOT(closedlg()));
	//登录响应
	connect(ploginbtn,SIGNAL(clicked()),this,SLOT(login()));
	
	bcloselgn = false;
	bnetflag  = false;
	
}
Example #17
0
Comments::Comments(QWidget *pParent, const char *name) :
  QWidget(pParent, name)
{
  _source = Uninitialized;
  _sourceid = -1;

  _verboseCommentList = false;
  if(_x_metrics)
    _verboseCommentList = _x_metrics->boolean("VerboseCommentList");

  QHBoxLayout *main = new QHBoxLayout(this);
  main->setMargin(0);
  main->setSpacing(7);

  QWidget *buttons = new QWidget(this);
  QVBoxLayout * buttonsLayout = new QVBoxLayout(buttons);
  buttonsLayout->setMargin(0);
  buttonsLayout->setSpacing(0);

  _comment = new XTreeWidget(this);
  _comment->setObjectName("_comment");
  _comment->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _comment->addColumn(tr("Date/Time"), _timeDateColumn, Qt::AlignCenter,true, "comment_date");
  _comment->addColumn(tr("Type"),    _itemColumn, Qt::AlignCenter,true, "type");
  _comment->addColumn(tr("User"),    _userColumn, Qt::AlignCenter,true, "comment_user");
  _comment->addColumn(tr("Comment"), -1,          Qt::AlignLeft,  true, "first");
  main->addWidget(_comment);

  _browser = new QTextBrowser(this);
  _browser->setObjectName("_browser");
  _browser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _browser->setOpenLinks(false);
  main->addWidget(_browser);

  _newComment = new QPushButton(tr("New"), buttons, "_newComment");
  buttonsLayout->addWidget(_newComment);

  _viewComment = new QPushButton(tr("View"), buttons, "_viewComment");
  _viewComment->setEnabled(FALSE);
  buttonsLayout->addWidget(_viewComment);

  _editComment = new QPushButton(tr("Edit"), buttons, "_editComment");
  _editComment->setEnabled(false);
  buttonsLayout->addWidget(_editComment);

  QSpacerItem *_buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
  buttonsLayout->addItem(_buttonSpacer);
  buttons->setLayout(buttonsLayout);
  main->addWidget(buttons);

  setLayout(main);

  connect(_newComment, SIGNAL(clicked()), this, SLOT( sNew()));
  connect(_viewComment, SIGNAL(clicked()), this, SLOT( sView()));
  connect(_editComment, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_comment, SIGNAL(valid(bool)), this, SLOT(sCheckButtonPriv(bool)));
  connect(_comment, SIGNAL(itemSelected(int)), _viewComment, SLOT(animateClick()));
  connect(_browser, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));

  setFocusProxy(_comment);

  setVerboseCommentList(_verboseCommentList);
}
Example #18
0
SessionViewer::SessionViewer(QWidget *parent) : QMainWindow(parent)
{
	setWindowTitle(tr("Session Viewer"));

	tabs = new QTabWidget();

	QWidget *chooserw = new QWidget();
	QVBoxLayout *layout = new QVBoxLayout();
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	chooserw->setLayout(layout);

	tabs->addTab(chooserw, tr("Session Chooser"));

	setCentralWidget(tabs);

	QLabel *l = new QLabel(tr("Choose the session to open"));
	l->setAlignment(Qt::AlignCenter);
	l->setStyleSheet("font-size: 25px; padding: 10px;");
	layout->addWidget(l);

	// Get the time data of the saved files
	vector<string> sessions = SessionReader::getSessionSaves();
	sort(sessions.begin(), sessions.end());

	vector<string> months;

	for(string filename : sessions)
	{
		if(filename.length() == 22)
		{
			string year = filename.substr(3, 4);
			string month = filename.substr(7, 2) + "/" + year;

			if(months.empty())
			{
				months.push_back(month);
			}
			else if(months.back() != month)
			{
				months.push_back(month);
			}
		}
	}

	// Session chooser labels
	QWidget *sessionchooserlabels = new QWidget();
	QHBoxLayout *scllayout = new QHBoxLayout();
	scllayout->setSpacing(0);
	scllayout->setContentsMargins(0, 0, 0, 0);
	sessionchooserlabels->setLayout(scllayout);
	layout->addWidget(sessionchooserlabels);

	QLabel *monthL = new QLabel(tr("Month"));
	QLabel *dayL = new QLabel(tr("Day"));
	QLabel *timeL = new QLabel(tr("Time"));

	monthL->setAlignment(Qt::AlignCenter);
	dayL->setAlignment(Qt::AlignCenter);
	timeL->setAlignment(Qt::AlignCenter);

	scllayout->addWidget(monthL);
	scllayout->addWidget(dayL);
	scllayout->addWidget(timeL);

	// Session chooser
	QWidget *sessionchooser = new QWidget();
	QHBoxLayout *sclayout = new QHBoxLayout();
	sclayout->setSpacing(0);
	sclayout->setContentsMargins(0, 0, 0, 0);
	sessionchooser->setLayout(sclayout);
	layout->addWidget(sessionchooser);

	monthchooser = new QListWidget();
	for(string month : months)
	{
		monthchooser->addItem(QString::fromStdString(month));
	}
	sclayout->addWidget(monthchooser);

	daychooser = new QListWidget();
	sclayout->addWidget(daychooser);

	timechooser = new QListWidget();
	sclayout->addWidget(timechooser);

	ok = new QPushButton(tr("Open Session"));
	ok->setEnabled(false);
	ok->setStyleSheet("font-size: 16px;");
	layout->addWidget(ok);


	QObject::connect(monthchooser, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(monthSelectionChanged(QListWidgetItem *, QListWidgetItem *)));
	if(monthchooser->count() != 0)
	{
		monthchooser->setCurrentRow(monthchooser->count() - 1);
	}

	QObject::connect(daychooser, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(daySelectionChanged(QListWidgetItem *, QListWidgetItem *)));
	QObject::connect(timechooser, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(timeSelectionChanged(QListWidgetItem *, QListWidgetItem *)));

	QObject::connect(ok, SIGNAL(clicked()), this, SLOT(loadSelectedSession()));

	///////////////////////////
    // Actual session viewer //
	///////////////////////////

	QWidget *viewer = new QWidget();
	QVBoxLayout *viewl = new QVBoxLayout();
	viewl->setSpacing(0);
	viewl->setContentsMargins(0, 0, 0, 0);
	viewer->setLayout(viewl);

	tabs->addTab(viewer, tr("Session Viewer"));

	noSessionOpen = new QLabel(tr("No session open"));
	noSessionOpen->setStyleSheet("padding: 20px; font-size: 28px;");
	noSessionOpen->setAlignment(Qt::AlignCenter);
	viewl->addWidget(noSessionOpen);

	sessionTitle = new QLabel();
	sessionTitle->setStyleSheet("padding: 10px; font-size: 26px;");
	sessionTitle->setAlignment(Qt::AlignCenter);
	sessionTitle->setMaximumHeight(50);
	viewl->addWidget(sessionTitle);
	sessionTitle->setVisible(false);

	sessionInfo = new QLabel();
	sessionInfo->setStyleSheet("padding: 5px; font-size: 18px");
	sessionInfo->setAlignment(Qt::AlignCenter);
	sessionInfo->setMaximumHeight(30);
	viewl->addWidget(sessionInfo);
	sessionInfo->setVisible(false);

	pics = new GalleryWidget(0, this);
	viewl->addWidget(pics);
	pics->setVisible(false);

	map = new Map3D();
	viewl->addWidget(map);
	map->hide();
	//sensorviewer = new SensorDataViewer();
	//viewl->addWidget(sensorviewer);

	timeline = new TimelineWidget(0);
	timeline->setMaximumHeight(100);
	timeline->setMinimumHeight(100);
	viewl->addWidget(timeline);
	timeline->setVisible(false);

	QObject::connect(timeline, SIGNAL(markerPressed(std::string, std::string, float)), this, SLOT(timelineMarkerPressed(std::string, std::string, float)));
	QObject::connect(timeline, SIGNAL(newTimeSelected(float)), this, SLOT(timelineTimeUpdated(float)));
}
Example #19
0
Arranger::Arranger(ArrangerView* parent, const char* name)
   : QWidget(parent)
      {
      setObjectName(name);
      _raster  = 0;      // measure
      selected = 0;
      showTrackinfoFlag = true;
      
      cursVal = INT_MAX;
      
      _parentWin=parent;
      
      setFocusPolicy(Qt::NoFocus);
      
      //---------------------------------------------------
      //  ToolBar
      //    create toolbar in toplevel widget
      //---------------------------------------------------

      parent->addToolBarBreak();
      QToolBar* toolbar = parent->addToolBar(tr("Arranger"));
      toolbar->setObjectName("ArrangerToolbar");
      
      QLabel* label = new QLabel(tr("Cursor"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      cursorPos = new PosLabel(0);
      cursorPos->setEnabled(false);
      cursorPos->setFixedHeight(22);
      toolbar->addWidget(cursorPos);

      label = new QLabel(tr("Snap"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      _rasterCombo = new QComboBox();
      for (int i = 0; i < 6; i++)
            _rasterCombo->insertItem(i, tr(gArrangerRasterStrings[i]), gArrangerRasterTable[i]);
      _rasterCombo->setCurrentIndex(1);
      // Set the audio record part snapping. Set to 0 (bar), the same as this combo box intial raster.
      MusEGlobal::song->setArrangerRaster(0);
      toolbar->addWidget(_rasterCombo);
      connect(_rasterCombo, SIGNAL(activated(int)), SLOT(rasterChanged(int)));
      _rasterCombo->setFocusPolicy(Qt::TabFocus);

      // Song len
      label = new QLabel(tr("Len"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);

      // song length is limited to 10000 bars; the real song len is limited
      // by overflows in tick computations
      lenEntry = new SpinBox(1, 10000, 1);
      lenEntry->setFocusPolicy(Qt::StrongFocus);
      lenEntry->setValue(MusEGlobal::song->len());
      lenEntry->setToolTip(tr("song length - bars"));
      lenEntry->setWhatsThis(tr("song length - bars"));
      toolbar->addWidget(lenEntry);
      connect(lenEntry, SIGNAL(valueChanged(int)), SLOT(songlenChanged(int)));

      label = new QLabel(tr("Pitch"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      
      globalPitchSpinBox = new SpinBox(-127, 127, 1);
      globalPitchSpinBox->setFocusPolicy(Qt::StrongFocus);
      globalPitchSpinBox->setValue(MusEGlobal::song->globalPitchShift());
      globalPitchSpinBox->setToolTip(tr("midi pitch"));
      globalPitchSpinBox->setWhatsThis(tr("global midi pitch shift"));
      toolbar->addWidget(globalPitchSpinBox);
      connect(globalPitchSpinBox, SIGNAL(valueChanged(int)), SLOT(globalPitchChanged(int)));
      
      label = new QLabel(tr("Tempo"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      
      globalTempoSpinBox = new SpinBox(50, 200, 1, toolbar);
      globalTempoSpinBox->setFocusPolicy(Qt::StrongFocus);
      globalTempoSpinBox->setSuffix(QString("%"));
      globalTempoSpinBox->setValue(MusEGlobal::tempomap.globalTempo());
      globalTempoSpinBox->setToolTip(tr("midi tempo"));
      globalTempoSpinBox->setWhatsThis(tr("midi tempo"));
      toolbar->addWidget(globalTempoSpinBox);
      connect(globalTempoSpinBox, SIGNAL(valueChanged(int)), SLOT(globalTempoChanged(int)));
      
      QToolButton* tempo50  = new QToolButton();
      tempo50->setText(QString("50%"));
      tempo50->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo50);
      connect(tempo50, SIGNAL(clicked()), SLOT(setTempo50()));
      
      QToolButton* tempo100 = new QToolButton();
      tempo100->setText(tr("N"));
      tempo100->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo100);
      connect(tempo100, SIGNAL(clicked()), SLOT(setTempo100()));
      
      QToolButton* tempo200 = new QToolButton();
      tempo200->setText(QString("200%"));
      tempo200->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo200);
      connect(tempo200, SIGNAL(clicked()), SLOT(setTempo200()));

      QVBoxLayout* box  = new QVBoxLayout(this);
      box->setContentsMargins(0, 0, 0, 0);
      box->setSpacing(0);
      box->addWidget(MusECore::hLine(this), Qt::AlignTop);

      //---------------------------------------------------
      //  Tracklist
      //---------------------------------------------------

      int xscale = -100;
      int yscale = 1;

      split  = new Splitter(Qt::Horizontal, this, "split");
      split->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
      box->addWidget(split, 1000);

      tracklist = new QWidget(split);

      split->setStretchFactor(split->indexOf(tracklist), 0);
      QSizePolicy tpolicy = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
      tpolicy.setHorizontalStretch(0);
      tpolicy.setVerticalStretch(100);
      tracklist->setSizePolicy(tpolicy);

      editor = new QWidget(split);
      split->setStretchFactor(split->indexOf(editor), 1);
      QSizePolicy epolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      epolicy.setHorizontalStretch(255);
      epolicy.setVerticalStretch(100);
      editor->setSizePolicy(epolicy);

      //---------------------------------------------------
      //    Track Info
      //---------------------------------------------------

      infoScroll = new ScrollBar(Qt::Vertical, tracklist);
      infoScroll->setObjectName("infoScrollBar");
      //genTrackInfo(tracklist); // Moved below

      // Track-Info Button
      ib  = new QToolButton(tracklist);
      ib->setText(tr("TrackInfo"));
      ib->setCheckable(true);
      ib->setChecked(showTrackinfoFlag);
      ib->setFocusPolicy(Qt::NoFocus);
      connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool)));
      
      // set up the header
      header = new Header(tracklist, "header");
      header->setFixedHeight(30);

      QFontMetrics fm1(header->font());
      int fw = 8;

      header->setColumnLabel(tr("R"), COL_RECORD, fm1.width('R')+fw);
      header->setColumnLabel(tr("M"), COL_MUTE, fm1.width('M')+fw);
      header->setColumnLabel(tr("S"), COL_SOLO, fm1.width('S')+fw);
      header->setColumnLabel(tr("C"), COL_CLASS, fm1.width('C')+fw);
      header->setColumnLabel(tr("Track"), COL_NAME, 100);
      header->setColumnLabel(tr("Port"), COL_OPORT, 60);
      header->setColumnLabel(tr("Ch"), COL_OCHANNEL, 30);
      header->setColumnLabel(tr("T"), COL_TIMELOCK, fm1.width('T')+fw);
      header->setColumnLabel(tr("Automation"), COL_AUTOMATION, 75);
      header->setColumnLabel(tr("Clef"), COL_CLEF, 75);
      for (unsigned i=0;i<custom_columns.size();i++)
        header->setColumnLabel(custom_columns[i].name, COL_CUSTOM_MIDICTRL_OFFSET+i, MAX(fm1.width(custom_columns[i].name)+fw, 30));
      header->setResizeMode(COL_RECORD, QHeaderView::Fixed);
      header->setResizeMode(COL_MUTE, QHeaderView::Fixed);
      header->setResizeMode(COL_SOLO, QHeaderView::Fixed);
      header->setResizeMode(COL_CLASS, QHeaderView::Fixed);
      header->setResizeMode(COL_NAME, QHeaderView::Interactive);
      header->setResizeMode(COL_OPORT, QHeaderView::Interactive);
      header->setResizeMode(COL_OCHANNEL, QHeaderView::Fixed);
      header->setResizeMode(COL_TIMELOCK, QHeaderView::Fixed);
      header->setResizeMode(COL_AUTOMATION, QHeaderView::Interactive);
      header->setResizeMode(COL_CLEF, QHeaderView::Interactive);
      for (unsigned i=0;i<custom_columns.size();i++)
        header->setResizeMode(COL_CUSTOM_MIDICTRL_OFFSET+i, QHeaderView::Interactive);

      setHeaderToolTips();
      setHeaderWhatsThis();
      header->setMovable (true);
      header->restoreState(header_state);


      list = new TList(header, tracklist, "tracklist");
      
      // Do this now that the list is available.
      genTrackInfo(tracklist);
      
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), SLOT(trackSelectionChanged()));
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), SIGNAL(selectionChanged()));
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), midiTrackInfo, SLOT(setTrack(MusECore::Track*)));
      connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw()));
      connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw()));

      //  tracklist:
      //
      //         0         1         2
      //   +-----------+--------+---------+
      //   | Trackinfo | scroll | Header  | 0
      //   |           | bar    +---------+
      //   |           |        | TList   | 1
      //   +-----------+--------+---------+
      //   |             hline            | 2
      //   +-----+------------------------+
      //   | ib  |                        | 3
      //   +-----+------------------------+

      connect(infoScroll, SIGNAL(valueChanged(int)), SLOT(trackInfoScroll(int)));
      tgrid  = new TLLayout(tracklist); // layout manager for this
      tgrid->wadd(0, trackInfo);
      tgrid->wadd(1, infoScroll);
      tgrid->wadd(2, header);
      tgrid->wadd(3, list);
      tgrid->wadd(4, MusECore::hLine(tracklist));
      tgrid->wadd(5, ib);

      //---------------------------------------------------
      //    Editor
      //---------------------------------------------------

      int offset = AL::sigmap.ticksMeasure(0);
      hscroll = new ScrollScale(-2000, -5, xscale, MusEGlobal::song->len(), Qt::Horizontal, editor, -offset);
      hscroll->setFocusPolicy(Qt::NoFocus);
      ib->setFixedHeight(hscroll->sizeHint().height());

      vscroll = new QScrollBar(editor);
      vscroll->setMinimum(0);
      vscroll->setMaximum(20*20);
      vscroll->setSingleStep(5);
      vscroll->setPageStep(25); // FIXME: too small steps here for me (flo), better control via window height?
      vscroll->setValue(0);
      vscroll->setOrientation(Qt::Vertical);      

      list->setScroll(vscroll);

      QList<int> vallist;
      vallist.append(tgrid->maximumSize().width());
      split->setSizes(vallist);

      QGridLayout* egrid  = new QGridLayout(editor);
      egrid->setColumnStretch(0, 50);
      egrid->setRowStretch(2, 50);
      egrid->setContentsMargins(0, 0, 0, 0);  
      egrid->setSpacing(0);  

      time = new MTScale(&_raster, editor, xscale);
      time->setOrigin(-offset, 0);
      canvas = new PartCanvas(&_raster, editor, xscale, yscale);
      canvas->setBg(MusEGlobal::config.partCanvasBg);
      canvas->setCanvasTools(arrangerTools);
      canvas->setOrigin(-offset, 0);
      canvas->setFocus();

      list->setFocusProxy(canvas); // Make it easy for track list popup line editor to give focus back to canvas.

      connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int)));
      connect(canvas, SIGNAL(trackChanged(MusECore::Track*)), list, SLOT(selectTrack(MusECore::Track*)));
      connect(list, SIGNAL(keyPressExt(QKeyEvent*)), canvas, SLOT(redirKeypress(QKeyEvent*)));
      connect(canvas, SIGNAL(selectTrackAbove()), list, SLOT(selectTrackAbove()));
      connect(canvas, SIGNAL(selectTrackBelow()), list, SLOT(selectTrackBelow()));
      connect(canvas, SIGNAL(horizontalZoom(bool, const QPoint&)), SLOT(horizontalZoom(bool, const QPoint&)));
      connect(canvas, SIGNAL(horizontalZoom(int, const QPoint&)), SLOT(horizontalZoom(int, const QPoint&)));
      connect(lenEntry,           SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(lenEntry,           SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(globalPitchSpinBox, SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(globalPitchSpinBox, SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(globalTempoSpinBox, SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(globalTempoSpinBox, SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(midiTrackInfo,      SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(midiTrackInfo,      SIGNAL(escapePressed()), SLOT(focusCanvas()));
      
      //connect(this,      SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
      connect(list,      SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
      connect(trackInfo, SIGNAL(redirectWheelEvent(QWheelEvent*)), infoScroll, SLOT(redirectedWheelEvent(QWheelEvent*)));
      
      egrid->addWidget(time, 0, 0, 1, 2);
      egrid->addWidget(MusECore::hLine(editor), 1, 0, 1, 2);

      egrid->addWidget(canvas,  2, 0);
      egrid->addWidget(vscroll, 2, 1);
      egrid->addWidget(hscroll, 3, 0, Qt::AlignBottom);

      connect(vscroll, SIGNAL(valueChanged(int)), canvas, SLOT(setYPos(int)));
      connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  canvas, SLOT(setXMag(int)));
      connect(vscroll, SIGNAL(valueChanged(int)), list,   SLOT(setYPos(int)));
      connect(hscroll, SIGNAL(scrollChanged(int)), time,   SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  time,   SLOT(setXMag(int)));
      connect(canvas,  SIGNAL(timeChanged(unsigned)),   SLOT(setTime(unsigned)));
      connect(canvas,  SIGNAL(verticalScroll(unsigned)),SLOT(verticalScrollSetYpos(unsigned)));
      connect(canvas,  SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
      connect(canvas,  SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); 
      connect(time,    SIGNAL(timeChanged(unsigned)),   SLOT(setTime(unsigned)));

      connect(list, SIGNAL(verticalScrollSetYpos(int)), vscroll, SLOT(setValue(int)));

      connect(canvas, SIGNAL(tracklistChanged()), list, SLOT(tracklistChanged()));
      connect(canvas, SIGNAL(dclickPart(MusECore::Track*)), SIGNAL(editPart(MusECore::Track*)));
      connect(canvas, SIGNAL(startEditor(MusECore::PartList*,int)),   SIGNAL(startEditor(MusECore::PartList*, int)));

      connect(MusEGlobal::song,   SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t)));
      connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
      connect(canvas, SIGNAL(selectionChanged()), SIGNAL(selectionChanged()));
      connect(canvas, SIGNAL(dropSongFile(const QString&)), SIGNAL(dropSongFile(const QString&)));
      connect(canvas, SIGNAL(dropMidiFile(const QString&)), SIGNAL(dropMidiFile(const QString&)));

      connect(canvas, SIGNAL(toolChanged(int)), SIGNAL(toolChanged(int)));
      connect(MusEGlobal::song,   SIGNAL(controllerChanged(MusECore::Track*, int)), SLOT(controllerChanged(MusECore::Track*, int)));

      configChanged();  // set configuration values
      if(canvas->part())
        midiTrackInfo->setTrack(canvas->part()->track());   
      showTrackInfo(showTrackinfoFlag);
      
      // Take care of some tabbies!
      setTabOrder(tempo200, trackInfo);
      setTabOrder(trackInfo, infoScroll);
      setTabOrder(infoScroll, list);
      setTabOrder(list, canvas);
      //setTabOrder(canvas, ib);
      //setTabOrder(ib, hscroll);
      }
Example #20
0
Comments::Comments(QWidget *pParent, const char *name) :
  QWidget(pParent)
{
  setObjectName(name);
  _source = Uninitialized;
  _sourceid = -1;
  _editable = true;

  _verboseCommentList = false;

  QVBoxLayout *vbox = new QVBoxLayout(this);

  QHBoxLayout *hbox = new QHBoxLayout();
  hbox->setMargin(0);
  hbox->setSpacing(7);
  
  _verbose = new XCheckBox(tr("Verbose Text"), this);
  _verbose->setObjectName("_verbose");
  _verboseCommentList = _verbose->isChecked();
  vbox->addWidget(_verbose);
      
  vbox->addLayout(hbox);

  QWidget *buttons = new QWidget(this);
  QVBoxLayout * buttonsLayout = new QVBoxLayout(buttons);
  buttonsLayout->setMargin(0);
  buttonsLayout->setSpacing(0);

  _comment = new XTreeWidget(this);
  _comment->setObjectName("_comment");
  _comment->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _comment->addColumn(tr("Date/Time"), _timeDateColumn, Qt::AlignCenter,true, "comment_date");
  _comment->addColumn(tr("Type"),    _itemColumn, Qt::AlignCenter,true, "type");
  _comment->addColumn(tr("Source"),  _itemColumn, Qt::AlignCenter,true, "comment_source");
  _comment->addColumn(tr("User"),    _userColumn, Qt::AlignCenter,true, "comment_user");
  _comment->addColumn(tr("Comment"), -1,          Qt::AlignLeft,  true, "first");
  _comment->addColumn(tr("Public"),    _ynColumn, Qt::AlignLeft, false, "comment_public");
  hbox->addWidget(_comment);

  _browser = new QTextBrowser(this);
  _browser->setObjectName("_browser");
  _browser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _browser->setOpenLinks(false);
  hbox->addWidget(_browser);

  _newComment = new QPushButton(tr("New"), buttons);
  _newComment->setObjectName("_newComment");
  buttonsLayout->addWidget(_newComment);

  _viewComment = new QPushButton(tr("View"), buttons);
  _viewComment->setObjectName("_viewComment");
  _viewComment->setEnabled(FALSE);
  buttonsLayout->addWidget(_viewComment);

  _editComment = new QPushButton(tr("Edit"), buttons);
  _editComment->setObjectName("_editComment");
  _editComment->setEnabled(false);
  buttonsLayout->addWidget(_editComment);

  QSpacerItem *_buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
  buttonsLayout->addItem(_buttonSpacer);
  buttons->setLayout(buttonsLayout);
  hbox->addWidget(buttons);
  
  _editmap = new QMultiMap<int, bool>();
  _editmap2 = new QMultiMap<int, bool>();

  connect(_newComment, SIGNAL(clicked()), this, SLOT( sNew()));
  connect(_viewComment, SIGNAL(clicked()), this, SLOT( sView()));
  connect(_editComment, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_comment, SIGNAL(valid(bool)), this, SLOT(sCheckButtonPriv(bool)));
  connect(_comment, SIGNAL(itemSelected(int)), _viewComment, SLOT(animateClick()));
  connect(_browser, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
  connect(_verbose, SIGNAL(toggled(bool)), this, SLOT(setVerboseCommentList(bool)));

  setFocusProxy(_comment);
  setVerboseCommentList(_verboseCommentList);
}
UIWizardNewVMPageExpert::UIWizardNewVMPageExpert(const QString &strGroup)
    : UIWizardNewVMPage1(strGroup)
{
    /* Create widgets: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        pMainLayout->setContentsMargins(8, 6, 8, 6);
        pMainLayout->setSpacing(10);
        m_pNameAndSystemCnt = new QGroupBox(this);
        {
            m_pNameAndSystemCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QHBoxLayout *pNameAndSystemCntLayout = new QHBoxLayout(m_pNameAndSystemCnt);
            {
                m_pNameAndSystemEditor = new UINameAndSystemEditor(m_pNameAndSystemCnt);
                pNameAndSystemCntLayout->addWidget(m_pNameAndSystemEditor);
            }
        }
        m_pMemoryCnt = new QGroupBox(this);
        {
            m_pMemoryCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QGridLayout *pMemoryCntLayout = new QGridLayout(m_pMemoryCnt);
            {
                m_pRamSlider = new VBoxGuestRAMSlider(m_pMemoryCnt);
                {
                    m_pRamSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
                    m_pRamSlider->setOrientation(Qt::Horizontal);
                    m_pRamSlider->setTickPosition(QSlider::TicksBelow);
                    m_pRamSlider->setValue(m_pNameAndSystemEditor->type().GetRecommendedRAM());
                }
                m_pRamEditor = new QILineEdit(m_pMemoryCnt);
                {
                    m_pRamEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
                    m_pRamEditor->setFixedWidthByText("88888");
                    m_pRamEditor->setAlignment(Qt::AlignRight);
                    m_pRamEditor->setValidator(new QIntValidator(m_pRamSlider->minRAM(), m_pRamSlider->maxRAM(), this));
                    m_pRamEditor->setText(QString::number(m_pNameAndSystemEditor->type().GetRecommendedRAM()));
                }
                m_pRamUnits = new QLabel(m_pMemoryCnt);
                {
                    m_pRamUnits->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
                }
                m_pRamMin = new QLabel(m_pMemoryCnt);
                {
                    m_pRamMin->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
                }
                m_pRamMax = new QLabel(m_pMemoryCnt);
                {
                    m_pRamMax->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
                }
                pMemoryCntLayout->addWidget(m_pRamSlider, 0, 0, 1, 3);
                pMemoryCntLayout->addWidget(m_pRamEditor, 0, 3);
                pMemoryCntLayout->addWidget(m_pRamUnits, 0, 4);
                pMemoryCntLayout->addWidget(m_pRamMin, 1, 0);
                pMemoryCntLayout->setColumnStretch(1, 1);
                pMemoryCntLayout->addWidget(m_pRamMax, 1, 2);
            }
        }
        m_pDiskCnt = new QGroupBox(this);
        {
            m_pDiskCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
            QGridLayout *pDiskCntLayout = new QGridLayout(m_pDiskCnt);
            {
                m_pDiskSkip = new QRadioButton(m_pDiskCnt);
                m_pDiskCreate = new QRadioButton(m_pDiskCnt);
                {
                    m_pDiskCreate->setChecked(true);
                }
                m_pDiskPresent = new QRadioButton(m_pDiskCnt);
                QStyleOptionButton options;
                options.initFrom(m_pDiskPresent);
                int iWidth = m_pDiskPresent->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &options, m_pDiskPresent);
                pDiskCntLayout->setColumnMinimumWidth(0, iWidth);
                m_pDiskSelector = new VBoxMediaComboBox(m_pDiskCnt);
                {
                    m_pDiskSelector->setType(UIMediumType_HardDisk);
                    m_pDiskSelector->repopulate();
                }
                m_pVMMButton = new QIToolButton(m_pDiskCnt);
                {
                    m_pVMMButton->setAutoRaise(true);
                    m_pVMMButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_dis_16px.png"));
                }
                pDiskCntLayout->addWidget(m_pDiskSkip, 0, 0, 1, 3);
                pDiskCntLayout->addWidget(m_pDiskCreate, 1, 0, 1, 3);
                pDiskCntLayout->addWidget(m_pDiskPresent, 2, 0, 1, 3);
                pDiskCntLayout->addWidget(m_pDiskSelector, 3, 1);
                pDiskCntLayout->addWidget(m_pVMMButton, 3, 2);
            }
        }
        pMainLayout->addWidget(m_pNameAndSystemCnt);
        pMainLayout->addWidget(m_pMemoryCnt);
        pMainLayout->addWidget(m_pDiskCnt);
        pMainLayout->addStretch();
        updateVirtualDiskSource();
    }

    /* Setup connections: */
    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(sltOsTypeChanged()));
    connect(m_pRamSlider, SIGNAL(valueChanged(int)), this, SLOT(sltRamSliderValueChanged(int)));
    connect(m_pRamEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltRamEditorTextChanged(const QString &)));
    connect(m_pDiskSkip, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskCreate, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskPresent, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pDiskSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(sltVirtualDiskSourceChanged()));
    connect(m_pVMMButton, SIGNAL(clicked()), this, SLOT(sltGetWithFileOpenDialog()));

    /* Register classes: */
    qRegisterMetaType<CMedium>();
    /* Register fields: */
    registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
    registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged()));
    registerField("machineFolder", this, "machineFolder");
    registerField("machineBaseName", this, "machineBaseName");
    registerField("ram", m_pRamSlider, "value", SIGNAL(valueChanged(int)));
    registerField("virtualDisk", this, "virtualDisk");
    registerField("virtualDiskId", this, "virtualDiskId");
    registerField("virtualDiskLocation", this, "virtualDiskLocation");
}
FileBrowserDialog::FileBrowserDialog(const Account &account, const ServerRepo& repo, const QString &path, QWidget *parent)
    : QDialog(parent),
      account_(account),
      repo_(repo),
      current_path_(path)
{
    current_lpath_ = current_path_.split('/');

    data_mgr_ = new DataManager(account_);

    setWindowTitle(tr("Cloud File Browser"));
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog)
#if !defined(Q_OS_MAC)
                   | Qt::FramelessWindowHint
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
                   | Qt::WindowMinimizeButtonHint
#endif
                   | Qt::Window);

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());
    setAttribute(Qt::WA_TranslucentBackground, true);

    createTitleBar();
    createToolBar();
    createStatusBar();
    createLoadingFailedView();
    createFileTable();

    QWidget* widget = new QWidget;
    widget->setObjectName("mainWidget");
    QVBoxLayout* layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);
    layout->addWidget(widget);

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->setContentsMargins(1, 0, 1, 0);
    vlayout->setSpacing(0);
    widget->setLayout(vlayout);

    stack_ = new QStackedWidget;
    stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack_->insertWidget(INDEX_TABLE_VIEW, table_view_);
    stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    stack_->setContentsMargins(0, 0, 0, 0);

    vlayout->addWidget(header_);
    vlayout->addWidget(toolbar_);
    vlayout->addWidget(stack_);
    vlayout->addWidget(status_bar_);

#ifdef Q_OS_MAC
    header_->setVisible(false);
#endif

    // this <--> table_view_
    connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)),
            this, SLOT(onDirentClicked(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntSaveAs(const SeafDirent&)),
            this, SLOT(onDirentSaveAs(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRename(const SeafDirent&)),
            this, SLOT(onGetDirentRename(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)),
            this, SLOT(onGetDirentRemove(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const QList<const SeafDirent*> &)),
            this, SLOT(onGetDirentRemove(const QList<const SeafDirent*> &)));
    connect(table_view_, SIGNAL(direntShare(const SeafDirent&)),
            this, SLOT(onGetDirentShare(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)),
            this, SLOT(onGetDirentUpdate(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntPaste()),
            this, SLOT(onGetDirentsPaste()));
    connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)),
            this, SLOT(onCancelDownload(const SeafDirent&)));
    connect(table_view_, SIGNAL(syncSubdirectory(const QString&)),
            this, SLOT(onGetSyncSubdirectory(const QString &)));

    //dirents <--> data_mgr_
    connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)),
            this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&)));
    connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)),
            this, SLOT(onGetDirentsFailed(const ApiError&)));

    //create <--> data_mgr_
    connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)),
            this, SLOT(onDirectoryCreateSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)),
            this, SLOT(onDirectoryCreateFailed(const ApiError&)));

    //rename <--> data_mgr_
    connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)),
            this, SLOT(onDirentRenameSuccess(const QString&, const QString&)));
    connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)),
            this, SLOT(onDirentRenameFailed(const ApiError&)));

    //remove <--> data_mgr_
    connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)),
            this, SLOT(onDirentRemoveSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)),
            this, SLOT(onDirentRemoveFailed(const ApiError&)));

    //share <--> data_mgr_
    connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)),
            this, SLOT(onDirentShareSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)),
            this, SLOT(onDirentShareFailed(const ApiError&)));

    //copy <--> data_mgr_
    connect(data_mgr_, SIGNAL(copyDirentsSuccess()),
            this, SLOT(onDirentsCopySuccess()));
    connect(data_mgr_, SIGNAL(copyDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsCopyFailed(const ApiError&)));

    //move <--> data_mgr_
    connect(data_mgr_, SIGNAL(moveDirentsSuccess()),
            this, SLOT(onDirentsMoveSuccess()));
    connect(data_mgr_, SIGNAL(moveDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsMoveFailed(const ApiError&)));

    //subrepo <-->data_mgr_
    connect(data_mgr_, SIGNAL(createSubrepoSuccess(const ServerRepo &)),
            this, SLOT(onCreateSubrepoSuccess(const ServerRepo &)));
    connect(data_mgr_, SIGNAL(createSubrepoFailed(const ApiError&)),
            this, SLOT(onCreateSubrepoFailed(const ApiError&)));

    connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)),
            this, SLOT(onFileAutoUpdated(const QString&, const QString&)));

    QTimer::singleShot(0, this, SLOT(fetchDirents()));
}
Example #23
0
ToolBar::ToolBar(QWidget *parent) : QWidget(parent)
{
    ZoomIn = new QPushButton(this);
    ZoomOut = new QPushButton(this);
    ZoomFit = new QPushButton(this);
    FullScreen = new QPushButton(this);
    Prev = new QPushButton(this);
    Next = new QPushButton(this);
    RotateLeft = new QPushButton(this);
    RotateRight = new QPushButton(this);
    Delete = new QPushButton(this);
    FlipH = new QPushButton(this);
    FlipV = new QPushButton(this);
    Play = new QPushButton(this);
    Info = new QPushButton(this);

    ZoomIn->setObjectName("ZoomIn");
    ZoomOut->setObjectName("ZoomOut");
    ZoomFit->setObjectName("ZoomFit");
    FullScreen->setObjectName("FullScreen");
    Prev->setObjectName("Prev");
    Next->setObjectName("Next");
    RotateLeft->setObjectName("RotateLeft");
    RotateRight->setObjectName("RotateRight");
    Delete->setObjectName("Delete");
    Info->setObjectName("Info");
    FlipV->setObjectName("FlipV");
    FlipH->setObjectName("FlipH");
    Play->setObjectName("Play");
    //Resize = new QPushButton(this);

    ZoomIn->setIcon(QIcon(":/images/zoomin.png"));
    ZoomOut->setIcon(QIcon(":/images/zoomout.png"));
    ZoomFit->setIcon(QIcon(":/images/zoomfit.png"));
    FullScreen->setIcon(QIcon(":/images/fullscreen.png"));
    Prev->setIcon(QIcon(":/images/prev.png"));
    Next->setIcon(QIcon(":/images/next.png"));
    RotateLeft->setIcon(QIcon(":/images/rotateleft.png"));
    RotateRight->setIcon(QIcon(":/images/rotateright.png"));
    Delete->setIcon(QIcon(":/images/delete.png"));
    Info->setIcon(QIcon(":/images/info.png"));
    FlipV->setIcon(QIcon(":/images/flipvertical.png"));
    FlipH->setIcon(QIcon(":/images/fliphorizontal.png"));
    Play->setIcon(QIcon(":/images/play.png"));
    //Resize->setIcon(QIcon(":/images/resize.png"));

    ZoomIn->setToolTip(tr("Zoom In"));
    ZoomOut->setToolTip(tr("Zoom Out"));
    ZoomFit->setToolTip(tr("Fit to Window"));
    FullScreen->setToolTip(tr("Full Screen"));
    Prev->setToolTip(tr("Prev"));
    Next->setToolTip(tr("Next"));
    RotateLeft->setToolTip(tr("Rotate Left"));
    RotateRight->setToolTip(tr("Rotate Right"));
    Delete->setToolTip(tr("Delete"));
    Info->setToolTip(tr("Infomation"));
    FlipV->setToolTip(tr("Flip Vertical"));
    FlipH->setToolTip(tr("Flip Horizontal"));
    Play->setToolTip(tr("Play"));

    label = new QLabel;
    label->setObjectName("label");
    QHBoxLayout *labelLayout = new QHBoxLayout;
    labelLayout->addStretch();
    labelLayout->addWidget(label);
    labelLayout->addStretch();
    labelLayout->setContentsMargins(0,0,0,0);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addStretch();
    mainLayout->addWidget(ZoomIn);
    mainLayout->addWidget(ZoomOut);
    mainLayout->addWidget(ZoomFit);
    mainLayout->addWidget(Prev);
    mainLayout->addWidget(Next);
    mainLayout->addWidget(RotateLeft);
    mainLayout->addWidget(RotateRight);
    mainLayout->addWidget(FlipH);
    mainLayout->addWidget(FlipV);
    mainLayout->addWidget(FullScreen);
    //mainLayout->addWidget(Resize);
    mainLayout->addWidget(Play);
    mainLayout->addWidget(Info);
    mainLayout->addWidget(Delete);
    mainLayout->addStretch();
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(1);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addLayout(labelLayout);
    layout->addLayout(mainLayout);
    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(3);
    setWindowFlags(Qt::FramelessWindowHint);
}
FileDescriptorWidget::FileDescriptorWidget(QWidget* parent) :
   QWidget(parent),
   mpFileDescriptor(NULL),
   mReadOnly(true),
   mModified(false),
   mpTreeWidget(NULL),
   mpFileBrowser(NULL),
   mpGcpGroup(NULL),
   mpGcpTree(NULL)
{
   // Item tree widget
   QStringList columnNames;
   columnNames.append("Item");
   columnNames.append("Value");

   mpTreeWidget = new CustomTreeWidget(this);
   mpTreeWidget->setColumnCount(columnNames.count());
   mpTreeWidget->setHeaderLabels(columnNames);
   mpTreeWidget->setRootIsDecorated(true);
   mpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
   mpTreeWidget->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true);
   mpTreeWidget->setSortingEnabled(false);

   QHeaderView* pHeader = mpTreeWidget->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(false);
      pHeader->setMovable(false);
      pHeader->setStretchLastSection(true);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->resizeSection(0, 150);
   }

   // Band file browser
   mpFileBrowser = new FileBrowser(mpTreeWidget);
   mpFileBrowser->setBrowseCaption("Select Band File");
   mpFileBrowser->hide();

   // GCP group box
   mpGcpGroup = new QGroupBox("Ground Control Points (GCP)", this);

   // GCP tree widget
   columnNames.clear();
   columnNames.append("Name");
   columnNames.append("Column");
   columnNames.append("Row");
   columnNames.append("Latitude");
   columnNames.append("Longitude");

   mpGcpTree = new CustomTreeWidget(mpGcpGroup);
   mpGcpTree->setColumnCount(columnNames.count());
   mpGcpTree->setHeaderLabels(columnNames);
   mpGcpTree->setRootIsDecorated(false);
   mpGcpTree->setSelectionMode(QAbstractItemView::SingleSelection);
   mpGcpTree->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true);
   mpGcpTree->setSortingEnabled(true);

   pHeader = mpGcpTree->header();
   if (pHeader != NULL)
   {
      pHeader->setSortIndicatorShown(true);
      pHeader->setMovable(false);
      pHeader->setStretchLastSection(false);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->resizeSection(0, 75);
      pHeader->resizeSection(1, 75);
      pHeader->resizeSection(2, 75);
   }

   // Layout
   QVBoxLayout* pGcpLayout = new QVBoxLayout(mpGcpGroup);
   pGcpLayout->setMargin(10);
   pGcpLayout->setSpacing(10);
   pGcpLayout->addWidget(mpGcpTree, 10);

   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(10);
   pLayout->addWidget(mpTreeWidget);
   pLayout->addWidget(mpGcpGroup);

   // Connections
   VERIFYNR(connect(mpTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this,
      SLOT(descriptorItemChanged(QTreeWidgetItem*, int))));
}
TransactionView::TransactionView(QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0)
{
    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);
#ifdef Q_WS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(26);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(23);
#endif

    dateWidget = new QComboBox(this);
#ifdef Q_WS_MAC
    dateWidget->setFixedWidth(121);
#else
    dateWidget->setFixedWidth(120);
#endif
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
#ifdef Q_WS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
#ifdef Q_WS_MAC
    amountWidget->setFixedWidth(97);
#else
    amountWidget->setFixedWidth(100);
#endif
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll blu width with spacing
#ifdef Q_WS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll blu
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    transactionView = view;

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);

    // Connect actions
    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
void JabberEditAccountWidget::createOptionsTab(QTabWidget *tabWidget)
{
	QWidget *optionsTab = new QWidget(this);
	tabWidget->addTab(optionsTab, tr("Options"));

	QVBoxLayout *layout = new QVBoxLayout(optionsTab);
	layout->setSpacing(6);
	layout->setMargin(9);

	QGroupBox *resource = new QGroupBox(tr("Resource"), this);
	QVBoxLayout *resourceLayout = new QVBoxLayout(resource);

	QHBoxLayout *resourceDetailsLayout = new QHBoxLayout();
	resourceDetailsLayout->setSpacing(6);
	resourceDetailsLayout->setMargin(0);

	AutoResource = new QCheckBox(tr("Use hostname as a resource"));
	connect(AutoResource, SIGNAL(clicked()), this, SLOT(dataChanged()));
	connect(AutoResource, SIGNAL(toggled(bool)), SLOT(autoResourceToggled(bool)));
	resourceLayout->addWidget(AutoResource);

	ResourceLabel = new QLabel;
	ResourceLabel->setText(tr("Resource") + ':');
	resourceDetailsLayout->addWidget(ResourceLabel);

	ResourceName = new QLineEdit;
	connect(ResourceName, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	resourceDetailsLayout->addWidget(ResourceName);

	PriorityLabel = new QLabel;
	PriorityLabel->setText(tr("Priority") + ':');
	resourceDetailsLayout->addWidget(PriorityLabel);

	Priority = new QLineEdit;
	connect(Priority, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
	Priority->setValidator(new QIntValidator(Priority));
	resourceDetailsLayout->addWidget(Priority);

	resourceLayout->addLayout(resourceDetailsLayout);
	layout->addWidget(resource);

	QGroupBox *dataTransferProxy = new QGroupBox(tr("Data transfer proxy"), this);

	QHBoxLayout *dataTransferProxyLayout = new QHBoxLayout(dataTransferProxy);
	dataTransferProxyLayout->setSpacing(6);
	dataTransferProxyLayout->setMargin(0);

	DataTransferProxyLabel = new QLabel;
	DataTransferProxyLabel->setText(tr("Data transfer proxy") + ':');
	dataTransferProxyLayout->addWidget(DataTransferProxyLabel);

	DataTransferProxy = new QLineEdit;
	dataTransferProxyLayout->addWidget(DataTransferProxy);

	layout->addWidget(dataTransferProxy);

	QGroupBox *notifications = new QGroupBox(tr("Notifications"), this);

	QVBoxLayout *notificationsLayout = new QVBoxLayout(notifications);
	SendTypingNotification = new QCheckBox(tr("Send composing events"));
	connect(SendTypingNotification, SIGNAL(clicked()), this, SLOT(dataChanged()));
	notificationsLayout->addWidget(SendTypingNotification);

	SendGoneNotification = new QCheckBox(tr("Send inactivity events (end/suspend conversation)"));
	SendGoneNotification->setEnabled(false);
	connect(SendGoneNotification, SIGNAL(clicked()), this, SLOT(dataChanged()));
	connect(SendTypingNotification, SIGNAL(toggled(bool)), SendGoneNotification, SLOT(setEnabled(bool)));
	notificationsLayout->addWidget(SendGoneNotification);

	layout->addWidget(notifications);

	layout->addStretch(100);
}
Example #27
0
pfmPage::pfmPage (QWidget *parent, PFM_DEFINITION *pfmDef, PFM_GLOBAL *pfmg, NV_INT32 page_num):
    QWizardPage (parent)
{
    setPixmap (QWizard::WatermarkPixmap, QPixmap(":/icons/pfmLoadMWatermark.png"));

    pfm_def = pfmDef;
    pfm_global = pfmg;
    pfm_def->existing = NVFalse;
    l_page_num = page_num;
    pfmIndex.sprintf ("%02d", page_num - 1);
    prev_mbin = pfm_def->mbin_size;
    prev_gbin = pfm_def->gbin_size;

    QString title;
    title = tr ("PFM ") + pfmIndex + tr (" Options");
    setTitle (title);


    QVBoxLayout *pageLayout = new QVBoxLayout (this);
    pageLayout->setMargin (5);
    pageLayout->setSpacing (5);


    QHBoxLayout *pfm_file_box = new QHBoxLayout;
    pfm_file_box->setSpacing (5);

    pageLayout->addLayout (pfm_file_box);


    QString pfl = tr ("PFM file ") + pfmIndex;
    pfm_file_label = new QLabel (pfl, this);

    pfm_file_box->addWidget (pfm_file_label, 1);

    pfm_file_edit = new QLineEdit (this);
    pfm_file_edit->setToolTip (tr ("Set the PFM file name manually"));
    connect (pfm_file_edit, SIGNAL (textChanged (const QString &)), this, SLOT (slotPFMFileEdit (const QString &)));


    pfm_file_box->addWidget (pfm_file_edit, 10);

    pfm_file_browse = new QPushButton (tr ("Browse..."), this);
    pfm_file_browse->setToolTip (tr ("Select a preexisting PFM file to append to or create file in new directory"));

    pfm_file_label->setWhatsThis (pfm_fileText);
    pfm_file_edit->setWhatsThis (pfm_fileText);
    pfm_file_browse->setWhatsThis (pfm_fileBrowseText);

    connect (pfm_file_browse, SIGNAL (clicked ()), this, SLOT (slotPFMFileBrowse ()));

    pfm_file_box->addWidget (pfm_file_browse, 1);


    QGroupBox *limBox = new QGroupBox (tr ("Limits"), this);
    QHBoxLayout *limBoxLayout = new QHBoxLayout;
    limBox->setLayout (limBoxLayout);
    limBoxLayout->setSpacing (10);


    QGroupBox *mBinsBox = new QGroupBox (tr ("Bin size (meters)"), this);
    QHBoxLayout *mBinsBoxLayout = new QHBoxLayout;
    mBinsBox->setLayout (mBinsBoxLayout);
    mBinsBoxLayout->setSpacing (10);

    mBinSize = new QDoubleSpinBox (this);
    mBinSize->setDecimals (2);
    mBinSize->setRange (0.0, 1000.0);
    mBinSize->setSingleStep (1.0);
    mBinSize->setValue (pfm_def->mbin_size);
    mBinSize->setWrapping (TRUE);
    mBinSize->setToolTip (tr ("Set the PFM bin size in meters"));
    mBinSize->setWhatsThis (mBinSizeText);
    connect (mBinSize, SIGNAL (valueChanged (double)), this, SLOT (slotMBinSizeChanged (double)));
    mBinsBoxLayout->addWidget (mBinSize);


    limBoxLayout->addWidget (mBinsBox);


    QGroupBox *gBinsBox = new QGroupBox (tr ("Bin size (minutes)"), this);
    QHBoxLayout *gBinsBoxLayout = new QHBoxLayout;
    gBinsBox->setLayout (gBinsBoxLayout);
    gBinsBoxLayout->setSpacing (10);

    gBinSize = new QDoubleSpinBox (this);
    gBinSize->setDecimals (3);
    gBinSize->setRange (0.0, 200.0);
    gBinSize->setSingleStep (0.05);
    gBinSize->setValue (pfm_def->gbin_size);
    gBinSize->setWrapping (TRUE);
    gBinSize->setToolTip (tr ("Set the PFM bin size in minutes"));
    gBinSize->setWhatsThis (gBinSizeText);
    connect (gBinSize, SIGNAL (valueChanged (double)), this, SLOT (slotGBinSizeChanged (double)));
    gBinsBoxLayout->addWidget (gBinSize);


    limBoxLayout->addWidget (gBinsBox);


    QGroupBox *minDBox = new QGroupBox (tr ("Minimum depth"), this);
    QHBoxLayout *minDBoxLayout = new QHBoxLayout;
    minDBox->setLayout (minDBoxLayout);
    minDBoxLayout->setSpacing (10);

    minDepth = new QDoubleSpinBox (this);
    minDepth->setDecimals (1);
    minDepth->setRange (-10000.0, 12000.0);
    minDepth->setSingleStep (1000.0);
    minDepth->setValue (pfm_def->min_depth);
    minDepth->setWrapping (TRUE);
    minDepth->setToolTip (tr ("Set the minimum allowable depth for the PFM structure"));
    minDepth->setWhatsThis (minDepthText);
    minDBoxLayout->addWidget (minDepth);


    limBoxLayout->addWidget (minDBox);


    QGroupBox *maxDBox = new QGroupBox (tr ("Maximum depth"), this);
    QHBoxLayout *maxDBoxLayout = new QHBoxLayout;
    maxDBox->setLayout (maxDBoxLayout);
    maxDBoxLayout->setSpacing (10);

    maxDepth = new QDoubleSpinBox (this);
    maxDepth->setDecimals (1);
    maxDepth->setRange (-10000.0, 12000.0);
    maxDepth->setSingleStep (1000.0);
    maxDepth->setValue (pfm_def->max_depth);
    maxDepth->setWrapping (TRUE);
    maxDepth->setToolTip (tr ("Set the maximum allowable depth for the PFM structure"));
    maxDepth->setWhatsThis (maxDepthText);
    maxDBoxLayout->addWidget (maxDepth);


    limBoxLayout->addWidget (maxDBox);


    QGroupBox *precBox = new QGroupBox (tr ("Precision"), this);
    QHBoxLayout *precBoxLayout = new QHBoxLayout;
    precBox->setLayout (precBoxLayout);
    precBoxLayout->setSpacing (10);

    precision = new QComboBox (this);
    precision->setToolTip (tr ("Set the PFM structure depth precision"));
    precision->setWhatsThis (precisionText);
    precision->setEditable (FALSE);
    precision->addItem ("0.01 " + tr ("(one centimeter)"));
    precision->addItem ("0.10 " + tr ("(one decimeter)"));
    precision->addItem ("1.00 " + tr ("(one meter)"));
    precBoxLayout->addWidget (precision);


    limBoxLayout->addWidget (precBox);


    pageLayout->addWidget (limBox);


    QGroupBox *areaBox = new QGroupBox (tr ("Area file"), this);
    QHBoxLayout *areaBoxLayout = new QHBoxLayout;
    areaBox->setLayout (areaBoxLayout);
    areaBoxLayout->setSpacing (10);

    area_edit = new QLineEdit (this);
    area_edit->setReadOnly (TRUE);
    area_edit->setToolTip (tr ("Area file name for this PFM"));
    area_edit->setWhatsThis (areaText);
    areaBoxLayout->addWidget (area_edit);

    area_browse = new QPushButton (tr ("Browse..."), this);
    area_browse->setToolTip (tr ("Select an area file to define the PFM area"));
    area_browse->setWhatsThis (areaBrowseText);
    connect (area_browse, SIGNAL (clicked ()), this, SLOT (slotAreaFileBrowse ()));
    areaBoxLayout->addWidget (area_browse);

    area_map = new QPushButton (tr ("Map..."), this);
    area_map->setToolTip (tr ("Create an area file using areaCheck"));
    area_map->setWhatsThis (area_mapText);
    connect (area_map, SIGNAL (clicked ()), this, SLOT (slotAreaMap ()));
    areaBoxLayout->addWidget (area_map);

    area_pfm = new QPushButton (tr ("PFM..."), this);
    area_pfm->setToolTip (tr ("Use the area in an already existing PFM structure"));
    area_pfm->setWhatsThis (area_PFMText);
    connect (area_pfm, SIGNAL (clicked ()), this, SLOT (slotAreaPFM ()));
    areaBoxLayout->addWidget (area_pfm);

    area_nsew = new QPushButton (tr ("NSEW..."), this);
    area_nsew->setToolTip (tr ("Create an area file by defining North, South, East, and West bounds"));
    area_nsew->setWhatsThis (area_nsewText);
    connect (area_nsew, SIGNAL (clicked ()), this, SLOT (slotAreaNSEW ()));
    areaBoxLayout->addWidget (area_nsew);


    pageLayout->addWidget (areaBox, 1);



    QGroupBox *optBox = new QGroupBox (tr ("Optional files"), this);
    QHBoxLayout *optBoxLayout = new QHBoxLayout;
    optBox->setLayout (optBoxLayout);
    optBoxLayout->setSpacing (10);


    QGroupBox *mosaicBox = new QGroupBox (tr ("Mosaic file"), this);
    QHBoxLayout *mosaicBoxLayout = new QHBoxLayout;
    mosaicBox->setLayout (mosaicBoxLayout);
    mosaicBoxLayout->setSpacing (10);

    mosaic_edit = new QLineEdit (this);
    mosaic_edit->setReadOnly (TRUE);
    mosaic_edit->setToolTip (tr ("Mosaic file name for this PFM"));
    mosaic_edit->setWhatsThis (mosaicText);
    mosaicBoxLayout->addWidget (mosaic_edit);

    mosaic_browse = new QPushButton (tr ("Browse..."), this);
    mosaic_browse->setToolTip (tr ("Select a mosaic file for this PFM"));
    mosaic_browse->setWhatsThis (mosaicBrowseText);
    mosaic_edit->setText (pfm_def->mosaic);
    connect (mosaic_browse, SIGNAL (clicked ()), this, SLOT (slotMosaicFileBrowse ()));
    mosaicBoxLayout->addWidget (mosaic_browse);


    optBoxLayout->addWidget (mosaicBox);


    QGroupBox *featureBox = new QGroupBox (tr ("Feature file"), this);
    QHBoxLayout *featureBoxLayout = new QHBoxLayout;
    featureBox->setLayout (featureBoxLayout);
    featureBoxLayout->setSpacing (10);

    feature_edit = new QLineEdit (this);
    feature_edit->setReadOnly (TRUE);
    feature_edit->setToolTip (tr ("Feature file name for this PFM"));
    feature_edit->setWhatsThis (featureText);
    featureBoxLayout->addWidget (feature_edit);

    feature_browse = new QPushButton (tr ("Browse..."), this);
    feature_browse->setToolTip (tr ("Select a feature file for this PFM"));
    feature_browse->setWhatsThis (featureBrowseText);
    feature_edit->setText (pfm_def->feature);
    connect (feature_browse, SIGNAL (clicked ()), this, SLOT (slotFeatureFileBrowse ()));
    featureBoxLayout->addWidget (feature_browse);


    optBoxLayout->addWidget (featureBox);


    pageLayout->addWidget (optBox, 1);


    QGroupBox *filtBox = new QGroupBox (tr ("Area filter settings"), this);
    QHBoxLayout *filtBoxLayout = new QHBoxLayout;
    filtBox->setLayout (filtBoxLayout);
    filtBoxLayout->setSpacing (10);


    QGroupBox *aBox = new QGroupBox (tr ("Apply area filter"), this);
    QHBoxLayout *aBoxLayout = new QHBoxLayout;
    aBox->setLayout (aBoxLayout);
    aBoxLayout->setSpacing (10);

    applyFilter = new QCheckBox (this);
    applyFilter->setToolTip (tr ("Apply the area filter for this PFM"));
    applyFilter->setWhatsThis (applyFilterText);
    applyFilter->setChecked (pfm_def->apply_area_filter);
    connect (applyFilter, SIGNAL (stateChanged (int)), this, SLOT (slotApplyFilterStateChanged (int)));
    aBoxLayout->addWidget (applyFilter);


    filtBoxLayout->addWidget (aBox);


    QGroupBox *dBox = new QGroupBox (tr ("Deep filter only"), this);
    QHBoxLayout *dBoxLayout = new QHBoxLayout;
    dBox->setLayout (dBoxLayout);
    dBoxLayout->setSpacing (10);

    deepFilter = new QCheckBox (this);
    deepFilter->setToolTip (tr ("Only filter values deeper than the average surface"));
    deepFilter->setWhatsThis (deepFilterText);
    deepFilter->setChecked (pfm_def->deep_filter_only);
    if (!pfm_def->apply_area_filter) deepFilter->setEnabled (FALSE);
    dBoxLayout->addWidget (deepFilter);


    filtBoxLayout->addWidget (dBox);


    QGroupBox *bBox = new QGroupBox (tr ("Bin standard deviation"), this);
    QHBoxLayout *bBoxLayout = new QHBoxLayout;
    bBox->setLayout (bBoxLayout);
    bBoxLayout->setSpacing (10);

    stdSpin = new QDoubleSpinBox (this);
    stdSpin->setDecimals (2);
    stdSpin->setRange (0.3, 3.0);
    stdSpin->setSingleStep (0.1);
    stdSpin->setValue (pfm_def->cellstd);
    stdSpin->setWrapping (TRUE);
    stdSpin->setToolTip (tr ("Set the area filter standard deviation"));
    stdSpin->setWhatsThis (stdText);
    if (!pfm_def->apply_area_filter) stdSpin->setEnabled (FALSE);
    bBoxLayout->addWidget (stdSpin);


    filtBoxLayout->addWidget (bBox);


    QGroupBox *tBox = new QGroupBox (tr ("Feature Radius"), this);
    QHBoxLayout *tBoxLayout = new QHBoxLayout;
    tBox->setLayout (tBoxLayout);
    tBoxLayout->setSpacing (10);

    featureRadius = new QDoubleSpinBox (this);
    featureRadius->setDecimals (2);
    featureRadius->setRange (0.0, 200.0);
    featureRadius->setSingleStep (10.0);
    featureRadius->setValue (pfm_def->radius);
    featureRadius->setWrapping (TRUE);
    featureRadius->setToolTip (tr ("Set the radius of the area around features to exclude from filtering"));
    featureRadius->setWhatsThis (featureRadiusText);
    if (!pfm_def->apply_area_filter) featureRadius->setEnabled (FALSE);
    tBoxLayout->addWidget (featureRadius);


    filtBoxLayout->addWidget (tBox);


    pageLayout->addWidget (filtBox, 1);


    //  Register fields.

    pfm_file_edit_field = "pfm_file_edit" + pfmIndex;
    registerField (pfm_file_edit_field, pfm_file_edit);

    area_edit_field = "area_edit" + pfmIndex;
    registerField (area_edit_field, area_edit);

    mBinSizeField = "mBinSize" + pfmIndex;
    registerField (mBinSizeField, mBinSize, "value", "valueChanged");

    gBinSizeField = "gBinSize" + pfmIndex;
    registerField (gBinSizeField, gBinSize, "value", "valueChanged");

    minDepthField = "minDepth" + pfmIndex;
    registerField (minDepthField, minDepth, "value", "valueChanged");

    maxDepthField = "maxDepth" + pfmIndex;
    registerField (maxDepthField, maxDepth, "value", "valueChanged");

    precisionField = "precision" + pfmIndex;
    registerField (precisionField, precision);

    mosaic_edit_field = "mosaic_edit" + pfmIndex;
    registerField (mosaic_edit_field, mosaic_edit);

    feature_edit_field = "feature_edit" + pfmIndex;
    registerField (feature_edit_field, feature_edit);

    applyFilterField = "applyFilter" + pfmIndex;
    registerField (applyFilterField, applyFilter);

    deepFilterField = "deepFilter" + pfmIndex;
    registerField (deepFilterField, deepFilter);

    stdSpinField = "stdSpin" + pfmIndex;
    registerField (stdSpinField, stdSpin, "value", "valueChanged");

    featureRadiusField = "featureRadius" + pfmIndex;
    registerField (featureRadiusField, featureRadius, "value", "valueChanged");


    setFields (pfmDef);
}
Example #28
0
CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
{

    setFrameStyle(QFrame::NoFrame);
    setFrameShape(QFrame::StyledPanel);
    setFrameShadow(QFrame::Sunken);

    // TODO: The following code should be enabled for OSX
    // when QTBUG-23205 is fixed
    if (!HostOsInfo::isMacHost()) {
        QGraphicsDropShadowEffect *dropShadowEffect = new QGraphicsDropShadowEffect;
        dropShadowEffect->setBlurRadius(6);
        dropShadowEffect->setOffset(2, 2);
        setGraphicsEffect(dropShadowEffect);
    }
    setAutoFillBackground(true);

    m_hueControl = new HueControl(this);
    m_colorBox = new ColorBox(this);

    QWidget *colorFrameWidget = new QWidget(this);
    QVBoxLayout* vBox = new QVBoxLayout(colorFrameWidget);
    colorFrameWidget->setLayout(vBox);
    vBox->setSpacing(0);
    vBox->setMargin(0);
    vBox->setContentsMargins(0,5,0,28);

    m_beforeColorWidget = new QFrame(colorFrameWidget);
    m_beforeColorWidget->setFixedSize(30, 18);
    m_beforeColorWidget->setAutoFillBackground(true);

    m_currentColorWidget = new QFrame(colorFrameWidget);
    m_currentColorWidget->setFixedSize(30, 18);
    m_currentColorWidget->setAutoFillBackground(true);

    vBox->addWidget(m_beforeColorWidget);
    vBox->addWidget(m_currentColorWidget);


    m_rSpinBox = new QDoubleSpinBox(this);
    m_gSpinBox = new QDoubleSpinBox(this);
    m_bSpinBox = new QDoubleSpinBox(this);
    m_alphaSpinBox = new QDoubleSpinBox(this);

    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->setSpacing(4);
    gridLayout->setVerticalSpacing(4);
    gridLayout->setMargin(4);
    setLayout(gridLayout);

    gridLayout->addWidget(m_colorBox, 0, 0, 4, 1);
    gridLayout->addWidget(m_hueControl, 0, 1, 4, 1);

    gridLayout->addWidget(colorFrameWidget, 0, 2, 2, 1);

    gridLayout->addWidget(new QLabel("R", this), 0, 3, 1, 1);
    gridLayout->addWidget(new QLabel("G", this), 1, 3, 1, 1);
    gridLayout->addWidget(new QLabel("B", this), 2, 3, 1, 1);
    gridLayout->addWidget(new QLabel("A", this), 3, 3, 1, 1);

    gridLayout->addWidget(m_rSpinBox, 0, 4, 1, 1);
    gridLayout->addWidget(m_gSpinBox, 1, 4, 1, 1);
    gridLayout->addWidget(m_bSpinBox, 2, 4, 1, 1);
    gridLayout->addWidget(m_alphaSpinBox, 3, 4, 1, 1);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);

    QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);
    QPushButton *applyButton = buttonBox->addButton(QDialogButtonBox::Apply);

    gridLayout->addWidget(buttonBox, 4, 0, 1, 2);

    resize(sizeHint());

    connect(m_colorBox, SIGNAL(colorChanged()), this, SLOT(onColorBoxChanged()));
    connect(m_alphaSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged()));
    connect(m_rSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged()));
    connect(m_gSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged()));
    connect(m_bSpinBox, SIGNAL(valueChanged(double)), this, SLOT(spinBoxChanged()));
    connect(m_hueControl, SIGNAL(hueChanged(int)), this, SLOT(onHueChanged(int)));

    connect(applyButton, SIGNAL(pressed()), this, SLOT(onAccept()));
    connect(cancelButton, SIGNAL(pressed()), this, SIGNAL(rejected()));

    m_alphaSpinBox->setMaximum(1);
    m_rSpinBox->setMaximum(1);
    m_gSpinBox->setMaximum(1);
    m_bSpinBox->setMaximum(1);
    m_alphaSpinBox->setSingleStep(0.1);
    m_rSpinBox->setSingleStep(0.1);
    m_gSpinBox->setSingleStep(0.1);
    m_bSpinBox->setSingleStep(0.1);

    m_blockUpdate = false;
}
Example #29
0
TilesetDock::TilesetDock(QWidget *parent):
    QDockWidget(parent),
    mMapDocument(nullptr),
    mTabBar(new QTabBar),
    mViewStack(new QStackedWidget),
    mToolBar(new QToolBar),
    mCurrentTile(nullptr),
    mCurrentTiles(nullptr),
    mNewTileset(new QAction(this)),
    mImportTileset(new QAction(this)),
    mExportTileset(new QAction(this)),
    mPropertiesTileset(new QAction(this)),
    mDeleteTileset(new QAction(this)),
    mEditTerrain(new QAction(this)),
    mAddTiles(new QAction(this)),
    mRemoveTiles(new QAction(this)),
    mTilesetMenuButton(new TilesetMenuButton(this)),
    mTilesetMenu(new QMenu(this)),
    mTilesetActionGroup(new QActionGroup(this)),
    mTilesetMenuMapper(nullptr),
    mEmittingStampCaptured(false),
    mSynchronizingSelection(false)
{
    setObjectName(QLatin1String("TilesetDock"));

    mTabBar->setMovable(true);
    mTabBar->setUsesScrollButtons(true);

    connect(mTabBar, SIGNAL(currentChanged(int)),
            SLOT(updateActions()));
    connect(mTabBar, SIGNAL(tabMoved(int,int)),
            this, SLOT(moveTileset(int,int)));

    QWidget *w = new QWidget(this);

    QHBoxLayout *horizontal = new QHBoxLayout;
    horizontal->setSpacing(0);
    horizontal->addWidget(mTabBar);
    horizontal->addWidget(mTilesetMenuButton);

    QVBoxLayout *vertical = new QVBoxLayout(w);
    vertical->setSpacing(0);
    vertical->setMargin(5);
    vertical->addLayout(horizontal);
    vertical->addWidget(mViewStack);

    horizontal = new QHBoxLayout;
    horizontal->setSpacing(0);
    horizontal->addWidget(mToolBar, 1);
    vertical->addLayout(horizontal);

    mNewTileset->setIcon(QIcon(QLatin1String(":images/16x16/document-new.png")));
    mImportTileset->setIcon(QIcon(QLatin1String(":images/16x16/document-import.png")));
    mExportTileset->setIcon(QIcon(QLatin1String(":images/16x16/document-export.png")));
    mPropertiesTileset->setIcon(QIcon(QLatin1String(":images/16x16/document-properties.png")));
    mDeleteTileset->setIcon(QIcon(QLatin1String(":images/16x16/edit-delete.png")));
    mEditTerrain->setIcon(QIcon(QLatin1String(":images/16x16/terrain.png")));
    mAddTiles->setIcon(QIcon(QLatin1String(":images/16x16/add.png")));
    mRemoveTiles->setIcon(QIcon(QLatin1String(":images/16x16/remove.png")));

    Utils::setThemeIcon(mNewTileset, "document-new");
    Utils::setThemeIcon(mImportTileset, "document-import");
    Utils::setThemeIcon(mExportTileset, "document-export");
    Utils::setThemeIcon(mPropertiesTileset, "document-properties");
    Utils::setThemeIcon(mDeleteTileset, "edit-delete");
    Utils::setThemeIcon(mAddTiles, "add");
    Utils::setThemeIcon(mRemoveTiles, "remove");

    connect(mNewTileset, SIGNAL(triggered()),
            SIGNAL(newTileset()));
    connect(mImportTileset, SIGNAL(triggered()),
            SLOT(importTileset()));
    connect(mExportTileset, SIGNAL(triggered()),
            SLOT(exportTileset()));
    connect(mPropertiesTileset, SIGNAL(triggered()),
            SLOT(editTilesetProperties()));
    connect(mDeleteTileset, SIGNAL(triggered()),
            SLOT(removeTileset()));
    connect(mEditTerrain, SIGNAL(triggered()),
            SLOT(editTerrain()));
    connect(mAddTiles, SIGNAL(triggered()),
            SLOT(addTiles()));
    connect(mRemoveTiles, SIGNAL(triggered()),
            SLOT(removeTiles()));

    mToolBar->addAction(mNewTileset);
    mToolBar->setIconSize(QSize(16, 16));
    mToolBar->addAction(mImportTileset);
    mToolBar->addAction(mExportTileset);
    mToolBar->addAction(mPropertiesTileset);
    mToolBar->addAction(mDeleteTileset);
    mToolBar->addAction(mEditTerrain);
    mToolBar->addAction(mAddTiles);
    mToolBar->addAction(mRemoveTiles);

    mZoomable = new Zoomable(this);
    mZoomComboBox = new QComboBox;
    mZoomable->connectToComboBox(mZoomComboBox);
    horizontal->addWidget(mZoomComboBox);

    connect(mViewStack, &QStackedWidget::currentChanged,
            this, &TilesetDock::updateCurrentTiles);
    connect(mViewStack, &QStackedWidget::currentChanged,
            this, &TilesetDock::currentTilesetChanged);

    connect(TilesetManager::instance(), SIGNAL(tilesetChanged(Tileset*)),
            this, SLOT(tilesetChanged(Tileset*)));

    connect(DocumentManager::instance(), SIGNAL(documentAboutToClose(MapDocument*)),
            SLOT(documentAboutToClose(MapDocument*)));

    mTilesetMenuButton->setMenu(mTilesetMenu);
    connect(mTilesetMenu, SIGNAL(aboutToShow()), SLOT(refreshTilesetMenu()));

    setWidget(w);
    retranslateUi();
    setAcceptDrops(true);
    updateActions();
}
Example #30
0
//
// Contributors page
//
ContributorsPage::ContributorsPage(Context *context, QDir home) : context(context), home(home)
{
    QStringList contributors;
    contributors.append("Alejandro Martinez");
    contributors.append("Andrew Bryson");
    contributors.append("Andy Froncioni");
    contributors.append("Austin Roach");
    contributors.append("Berend De Schouwer");
    contributors.append("Bruno Assis");
    contributors.append("Chris Cleeland");
    contributors.append("Claus Assmann");
    contributors.append("Dag Gruneau");
    contributors.append("Damien Grauser");
    contributors.append("Darren Hague");
    contributors.append("Dave Waterworth");
    contributors.append("Dean Junk");
    contributors.append("Eric Brandt");
    contributors.append("Eric Murray");
    contributors.append("Frank Zschockelt");
    contributors.append("Gareth Coco");
    contributors.append("Greg Lonnon");
    contributors.append("Ilja Booij");
    contributors.append("Jaime Jofre");
    contributors.append("Jamie Kimberley");
    contributors.append("Jim Ley");
    contributors.append("John Ehrlinger");
    contributors.append("Jon Escombe");
    contributors.append("Josef Gebel");
    contributors.append("Julian Baumgartner");
    contributors.append("Julian Simioni");
    contributors.append("Justin Knotzke");
    contributors.append("Keisuke Yamaguchi");
    contributors.append("Ken Sallot");
    contributors.append("Luke NRG");
    contributors.append("Magnus Gille");
    contributors.append("Marc Boudreau");
    contributors.append("Mark Liversedge");
    contributors.append("Mark Rages");
    contributors.append("Mitsukuni Sato");
    contributors.append("Ned Harding");
    contributors.append("Okano Takayoshi");
    contributors.append("Patrick McNerthney");
    contributors.append("Rainer Clasen");
    contributors.append("Robb Romans");
    contributors.append("Robert Carlsen");
    contributors.append("Roberto Massa");
    contributors.append("Ron Alford");
    contributors.append("Satoru Kurashiki");
    contributors.append("Sean Rhea");
    contributors.append("Steven Gribble");
    contributors.append("Thomas Weichmann");
    contributors.append("Tilman Schmiedeberg");
    contributors.append("Walter B&#252;rki");

    QString contributorsTable = "<center><table><tr>";
    for (int i=0;i<contributors.count();i++){
        contributorsTable.append("<td><center>"+contributors.at(i)+"</center></td>");
        if ((i+1) % 3 == 0)
            contributorsTable.append("</tr><tr>");
    }
    contributorsTable.append("</tr></table></center>");

    QLabel *text;
    text=new QLabel(this);
    text->setContentsMargins(0,0,0,0);
    text->setText(contributorsTable);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->addWidget(text);

    setLayout(mainLayout);
}