<commit_before>// For conditions of distribution and use, see copyright notice in license.txt

#include "StableHeaders.h"
#include "OpenSimSceneExporter.h"

#include "WorldBuildingModule.h"
#include "SceneParser.h"

#include "UiServiceInterface.h"
#include "UiProxyWidget.h"

#include "TextureServiceInterface.h"
#include "TextureResource.h"

#include "OgreImage.h"

#include <QHash>
#include <QSet>
#include <QDateTime>
#include <QFile>
#include <QFileInfo>
#include <QImage>

#include <QFileDialog>
#include <QMessageBox>
#include <QGraphicsScene>
#include <QCryptographicHash>
#include <QUrl>

namespace WorldBuilding
{

    SceneExporter::SceneExporter(QObject *parent, Foundation::Framework *framework, SceneParser *scene_parser) :
        QObject(parent),
        framework_(framework),
        scene_parser_(scene_parser),
        backup_widget_(new QWidget()),
        backup_proxy_(0)
    {
        ui_.setupUi(backup_widget_);

        connect(ui_.button_do_backup, SIGNAL(clicked()), SLOT(StartBackup()));
        connect(ui_.button_browse_location, SIGNAL(clicked()), SLOT(BrowseStoreLocation()));
        connect(backup_widget_, SIGNAL(destroyed(QObject*)), SLOT(InternalDestroyed(QObject*)));

        backup_meshes_ = true;
        backup_textures_ = true;
        backup_animations_ = true;
        backup_particles_ = true;
        backup_sounds_ = true;
    }

    SceneExporter::~SceneExporter()
    {
        if (backup_proxy_)
        {
            UiServiceInterface *ui = framework_->GetService<UiServiceInterface>();
            if (ui)
            {
                backup_proxy_->hide();
                ui->RemoveWidgetFromScene(backup_proxy_);
            }
        }
        if (backup_widget_)
            backup_widget_->deleteLater();
    }

    void SceneExporter::InternalDestroyed(QObject *object)
    {
        backup_widget_ = 0;
    }

    void SceneExporter::PostInitialize()
    {
        UiServiceInterface *ui = framework_->GetService<UiServiceInterface>();
        if (ui)
        {
            backup_proxy_ = ui->AddWidgetToScene(backup_widget_);
            ui->RegisterUniversalWidget("OpenSim Scene Backup Tool", backup_proxy_);
            backup_widget_->hide();
        }
        else
            WorldBuildingModule::LogWarning("OpenSimSceneService: Failed to add OpenSim Scene Tool to scene and menu");
    }

    void SceneExporter::ShowBackupTool()
    {
        if (!backup_proxy_)
            return;
        if (backup_proxy_->scene()->isActive() && !backup_proxy_->isVisible())
            backup_proxy_->show();
    }

    void SceneExporter::BrowseStoreLocation()
    {
        QString location = QFileDialog::getExistingDirectory(backup_widget_, "Browse Store Location");
        if (location.isEmpty())
            return;
        ui_.lineedit_store_location->setText(location);
    }
<commit_msg>Removing opensim scene tool as a universal widget.<commit_after>// For conditions of distribution and use, see copyright notice in license.txt

#include "StableHeaders.h"
#include "OpenSimSceneExporter.h"

#include "WorldBuildingModule.h"
#include "SceneParser.h"

#include "UiServiceInterface.h"
#include "UiProxyWidget.h"

#include "TextureServiceInterface.h"
#include "TextureResource.h"

#include "OgreImage.h"

#include <QHash>
#include <QSet>
#include <QDateTime>
#include <QFile>
#include <QFileInfo>
#include <QImage>

#include <QFileDialog>
#include <QMessageBox>
#include <QGraphicsScene>
#include <QCryptographicHash>
#include <QUrl>

namespace WorldBuilding
{

    SceneExporter::SceneExporter(QObject *parent, Foundation::Framework *framework, SceneParser *scene_parser) :
        QObject(parent),
        framework_(framework),
        scene_parser_(scene_parser),
        backup_widget_(new QWidget()),
        backup_proxy_(0)
    {
        ui_.setupUi(backup_widget_);

        connect(ui_.button_do_backup, SIGNAL(clicked()), SLOT(StartBackup()));
        connect(ui_.button_browse_location, SIGNAL(clicked()), SLOT(BrowseStoreLocation()));
        connect(backup_widget_, SIGNAL(destroyed(QObject*)), SLOT(InternalDestroyed(QObject*)));

        backup_meshes_ = true;
        backup_textures_ = true;
        backup_animations_ = true;
        backup_particles_ = true;
        backup_sounds_ = true;
    }

    SceneExporter::~SceneExporter()
    {
        if (backup_proxy_)
        {
            UiServiceInterface *ui = framework_->GetService<UiServiceInterface>();
            if (ui)
            {
                backup_proxy_->hide();
                ui->RemoveWidgetFromScene(backup_proxy_);
            }
        }
        if (backup_widget_)
            backup_widget_->deleteLater();
    }

    void SceneExporter::InternalDestroyed(QObject *object)
    {
        backup_widget_ = 0;
    }

    void SceneExporter::PostInitialize()
    {
        UiServiceInterface *ui = framework_->GetService<UiServiceInterface>();
        if (ui)
        {
            backup_proxy_ = ui->AddWidgetToScene(backup_widget_);
            backup_widget_->hide();
        }
        else
            WorldBuildingModule::LogWarning("OpenSimSceneService: Failed to add OpenSim Scene Tool to scene and menu");
    }

    void SceneExporter::ShowBackupTool()
    {
        if (!backup_proxy_)
            return;
        if (backup_proxy_->scene()->isActive() && !backup_proxy_->isVisible())
            backup_proxy_->show();
    }

    void SceneExporter::BrowseStoreLocation()
    {
        QString location = QFileDialog::getExistingDirectory(backup_widget_, "Browse Store Location");
        if (location.isEmpty())
            return;
        ui_.lineedit_store_location->setText(location);
    }

{'fraction_non_alphanumeric': 0.11124823695345556, 'fraction_numerical': 0.0007052186177715092, 'mean_word_length': 3.0262597586941093, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2400524', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1612, 'n_words': 306}