KisColorSelectorNgDockerWidget::KisColorSelectorNgDockerWidget(QWidget *parent) :
    QWidget(parent),
    m_colorHistoryAction(0),
    m_commonColorsAction(0),
    m_verticalColorPatchesLayout(0),
    m_horizontalColorPatchesLayout(0),
    m_canvas(0)
{
    setAutoFillBackground(true);

    m_colorSelectorContainer = new KisColorSelectorContainer(this);
    m_colorHistoryWidget = new KisColorHistory(this);
    m_commonColorsWidget = new KisCommonColors(this);

    //default settings
    //remember to also change the default in the ui file

    //shade selector

    //layout
    m_verticalColorPatchesLayout = new QHBoxLayout();
    m_verticalColorPatchesLayout->setSpacing(0);
    m_verticalColorPatchesLayout->setMargin(0);
    m_verticalColorPatchesLayout->addWidget(m_colorSelectorContainer);

    m_horizontalColorPatchesLayout = new QVBoxLayout(this);
    m_horizontalColorPatchesLayout->setSpacing(0);
    m_horizontalColorPatchesLayout->setMargin(0);
    m_horizontalColorPatchesLayout->addLayout(m_verticalColorPatchesLayout);

    updateLayout();

    connect(m_colorSelectorContainer, SIGNAL(openSettings()), this, SLOT(openSettings()));

    //emit settingsChanged() if the settings are changed in krita preferences
    KisPreferenceSetRegistry *preferenceSetRegistry = KisPreferenceSetRegistry::instance();
    KisColorSelectorSettingsFactory* factory =
            dynamic_cast<KisColorSelectorSettingsFactory*>(preferenceSetRegistry->get("KisColorSelectorSettingsFactory"));
    Q_ASSERT(factory);
    connect(&(factory->repeater), SIGNAL(settingsUpdated()), this, SIGNAL(settingsChanged()), Qt::UniqueConnection);
    connect(this,     SIGNAL(settingsChanged()), this,                     SLOT(updateLayout()), Qt::UniqueConnection);
    connect(this,     SIGNAL(settingsChanged()), m_commonColorsWidget,     SLOT(updateSettings()), Qt::UniqueConnection);
    connect(this,     SIGNAL(settingsChanged()), m_colorHistoryWidget,     SLOT(updateSettings()), Qt::UniqueConnection);
    connect(this,     SIGNAL(settingsChanged()), m_colorSelectorContainer, SIGNAL(settingsChanged()), Qt::UniqueConnection);
    connect(this,     SIGNAL(settingsChanged()), this,                     SLOT(update()), Qt::UniqueConnection);


    emit settingsChanged();

    m_colorHistoryAction = new QAction("Show color history", this);
    m_colorHistoryAction->setShortcut(QKeySequence(tr("H")));
    connect(m_colorHistoryAction, SIGNAL(triggered()), m_colorHistoryWidget, SLOT(showPopup()), Qt::UniqueConnection);


    m_commonColorsAction = new QAction("Show common colors", this);
    m_commonColorsAction->setShortcut(QKeySequence(tr("U")));
    connect(m_commonColorsAction, SIGNAL(triggered()), m_commonColorsWidget, SLOT(showPopup()), Qt::UniqueConnection);

}
예제 #2
0
View::View(VideoPlayer* player, Screen* screen) :
    QWidget(screen),
    ui(new Ui::View),
    overlayUi(new Ui::ViewOverlay),
    screen(screen),
    player(player),
    overlay(new QWidget),
    isMovable(false),
    awesome(0)
{
    // setup UI
    ui->setupUi(this);
    overlayUi->setupUi(overlay);

    overlay->setParent(this);

    ui->zoomedLabel->hide();

    QVBoxLayout* layout = new QVBoxLayout;
    ui->video->setLayout(layout);

    player->setWidget(ui->video);

    awesome = new QtAwesome(this);
    awesome->initFontAwesome();
    awesome->setDefaultOption("color", QColor(255,255,255));
    awesome->setDefaultOption("color-disabled", QColor(127,127,127));
    awesome->setDefaultOption("color-active", QColor(255,255,255));
    awesome->setDefaultOption("color-selected", QColor(255,255,255));

    ui->moveButton->setIcon(awesome->icon(fa::arrows));
    ui->settingsButton->setIcon(awesome->icon(fa::cog));
    ui->zoomButton->setIcon(awesome->icon(fa::expand));
    ui->removeButton->setIcon(awesome->icon(fa::times));

    overlayUi->moveUpButton->setIcon(awesome->icon(fa::arrowcircleup));
    overlayUi->moveDownButton->setIcon(awesome->icon(fa::arrowcircledown));
    overlayUi->moveLeftButton->setIcon(awesome->icon(fa::arrowcircleleft));
    overlayUi->moveRightButton->setIcon(awesome->icon(fa::arrowcircleright));

    connect(ui->moveButton, SIGNAL(toggled(bool)), this, SLOT(setMovable(bool)));
    connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(openSettings()));

    connect(overlayUi->settingsButton, SIGNAL(clicked()), this, SLOT(openSettings()));

    connect(ui->zoomButton, SIGNAL(toggled(bool)), this, SLOT(setZoomed(bool)));
    connect(ui->removeButton, SIGNAL(clicked()), this, SIGNAL(removed()));
    connect(overlayUi->moveUpButton, SIGNAL(clicked()), this, SIGNAL(movedUp()));
    connect(overlayUi->moveDownButton, SIGNAL(clicked()), this, SIGNAL(movedDown()));
    connect(overlayUi->moveLeftButton, SIGNAL(clicked()), this, SIGNAL(movedLeft()));
    connect(overlayUi->moveRightButton, SIGNAL(clicked()), this, SIGNAL(movedRight()));
}
예제 #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    iTrytoClose = false;
    iDownloader = new FileDownloader(this);
    iAudioExtractor = new AudioExtractor(this);
    ui->setupUi(this);
    ui->progressBar->setMinimum(0);
    ui->progressBar->setMaximum(100);
    ui->progressBar->setValue(0);
    connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startDownload()));
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload()));
    connect(iDownloader, SIGNAL(downloadProgress(int)), this, SLOT(updateProgress(int)));
    connect(iDownloader, SIGNAL(stateChanged(DownloadState)), this, SLOT(stateChanged(DownloadState)));
    connect(ui->extractButton, SIGNAL(clicked()), this, SLOT(extractAudio()));
    connect(ui->codecButton, SIGNAL(clicked()), this, SLOT(codecInfo()));
    connect(ui->encodeButton, SIGNAL(clicked()), this, SLOT(encodeX264()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeApp()));
    connect(iDownloader, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&)));
    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearInfoText()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(openSettings()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAbout()));
    connect(iAudioExtractor, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&)));
    connect(iAudioExtractor, SIGNAL(extractStateChanged(int)), this, SLOT(extractStateChanged(int)));
    connect(iAudioExtractor, SIGNAL(encodeStateChanged(int)), this, SLOT(extractStateChanged(int)));
    ui->videoIdEdit->setText("nVjsGKrE6E8");
}
예제 #4
0
파일: LaunchPad.cpp 프로젝트: loh-tar/filu
void LaunchPad::saveSettings()
{
  SettingsFile* sfile = openSettings();

  ButtonPad::saveSettings();

  int btnCount = mButtons.buttons().size();

  // Don't save the 'I'll be back' info
  if(btnCount < 2 and mButtons.button(0)->text() == "Echo")
  {
    sfile->beginGroup(QString::number(0));
    sfile->set("Tip", cDummyTip);
    sfile->endGroup();
  }

  for(int i = 0; i < btnCount; ++i)
  {
    sfile->beginGroup(QString::number(i));

    sfile->set("Command",    mCommands.at(i));
    sfile->set("SymbolType", mSymbolTypes.at(i));
    sfile->set("AllMarkets", mMultis.at(i));

    sfile->endGroup();
  }

  closeSettings();
}
예제 #5
0
파일: systray.cpp 프로젝트: jplsek/puush-qt
void Systray::createActions()
{
    myAccountAction = new QAction(tr("&My Account"));
    connect(myAccountAction, SIGNAL(triggered()), this, SLOT(openAccount()));

    uploadFileAction = new QAction(tr("Upload &File..."));
    connect(uploadFileAction, SIGNAL(triggered()), this, SLOT(uploadFile()));

    uploadClipboardAction = new QAction(tr("Upload &Clipboard"));
    connect(uploadClipboardAction, SIGNAL(triggered()), this, SLOT(uploadClipboard()));

    fullScreenAction = new QAction(tr("Capture &Desktop"));
    connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(fullScreenScreenshot()));

    selectAreaAction = new QAction(tr("Capture &Area"));
    connect(selectAreaAction, SIGNAL(triggered()), this, SLOT(selectAreaScreenshot()));

    activeAction = new QAction(tr("Capture Current &Window"));
    connect(activeAction, SIGNAL(triggered()), this, SLOT(activeWindowScreenshotTimed()));

    historyMenu = new QMenu(tr("&History"));

    settingsAction = new QAction(tr("&Settings..."));
    connect(settingsAction, SIGNAL(triggered()), this, SLOT(openSettings()));

    quitAction = new QAction(tr("&Quit"));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    openSaveDirectoryAction = new QAction(tr("&Open Screenshot Directory"));
    connect(openSaveDirectoryAction, SIGNAL(triggered()), this, SLOT(openSaveDirectory()));
}
void MainWindow::createActions()
{
    openSettingsAct = new QAction(tr("&Open Application Settings..."), this);
    openSettingsAct->setShortcuts(QKeySequence::Open);
    connect(openSettingsAct, SIGNAL(triggered()), this, SLOT(openSettings()));

    openIniFileAct = new QAction(tr("Open I&NI File..."), this);
    openIniFileAct->setShortcut(tr("Ctrl+N"));
    connect(openIniFileAct, SIGNAL(triggered()), this, SLOT(openIniFile()));

    openPropertyListAct = new QAction(tr("Open Mac &Property List..."), this);
    openPropertyListAct->setShortcut(tr("Ctrl+P"));
    connect(openPropertyListAct, SIGNAL(triggered()),
            this, SLOT(openPropertyList()));

    openRegistryPathAct = new QAction(tr("Open Windows &Registry Path..."),
                                      this);
    openRegistryPathAct->setShortcut(tr("Ctrl+G"));
    connect(openRegistryPathAct, SIGNAL(triggered()),
            this, SLOT(openRegistryPath()));

    refreshAct = new QAction(tr("&Refresh"), this);
    refreshAct->setShortcut(tr("Ctrl+R"));
    refreshAct->setEnabled(false);
    connect(refreshAct, SIGNAL(triggered()), settingsTree, SLOT(refresh()));

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    autoRefreshAct = new QAction(tr("&Auto-Refresh"), this);
    autoRefreshAct->setShortcut(tr("Ctrl+A"));
    autoRefreshAct->setCheckable(true);
    autoRefreshAct->setEnabled(false);
    connect(autoRefreshAct, SIGNAL(triggered(bool)),
            settingsTree, SLOT(setAutoRefresh(bool)));
    connect(autoRefreshAct, SIGNAL(triggered(bool)),
            refreshAct, SLOT(setDisabled(bool)));

    fallbacksAct = new QAction(tr("&Fallbacks"), this);
    fallbacksAct->setShortcut(tr("Ctrl+F"));
    fallbacksAct->setCheckable(true);
    fallbacksAct->setEnabled(false);
    connect(fallbacksAct, SIGNAL(triggered(bool)),
            settingsTree, SLOT(setFallbacksEnabled(bool)));

    aboutAct = new QAction(tr("&About"), this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

#ifndef Q_WS_MAC
    openPropertyListAct->setEnabled(false);
#endif
#ifndef Q_WS_WIN
    openRegistryPathAct->setEnabled(false);
#endif
}
예제 #7
0
GM_Icon::GM_Icon(GM_Manager* manager, QupZilla* window)
    : ClickableLabel(window)
    , m_manager(manager)
    , m_window(window)
{
    setCursor(Qt::PointingHandCursor);
    setPixmap(QPixmap(":gm/data/icon16.png"));
    setToolTip(tr("Open GreaseMonkey settings"));

    connect(this, SIGNAL(clicked(QPoint)), this, SLOT(openSettings()));
}
예제 #8
0
파일: systray.cpp 프로젝트: jplsek/puush-qt
/**
 * Checks if the user is logged in, and if not, display the log in window.
 * @brief Systray::isLoggedIn
 * @return
 */
bool Systray::isLoggedIn(bool msg = true)
{
    if (s.value(Settings::ACCOUNT_API_KEY) != "")
        return true;

    if (msg) {
        trayIcon->showMessage("puush-qt", tr("You are not logged into Puush..."), QSystemTrayIcon::Warning);
        openSettings(2);
    }

    return false;
}
예제 #9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_idRecord = -1;

    connect(ui->action_File_Create, SIGNAL(triggered()), this, SLOT(createKhollo()));
    connect(ui->action_File_Open, SIGNAL(triggered()), this, SLOT(openKhollo()));
    connect(ui->action_File_Settings, SIGNAL(triggered()), this, SLOT(openSettings()));
    connect(ui->action_File_Quit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->action_DB_Students, SIGNAL(triggered()), this, SLOT(openStudentsManager()));
    connect(ui->action_DB_Groups, SIGNAL(triggered()), this, SLOT(openGroupsManager()));
    connect(ui->action_DB_Subjects, SIGNAL(triggered()), this, SLOT(openSubjectsManager()));
    connect(ui->action_DB_Kholleurs, SIGNAL(triggered()), this, SLOT(openKholleursManager()));
    connect(ui->action_Schedule_Students_Groups, SIGNAL(triggered()), this, SLOT(openUsersGroupsManager()));
    connect(ui->action_Schedule_Timetable, SIGNAL(triggered()), this, SLOT(openCoursesManager()));
    connect(ui->action_Schedule_Swapping_Groups, SIGNAL(triggered()), this, SLOT(openGroupsSwappingsManager()));
    connect(ui->action_Schedule_Tribes, SIGNAL(triggered()), this, SLOT(openTribesManager()));
    connect(ui->action_Schedule_Kholles, SIGNAL(triggered()), this, SLOT(openTimeslotsManager()));
    connect(ui->action_Schedule_Events, SIGNAL(triggered()), this, SLOT(openEventsManager()));
    connect(ui->action_Kholles_Interface, SIGNAL(triggered()), this, SLOT(openInterface()));
    connect(ui->action_Kholles_Generate, SIGNAL(triggered()), this, SLOT(openKholloscope()));
    connect(ui->action_Kholles_Historic, SIGNAL(triggered()), this, SLOT(openReview()));
    connect(ui->action_Kholles_LastChanges, SIGNAL(triggered()), this, SLOT(openLastChanges()));
    connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(openHelp()));
    connect(ui->action_AboutIt, SIGNAL(triggered()), this, SLOT(openAboutIt()));

    connect(this, SIGNAL(triggerInterface(QDate,int)), this, SLOT(openInterfaceWithDate(QDate,int)));

    m_shortcutNotepad = Notepad::shortcut();
    this->addAction(m_shortcutNotepad);

    updateWindow();

#ifndef Q_OS_MAC
    // Ouvrir directement un fichier sur OS autre que Mac
    args = QCoreApplication::arguments();
    if(args.count() > 1) {
        QString suffix = QFileInfo(args[1]).suffix().toUpper();
        // Check the file suffix
        if(suffix == "KSCOPE") {
            openKhollo(args[1]); // Try to open the file
        } else {
            QMessageBox::critical(this, "Fichier non pris en charge", "Erreur : Fichier " + QFileInfo(args[1]).suffix().toUpper() + " non pris en charge.");
        }
    }
#endif
}
예제 #10
0
파일: config.cpp 프로젝트: Tasssadar/Lorris
Config::Config()
{
    // Check defaults
    Q_ASSERT(sizeof_array(keys_quint32)   == CFG_QUINT32_NUM);
    Q_ASSERT(sizeof_array(def_quint32)    == CFG_QUINT32_NUM);
    Q_ASSERT(sizeof_array(keys_string)    == CFG_STRING_NUM);
    Q_ASSERT(sizeof_array(def_string)     == CFG_STRING_NUM);
    Q_ASSERT(sizeof_array(keys_bool)      == CFG_BOOL_NUM);
    Q_ASSERT(sizeof_array(def_bool)       == CFG_BOOL_NUM);
    Q_ASSERT(sizeof_array(keys_variant)   == CFG_VARIANT_NUM);
    Q_ASSERT(sizeof_array(def_float)      == CFG_FLOAT_NUM);
    Q_ASSERT(sizeof_array(keys_float)     == CFG_FLOAT_NUM);

    openSettings();
}
예제 #11
0
//================
//     PRIVATE
//================
void RSSFeedPlugin::updateOptionsMenu(){
  optionsMenu->clear();
  optionsMenu->addAction(LXDG::findIcon("list-add",""), tr("Add RSS Feed"), this, SLOT(openFeedNew()) );
  optionsMenu->addAction(LXDG::findIcon("help-about",""), tr("View Feed Details"), this, SLOT(openFeedInfo()) );
  optionsMenu->addAction(LXDG::findIcon("configure",""), tr("Settings"), this, SLOT(openSettings()) );
  optionsMenu->addSeparator();
  optionsMenu->addAction(LXDG::findIcon("download",""), tr("Update Feeds Now"), this, SLOT(resyncFeeds()) );

  presetMenu->clear();
  QStringList feeds = LOS::RSSFeeds();
  feeds << tr("Lumina Desktop RSS")+"::::http://lumina-desktop.org/?feed=rss2";
  feeds.sort();
  for(int i=0; i<feeds.length(); i++){ 
    QAction *tmp = presetMenu->addAction(feeds[i].section("::::",0,0) );
    tmp->setWhatsThis( feeds[i].section("::::",1,-1) );
  }
}
예제 #12
0
ClientServer::ClientServer(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_openAction(new QAction(this)), m_settingsAction(new QAction(this)),
  m_molecule(NULL), m_controller(NULL), m_communicator(NULL), m_channel(NULL)
{
  m_openAction->setEnabled(true);
  m_openAction->setText("Open Molecule");
  m_actions.append(m_openAction);

  m_settingsAction->setEnabled(true);
  m_settingsAction->setText("Settings");
  m_actions.append(m_settingsAction);

  connect(m_openAction, SIGNAL(triggered()), SLOT(openFile()));
  connect(m_settingsAction, SIGNAL(triggered()), SLOT(openSettings()));
  connect(this, SIGNAL(connectionError()), SLOT(onConnectionError()));
}
예제 #13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QCoreApplication::setOrganizationName("Bending software");
    QCoreApplication::setApplicationName("Beta addon downloader");

    _model = new BamModel;
    ui->addonList->setModel(_model);
    downloadList();

    connect(ui->actionSettings, SIGNAL(triggered()),
            this, SLOT(openSettings()));
    connect(ui->runGame, SIGNAL(clicked()),
            this, SLOT(runGame()));
}
예제 #14
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: openSettings(); break;
        case 1: openIniFile(); break;
        case 2: openPropertyList(); break;
        case 3: openRegistryPath(); break;
        case 4: about(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
예제 #15
0
파일: systray.cpp 프로젝트: jplsek/puush-qt
void Systray::doDoubleClickAction()
{
    if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::OPEN_UPLOADS)) {
        openSaveDirectory();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::OPEN_SETTINGS)) {
        openSettings();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::UPLOAD_FILE)) {
        uploadFile();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::CAPTURE_DESKTOP)) {
        fullScreenScreenshot();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::CAPTURE_AREA)) {
        selectAreaScreenshot();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::CAPTURE_WINDOW)) {
        activeWindowScreenshotTimed();
    } else if (s.radioValueIs(Settings::TRAY_CLICK_ACTION, Settings::OPEN_ACCOUNT)) {
        openAccount();
    } else {
        qDebug() << "Option not recognized";
    }
}
예제 #16
0
Raspbed::Raspbed(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::Raspbed), bed() {
    ui->setupUi(this);
    settings.loadSettings();

    setupDisplay();

    settingsMenu = ui->menuBar->addMenu("Menu");
    settingsAction = settingsMenu->addAction("Settings");

    connect(settingsAction, SIGNAL(triggered()), this, SLOT(openSettings()));

    selectedButton = ui->headUpButton;
    selected = false;
    callInProgress = false;
    numRightClicks = 0;
    numLeftClicks = 0;

    resetBed();
}
예제 #17
0
파일: LaunchPad.cpp 프로젝트: loh-tar/filu
void LaunchPad::loadSettings()
{
  SettingsFile* sfile = openSettings();

  ButtonPad::loadSettings();

  for(int i = 0; i < mButtons.buttons().size(); ++i)
  {
    sfile->beginGroup(QString::number(i));

    mCommands.append(sfile->getST("Command"));
    mSymbolTypes.append(sfile->getST("SymbolType"));
    mMultis.append(sfile->getBL("AllMarkets", false));

    sfile->endGroup();
  }

  closeSettings();

  return;
}
예제 #18
0
PanelPage::PanelPage(QGraphicsItem *parent): MApplicationPage(parent)
{
    m_panelmgr = new McaPanelManager(this);
    m_panelmgr->setCategories(QStringList() << "email" << "social" << "im");
    m_panelmgr->initialize("sample");

    m_frozen = false;
    m_hiding = false;

    QGraphicsLinearLayout *linear = new QGraphicsLinearLayout(Qt::Vertical, centralWidget());

    QGraphicsLinearLayout *toolbar = new QGraphicsLinearLayout(Qt::Horizontal);
    linear->addItem(toolbar);

    MButton *button = new MButton("Search");
    connect(button, SIGNAL(clicked()), this, SLOT(openSearch()));
    toolbar->addItem(button);

    button = new MButton("Settings");
    connect(button, SIGNAL(clicked()), this, SLOT(openSettings()));
    toolbar->addItem(button);

    m_freezeButton = new MButton("Freeze");
    connect(m_freezeButton, SIGNAL(clicked()), this, SLOT(toggleFreeze()));
    toolbar->addItem(m_freezeButton);

    m_hideButton = new MButton("Mode: Default");
    connect(m_hideButton, SIGNAL(clicked()), this, SLOT(toggleHide()));
    toolbar->addItem(m_hideButton);

    MList *list = new MList;
    linear->addItem(list);
    list->setPreferredWidth(800);
    list->setItemModel(m_panelmgr->feedModel());
    PanelCellCreator *cellCreator = new PanelCellCreator;
    cellCreator->m_page = this;
    list->setCellCreator(cellCreator);
}
예제 #19
0
파일: mainwindow.cpp 프로젝트: Starbow/eros
MainWindow::MainWindow(Eros *eros, QWidget *parent )
	: QMainWindow(parent)
{

	QFontDatabase::addApplicationFont(":/font/NotoSans-Regular");
	QFontDatabase::addApplicationFont(":/font/NotoSans-Bold");
	QFontDatabase::addApplicationFont(":/font/NotoSans-Italic");
	QFontDatabase::addApplicationFont(":/font/NotoSans-BoldItalic");
	QFontDatabase::addApplicationFont(":/font/Gobold");
	QFontDatabase::addApplicationFont(":/font/Gobold-bold");
	QFontDatabase::addApplicationFont(":/font/Gobold-thin");


	QFile version(":/data/version_info");
	if(!version.open(QIODevice::ReadOnly))
	{
		this->local_version_ = 1;
	}
	else
	{
		QByteArray data = version.readAll();
		QStringList tokens = QString::fromUtf8(data).split('|');
		this->local_version_ = tokens[0].toInt();
		version.close();
	}
	
	ui.setupUi(this);
	ui.centralWidget->setMouseTracking(true);
	this->setWindowTitle(tr("Alpha Version %1").arg(this->local_version_));

	setUiEnabled(false);
	this->eros_ = eros;
	this->config_ = new Config(this);
	this->connection_timer_ = new QTimer(this);
	this->matchmaking_timer_ = new QTimer(this);
	this->matchmaking_timer_->setInterval(500);
	this->matchmaking_start_ = new QTime();
	this->matchmaking_result_time_ = new QTime();
	this->long_process_start_time_ = new QTime();
	this->watcher_ = new DirectoryWatcher(this);
	this->watches_ = QList<DirectoryWatch*>();
	this->update_checker_nam_ = new QNetworkAccessManager(this);
	this->update_timer_ = new QTimer(this);
	this->long_process_timer_ = new QTimer(this);
	this->tray_icon_ = new QSystemTrayIcon(this);
	this->tray_icon_menu_ = new QMenu(this);
	this->preview_loader_nam_ = new QNetworkAccessManager(this);
	this->preview_cache_ = QMap<QString, QPixmap*>();
	this->upload_queue_ = QMap<QString, QTime*>();
	this->upload_queue_timer_ = new QTimer(this);

	tray_icon_action_show_ = new QAction("Hide Eros", this);
	tray_icon_action_close_ = new QAction("Close Eros", this);


	QObject::connect(tray_icon_action_show_, SIGNAL(triggered()), this, SLOT(toggleWindow()));
    QObject::connect(tray_icon_action_close_, SIGNAL(triggered()), qApp, SLOT(quit()));
	QObject::connect(this->tray_icon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));


	this->tray_icon_->setIcon(QIcon(":/img/client/icons/icon_32x32"));
	this->tray_icon_menu_->addAction(tray_icon_action_show_);
	this->tray_icon_menu_->addAction(tray_icon_action_close_);
	this->tray_icon_->setContextMenu(this->tray_icon_menu_);

#if !defined(Q_OS_MAC)
    title_bar_ = ErosTitleBar::addToLayout(this, ui.verticalLayout);
    title_bar_->setMenu(this->tray_icon_menu_);
#endif



	// File watcher
	QObject::connect(this->watcher_, SIGNAL(added(const QString &, const QString &)), this, SLOT(fileAdded(const QString &, const QString&)));

	// Update checker
	QObject::connect(update_checker_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateCheckerFinished(QNetworkReply*)));
	QObject::connect(this->update_timer_, SIGNAL(timeout()), this, SLOT(updateCheckerTimerWorker()));

	//Preview loader
	QObject::connect(preview_loader_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(previewDownloadFinished(QNetworkReply*)));

	// Set up Eros signals
	/// Eros Signals
	QObject::connect(eros_, SIGNAL(stateChanged(ErosState)), this, SLOT(erosStateChanged(ErosState)));
	QObject::connect(eros_, SIGNAL(connectionError(QAbstractSocket::SocketError, const QString)), this, SLOT(erosConnectionError(QAbstractSocket::SocketError, const QString)));
	QObject::connect(eros_, SIGNAL(connected()), this, SLOT(erosConnected()));
	QObject::connect(eros_, SIGNAL(disconnected()), this, SLOT(erosDisconnected()));
	QObject::connect(eros_, SIGNAL(authenticationFailed()), this, SLOT(erosAuthenticationFailed()));
	QObject::connect(eros_, SIGNAL(alreadyLoggedIn()), this, SLOT(erosAlreadyLoggedIn()));
	QObject::connect(eros_, SIGNAL(broadcastAlert(const QString, int)), this, SLOT(erosBroadcastAlert(const QString, int)));
	QObject::connect(eros_, SIGNAL(chatRoomAdded(ChatRoom*)), this, SLOT(erosChatRoomAdded(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomRemoved(ChatRoom*)), this, SLOT(erosChatRoomRemoved(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomJoined(ChatRoom*)), this, SLOT(erosChatRoomJoined(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomLeft(ChatRoom*)), this, SLOT(erosChatRoomLeft(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatMessageReceieved(User*, const QString)), this, SLOT(erosChatMessageReceieved(User*, const QString)));
	QObject::connect(eros_, SIGNAL(localUserUpdated(LocalUser*)), this, SLOT(erosLocalUserUpdated(LocalUser*)));
	QObject::connect(eros_, SIGNAL(matchmakingStateChanged(ErosMatchmakingState)), this, SLOT(erosMatchmakingStateChanged(ErosMatchmakingState)));
	QObject::connect(eros_, SIGNAL(matchmakingMatchFound(MatchmakingMatch *)), this, SLOT(erosMatchmakingMatchFound(MatchmakingMatch *)));
	//QObject::connect(eros_, SIGNAL(regionStatsUpdated(ErosRegion, int)), this, SLOT(erosRegionStatsUpdated(ErosRegion, int)));
	QObject::connect(eros_, SIGNAL(statsUpdated(int, int)), this, SLOT(erosStatsUpdated(int, int)));
	QObject::connect(eros_, SIGNAL(replayUploadError(ErosError)), this, SLOT(erosReplayUploadError(ErosError)));
	QObject::connect(eros_, SIGNAL(replayUploaded()), this, SLOT(erosReplayUploaded()));
	QObject::connect(eros_, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(erosUploadProgress(qint64, qint64)));
	
	QObject::connect(eros_, SIGNAL(longProcessStateChanged(ErosLongProcessState)), this, SLOT(erosLongProcessStateChanged(ErosLongProcessState)));
	QObject::connect(eros_, SIGNAL(drawRequested()), this, SLOT(erosDrawRequested()));
	QObject::connect(eros_, SIGNAL(drawRequestFailed()), this, SLOT(erosDrawRequestFailed()));
	QObject::connect(eros_, SIGNAL(noShowRequested()), this, SLOT(erosNoShowRequested()));
	QObject::connect(eros_, SIGNAL(noShowRequestFailed()), this, SLOT(erosNoShowRequestFailed()));
	QObject::connect(eros_, SIGNAL(acknowledgeLongProcessFailed()), this, SLOT(erosAcknowledgeLongProcessFailed()));
	QObject::connect(eros_, SIGNAL(acknowledgedLongProcess()), this, SLOT(erosAcknowledgedLongProcess()));

	QObject::connect(eros_, SIGNAL(vetoesUpdated()), this, SLOT(erosVetoesUpdated()));
	QObject::connect(eros_, SIGNAL(toggleVetoFailed(Map*,ErosError)), this, SLOT(erosToggleVetoFailed(Map*,ErosError)));


	/// Eros Slots
	QObject::connect(this, SIGNAL(connectToEros(const QString, const QString, const QString)), eros_, SLOT(connectToEros(const QString, const QString, const QString)));
	QObject::connect(this, SIGNAL(disconnectFromEros()), eros_, SLOT(disconnectFromEros()));
	QObject::connect(ui.btnRefreshChats, SIGNAL(clicked()), eros_, SLOT(refreshChatRooms()));
	QObject::connect(this, SIGNAL(joinChatRoom(ChatRoom *, const QString)), eros_, SLOT(joinChatRoom(ChatRoom *, const QString)));
	QObject::connect(this, SIGNAL(leaveChatRoom(ChatRoom *)), eros_, SLOT(leaveChatRoom(ChatRoom *)));

	QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegion, int)), eros_, SLOT(queueMatchmaking(ErosRegion, int)));
	QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegionList, int)), eros_, SLOT(queueMatchmaking(ErosRegionList, int)));
	QObject::connect(this, SIGNAL(dequeueMatchmaking()), eros_, SLOT(dequeueMatchmaking()));
    QObject::connect(this, SIGNAL(forfeitMatchmaking()), eros_, SLOT(forfeitMatchmaking()));

	QObject::connect(this, SIGNAL(uploadReplay(QIODevice*)), eros_, SLOT(uploadReplay(QIODevice*)));
	QObject::connect(this, SIGNAL(uploadReplay(const QString)), eros_, SLOT(uploadReplay(const QString)));

	QObject::connect(this, SIGNAL(requestDraw()), eros_, SLOT(requestDraw()));
	QObject::connect(this, SIGNAL(requestNoShow()), eros_, SLOT(requestNoShow()));
	QObject::connect(this, SIGNAL(acknowledgeLongProcess(bool)), eros_, SLOT(acknowledgeLongProcess(bool)));

	QObject::connect(this, SIGNAL(toggleVeto(Map*)), eros_, SLOT(toggleVeto(Map*)));
	


	// timers
	QObject::connect(this->connection_timer_, SIGNAL(timeout()), this, SLOT(connectionTimerWorker()));
	QObject::connect(this->matchmaking_timer_, SIGNAL(timeout()), this, SLOT(matchmakingTimerWorker()));
	QObject::connect(this->long_process_timer_, SIGNAL(timeout()), this, SLOT(longProcessTimerWorker()));
	QObject::connect(this->upload_queue_timer_, SIGNAL(timeout()), this, SLOT(uploadTimerWorker()));

	this->long_process_timer_->setInterval(250);

	// UI Stuff
	settings_window_ = nullptr;
	bnetsettings_window_ = nullptr;

	// Remove the close box from the first 2 tabs.
    // On mac it's LeftSide. Assuming RightSide causes a nullptr.

	for (int i = 0; i < 3; i++)
	{
		QWidget *tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::RightSide);
		if (tab != nullptr)
			tab->resize(0, 0);

		tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::LeftSide);
		if (tab != nullptr)
			tab->resize(0, 0);
	}
    
	ui.tabContainer->tabBar()->setUsesScrollButtons(true);
	
	QObject::connect(ui.tabContainer, SIGNAL(tabCloseRequested(int)), this, SLOT(tabContainer_tabCloseRequested(int)));
	QObject::connect(ui.tabContainer, SIGNAL(currentChanged(int)), this, SLOT(tabContainer_currentChanged(int)));
	QObject::connect(ui.lblBottomMenu, SIGNAL(linkActivated(const QString &)), this, SLOT(label_linkActivated(const QString&)));
	QObject::connect(ui.btnJoinRoom, SIGNAL(clicked()), this, SLOT(btnJoinRoom_pressed()));
	QObject::connect(ui.lstChats, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstChats_currentItemChanged(QListWidgetItem *, QListWidgetItem *)));
	QObject::connect(ui.lstChats, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(lstChats_itemDoubleClicked(QListWidgetItem*)));
	QObject::connect(ui.cmbRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbRegion_currentIndexChanged(int)));
	QObject::connect(ui.cmbMapRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbMapRegion_currentIndexChanged(int)));
	QObject::connect(ui.btnQueue, SIGNAL(clicked()), this, SLOT(btnQueue_pressed()));
	QObject::connect(ui.btnDraw, SIGNAL(clicked()), this, SLOT(btnDraw_pressed()));
	QObject::connect(ui.btnNoShow, SIGNAL(clicked()), this, SLOT(btnNoShow_pressed()));
	QObject::connect(ui.lstMaps, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstMaps_currentItemChanged(QListWidgetItem *, QListWidgetItem *)));
	QObject::connect(ui.btnToggleVeto, SIGNAL(clicked()), this, SLOT(btnToggleVeto_clicked()));
	QObject::connect(ui.chkQueueRegion, SIGNAL(stateChanged(int)), this, SLOT(chkQueueRegion_stateChanged(int)));
#if !defined(Q_OS_MAC)
	this->tray_icon_->show();
#endif

		// The user should be prevented from emptying invalid values in the settings dialog.
	if (this->config_->profiles().count() == 0)
	{
		QMessageBox::information(this, "Eros", tr("Welcome to Eros! You need to configure some settings in order to continue. The settings window will now open."));
		openSettings();
	}
	else
	{
		this->connection_timer_->setInterval(500);
		this->connection_timer_->start();
	}

	QTimer::singleShot(0, this, SLOT(updateCheckerTimerWorker()));
	this->update_timer_->setInterval(1000 * 60 * 10);
	this->update_timer_->start();

	notification_sound_ = new QSound(":/sound/notification", this);
}
예제 #20
0
void MainWindow::createActions()
{
    m_newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    m_newAct->setShortcut(tr("Ctrl+N"));
    m_newAct->setStatusTip(tr("Create a new file"));
    connect(m_newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    m_openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
    m_openAct->setShortcut(tr("Ctrl+O"));
    m_openAct->setStatusTip(tr("Open a file from disk"));
    connect(m_openAct, SIGNAL(triggered()), this, SLOT(open()));

    m_saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    m_saveAct->setShortcut(tr("Ctrl+S"));
    m_saveAct->setStatusTip(tr("Save the document to disk"));
    connect(m_saveAct, SIGNAL(triggered()), this, SLOT(save()));

    m_saveAsAct = new QAction(tr("Save &As..."), this);
    m_saveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(m_saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));

    m_closeAct = new QAction(tr("&Close..."), this);
    m_closeAct->setShortcut(tr("Ctrl+W"));
    m_closeAct->setStatusTip(tr("Close the document"));
    connect(m_closeAct, SIGNAL(triggered()), this, SLOT(close()));

    m_openSourceFile = new QAction(tr("&Open Source File"), this);
    m_openSourceFile->setShortcut(tr("Ctrl+Alt+J"));
    m_openSourceFile->setStatusTip(tr("Open a file from the source directory"));
    connect(m_openSourceFile, SIGNAL(triggered()), this, SLOT(openSourceFile()));

    m_openBuildFile = new QAction(tr("&Open Build File"), this);
    m_openBuildFile->setShortcut(tr("Ctrl+Alt+K"));
    m_openBuildFile->setStatusTip(tr("Open a file from the build directory"));
    connect(m_openBuildFile, SIGNAL(triggered()), this, SLOT(openBuildFile()));

    m_selectOpenedFile = new QAction(tr("&Select Opened File"), this);
    m_selectOpenedFile->setShortcut(tr("Ctrl+Space"));
    m_selectOpenedFile->setStatusTip(tr("Select an already opened file"));
    connect(m_selectOpenedFile, SIGNAL(triggered()), this, SLOT(selectOpenedFile()));

    m_exitAct = new QAction(tr("E&xit"), this);
    m_exitAct->setShortcut(tr("Ctrl+Q"));
    m_exitAct->setStatusTip(tr("Exit the application"));
    connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close()));

    m_cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
    m_cutAct->setShortcut(tr("Ctrl+X"));
    m_cutAct->setStatusTip(tr("Cut the current selection's contents to the "
                            "clipboard"));
    connect(m_cutAct, SIGNAL(triggered()), m_fileStack, SLOT(cut()));

    m_copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
    m_copyAct->setShortcut(tr("Ctrl+C"));
    m_copyAct->setStatusTip(tr("Copy the current selection's contents to the "
                             "clipboard"));
    connect(m_copyAct, SIGNAL(triggered()), m_fileStack, SLOT(copy()));

    m_pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
    m_pasteAct->setShortcut(tr("Ctrl+V"));
    m_pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
                              "selection"));
    connect(m_pasteAct, SIGNAL(triggered()), m_fileStack, SLOT(paste()));

    m_splitVertical = new QAction(tr("Split &Vertical"), this);
    m_splitVertical->setShortcut(tr("Ctrl+Alt+V"));
    m_splitVertical->setStatusTip(tr("Split the focused file view vertically"));
    connect(m_splitVertical, SIGNAL(triggered()), this, SLOT(splitVertical()));

    m_splitHorizontal = new QAction(tr("Split &Horizontal"), this);
    m_splitHorizontal->setShortcut(tr("Ctrl+Alt+H"));
    m_splitHorizontal->setStatusTip(tr("Split the focused file view horizontally"));
    connect(m_splitHorizontal, SIGNAL(triggered()), this, SLOT(splitHorizontal()));

    m_newProjectAct = new QAction(QIcon(":/images/new.png"), tr("&New Project"), this);
    m_newProjectAct->setStatusTip(tr("Create a new project"));
    connect(m_newProjectAct, SIGNAL(triggered()), this, SLOT(newProject()));

    m_openProjectAct = new QAction(QIcon(":/images/open.png"), tr("&Open Project..."), this);
    m_openProjectAct->setStatusTip(tr("Open an existing project"));
    connect(m_openProjectAct, SIGNAL(triggered()), this, SLOT(openProject()));

    m_importProjectAct = new QAction(tr("&Import Project"), this);
    m_importProjectAct->setStatusTip(tr("Import an existing project"));
    connect(m_importProjectAct, SIGNAL(triggered()), this, SLOT(importProject()));

    m_closeProjectAct = new QAction(tr("&Close Project..."), this);
    m_closeProjectAct->setStatusTip(tr("Close the project"));
    connect(m_closeProjectAct, SIGNAL(triggered()), this, SLOT(closeProject()));

    m_openSettingsAct = new QAction(tr("&Configure..."), this);
    m_openSettingsAct->setStatusTip(tr("Configure settings"));
    connect(m_openSettingsAct, SIGNAL(triggered()), this, SLOT(openSettings()));

    m_aboutAct = new QAction(tr("&About"), this);
    m_aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    m_aboutQtAct = new QAction(tr("About &Qt"), this);
    m_aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(m_aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    m_cutAct->setEnabled(false);
    m_copyAct->setEnabled(false);
    connect(m_fileStack, SIGNAL(copyAvailable(bool)),
            m_cutAct, SLOT(setEnabled(bool)));
    connect(m_fileStack, SIGNAL(copyAvailable(bool)),
            m_copyAct, SLOT(setEnabled(bool)));
}
예제 #21
0
/*
 * UART sample.
 *
 * Some functions do not work with ICCAVR.
 */
int main(void)
{
    int got;
    int userchoice;
    char *cp;
    u_long baud = 115200;

#ifdef STDIO_FLOATING_POINT
    float dval = 0.0;
#endif

    /*
     * Each device must be registered. We do this by referencing the 
     * device structure of the driver. The advantage is, that only 
     * those device drivers are included in our flash code, which we 
     * really need.
     *
     * The uart0 device is the first one on the ATmega chip. So it 
     * has no configurable base address or interrupt and we set both 
     * parameters to zero.
     */
    NutRegisterDevice(&DEV_UART, 0, 0);

    /*
     * Now, as the device is registered, we can open it. The fopen()
     * function returns a pointer to a FILE structure, which we use 
     * for subsequent reading and writing.
     */
    uart = fopen(DEV_UART_NAME, "r+");
    
    freopen("uart0", "w", stdout);
    _ioctl(_fileno(stdout), UART_SETSPEED, &baud);

    /*
     * Before doing the first read or write, we set the baudrate.
     * This low level function doesn't know about FILE structures
     * and we use _fileno() to get the low level file descriptor
     * of the stream.
     *
     * The short sleep allows the UART to settle after the baudrate
     * change.
     */
    _ioctl(_fileno(uart), UART_SETSPEED, &baud);

    /* Initialize the LCd */
    NutRegisterDevice(&devLcd, 0, 0);
    /* Initialize UROM */
    NutRegisterDevice(&devUrom, 0, 0);
    NutRegisterDevice(&devDebug0, 0, 0);

    /*
    * Stream devices can use low level read and write functions.
    * Writing program space data is supported too.
    */
    _write(_fileno(uart), banner, strlen(banner));
    {
        lcdPrint(banner);
		
        _write_P(_fileno(uart), presskey_P, sizeof(presskey_P));
    }

    /*
     * Stream devices do buffered I/O. That means, nothing will be 
     * passed to the hardware device until either the output buffer 
     * is full or we do a flush. With stream I/O we typically use
     * fflush(), but low level writing a null pointer will also flush 
     * the output buffer.
     */
    _write(_fileno(uart), 0, 0);

    /*
     * The low level function read() will grab all available bytes 
     * from the input buffer. If the buffer is empty, the call will
     * block until something is available for reading.
     */
    got = _read(_fileno(uart), inbuf, sizeof(inbuf));
    _write(_fileno(uart), inbuf, got);
	
	/*
     * Nut/OS never expects a thread to return. So we enter an 
     * endless loop here.
     */

    do {
	fflush(uart);
	lcdPrint("Main Menu");
	userchoice = 0;
        /*
         * A bit more advanced input routine is able to read a string 
         * up to and including the first newline character or until a
         * specified maximum number of characters, whichever comes first.
         */
		puts("\n*************");
		puts("\n* Main Menu *");
		puts("\n*************\n");
		puts("\n1. Generate speech\n");
		puts("\n2. IRC\n");
		puts("\n3. Settings\n");
		puts("\n4. Help\n");
		puts("\n5. Play wav\n");
      puts("\nEnter your choice: ");
		readLine(inbuf, sizeof(inbuf));

        /*
         * Streams support formatted output as well as printing strings 
         * from program space.
         */
        if (inbuf[0]) {
		   puts("\n\n");
			userchoice = atoi(inbuf);
			switch (userchoice)
    		{
    		case 1: speechSynthesize(uart);
        		break;
    		case 2: runIRC(uart);
        		break;
    		case 3: openSettings(uart);
        		break;
    		case 4: showHelp(uart);        		
        		break;
    		case 5: playWAV(uart);
    		    break;
    		default: puts("Invalid option selected\n");
    		}
		}

        /*
         * Just to demonstrate formatted floating point output.
         * In order to use this, we need to link the application
         * with nutcrtf instead of nutcrt for pure integer.
         */
#ifdef STDIO_FLOATING_POINT
        dval += 1.0125;
        fprintf(uart, "FP %f\n", dval);
#endif
    }
	while (1);
}
예제 #22
0
파일: window.cpp 프로젝트: grahamrow/muview
Window::Window(int argc, char *argv[]) :
    QMainWindow(NULL),
    ui(new Ui::Window)
{
    ui->setupUi(this);

	// Cache size
	cacheSize = 50;
	cachePos  = 0;

	prefs = new Preferences(this);
    about = new AboutDialog(this);

    connect(prefs, SIGNAL(finished(int)), this, SLOT(updatePrefs()));

    initSlider(ui->xSlider);
    initSlider(ui->ySlider);
    initSlider(ui->zSlider);
    initSpanSlider(ui->xSpanSlider);
    initSpanSlider(ui->ySpanSlider);
    initSpanSlider(ui->zSpanSlider);

	// Rotation
    connect(ui->xSlider,  SIGNAL(valueChanged(int)),     ui->viewport, SLOT(setXRotation(int)));
    connect(ui->viewport, SIGNAL(xRotationChanged(int)), ui->xSlider, SLOT(setValue(int)));
    connect(ui->ySlider,  SIGNAL(valueChanged(int)),     ui->viewport, SLOT(setYRotation(int)));
    connect(ui->viewport, SIGNAL(yRotationChanged(int)), ui->ySlider, SLOT(setValue(int)));
    connect(ui->zSlider,  SIGNAL(valueChanged(int)),     ui->viewport, SLOT(setZRotation(int)));
    connect(ui->viewport, SIGNAL(zRotationChanged(int)), ui->zSlider, SLOT(setValue(int)));

	// Slicing
    connect(ui->xSpanSlider, SIGNAL(lowerValueChanged(int)), ui->viewport, SLOT(setXSliceLow(int)));
    connect(ui->xSpanSlider, SIGNAL(upperValueChanged(int)), ui->viewport, SLOT(setXSliceHigh(int)));
    connect(ui->ySpanSlider, SIGNAL(lowerValueChanged(int)), ui->viewport, SLOT(setYSliceLow(int)));
    connect(ui->ySpanSlider, SIGNAL(upperValueChanged(int)), ui->viewport, SLOT(setYSliceHigh(int)));
    connect(ui->zSpanSlider, SIGNAL(lowerValueChanged(int)), ui->viewport, SLOT(setZSliceLow(int)));
    connect(ui->zSpanSlider, SIGNAL(upperValueChanged(int)), ui->viewport, SLOT(setZSliceHigh(int)));

    ui->animSlider->setRange(0, 10);
    ui->animSlider->setSingleStep(1);
    ui->animSlider->setPageStep(10);
    ui->animSlider->setTickInterval(2);
    ui->animSlider->setTickPosition(QSlider::TicksRight);
    ui->animSlider->setEnabled(false);

    // Actions
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAbout()));
    connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(openSettings()));
    connect(ui->actionFiles, SIGNAL(triggered()), this, SLOT(openFiles()));
    connect(ui->actionDir, SIGNAL(triggered()), this, SLOT(openDir()));

    connect(ui->actionCubes,   SIGNAL(triggered()), this, SLOT(toggleDisplay()));
    connect(ui->actionCones,   SIGNAL(triggered()), this, SLOT(toggleDisplay()));
    connect(ui->actionVectors, SIGNAL(triggered()), this, SLOT(toggleDisplay()));

    displayType = new QActionGroup(this);
    displayType->addAction(ui->actionCubes);
    displayType->addAction(ui->actionCones);
    displayType->addAction(ui->actionVectors);
    ui->actionCubes->setChecked(true);

    signalMapper = new QSignalMapper(this);
    signalMapper->setMapping (ui->actionFollow, "") ;
    connect (signalMapper, SIGNAL(mapped(QString)), this, SLOT(watchDir(QString))) ;
    connect(ui->actionFollow, SIGNAL(triggered()), signalMapper, SLOT(map()));

    ui->xSlider->setValue(15 * 16);
    ui->ySlider->setValue(345 * 16);
    ui->zSlider->setValue(0 * 16);
	setWindowTitle(tr("MuView 0.9"));

	// Data, don't connect until we are ready (probably still not ready here)...
    connect(ui->animSlider, SIGNAL(valueChanged(int)), this, SLOT(updateDisplayData(int)));
	
	// Load files from command line if supplied
	if (argc > 1) {
		QStringList rawList;
		for (int i=1; i<argc; i++) {
			rawList << argv[i];
		}

		if (rawList.contains(QString("-w"))) {
			if (rawList.indexOf("-w") < (rawList.length() - 1))  {
				watchDir(rawList[rawList.indexOf("-w")+1]);
			}
		} else {
			QStringList allLoadedFiles;
			foreach (QString item, rawList)
			{
				QFileInfo info(item);
				if (!info.exists()) {
					std::cout << "File " << item.toStdString() << " does not exist" << std::endl;
				} else {
								// Push our new content...
					if (info.isDir()) {
						QDir chosenDir(item);
						dirString = chosenDir.path()+"/";
						QStringList filters;
						filters << "*.omf" << "*.ovf";
						chosenDir.setNameFilters(filters);
						QStringList files = chosenDir.entryList();

						foreach (QString file, files)
						{
							filenames << (dirString+file);
							displayNames << (dirString+item);
							//omfCache.push_back(readOMF((dirString+file).toStdString(), tempHeader));
						}

					} else {
예제 #23
0
int ClientInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: sendMessage(); break;
        case 1: chat((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< ENUM_TYPE(*)>(_a[4]))); break;
        case 2: changeServerInformations((*reinterpret_cast< ServerInformations(*)>(_a[1]))); break;
        case 3: changeClientID((*reinterpret_cast< CLID(*)>(_a[1]))); break;
        case 4: changeClientNickname((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 5: showError((*reinterpret_cast< ENUM_TYPE(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 6: changeGameMaster((*reinterpret_cast< CLID(*)>(_a[1]))); break;
        case 7: clientVoted((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< CLID(*)>(_a[2]))); break;
        case 8: connectionEtablished(); break;
        case 9: connectionLost(); break;
        case 10: diceRolled((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< quint16(*)>(_a[2])),(*reinterpret_cast< quint16(*)>(_a[3]))); break;
        case 11: sanctionned((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< ENUM_TYPE(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 12: rollDice(); break;
        case 13: rollSpecialDice(); break;
        case 14: serverName((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 15: motdChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 16: gameLaunched(); break;
        case 17: setTitle(); break;
        case 18: playSound((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 19: updatePlayerList(); break;
        case 20: clientJoined((*reinterpret_cast< CLID(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 21: clientLeft((*reinterpret_cast< CLID(*)>(_a[1]))); break;
        case 22: updateGMLabel(); break;
        case 23: updateGMPanel(); break;
        case 24: { bool _r = addLanguage();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 25: { bool _r = addLanguage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 26: languageListMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 27: { bool _r = removeLanguage((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 28: removeLanguageMenu(); break;
        case 29: importLanguageList(); break;
        case 30: sendLanguageList(); break;
        case 31: { CLID _r = CLIDFromString((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< CLID*>(_a[0]) = _r; }  break;
        case 32: switchConnectionState(); break;
        case 33: openSettings(); break;
        case 34: openSoundsGUI(); break;
        case 35: aboutUs(); break;
        case 36: aboutServer(); break;
        case 37: openMapEditor(); break;
        case 38: clearMapEditor(); break;
        case 39: mapFlare(); break;
        case 40: resetData(); break;
        case 41: setCSS((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 42: setCSS(); break;
        case 43: setInterface((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 44: setInterface(); break;
        case 45: playerListMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 46: actionKick(); break;
        case 47: actionBan(); break;
        case 48: actionVoteGM(); break;
        case 49: actionChangeGM(); break;
        case 50: refresh(); break;
        case 51: textChanged(); break;
        case 52: narrationChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 53: syncSoundLibs((*reinterpret_cast< QList<SoundLibInformations>(*)>(_a[1]))); break;
        case 54: syncLanguagesList((*reinterpret_cast< QList<QPair<QString,QString> >(*)>(_a[1]))); break;
        case 55: syncDictionariesList((*reinterpret_cast< QStringList(*)>(_a[1]))); break;
        case 56: requestScriptDownload((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 57: sendScriptToServer((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 58: deleteScript((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 59: renameScript((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 60: makeEntity((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 61: deleteEntity((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 62: injectCode((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 63: scriptToGMMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 64: scriptToOwnerMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 65: scriptActionMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 66: scriptToPlayerMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 67: scriptMsg((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 68: scriptError((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 69: sendMapToServer((*reinterpret_cast< const MapInformations*const(*)>(_a[1])),(*reinterpret_cast< const QMap<QString,RSID>(*)>(_a[2]))); break;
        case 70: addDictionnary(); break;
        case 71: saveGame(); break;
        case 72: loadGame(); break;
        case 73: VOIPRemoveClient(); break;
        case 74: VOIPAddClient(); break;
        case 75: VOIPClientVolume(); break;
        case 76: dataPerSecond((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 77;
    }
    return _id;
}